QElectroTech  0.8-dev
diagram.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef DIAGRAM_H
19 #define DIAGRAM_H
20 #include <QtWidgets>
21 #include <QtXml>
22 #include <QHash>
23 #include <QUuid>
24 
25 #include "bordertitleblock.h"
26 #include "conductorproperties.h"
27 #include "exportproperties.h"
28 #include "qgimanager.h"
29 #include "numerotationcontext.h"
30 #include "qetproject.h"
32 #include "elementsmover.h"
33 #include "elementtextsmover.h"
34 
35 class Conductor;
36 class CustomElement;
37 class DiagramContent;
38 class DiagramPosition;
39 class DiagramTextItem;
40 class Element;
41 class ElementsLocation;
42 class QETProject;
43 class Terminal;
44 class DiagramImageItem;
46 class DiagramFolioList;
47 class QETProject;
48 
55 class Diagram : public QGraphicsScene
56 {
58  friend QETProject;
59 
60  Q_OBJECT
61 
62  // constructors, destructor
63  private:
65  ~Diagram() override;
66  Diagram(const Diagram &diagram);
67 
68  // ATTRIBUTES
69  public:
85  static int xGrid;
87  static int yGrid;
89  static int xKeyGrid;
91  static int yKeyGrid;
93  static int xKeyGridFine;
95  static int yKeyGridFine;
97  static const qreal margin;
99  static QColor background_color;
101  QHash <QString, QStringList> m_elmt_unitfolio_max;
102  QHash <QString, QStringList> m_elmt_tenfolio_max;
103  QHash <QString, QStringList> m_elmt_hundredfolio_max;
105  QHash <QString, QStringList> m_cnd_unitfolio_max;
106  QHash <QString, QStringList> m_cnd_tenfolio_max;
107  QHash <QString, QStringList> m_cnd_hundredfolio_max;
108 
109  private:
110  QGraphicsLineItem *conductor_setter_;
115 
116  QDomDocument xml_document_;
117 
119 
124 
127 
130  QUuid m_uuid = QUuid::createUuid();
131 
132  // METHODS
133  protected:
134  void drawBackground(QPainter *, const QRectF &) override;
135 
136  void mouseDoubleClickEvent (
137  QGraphicsSceneMouseEvent *event) override;
138  void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
139  void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
140  void mouseReleaseEvent (
141  QGraphicsSceneMouseEvent *event) override;
142  void wheelEvent (QGraphicsSceneWheelEvent *event) override;
143  void keyPressEvent (QKeyEvent *event) override;
144  void keyReleaseEvent (QKeyEvent *) override;
145 
146  public:
147  QUuid uuid();
148  void setEventInterface (DiagramEventInterface *event_interface);
149  void clearEventInterface();
150 
151  //methods related to autonum
152  QString conductorsAutonumName() const;
153  void setConductorsAutonumName(const QString &name);
154 
155  static bool clipboardMayContainDiagram();
156 
157  // methods related to parent project
158  QETProject *project() const;
159  int folioIndex() const;
160  qreal declaredQElectroTechVersion(bool = true) const;
161  void showMe() {emit showDiagram(this);}
162  bool isReadOnly() const;
163 
164  // methods related to conductor creation
165  void setConductor(bool);
166  void setConductorStart (QPointF);
167  void setConductorStop(QPointF);
168  QList < QSet <Conductor *> > potentials();
169 
170  // methods related to XML import/export
171  QDomDocument toXml(bool = true);
172  bool initFromXml(QDomElement &,
173  QPointF = QPointF(),
174  bool = true,
175  DiagramContent * = nullptr);
176  bool fromXml(QDomDocument &,
177  QPointF = QPointF(),
178  bool = true,
179  DiagramContent * = nullptr);
180  bool fromXml(QDomElement &,
181  QPointF = QPointF(),
182  bool = true,
183  DiagramContent * = nullptr);
184  void folioSequentialsToXml(QHash<QString,
185  QStringList>*,
186  QDomElement *,
187  const QString&,
188  const QString&,
189  QDomDocument *);
190  void folioSequentialsFromXml(const QDomElement&,
191  QHash<QString,
192  QStringList>*,
193  const QString&,
194  const QString&,
195  const QString&,
196  const QString&);
197 
198  void refreshContents();
199 
200  // methods related to graphics items addition/removal on the diagram
201  virtual void addItem (QGraphicsItem *item);
202  virtual void removeItem (QGraphicsItem *item);
203 
204  // methods related to graphics options
206  void setDisplayGrid(bool);
207  bool displayGrid();
208  void setUseBorder(bool);
209  bool useBorder();
212  DiagramPosition convertPosition(const QPointF &);
213  static QPointF snapToGrid(const QPointF &p);
214 
215  bool drawTerminals() const;
216  void setDrawTerminals(bool);
217  bool drawColoredConductors() const;
218  void setDrawColoredConductors(bool);
219 
220  QString title() const;
221  bool toPaintDevice(QPaintDevice &, int = -1, int = -1,
222  Qt::AspectRatioMode = Qt::KeepAspectRatio);
223  QSize imageSize() const;
224 
225  bool isEmpty() const;
226 
227  QList<Element *> elements() const;
228  QList<Conductor *> conductors() const;
229  QSet<Conductor *> selectedConductors() const;
230  DiagramContent content() const;
231  bool canRotateSelection() const;
234  bool usesElement(const ElementsLocation &);
235  bool usesTitleBlockTemplate(const QString &);
236 
237  QUndoStack &undoStack();
239 
240  //methods related to element label Update Policy
241  void freezeElements(bool freeze);
242  void unfreezeElements();
243  void setFreezeNewElements(bool);
244  bool freezeNewElements();
245 
246  //methods related to conductor label Update Policy
247  void freezeConductors(bool freeze);
248  void setFreezeNewConductors(bool);
249  bool freezeNewConductors();
250 
251  //methods related to insertion and loading of folio sequential
252  void insertFolioSeqHash (QHash<QString, QStringList> *hash,
253  const QString& title,
254  const QString& seq,
255  NumerotationContext *nc);
256  void loadFolioSeqHash (QHash<QString, QStringList> *hash,
257  const QString& title, const QString& seq,
258  NumerotationContext *nc);
259  void changeZValue(QET::DepthOption option);
260 
261  public slots:
262  void adjustSceneRect ();
263  void titleChanged(const QString &);
264  void titleBlockTemplateChanged(const QString &);
265  void titleBlockTemplateRemoved(const QString &,
266  const QString & = QString());
267  void setTitleBlockTemplate(const QString &);
268  void updateLabels();
269  void loadElmtFolioSeq();
270  void loadCndFolioSeq();
271 
272  // methods related to graphics items selection
273  void selectAll();
274  void deselectAll();
275  void invertSelection();
276 
277  signals:
279  void usedTitleBlockTemplateChanged(const QString &);
280  void diagramTitleChanged(Diagram *, const QString &);
281 
285 
288 
290 };
292 
293 
300 inline void Diagram::setConductor(bool adding) {
301  if (adding) {
302  if (!conductor_setter_ -> scene()) addItem(conductor_setter_);
303  } else {
304  if (conductor_setter_ -> scene()) removeItem(conductor_setter_);
305  }
306 }
307 
314 inline void Diagram::setConductorStart(QPointF start) {
315  conductor_setter_ -> setLine(QLineF(start, conductor_setter_ -> line().p2()));
316 }
317 
324 inline void Diagram::setConductorStop(QPointF end) {
325  conductor_setter_ -> setLine(QLineF(conductor_setter_ -> line().p1(), end));
326 }
327 
333 inline void Diagram::setDisplayGrid(bool dg) {
334  draw_grid_ = dg;
335 }
336 
341 inline bool Diagram::displayGrid() {
342  return(draw_grid_);
343 }
344 
353 inline void Diagram::setUseBorder(bool ub) {
354  use_border_ = ub;
355 }
356 
362 inline bool Diagram::useBorder() {
363  return(use_border_);
364 }
365 
377 }
378 
385  BorderOptions options = EmptyBorder;
387  options = (BorderOptions)(options|TitleBlock);
389  options = (BorderOptions)(options|Columns);
390  return(options);
391 }
392 
397 inline QUndoStack &Diagram::undoStack() {
398  return *(project()->undoStack());
399 }
400 
406  return(*qgi_manager_);
407 }
408 
413 inline bool Diagram::drawTerminals() const {
414  return(draw_terminals_);
415 }
416 
421 inline bool Diagram::drawColoredConductors() const {
422  return(draw_colored_conductors_);
423 }
424 
425 #endif
Diagram::NumerotationType
NumerotationType
Represents available option of Numerotation type.
Definition: diagram.h:79
Diagram::m_elmt_tenfolio_max
QHash< QString, QStringList > m_elmt_tenfolio_max
Definition: diagram.h:102
qgimanager.h
Diagram::clipboardMayContainDiagram
static bool clipboardMayContainDiagram()
Diagram::clipboardMayContainDiagram.
Definition: diagram.cpp:2312
ElementsMover::beginMovement
int beginMovement(Diagram *, QGraphicsItem *=nullptr)
ElementsMover::beginMovement Start a new movement.
Definition: elementsmover.cpp:65
Diagram::background_color
static QColor background_color
background color of diagram
Definition: diagram.h:99
Diagram::elements
QList< Element * > elements() const
Diagram::elements.
Definition: diagram.cpp:2031
QETProject::ProjectParsingRunning
@ ProjectParsingRunning
XML parsing failed.
Definition: qetproject.h:59
Diagram::xKeyGridFine
static int xKeyGridFine
Key grid fine x step size.
Definition: diagram.h:93
QETProject::addElementAutoNum
void addElementAutoNum(const QString &key, const NumerotationContext &context)
QETProject::addElementAutoNum Add a new element numerotation context. If key already exist,...
Definition: qetproject.cpp:598
Diagram::yKeyGridFine
static int yKeyGridFine
Key grid fine y step size.
Definition: diagram.h:95
Diagram::setEventInterface
void setEventInterface(DiagramEventInterface *event_interface)
Diagram::setEventInterface Set event_interface has current interface. Diagram become the ownership of...
Definition: diagram.cpp:531
DiagramContent::Images
@ Images
Definition: diagramcontent.h:57
QETProject::dataBase
projectDataBase * dataBase()
QETProject::dataBase.
Definition: qetproject.cpp:124
Diagram::draw_grid_
bool draw_grid_
Definition: diagram.h:120
Conductor::terminal2
Terminal * terminal2
Definition: conductor.h:68
QETProject::undoStack
QUndoStack * undoStack()
Definition: qetproject.h:168
DynamicElementTextItem
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
Definition: dynamicelementtextitem.h:39
Diagram::xml_document_
QDomDocument xml_document_
Definition: diagram.h:116
Diagram::m_event_interface
DiagramEventInterface * m_event_interface
Definition: diagram.h:126
DiagramEventInterface::finish
void finish()
Diagram::canRotateSelection
bool canRotateSelection() const
Diagram::canRotateSelection.
Definition: diagram.cpp:2395
Diagram::titleChanged
void titleChanged(const QString &)
Diagram::titleChanged emit(diagramTitleChanged(this, title));.
Definition: diagram.cpp:1611
diagramcommands.h
QET::ElementsArea
@ ElementsArea
Export the content of the diagram only.
Definition: qet.h:141
Diagram::setDrawColoredConductors
void setDrawColoredConductors(bool)
Diagram::setDrawColoredConductors Defines whether or not to respect the colors of the conductors....
Definition: diagram.cpp:2288
DiagramEventInterface::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: diagrameventinterface.cpp:42
Diagram::m_cnd_unitfolio_max
QHash< QString, QStringList > m_cnd_unitfolio_max
Hash containing max values for folio sequential autonums in this diagram.
Definition: diagram.h:105
Diagram::m_freeze_new_elements
bool m_freeze_new_elements
Definition: diagram.h:128
BorderTitleBlock::titleBlockFolioChanged
void titleBlockFolioChanged(const QString &)
titleBlockFolioChanged Signal emitted after Folio has changed
DiagramPosition::setPosition
void setPosition(const QPointF &)
Definition: diagramposition.cpp:52
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(NamesList)
Diagram::freezeElements
void freezeElements(bool freeze)
Diagram::freezeElements Freeze every existent element label.
Definition: diagram.cpp:2104
IndependentTextItem::Type
@ Type
Definition: independenttextitem.h:39
Diagram::adjustSceneRect
void adjustSceneRect()
Diagram::adjustSceneRect Recalcul and adjust the size of the scene.
Definition: diagram.cpp:2166
Diagram::setConductorStop
void setConductorStop(QPointF)
Diagram::setConductorStop Set the end point of the conductor setter.
Definition: diagram.h:324
BorderTitleBlock::displayColumns
void displayColumns(bool)
BorderTitleBlock::displayColumns.
Definition: bordertitleblock.cpp:442
Diagram::fromXml
bool fromXml(QDomDocument &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
Diagram::fromXml Imports the described schema into an XML document. If a position is specified,...
Definition: diagram.cpp:1029
ElementProvider
Definition: elementprovider.h:37
Diagram::deselectAll
void deselectAll()
Diagram::deselectAll Deselects all selected objects.
Definition: diagram.cpp:1690
Diagram::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mousePressEvent This event is managed by diagram event interface if any.
Definition: diagram.cpp:247
ElementsLocation::path
QString path() const
ElementsLocation::path.
Definition: elementslocation.cpp:206
ExportProperties::draw_colored_conductors
bool draw_colored_conductors
Whether to render conductors colors.
Definition: exportproperties.h:49
QetGraphicsTableItem
The QetGraphicsTableItem class This item display a table destined to represent the content of a QAbst...
Definition: qetgraphicstableitem.h:43
Diagram::declaredQElectroTechVersion
qreal declaredQElectroTechVersion(bool=true) const
Diagram::declaredQElectroTechVersion.
Definition: diagram.cpp:2348
exportdialog.h
conductor.h
Diagram::toXml
QDomDocument toXml(bool=true)
Diagram::toXml Exports all or part of the schema.
Definition: diagram.cpp:721
DiagramContent::m_conductors_to_move
QList< Conductor * > m_conductors_to_move
Definition: diagramcontent.h:74
QET::version
const QString version
QElectroTech version (as string, used to mark projects and elements XML documents)
Definition: qet.h:32
Diagram::m_conductors_autonum_name
QString m_conductors_autonum_name
Definition: diagram.h:125
Diagram::TitleBlock
@ TitleBlock
Definition: diagram.h:77
Diagram::elementTextsMover
ElementTextsMover & elementTextsMover()
Diagram::elementTextsMover.
Definition: diagram.cpp:2065
Diagram::qgi_manager_
QGIManager * qgi_manager_
Definition: diagram.h:113
QETProject::addConductorAutoNum
void addConductorAutoNum(const QString &key, const NumerotationContext &context)
QETProject::addConductorAutoNum Add a new conductor numerotation context. If key already exist,...
Definition: qetproject.cpp:587
BorderTitleBlock::draw
void draw(QPainter *painter)
BorderTitleBlock::draw Draw the border and the titleblock.
Definition: bordertitleblock.cpp:504
diagramposition.h
conductortextitem.h
Diagram::freezeNewConductors
bool freezeNewConductors()
Diagram::freezeNewConductors.
Definition: diagram.cpp:2158
Diagram::yKeyGrid
static int yKeyGrid
Key grid y step size.
Definition: diagram.h:91
Diagram::~Diagram
~Diagram() override
Diagram::~Diagram Destructor.
Definition: diagram.cpp:120
QET::Raise
@ Raise
Raise item one layer above their current one; zValues are incremented.
Definition: qet.h:47
Diagram::setConductorsAutonumName
void setConductorsAutonumName(const QString &name)
Diagram::setConductorsAutonumName.
Definition: diagram.cpp:572
BorderTitleBlock::borderAndTitleBlockRect
QRectF borderAndTitleBlockRect() const
BorderTitleBlock::borderAndTitleBlockRect.
Definition: bordertitleblock.cpp:134
Diagram::showMe
void showMe()
Definition: diagram.h:161
elementtextitemgroup.h
Diagram::setConductor
void setConductor(bool)
Diagram::setConductor Display or hide the conductor setter, i.e. a dashed conductor stub which appear...
Definition: diagram.h:300
Diagram::addItem
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
Definition: diagram.cpp:1550
BorderTitleBlock::titleBlockFromXml
void titleBlockFromXml(const QDomElement &)
BorderTitleBlock::titleBlockFromXml Reads the title block values from XML.
Definition: bordertitleblock.cpp:212
QetShapeItem::Type
@ Type
Definition: qetshapeitem.h:63
exportproperties.h
DiagramContent
Definition: diagramcontent.h:46
ElementsMover
Definition: elementsmover.h:38
TitleBlockTemplatesProjectCollection::getTemplate
TitleBlockTemplate * getTemplate(const QString &) override
Definition: templatescollection.cpp:191
Diagram::wheelEvent
void wheelEvent(QGraphicsSceneWheelEvent *event) override
Diagram::wheelEvent This event is managed by diagram event interface if any.
Definition: diagram.cpp:304
Conductor::valideXml
static bool valideXml(QDomElement &)
Definition: conductor.cpp:575
DiagramContent::m_elements
QList< Element * > m_elements
Definition: diagramcontent.h:69
Diagram::xKeyGrid
static int xKeyGrid
Key grid x step size.
Definition: diagram.h:89
NumerotationContext::replaceValue
void replaceValue(int, QString)
NumerotationContext::replaceValue This class replaces the current NC field value with content.
Definition: numerotationcontext.cpp:183
Diagram::isEmpty
bool isEmpty() const
Diagram::isEmpty An empty schema contains no element, conductor, or text field.
Definition: diagram.cpp:680
BorderTitleBlock::title
QString title() const
Definition: bordertitleblock.h:111
Terminal::Z
static const qreal Z
Definition: terminal.h:109
Diagram::m_project
QETProject * m_project
Definition: diagram.h:114
Diagram::m_freeze_new_conductors_
bool m_freeze_new_conductors_
Definition: diagram.h:129
DiagramEventInterface::keyReleaseEvent
virtual void keyReleaseEvent(QKeyEvent *event)
Definition: diagrameventinterface.cpp:70
ElementsMover::endMovement
void endMovement()
ElementsMover::endMovement Ended the current movement by creating an undo added to the undostack of t...
Definition: elementsmover.cpp:150
ExportProperties::draw_border
bool draw_border
Whether to render the border (along with rows/columns headers)
Definition: exportproperties.h:46
autonum::numerotationContextToFormula
QString numerotationContextToFormula(const NumerotationContext &nc)
numerotationContextToFormula
Definition: assignvariables.cpp:473
QETProject::elementCurrentAutoNum
QString elementCurrentAutoNum() const
QETProject::elementCurrentAutoNum.
Definition: qetproject.cpp:531
Diagram::loadFolioSeqHash
void loadFolioSeqHash(QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
Diagram::loadFolioSeqHash This class loads all folio sequential variables related to the current auto...
Definition: diagram.cpp:1760
elementsmover.h
Diagram::usesTitleBlockTemplate
bool usesTitleBlockTemplate(const QString &)
Diagram::usesTitleBlockTemplate.
Definition: diagram.cpp:2096
Diagram::titleBlockTemplateChanged
void titleBlockTemplateChanged(const QString &)
Diagram::titleBlockTemplateChanged This slot may be used to inform the diagram object that the given ...
Definition: diagram.cpp:1622
DiagramEventInterface::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: diagrameventinterface.cpp:38
NumerotationContext
Definition: numerotationcontext.h:31
BorderTitleBlock::displayTitleBlock
void displayTitleBlock(bool)
BorderTitleBlock::displayTitleBlock.
Definition: bordertitleblock.cpp:431
BorderTitleBlock::titleBlockTemplateName
QString titleBlockTemplateName() const
BorderTitleBlock::titleBlockTemplateName.
Definition: bordertitleblock.cpp:387
Element::Type
@ Type
Definition: element.h:74
addelementtextcommand.h
QET::findInDomElement
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
Definition: qet.cpp:333
DiagramContent::conductors
QList< Conductor * > conductors(int=AnyConductor) const
DiagramContent::conductors.
Definition: diagramcontent.cpp:167
Diagram::Conductors
@ Conductors
Definition: diagram.h:79
Diagram::draw_colored_conductors_
bool draw_colored_conductors_
Definition: diagram.h:123
ExportProperties::draw_titleblock
bool draw_titleblock
Whether to render the title block.
Definition: exportproperties.h:47
BorderTitleBlock::borderToXml
void borderToXml(QDomElement &)
BorderTitleBlock::borderToXml Exports the border current settings to XML.
Definition: bordertitleblock.cpp:223
ElementCollectionHandler::importFromProject
bool importFromProject(QETProject *project, ElementsLocation &location)
ElementCollectionHandler::importFromProject Import the element represented by location to the embedde...
Definition: elementcollectionhandler.cpp:405
Diagram::freezeConductors
void freezeConductors(bool freeze)
Diagram::freezeConductors Freeze every existent conductor label.
Definition: diagram.cpp:2140
Diagram::updateLabels
void updateLabels()
Diagram::updateLabels Update elements and conductors that reference folio field in their labels.
Definition: diagram.cpp:1716
Diagram::drawTerminals
bool drawTerminals() const
Diagram::drawTerminals.
Definition: diagram.h:413
Diagram::imageSize
QSize imageSize() const
Diagram::imageSize Allows you to know the dimensions that the image generated by the toImage() method...
Definition: diagram.cpp:651
Diagram::border_and_titleblock
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
Definition: diagram.h:83
Diagram::project
QETProject * project() const
Diagram::project.
Definition: diagram.cpp:2326
BorderTitleBlock::titleBlockToXml
void titleBlockToXml(QDomElement &)
BorderTitleBlock::titleBlockToXml Exports the title block current values to XML.
Definition: bordertitleblock.cpp:203
Diagram::usedTitleBlockTemplateChanged
void usedTitleBlockTemplateChanged(const QString &)
NumerotationContext::size
int size() const
NumerotationContext::size.
Definition: numerotationcontext.cpp:93
Diagram::m_uuid
QUuid m_uuid
Definition: diagram.h:130
qetapp.h
QETProject::embeddedTitleBlockTemplatesCollection
TitleBlockTemplatesProjectCollection * embeddedTitleBlockTemplatesCollection()
Definition: qetproject.cpp:243
Diagram::loadCndFolioSeq
void loadCndFolioSeq()
Diagram::loadCndFolioSeq This class loads all conductor folio sequential variables related to the cur...
Definition: diagram.cpp:1942
Conductor::terminal1
Terminal * terminal1
Definition: conductor.h:67
BorderTitleBlock::titleBlockTemplateRemoved
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate *=nullptr)
BorderTitleBlock::titleBlockTemplateRemoved This slot has to be used to inform this class that the gi...
Definition: bordertitleblock.cpp:414
Diagram::toPaintDevice
bool toPaintDevice(QPaintDevice &, int=-1, int=-1, Qt::AspectRatioMode=Qt::KeepAspectRatio)
Definition: diagram.cpp:580
DiagramImageItem
Definition: diagramimageitem.h:31
BorderTitleBlock::insideBorderRect
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
Definition: bordertitleblock.cpp:185
QETXML::subChild
QVector< QDomElement > subChild(const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name)
QETXML::subChild.
Definition: qetxml.cpp:341
QET::SendBackward
@ SendBackward
Send item to the background so they have the lowest zValue.
Definition: qet.h:49
ElementCollectionHandler
The ElementCollectionHandler class Provide several method to copy element or directory from a collect...
Definition: elementcollectionhandler.h:109
Diagram::Diagram
Diagram(QETProject *project)
Diagram::Diagram Constructor.
Definition: diagram.cpp:64
ElementsMover::continueMovement
void continueMovement(const QPointF &)
ElementsMover::continueMovement Add a move to the current movement.
Definition: elementsmover.cpp:112
TitleBlockTemplate
The TitleBlockTemplate class This class represents an title block template for an electric diagram....
Definition: titleblocktemplate.h:36
Diagram::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *) override
Diagram::keyReleaseEvent This event is managed by diagram event interface if any. Else move selected ...
Definition: diagram.cpp:479
Diagram::DiagramFolioList
friend DiagramFolioList
Definition: diagram.h:57
Diagram::selectAll
void selectAll()
Diagram::selectAll Select all schema objects.
Definition: diagram.cpp:1676
Diagram::setUseBorder
void setUseBorder(bool)
Diagram::setUseBorder Set whether the diagram border (including rows/colums headers and the title blo...
Definition: diagram.h:353
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
QET::BringForward
@ BringForward
Bring item to the foreground so they have the highest zValue.
Definition: qet.h:46
elementcollectionhandler.h
DynamicElementTextItem::Type
@ Type
Definition: dynamicelementtextitem.h:61
Diagram::conductor_setter_
QGraphicsLineItem * conductor_setter_
Definition: diagram.h:110
Diagram::clearEventInterface
void clearEventInterface()
Diagram::clearEventInterface Clear the current event interface.
Definition: diagram.cpp:551
Diagram::setBorderOptions
void setBorderOptions(BorderOptions)
Diagram::setBorderOptions Set the rendering options for the diagram border (including rows/colums hea...
Definition: diagram.h:373
Diagram::titleBlockTemplateRemoved
void titleBlockTemplateRemoved(const QString &, const QString &=QString())
Diagram::titleBlockTemplateRemoved This slot has to be be used to inform this class that the given ti...
Definition: diagram.cpp:1639
Diagram::Columns
@ Columns
Definition: diagram.h:77
projectDataBase::addElement
void addElement(Element *element)
projectDataBase::addElement
Definition: projectdatabase.cpp:91
Conductor::calculateTextItemPosition
void calculateTextItemPosition()
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizont...
Definition: conductor.cpp:1290
xrefproperties.h
elementprovider.h
Diagram::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseMoveEvent This event is managed by diagram event interface if any.
Definition: diagram.cpp:266
diagramview.h
QET::Icons::Conductor
QIcon Conductor
Definition: qeticons.cpp:35
QetGraphicsTableItem::Type
@ Type
Definition: qetgraphicstableitem.h:57
Diagram::removeItem
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Reimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
Definition: diagram.cpp:1581
Diagram::isReadOnly
bool isReadOnly() const
Diagram::isReadOnly.
Definition: diagram.cpp:2363
Element::fromXml
virtual bool fromXml(QDomElement &, QHash< int, Terminal * > &, bool=false)
Element::fromXml Import the parameters of this element from a xml document. When call this function e...
Definition: element.cpp:684
Terminal::removeConductor
void removeConductor(Conductor *conductor)
Terminal::removeConductor Remove a conductor from this terminal.
Definition: terminal.cpp:239
Diagram::insertFolioSeqHash
void insertFolioSeqHash(QHash< QString, QStringList > *hash, const QString &title, const QString &seq, NumerotationContext *nc)
Diagram::insertFolioSeqHash This class inserts a stringlist containing all sequential variables relat...
Definition: diagram.cpp:1733
DiagramEventInterface::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: diagrameventinterface.cpp:34
Diagram::EmptyBorder
@ EmptyBorder
Definition: diagram.h:77
elementtextsmover.h
Diagram::editElementRequired
void editElementRequired(const ElementsLocation &)
Signal emitted when users wish to edit an element from the diagram.
QET::BorderArea
@ BorderArea
Export the diagram along with its border and title block.
Definition: qet.h:140
Diagram::changeZValue
void changeZValue(QET::DepthOption option)
Diagram::changeZValue Change the Z value of the current selected item, according to option.
Definition: diagram.cpp:1784
Diagram::invertSelection
void invertSelection()
Diagram::invertSelection Reverses the selection state of all schema objects Inverse l'etat de selecti...
Definition: diagram.cpp:1701
Diagram::convertPosition
DiagramPosition convertPosition(const QPointF &)
Diagram::convertPosition.
Definition: diagram.cpp:2223
element.h
ConductorProperties::fromXml
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element 'e'.
Definition: conductorproperties.cpp:307
QET::DepthOption
DepthOption
List the various kind of changes for the zValue.
Definition: qet.h:45
QETApp::projectId
static int projectId(const QETProject *)
QETApp::projectId.
Definition: qetapp.cpp:2433
Diagram::conductorsAutonumName
QString conductorsAutonumName() const
Diagram::conductorsAutonumName.
Definition: diagram.cpp:564
Diagram::m_element_texts_mover
ElementTextsMover m_element_texts_mover
Definition: diagram.h:112
ElementTextsMover
Definition: elementtextsmover.h:35
qpropertyundocommand.h
AlignmentTextsGroupCommand
The AlignmentTextsGroupCommand class.
Definition: addelementtextcommand.h:145
numerotationcontext.h
DiagramEventInterface::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: diagrameventinterface.cpp:46
ConductorProperties::toXml
void toXml(QDomElement &) const
ConductorProperties::toXml Export conductor propertie, in the XML element 'e'.
Definition: conductorproperties.cpp:264
BorderTitleBlock::borderChanged
void borderChanged(QRectF old_border, QRectF new_border)
borderChanged Signal emitted after the border has changed
Diagram::BorderOptions
BorderOptions
The BorderOptions enum Represents available options when rendering a particular diagram: EmptyBorder:...
Definition: diagram.h:77
Diagram::refreshContents
void refreshContents()
Diagram::refreshContents refresh all content of diagram.
Definition: diagram.cpp:1526
Diagram::m_cnd_tenfolio_max
QHash< QString, QStringList > m_cnd_tenfolio_max
Definition: diagram.h:106
bordertitleblock.h
DiagramEventInterface::wheelEvent
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
Definition: diagrameventinterface.cpp:50
Diagram::applyProperties
ExportProperties applyProperties(const ExportProperties &)
Diagram::applyProperties This method allows you to apply new rendering options while accessing the cu...
Definition: diagram.cpp:2186
Element
Definition: element.h:41
Diagram::undoStack
QUndoStack & undoStack()
Diagram::undoStack.
Definition: diagram.h:397
QETProject::conductorAutoNum
QHash< QString, NumerotationContext > conductorAutoNum() const
QETProject::conductorAutoNum.
Definition: qetproject.cpp:493
Diagram::defaultConductorProperties
ConductorProperties defaultConductorProperties
Default properties for new conductors.
Definition: diagram.h:81
projectDataBase::removeElement
void removeElement(Element *element)
projectDataBase::removeElement
Definition: projectdatabase.cpp:122
Diagram::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseDoubleClickEvent This event is managed by diagram event interface if any.
Definition: diagram.cpp:228
qetproject.h
QET::Lower
@ Lower
Send item one layer below their current one; zValues are decremented.
Definition: qet.h:48
Diagram::freezeNewElements
bool freezeNewElements()
Diagram::freezeNewElements.
Definition: diagram.cpp:2132
Terminal::addConductor
bool addConductor(Conductor *conductor)
Terminal::addConductor Add a conductor to this terminal.
Definition: terminal.cpp:215
ElementFactory::Instance
static ElementFactory * Instance()
Definition: elementfactory.h:38
Diagram::m_cnd_hundredfolio_max
QHash< QString, QStringList > m_cnd_hundredfolio_max
Definition: diagram.h:107
ExportProperties::draw_terminals
bool draw_terminals
Whether to render terminals.
Definition: exportproperties.h:48
conductorproperties.h
Diagram::margin
static const qreal margin
margin around the diagram
Definition: diagram.h:97
ExportProperties::exported_area
QET::DiagramArea exported_area
Area of diagrams to be rendered.
Definition: exportproperties.h:50
diagramcontent.h
Diagram::loadElmtFolioSeq
void loadElmtFolioSeq()
Diagram::loadElmtFolioSeq This class loads all folio sequential variables related to the current auto...
Definition: diagram.cpp:1857
ElementsLocation
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition: elementslocation.h:46
Diagram::findElementRequired
void findElementRequired(const ElementsLocation &)
Diagram::drawBackground
void drawBackground(QPainter *, const QRectF &) override
Diagram::drawBackground Draw the background of the diagram, ie the grid.
Definition: diagram.cpp:158
Diagram::folioSequentialsToXml
void folioSequentialsToXml(QHash< QString, QStringList > *, QDomElement *, const QString &, const QString &, QDomDocument *)
Diagram::folioSequentialsToXml Add folio sequential to QDomElement.
Definition: diagram.cpp:980
Diagram::xGrid
static int xGrid
abscissa grid step size
Definition: diagram.h:85
Element::unlinkAllElements
virtual void unlinkAllElements()
Definition: element.h:155
independenttextitem.h
Conductor::setFreezeLabel
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false.
Definition: conductor.cpp:2035
Diagram::qgiManager
QGIManager & qgiManager()
Diagram::qgiManager.
Definition: diagram.h:405
diagrameventinterface.h
DiagramTextItem
Definition: diagramtextitem.h:34
Element::valideXml
static bool valideXml(QDomElement &)
Definition: element.cpp:651
DiagramContent::All
@ All
Definition: diagramcontent.h:65
QETProject
Definition: qetproject.h:51
Diagram::diagramTitleChanged
void diagramTitleChanged(Diagram *, const QString &)
qetgraphicstableitem.h
BorderTitleBlock::needTitleBlockTemplate
void needTitleBlockTemplate(const QString &)
needTitleBlockTemplate Signal emitted when this object needs to set a specific title block template....
Diagram::m_elmt_hundredfolio_max
QHash< QString, QStringList > m_elmt_hundredfolio_max
Definition: diagram.h:103
BorderTitleBlock::columnsAreDisplayed
bool columnsAreDisplayed() const
Definition: bordertitleblock.h:140
ElementTextItemGroup
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
Definition: elementtextitemgroup.h:36
Diagram::borderOptions
BorderOptions borderOptions()
Diagram::borderOptions.
Definition: diagram.h:384
DiagramContent::SelectedOnly
@ SelectedOnly
Definition: diagramcontent.h:66
BorderTitleBlock::titleBlockIsDisplayed
bool titleBlockIsDisplayed() const
Definition: bordertitleblock.h:136
ElementProvider::table
QVector< QetGraphicsTableItem * > table(QetGraphicsTableItem *table=nullptr, QAbstractItemModel *model=nullptr)
ElementProvider::table.
Definition: elementprovider.cpp:120
Conductor::isValid
bool isValid() const
Conductor::isValid.
Definition: conductor.cpp:150
Diagram::yGrid
static int yGrid
ordinate grid step size
Definition: diagram.h:87
Diagram::setConductorStart
void setConductorStart(QPointF)
Diagram::setConductorStart Set the start point of the conductor setter.
Definition: diagram.h:314
elementfactory.h
QETApp::project
static QETProject * project(const uint &)
QETApp::project.
Definition: qetapp.cpp:2416
NumerotationContext::itemAt
QStringList itemAt(const int) const
NumerotationContext::itemAt.
Definition: numerotationcontext.cpp:110
Diagram::elementsMover
ElementsMover & elementsMover()
Diagram::elementsMover.
Definition: diagram.cpp:2057
Diagram::uuid
QUuid uuid()
Diagram::uuid.
Definition: diagram.cpp:519
Diagram::diagramActivated
void diagramActivated()
Diagram::displayGrid
bool displayGrid()
Diagram::displayGrid.
Definition: diagram.h:341
Diagram::folioIndex
int folioIndex() const
Diagram::folioIndex.
Definition: diagram.cpp:2335
findTerminal
Terminal * findTerminal(int conductor_index, QDomElement &f, QHash< int, Terminal * > &table_adr_id, QList< Element * > &added_elements)
findTerminal Find terminal to which the conductor should be connected
Definition: diagram.cpp:1093
Conductor::Type
@ Type
Definition: conductor.h:64
qetxml.h
QGIManager
Definition: qgimanager.h:27
BorderTitleBlock
The BorderTitleBlock class This class represents the border and the titleblock which frame a particul...
Definition: bordertitleblock.h:37
Diagram::title
QString title() const
Diagram::title.
Definition: diagram.cpp:2023
ConductorProperties
The ConductorProperties class This class represents the functional properties of a particular conduct...
Definition: conductorproperties.h:68
BorderTitleBlock::diagramTitleChanged
void diagramTitleChanged(const QString &)
diagramTitleChanged Signal emitted after the title has changed
Diagram::snapToGrid
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
IndependentTextItem
Definition: independenttextitem.h:28
Diagram::potentials
QList< QSet< Conductor * > > potentials()
Diagram::potential.
Definition: diagram.cpp:690
Diagram::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Diagram::keyPressEvent This event is managed by diagram event interface if any. Else move selected el...
Definition: diagram.cpp:324
DiagramContent::Shapes
@ Shapes
Definition: diagramcontent.h:62
Diagram::setFreezeNewConductors
void setFreezeNewConductors(bool)
Diagram::setfreezeNewConductors Set new conductor label to be frozen.
Definition: diagram.cpp:2150
DiagramContent::items
QList< QGraphicsItem * > items(int=All) const
DiagramContent::items.
Definition: diagramcontent.cpp:374
QetShapeItem
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
Definition: qetshapeitem.h:36
qetshapeitem.h
Diagram::QETProject
friend QETProject
Definition: diagram.h:58
Diagram::initFromXml
bool initFromXml(QDomElement &, QPointF=QPointF(), bool=true, DiagramContent *=nullptr)
Diagram::initFromXml Imports the described schema in an XML element. This method delegates its work t...
Definition: diagram.cpp:1067
ExportProperties
Definition: exportproperties.h:27
ConductorTextItem::Type
@ Type
Definition: conductortextitem.h:42
Diagram::setDrawTerminals
void setDrawTerminals(bool)
Diagram::setDrawTerminals Defines whether or not to display the terminals.
Definition: diagram.cpp:2271
Diagram::useBorder
bool useBorder()
Diagram::useBorder.
Definition: diagram.h:362
Diagram::diagram_qet_version_
qreal diagram_qet_version_
Definition: diagram.h:118
dynamicelementtextitem.h
DiagramPosition
Definition: diagramposition.h:29
Diagram::setDisplayGrid
void setDisplayGrid(bool)
Diagram::setDisplayGrid Set whether the diagram grid should be drawn.
Definition: diagram.h:333
Diagram::use_border_
bool use_border_
Definition: diagram.h:121
Diagram::setFreezeNewElements
void setFreezeNewElements(bool)
Diagram::freezeNewElements Set new element label to be frozen.
Definition: diagram.cpp:2124
Diagram::m_elmt_unitfolio_max
QHash< QString, QStringList > m_elmt_unitfolio_max
Hash containing max values for folio sequential autonums in this diagram.
Definition: diagram.h:101
Conductor
Definition: conductor.h:43
Diagram::unfreezeElements
void unfreezeElements()
Diagram::unfreezeElements Unfreeze every existent element label.
Definition: diagram.cpp:2114
Diagram::folioSequentialsFromXml
void folioSequentialsFromXml(const QDomElement &, QHash< QString, QStringList > *, const QString &, const QString &, const QString &, const QString &)
Diagram::folioSequentialsFromXml Load folio sequential from QDomElement.
Definition: diagram.cpp:1491
QETProject::elementAutoNum
QHash< QString, NumerotationContext > elementAutoNum() const
QETProject::elementAutoNum.
Definition: qetproject.cpp:501
Diagram::draw_terminals_
bool draw_terminals_
Definition: diagram.h:122
BorderTitleBlock::borderFromXml
void borderFromXml(const QDomElement &)
BorderTitleBlock::borderFromXml Reads the border settings from XML.
Definition: bordertitleblock.cpp:241
DiagramImageItem::Type
@ Type
Definition: diagramimageitem.h:42
terminal.h
Diagram::usesElement
bool usesElement(const ElementsLocation &)
Diagram::usesElement Used to find out if an element is used on a schema.
Definition: diagram.cpp:2080
DiagramEventInterface
The DiagramEventInterface class isRunning() return true if action is running (do something)....
Definition: diagrameventinterface.h:46
Diagram::setTitleBlockTemplate
void setTitleBlockTemplate(const QString &)
Diagram::setTitleBlockTemplate Set the template to use to render the title block of this diagram.
Definition: diagram.cpp:1656
Diagram::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Diagram::mouseReleaseEvent This event is managed by diagram event interface if any.
Definition: diagram.cpp:285
Diagram::selectedConductors
QSet< Conductor * > selectedConductors() const
Diagram::selectedConductors.
Definition: diagram.cpp:2297
Terminal
The Terminal class This class represents a terminal of an electrical element, i.e....
Definition: terminal.h:35
Diagram::conductors
QList< Conductor * > conductors() const
Diagram::conductors.
Definition: diagram.cpp:2044
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
DiagramContent::Elements
@ Elements
Definition: diagramcontent.h:54
DiagramContent::m_text_fields
QSet< IndependentTextItem * > m_text_fields
Definition: diagramcontent.h:70
DiagramEventInterface::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action.
Definition: diagrameventinterface.cpp:59
Diagram::drawColoredConductors
bool drawColoredConductors() const
Diagram::drawColoredConductors.
Definition: diagram.h:421
Element::freezeLabel
void freezeLabel(bool freeze)
Element::freezeLabel Freeze this element label.
Definition: element.cpp:1715
diagramimageitem.h
BorderTitleBlock::displayBorder
void displayBorder(bool)
BorderTitleBlock::displayBorder.
Definition: bordertitleblock.cpp:468
Diagram::m_elements_mover
ElementsMover m_elements_mover
Definition: diagram.h:111
QetGraphicsTableItem::xmlTagName
static QString xmlTagName()
Definition: qetgraphicstableitem.h:85
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
BorderTitleBlock::convertPosition
DiagramPosition convertPosition(const QPointF &)
BorderTitleBlock::convertPosition Convert a Point in cartesian coordinate (x : 12....
Definition: bordertitleblock.cpp:880
BorderTitleBlock::titleBlockTemplateChanged
void titleBlockTemplateChanged(const QString &)
BorderTitleBlock::titleBlockTemplateChanged This slot may be used to inform this class that the given...
Definition: bordertitleblock.cpp:399
Diagram::content
DiagramContent content() const
Diagram::content.
Definition: diagram.cpp:2375
diagram.h
BorderTitleBlock::borderIsDisplayed
bool borderIsDisplayed() const
Definition: bordertitleblock.h:145
QETProject::conductorCurrentAutoNum
QString conductorCurrentAutoNum() const
QETProject::conductorCurrentAutoNum.
Definition: qetproject.cpp:560
Diagram::Diagram
Diagram(const Diagram &diagram)
ExportProperties::draw_grid
bool draw_grid
Whether to render the diagram grid.
Definition: exportproperties.h:45
Diagram::showDiagram
void showDiagram(Diagram *)