QElectroTech  0.8-dev
diagramcontent.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_CONTENT_H
19 #define DIAGRAM_CONTENT_H
20 
21 #include <QSet>
22 #include <QVector>
23 
24 class QGraphicsItem;
25 class Conductor;
26 class Element;
28 class DiagramImageItem;
29 class QetShapeItem;
32 class Diagram;
33 class DiagramTextItem;
35 
46 {
47  public:
49  DiagramContent(Diagram *diagram, bool selected = true);
51 
53  enum Filter {
54  Elements = 1,
57  Images = 8,
61  AnyConductor = 112,
62  Shapes = 128,
63  TextGroup = 256,
64  Tables = 512,
65  All = 1023,
66  SelectedOnly = 1024
67  };
68 
69  QList<Element *> m_elements;
70  QSet<IndependentTextItem *> m_text_fields;
71  QSet<DiagramImageItem *> m_images;
72  QSet<QetShapeItem *> m_shapes;
73  QList<Conductor *> m_conductors_to_update;
74  QList<Conductor *> m_conductors_to_move;
75  QList<Conductor *> m_other_conductors;
76  QList<Conductor *> m_potential_conductors;
77  QSet<DynamicElementTextItem *> m_element_texts;
78  QSet<ElementTextItemGroup *> m_texts_groups;
79  QList<QGraphicsItem *> m_selected_items;
80  QVector<QetGraphicsTableItem *> m_tables;
81 
82 
83  QList<DiagramTextItem *> selectedTexts() const;
84  QList<ElementTextItemGroup *> selectedTextsGroup() const;
85  QList<Conductor *> conductors(int = AnyConductor) const;
86  bool hasDeletableItems() const;
87  bool hasCopiableItems() const;
88  QList<QGraphicsItem *> items(int = All) const;
89  QString sentence(int = All) const;
90  int count(int = All) const;
91  void clear();
93 
95  bool potentialIsManaged(QList<Conductor *>conductors);
96  bool hasTextEditing();
97 };
98 QDebug &operator<<(QDebug, DiagramContent &);
99 #endif
DiagramContent::Tables
@ Tables
Definition: diagramcontent.h:64
DiagramContent::Images
@ Images
Definition: diagramcontent.h:57
DiagramContent::AnyConductor
@ AnyConductor
Definition: diagramcontent.h:61
DiagramContent::ConductorsToMove
@ ConductorsToMove
Definition: diagramcontent.h:58
DynamicElementTextItem
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
Definition: dynamicelementtextitem.h:39
IndependentTextItem::Type
@ Type
Definition: independenttextitem.h:39
DiagramContent::m_selected_items
QList< QGraphicsItem * > m_selected_items
Definition: diagramcontent.h:79
QetGraphicsTableItem
The QetGraphicsTableItem class This item display a table destined to represent the content of a QAbst...
Definition: qetgraphicstableitem.h:43
conductor.h
DiagramContent::m_conductors_to_move
QList< Conductor * > m_conductors_to_move
Definition: diagramcontent.h:74
DiagramContent::hasTextEditing
bool hasTextEditing()
DiagramContent::hasTextEditing.
Definition: diagramcontent.cpp:358
DiagramContent::TextFields
@ TextFields
Definition: diagramcontent.h:55
conductortextitem.h
elementtextitemgroup.h
DiagramContent::m_images
QSet< DiagramImageItem * > m_images
Definition: diagramcontent.h:71
QetShapeItem::Type
@ Type
Definition: qetshapeitem.h:63
DiagramContent
Definition: diagramcontent.h:46
DiagramContent::clear
void clear()
DiagramContent::clear Remove all items from the diagram content.
Definition: diagramcontent.cpp:227
DiagramContent::m_elements
QList< Element * > m_elements
Definition: diagramcontent.h:69
DiagramContent::m_conductors_to_update
QList< Conductor * > m_conductors_to_update
Definition: diagramcontent.h:73
DiagramContent::hasCopiableItems
bool hasCopiableItems() const
DiagramContent::hasCopiableItems.
Definition: diagramcontent.cpp:213
Element::Type
@ Type
Definition: element.h:74
QET::ElementsAndConductorsSentence
QString ElementsAndConductorsSentence(int elements=0, int conductors=0, int indi_texts=0, int images=0, int shapes=0, int element_text=0, int tables_count=0)
QET::ElementsAndConductorsSentence Permet de composer rapidement la proposition "x elements et y cond...
Definition: qet.cpp:258
DiagramContent::conductors
QList< Conductor * > conductors(int=AnyConductor) const
DiagramContent::conductors.
Definition: diagramcontent.cpp:167
DiagramContent::ElementTextFields
@ ElementTextFields
Definition: diagramcontent.h:56
DiagramContent::sentence
QString sentence(int=All) const
DiagramContent::sentence.
Definition: diagramcontent.cpp:438
operator<<
QDebug & operator<<(QDebug, DiagramContent &)
operator << Use to debug a diagram content
Definition: diagramcontent.cpp:467
DiagramImageItem
Definition: diagramimageitem.h:31
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DynamicElementTextItem::Type
@ Type
Definition: dynamicelementtextitem.h:61
DiagramContent::Filter
Filter
Used to filter the different items carried by this container.
Definition: diagramcontent.h:53
DiagramContent::selectedTextsGroup
QList< ElementTextItemGroup * > selectedTextsGroup() const
DiagramContent::selectedTextsGroup.
Definition: diagramcontent.cpp:150
QetGraphicsTableItem::Type
@ Type
Definition: qetgraphicstableitem.h:57
DiagramContent::ConductorsToUpdate
@ ConductorsToUpdate
Definition: diagramcontent.h:59
DiagramContent::m_texts_groups
QSet< ElementTextItemGroup * > m_texts_groups
Definition: diagramcontent.h:78
element.h
DiagramContent::m_tables
QVector< QetGraphicsTableItem * > m_tables
Definition: diagramcontent.h:80
DiagramContent::~DiagramContent
~DiagramContent()
Definition: diagramcontent.cpp:120
DiagramContent::potentialIsManaged
bool potentialIsManaged(QList< Conductor * >conductors)
DiagramContent::potentialIsManaged.
Definition: diagramcontent.cpp:341
Element
Definition: element.h:41
DiagramContent::hasDeletableItems
bool hasDeletableItems() const
DiagramContent::hasDeletableItems.
Definition: diagramcontent.cpp:190
DiagramContent::count
int count(int=All) const
DiagramContent::count.
Definition: diagramcontent.cpp:401
DiagramContent::m_potential_conductors
QList< Conductor * > m_potential_conductors
Definition: diagramcontent.h:76
diagramcontent.h
independenttextitem.h
DiagramTextItem
Definition: diagramtextitem.h:34
DiagramContent::All
@ All
Definition: diagramcontent.h:65
DiagramContent::m_element_texts
QSet< DynamicElementTextItem * > m_element_texts
Definition: diagramcontent.h:77
qetgraphicstableitem.h
ElementTextItemGroup
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
Definition: elementtextitemgroup.h:36
DiagramContent::SelectedOnly
@ SelectedOnly
Definition: diagramcontent.h:66
Conductor::relatedPotentialConductors
QSet< Conductor * > relatedPotentialConductors(const bool all_diagram=true, QList< Terminal * > *t_list=nullptr)
Conductor::relatedPotentialConductors Return all conductors at the same potential of this conductor,...
Definition: conductor.cpp:1647
DiagramContent::m_shapes
QSet< QetShapeItem * > m_shapes
Definition: diagramcontent.h:72
Conductor::Type
@ Type
Definition: conductor.h:64
DiagramContent::selectedTexts
QList< DiagramTextItem * > selectedTexts() const
DiagramContent::selectedTexts.
Definition: diagramcontent.cpp:130
DiagramContent::TextGroup
@ TextGroup
Definition: diagramcontent.h:63
IndependentTextItem
Definition: independenttextitem.h:28
DiagramContent::Shapes
@ Shapes
Definition: diagramcontent.h:62
DiagramContent::OtherConductors
@ OtherConductors
Definition: diagramcontent.h:60
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
ConductorTextItem::Type
@ Type
Definition: conductortextitem.h:42
dynamicelementtextitem.h
DiagramContent::DiagramContent
DiagramContent()
DiagramContent::DiagramContent.
Definition: diagramcontent.cpp:35
DiagramContent::removeNonMovableItems
int removeNonMovableItems()
DiagramContent::removeNonMovableItems Remove all non movable item.
Definition: diagramcontent.cpp:247
Conductor
Definition: conductor.h:43
DiagramImageItem::Type
@ Type
Definition: diagramimageitem.h:42
terminal.h
operator<<
QDebug & operator<<(QDebug d, DiagramContent &content)
operator << Use to debug a diagram content
Definition: diagramcontent.cpp:467
Terminal
The Terminal class This class represents a terminal of an electrical element, i.e....
Definition: terminal.h:35
DiagramContent::Elements
@ Elements
Definition: diagramcontent.h:54
DiagramContent::m_text_fields
QSet< IndependentTextItem * > m_text_fields
Definition: diagramcontent.h:70
diagramimageitem.h
DiagramContent::operator+=
DiagramContent & operator+=(const DiagramContent &other)
Definition: diagramcontent.cpp:278
DiagramContent::m_other_conductors
QList< Conductor * > m_other_conductors
Definition: diagramcontent.h:75
diagram.h