2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2021-02-20 12:13:46 +01:00
|
|
|
Copyright 2006-2021 The QElectroTech Team
|
2020-10-17 20:25:30 +02:00
|
|
|
This file is part of QElectroTech.
|
2020-09-24 22:39:48 +02:00
|
|
|
|
2020-10-17 20:25:30 +02:00
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2020-09-24 22:39:48 +02:00
|
|
|
|
2020-10-17 20:25:30 +02:00
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2020-09-24 22:39:48 +02:00
|
|
|
|
2020-10-17 20:25:30 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
2007-12-01 10:47:15 +00:00
|
|
|
*/
|
2007-10-14 15:16:37 +00:00
|
|
|
#ifndef CONDUCTOR_PROPERTIES_H
|
|
|
|
#define CONDUCTOR_PROPERTIES_H
|
2015-08-09 12:06:31 +00:00
|
|
|
|
2007-10-14 15:16:37 +00:00
|
|
|
#include "qet.h"
|
2015-08-09 12:06:31 +00:00
|
|
|
#include <QColor>
|
2020-05-12 11:17:25 +02:00
|
|
|
#include <QSettings>
|
2015-08-09 12:06:31 +00:00
|
|
|
|
2021-02-24 18:48:59 +01:00
|
|
|
#include "properties/propertiesinterface.h"
|
2020-10-16 11:43:45 +02:00
|
|
|
|
2015-08-09 12:06:31 +00:00
|
|
|
class QPainter;
|
|
|
|
|
2007-10-14 15:16:37 +00:00
|
|
|
/**
|
2020-10-17 20:25:30 +02:00
|
|
|
@brief The SingleLineProperties class
|
|
|
|
This class represents the properties of a singleline conductor.
|
2007-10-14 15:16:37 +00:00
|
|
|
*/
|
2020-10-16 11:43:45 +02:00
|
|
|
class SingleLineProperties: public PropertiesInterface {
|
2020-10-17 20:25:30 +02:00
|
|
|
public:
|
|
|
|
SingleLineProperties();
|
|
|
|
virtual ~SingleLineProperties();
|
|
|
|
|
|
|
|
void setPhasesCount(int);
|
|
|
|
unsigned short int phasesCount();
|
|
|
|
bool isPen() const;
|
|
|
|
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &);
|
2021-03-04 19:18:28 +01:00
|
|
|
void toXmlPriv(QDomElement&) const override;
|
|
|
|
bool fromXmlPriv(const QDomElement &) override;
|
2020-10-17 20:25:30 +02:00
|
|
|
static bool valideXml(QDomElement& element);
|
|
|
|
void toSettings(QSettings &, const QString & = QString()) const;
|
|
|
|
void fromSettings(QSettings &, const QString & = QString());
|
|
|
|
|
|
|
|
/// Whether the singleline conductor should display the ground symbol
|
|
|
|
bool hasGround{true};
|
|
|
|
/// Whether the singleline conductor should display the neutral symbol
|
|
|
|
bool hasNeutral{true};
|
|
|
|
/// Protective Earth Neutral: visually merge neutral and ground
|
|
|
|
bool is_pen{false};
|
|
|
|
|
|
|
|
int operator==(const SingleLineProperties &) const;
|
|
|
|
int operator!=(const SingleLineProperties &) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned short int phases{1};
|
|
|
|
void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
|
|
|
void drawNeutral(QPainter *, QPointF, qreal);
|
|
|
|
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
2007-10-14 15:16:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-10-17 20:25:30 +02:00
|
|
|
@brief The ConductorProperties class
|
|
|
|
This class represents the functional properties of a particular conductor,
|
|
|
|
i.e. properties other than path and terminals.
|
2007-10-14 15:16:37 +00:00
|
|
|
*/
|
2020-10-16 11:43:45 +02:00
|
|
|
class ConductorProperties: public PropertiesInterface
|
2015-08-29 14:18:30 +00:00
|
|
|
{
|
2020-10-17 20:25:30 +02:00
|
|
|
public:
|
|
|
|
ConductorProperties();
|
|
|
|
virtual ~ConductorProperties();
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief The ConductorType enum Represents
|
|
|
|
the kind of a particular conductor:
|
|
|
|
Single: singleline symbols, no text input
|
|
|
|
Multi: text input, no symbol
|
|
|
|
*/
|
|
|
|
enum ConductorType { Single, Multi };
|
|
|
|
|
|
|
|
|
|
|
|
//Attributes
|
2021-03-04 19:18:28 +01:00
|
|
|
ConductorType type{ConductorType::Multi};
|
2020-10-17 20:25:30 +02:00
|
|
|
|
|
|
|
// TODO: set default values!
|
|
|
|
QColor color{QColor(Qt::black)},
|
|
|
|
m_color_2{QColor(Qt::black)},
|
|
|
|
text_color{QColor(Qt::black)};
|
|
|
|
|
|
|
|
QString
|
2021-03-04 19:18:28 +01:00
|
|
|
text{"_"},
|
2020-10-17 20:25:30 +02:00
|
|
|
m_function,
|
|
|
|
m_tension_protocol,
|
|
|
|
m_wire_color,
|
|
|
|
m_wire_section,
|
|
|
|
m_formula,
|
|
|
|
m_bus,
|
|
|
|
m_cable;
|
|
|
|
|
2020-10-19 11:07:04 +02:00
|
|
|
int text_size{9},
|
2020-10-17 20:25:30 +02:00
|
|
|
m_dash_size = 1;
|
|
|
|
|
2020-10-19 11:07:04 +02:00
|
|
|
double
|
|
|
|
cond_size{1},
|
2021-03-04 19:18:28 +01:00
|
|
|
verti_rotate_text{270},
|
|
|
|
horiz_rotate_text{0};
|
2020-10-17 20:25:30 +02:00
|
|
|
|
|
|
|
bool m_show_text{true},
|
2021-03-04 19:18:28 +01:00
|
|
|
m_one_text_per_folio{false},
|
2020-10-17 20:25:30 +02:00
|
|
|
m_bicolor = false;
|
|
|
|
|
|
|
|
Qt::Alignment
|
2020-10-19 11:07:04 +02:00
|
|
|
m_horizontal_alignment = Qt::AlignBottom,
|
2020-10-17 20:25:30 +02:00
|
|
|
m_vertical_alignment = Qt::AlignRight;
|
|
|
|
|
|
|
|
Qt::PenStyle style{Qt::PenStyle::SolidLine};
|
|
|
|
|
|
|
|
SingleLineProperties singleLineProperties;
|
|
|
|
|
|
|
|
// methods
|
|
|
|
static bool valideXml(QDomElement& element);
|
2021-03-07 14:07:47 +01:00
|
|
|
static QString xmlTagName();
|
2020-10-19 11:07:04 +02:00
|
|
|
void toSettings(QSettings &, const QString & = QString()) const override;
|
|
|
|
void fromSettings(QSettings &, const QString & = QString()) override;
|
2020-10-17 20:25:30 +02:00
|
|
|
static QString typeToString(ConductorType);
|
|
|
|
void applyForEqualAttributes(QList<ConductorProperties> list);
|
|
|
|
|
|
|
|
static ConductorProperties defaultProperties();
|
|
|
|
|
|
|
|
// operators
|
|
|
|
bool operator==(const ConductorProperties &) const;
|
|
|
|
bool operator!=(const ConductorProperties &) const;
|
|
|
|
|
2021-03-07 14:07:47 +01:00
|
|
|
private:
|
|
|
|
void toXmlPriv(QDomElement&) const override;
|
|
|
|
bool fromXmlPriv(const QDomElement &) override;
|
|
|
|
|
2020-10-17 20:25:30 +02:00
|
|
|
private:
|
|
|
|
void readStyle(const QString &);
|
|
|
|
QString writeStyle() const;
|
2007-10-14 15:16:37 +00:00
|
|
|
};
|
2015-08-09 12:06:31 +00:00
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(ConductorProperties)
|
|
|
|
|
2007-10-14 15:16:37 +00:00
|
|
|
#endif
|