QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
qet.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 _QET_H
19#define _QET_H
20
21#include <QDomElement>
22#include <QFile>
23#include <QObject>
24
25class QActionGroup;
30namespace QET {
31 QString license();
32
33 //Describe the current state of a graphic item
39
47
59
75
82
89
90
108
117
131
139
146
154
155 QString qetCollectionToString (const QetCollection &c);
156 QetCollection qetCollectionFromString (const QString &str);
157
158 bool lineContainsPoint(const QLineF &, const QPointF &);
159 bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr);
160 bool attributeIsAnInteger(const QDomElement &, const QString& , int * = nullptr);
161 bool attributeIsAReal(const QDomElement &, const QString& , qreal * = nullptr);
162 QString ElementsAndConductorsSentence(int elements=0,
163 int conductors=0,
164 int indi_texts=0,
165 int images=0,
166 int shapes=0,
167 int element_text=0,
168 int tables_count=0,
169 int terminal_strip_count=0);
170 QList<QDomElement> findInDomElement(const QDomElement &, const QString &);
171 QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);
172 QList<QChar> forbiddenCharacters();
173 QString stringToFileName(const QString &);
174 QString escapeSpaces(const QString &);
175 QString unescapeSpaces(const QString &);
176 QString joinWithSpaces(const QStringList &);
177 QStringList splitWithSpaces(const QString &);
178 QString diagramAreaToString(const QET::DiagramArea &);
180 qreal round(qreal, qreal);
181 qreal correctAngle(const qreal &, const bool &positive = false);
182 bool compareCanonicalFilePaths(const QString &, const QString &);
183 bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * error_message= nullptr);
184 bool writeToFile (QDomDocument &xml_doc, QFile *file, QString *error_message = nullptr);
185 bool eachStrIsEqual (const QStringList &qsl);
186 QActionGroup *depthActionGroup(QObject *parent = nullptr);
187}
188
190
191class Qet : public QObject
192{
193 Q_OBJECT
194
195 public:
204 Q_ENUM (EndType)
205
206 static QString endTypeToString(const Qet::EndType &);
207 static Qet::EndType endTypeFromString(const QString &);
208
213 West};
214 Q_ENUM (Orientation)
215
216 static Qet::Orientation nextOrientation(Qet::Orientation);
217 static Qet::Orientation previousOrientation(Qet::Orientation);
218
219 static Qet::Orientation orientationFromString (const QString &);
220 static QString orientationToString (Qet::Orientation);
221
222 static bool surLeMemeAxe (Qet::Orientation, Qet::Orientation);
223 static bool isOpposed (Qet::Orientation a, Qet::Orientation b);
224 static bool isHorizontal (Qet::Orientation);
225 static bool isVertical (Qet::Orientation);
226};
227
228#endif
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56
Definition element.h:43
Definition qet.h:192
Orientation
Orientation (used for electrical elements and their terminals)
Definition qet.h:210
@ North
Definition qet.h:210
@ South
Definition qet.h:212
@ East
Definition qet.h:211
EndType
This enum lists the various available endings for line primitives when drawing an electrical element.
Definition qet.h:197
@ None
Regular line.
Definition qet.h:198
@ Simple
Base-less triangle.
Definition qet.h:199
@ Triangle
Triangle.
Definition qet.h:200
@ Circle
Circle.
Definition qet.h:201
The TitleBlockTemplate class This class represents an title block template for an electric diagram....
Definition titleblocktemplate.h:37
Definition templatescollection.h:35
Q_DECLARE_METATYPE(NamesList)
Definition qet.h:30
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
Definition qet.cpp:347
Action
Definition qet.h:123
@ Ignore
Skip the current item.
Definition qet.h:125
@ Abort
abort the whole operation, ignoring the current item
Definition qet.h:127
@ Retry
The operation must be tried again.
Definition qet.h:124
@ Managed
the current item was handled by the Strategy object: do not treat it and continue
Definition qet.h:128
@ Erase
Erase the target content.
Definition qet.h:126
@ Rename
the target has to be renamed
Definition qet.h:129
qreal round(qreal, qreal)
Definition qet.cpp:574
bool lineContainsPoint(const QLineF &, const QPointF &)
Definition qet.cpp:152
TitleBlockColumnLength
enum used to specify the type of a length
Definition qet.h:141
@ RelativeToRemainingLength
the length is just a fraction of the length that is still available when other types of lengths have ...
Definition qet.h:144
@ RelativeToTotalLength
the length is just a fraction of the total available length
Definition qet.h:143
@ Absolute
the length is absolute and should be applied as is
Definition qet.h:142
QString license()
Definition qet.cpp:398
bool compareCanonicalFilePaths(const QString &, const QString &)
Definition qet.cpp:597
DepthOption
List the various kind of changes for the zValue.
Definition qet.h:41
@ Raise
Raise item one layer above their current one; zValues are incremented.
Definition qet.h:43
@ BringForward
Bring item to the foreground so they have the highest zValue.
Definition qet.h:42
@ Lower
Send item one layer below their current one; zValues are decremented.
Definition qet.h:44
@ SendBackward
Send item to the background so they have the lowest zValue.
Definition qet.h:45
QString diagramAreaToString(const QET::DiagramArea &)
Definition qet.cpp:555
QET::DiagramArea diagramAreaFromString(const QString &)
Definition qet.cpp:565
QString joinWithSpaces(const QStringList &)
Definition qet.cpp:484
bool eachStrIsEqual(const QStringList &qsl)
QET::eachStrIsEqual.
Definition qet.cpp:671
bool writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message=nullptr)
Definition qet.cpp:754
ConductorSegmentType
Known kinds of conductor segments.
Definition qet.h:84
@ Vertical
Vertical segment.
Definition qet.h:86
@ Both
Invalid segment.
Definition qet.h:87
@ Horizontal
Horizontal segment.
Definition qet.h:85
QString qetCollectionToString(const QetCollection &c)
QET::qetCollectionToString.
Definition qet.cpp:684
OperationAreas
List areas related to some common operations.
Definition qet.h:61
@ NoOperation
Definition qet.h:65
@ ResizeFromTopRightCorner
Definition qet.h:68
@ ResizeFromTopCenterCorner
Definition qet.h:67
@ ResizeFromBottomLeftCorner
Definition qet.h:71
@ MoveArea
Definition qet.h:64
@ ChangeInnerPoints
Definition qet.h:62
@ ResizeFromBottomCenterCorner
Definition qet.h:72
@ ResizeFromTopLeftCorner
Definition qet.h:66
@ ResizeFromMiddleLeftCorner
Definition qet.h:69
@ ResizeFromBottomRightCorner
Definition qet.h:73
@ RotateArea
Definition qet.h:63
@ ResizeFromMiddleRightCorner
Definition qet.h:70
qreal correctAngle(const qreal &, const bool &positive=false)
Definition qet.cpp:582
OrientedMovement
Oriented movements.
Definition qet.h:49
@ ToNorthWest
Definition qet.h:57
@ ToNorth
Definition qet.h:50
@ ToNorthEast
Definition qet.h:51
@ ToSouth
Definition qet.h:54
@ ToEast
Definition qet.h:52
@ ToSouthEast
Definition qet.h:53
@ ToWest
Definition qet.h:56
@ ToSouthWest
Definition qet.h:55
QStringList splitWithSpaces(const QString &)
Definition qet.cpp:501
QString escapeSpaces(const QString &)
Definition qet.cpp:465
bool attributeIsAReal(const QDomElement &, const QString &, qreal *=nullptr)
Definition qet.cpp:235
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF *=nullptr)
Definition qet.cpp:168
Filtering
Definition qet.h:112
@ EndFilter
Definition qet.h:115
@ RegularFilter
Definition qet.h:114
@ BeginFilter
Definition qet.h:113
bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message=nullptr)
Definition qet.cpp:622
DiagramArea
Definition qet.h:135
@ BorderArea
Export the diagram along with its border and title block.
Definition qet.h:136
@ ElementsArea
Export the content of the diagram only.
Definition qet.h:137
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive.
Definition qet.h:77
@ FreeScaling
do not interfere with the default scaling process
Definition qet.h:78
@ SnapScalingPointToGrid
snap the point used to define the new bounding rectangle to the grid
Definition qet.h:79
@ RoundScaleRatios
adjust the scaling movement so that the induced scaling ratios are rounded
Definition qet.h:80
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, int terminal_strip_count=0)
QET::ElementsAndConductorsSentence Permet de composer rapidement la proposition "x elements et y cond...
Definition qet.cpp:262
QString unescapeSpaces(const QString &)
Definition qet.cpp:474
QString stringToFileName(const QString &)
Definition qet.cpp:442
ItemType
Definition qet.h:95
@ All
Definition qet.h:106
@ Project
Definition qet.h:105
@ TitleBlockTemplatesCollectionItem
Definition qet.h:103
@ ElementsCategory
Definition qet.h:97
@ ElementsCollectionItem
Definition qet.h:100
@ ElementsCollection
Definition qet.h:98
@ ElementsContainer
Definition qet.h:99
QetCollection
Enum used to specify the origin of a collection of thing (title block, element etc....
Definition qet.h:148
@ Common
From common collection.
Definition qet.h:149
@ Company
From company collection.
Definition qet.h:150
@ Custom
From user collection.
Definition qet.h:151
@ Embedded
From an embedded collection (a project for example)
Definition qet.h:152
GraphicsItemState
Definition qet.h:34
@ GIBuildingFromXml
Item is currently building from a xml description (element)
Definition qet.h:36
@ GILoadingFromXml
Item is loading her properties from a xml description.
Definition qet.h:37
@ GIOK
General state.
Definition qet.h:35
QList< QChar > forbiddenCharacters()
Definition qet.cpp:427
bool attributeIsAnInteger(const QDomElement &, const QString &, int *=nullptr)
Definition qet.cpp:214
QActionGroup * depthActionGroup(QObject *parent=nullptr)
QET::depthActionGroup.
Definition qet.cpp:727
QetCollection qetCollectionFromString(const QString &str)
QET::qetCollectionFromString.
Definition qet.cpp:707