QElectroTech  0.8-dev
conductorproperties.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 CONDUCTOR_PROPERTIES_H
19 #define CONDUCTOR_PROPERTIES_H
20 
21 #include "qet.h"
22 #include <QColor>
23 #include <QSettings>
24 
25 class QPainter;
26 
32  public:
34  virtual ~SingleLineProperties();
35 
36  void setPhasesCount(int);
37  unsigned short int phasesCount();
38  bool isPen() const;
39  void draw(QPainter *, QET::ConductorSegmentType, const QRectF &);
40  void toXml(QDomElement &) const;
41  void fromXml(QDomElement &);
42  void toSettings(QSettings &, const QString & = QString()) const;
43  void fromSettings(QSettings &, const QString & = QString());
44 
46  bool hasGround;
48  bool hasNeutral;
50  bool is_pen;
51 
52  int operator==(const SingleLineProperties &) const;
53  int operator!=(const SingleLineProperties &) const;
54 
55  private:
56  unsigned short int phases;
57  void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal);
58  void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
59  void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
60 };
61 
68 {
69  public:
71  virtual ~ConductorProperties();
72 
80 
81 
82  //Attributes
84 
85  QColor color,
88 
89  QString text,
95 
96  int text_size,
98 
99  double cond_size,
102 
105  m_bicolor = false;
106 
107  Qt::Alignment m_horizontal_alignment = Qt::AlignBottom,
108  m_vertical_alignment = Qt::AlignRight;
109 
110  Qt::PenStyle style;
111 
113 
114  // methods
115  void toXml(QDomElement &) const;
116  void fromXml(QDomElement &);
117  void toSettings(QSettings &, const QString & = QString()) const;
118  void fromSettings(QSettings &, const QString & = QString());
119  static QString typeToString(ConductorType);
120  void applyForEqualAttributes(QList<ConductorProperties> list);
121 
123 
124  // operators
125  bool operator==(const ConductorProperties &) const;
126  bool operator!=(const ConductorProperties &) const;
127 
128  private:
129  void readStyle(const QString &);
130  QString writeStyle() const;
131 };
132 
134 
135 #endif
ConductorProperties::readStyle
void readStyle(const QString &)
Definition: conductorproperties.cpp:775
ConductorProperties::m_show_text
bool m_show_text
Definition: conductorproperties.h:103
ConductorProperties::Multi
@ Multi
Definition: conductorproperties.h:79
SingleLineProperties::isPen
bool isPen() const
Definition: conductorproperties.cpp:55
ConductorProperties::m_one_text_per_folio
bool m_one_text_per_folio
Definition: conductorproperties.h:104
ConductorProperties::color
QColor color
Definition: conductorproperties.h:85
SingleLineProperties::phasesCount
unsigned short int phasesCount()
Definition: conductorproperties.cpp:46
ConductorProperties::style
Qt::PenStyle style
Definition: conductorproperties.h:110
ConductorProperties::text_color
QColor text_color
Definition: conductorproperties.h:87
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(NamesList)
SingleLineProperties::drawNeutral
void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
Definition: conductorproperties.cpp:156
ConductorProperties::defaultProperties
static ConductorProperties defaultProperties()
ConductorProperties::defaultProperties.
Definition: conductorproperties.cpp:720
SingleLineProperties::is_pen
bool is_pen
Protective Earth Neutral: visually merge neutral and ground.
Definition: conductorproperties.h:50
ConductorProperties::operator!=
bool operator!=(const ConductorProperties &) const
Definition: conductorproperties.cpp:767
ConductorProperties::writeStyle
QString writeStyle() const
Definition: conductorproperties.cpp:806
SingleLineProperties::drawGround
void drawGround(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
Definition: conductorproperties.cpp:121
SingleLineProperties::fromSettings
void fromSettings(QSettings &, const QString &=QString())
Definition: conductorproperties.cpp:853
ConductorProperties::verti_rotate_text
double verti_rotate_text
Definition: conductorproperties.h:100
SingleLineProperties::SingleLineProperties
SingleLineProperties()
Definition: conductorproperties.cpp:25
ConductorProperties::m_dash_size
int m_dash_size
Definition: conductorproperties.h:97
SingleLineProperties::setPhasesCount
void setPhasesCount(int)
Definition: conductorproperties.cpp:41
ConductorProperties::type
ConductorType type
Definition: conductorproperties.h:83
ConductorProperties::toSettings
void toSettings(QSettings &, const QString &=QString()) const
Definition: conductorproperties.cpp:374
ConductorProperties::text_size
int text_size
Definition: conductorproperties.h:96
qet.h
SingleLineProperties::toSettings
void toSettings(QSettings &, const QString &=QString()) const
Definition: conductorproperties.cpp:841
ConductorProperties::singleLineProperties
SingleLineProperties singleLineProperties
Definition: conductorproperties.h:112
ConductorProperties::operator==
bool operator==(const ConductorProperties &) const
ConductorProperties::operator ==.
Definition: conductorproperties.cpp:735
SingleLineProperties
The SingleLineProperties class This class represents the properties of a singleline conductor.
Definition: conductorproperties.h:31
ConductorProperties::applyForEqualAttributes
void applyForEqualAttributes(QList< ConductorProperties > list)
ConductorProperties::applyForEqualAttributes Test each attribute of properties in the list separatly....
Definition: conductorproperties.cpp:464
ConductorProperties::fromXml
void fromXml(QDomElement &)
ConductorProperties::fromXml Import conductor propertie, from the attribute of the xml element 'e'.
Definition: conductorproperties.cpp:307
ConductorProperties::toXml
void toXml(QDomElement &) const
ConductorProperties::toXml Export conductor propertie, in the XML element 'e'.
Definition: conductorproperties.cpp:264
ConductorProperties::m_vertical_alignment
Qt::Alignment m_vertical_alignment
Definition: conductorproperties.h:108
SingleLineProperties::draw
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &)
Definition: conductorproperties.cpp:65
ConductorProperties::m_function
QString m_function
Definition: conductorproperties.h:90
ConductorProperties::~ConductorProperties
virtual ~ConductorProperties()
Definition: conductorproperties.cpp:255
conductorproperties.h
ConductorProperties::horiz_rotate_text
double horiz_rotate_text
Definition: conductorproperties.h:101
SingleLineProperties::operator==
int operator==(const SingleLineProperties &) const
Definition: conductorproperties.cpp:820
ConductorProperties::m_horizontal_alignment
Qt::Alignment m_horizontal_alignment
Definition: conductorproperties.h:107
ConductorProperties::ConductorType
ConductorType
The ConductorType enum Represents the kind of a particular conductor: Single: singleline symbols,...
Definition: conductorproperties.h:79
ConductorProperties::typeToString
static QString typeToString(ConductorType)
Definition: conductorproperties.cpp:448
ConductorProperties::m_color_2
QColor m_color_2
Definition: conductorproperties.h:86
ConductorProperties::cond_size
double cond_size
Definition: conductorproperties.h:99
SingleLineProperties::toXml
void toXml(QDomElement &) const
Definition: conductorproperties.cpp:215
SingleLineProperties::drawPen
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal)
SingleLineProperties::drawPen Draw the PEN (Protective Earth Neutral) symbol using painter at positio...
Definition: conductorproperties.cpp:188
ConductorProperties::m_formula
QString m_formula
Definition: conductorproperties.h:94
ConductorProperties::fromSettings
void fromSettings(QSettings &, const QString &=QString())
Definition: conductorproperties.cpp:407
SingleLineProperties::hasNeutral
bool hasNeutral
Whether the singleline conductor should display the neutral symbol.
Definition: conductorproperties.h:48
ConductorProperties
The ConductorProperties class This class represents the functional properties of a particular conduct...
Definition: conductorproperties.h:68
ConductorProperties::Single
@ Single
Definition: conductorproperties.h:79
QET::ConductorSegmentType
ConductorSegmentType
Known kinds of conductor segments.
Definition: qet.h:88
QET::Horizontal
@ Horizontal
Horizontal segment.
Definition: qet.h:89
ConductorProperties::m_bicolor
bool m_bicolor
Definition: conductorproperties.h:105
SingleLineProperties::~SingleLineProperties
virtual ~SingleLineProperties()
Destructeur.
Definition: conductorproperties.cpp:34
ConductorProperties::ConductorProperties
ConductorProperties()
Definition: conductorproperties.cpp:238
ConductorProperties::m_wire_color
QString m_wire_color
Definition: conductorproperties.h:92
SingleLineProperties::phases
unsigned short int phases
Definition: conductorproperties.h:56
ConductorProperties::text
QString text
Definition: conductorproperties.h:89
SingleLineProperties::hasGround
bool hasGround
Whether the singleline conductor should display the ground symbol.
Definition: conductorproperties.h:46
ConductorProperties::m_tension_protocol
QString m_tension_protocol
Definition: conductorproperties.h:91
SingleLineProperties::fromXml
void fromXml(QDomElement &)
Definition: conductorproperties.cpp:227
SingleLineProperties::operator!=
int operator!=(const SingleLineProperties &) const
Definition: conductorproperties.cpp:833
ConductorProperties::m_wire_section
QString m_wire_section
Definition: conductorproperties.h:93