2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2015-02-20 14:56:22 +00:00
|
|
|
Copyright 2006-2015 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
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>
|
|
|
|
|
|
|
|
class QPainter;
|
|
|
|
|
2007-10-14 15:16:37 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class represents the properties of a singleline conductor.
|
2007-10-14 15:16:37 +00:00
|
|
|
*/
|
|
|
|
class SingleLineProperties {
|
|
|
|
public:
|
|
|
|
SingleLineProperties();
|
|
|
|
virtual ~SingleLineProperties();
|
2015-12-28 15:19:55 +00:00
|
|
|
|
2007-10-14 15:16:37 +00:00
|
|
|
void setPhasesCount(int);
|
|
|
|
unsigned short int phasesCount();
|
2012-08-12 20:32:53 +00:00
|
|
|
bool isPen() const;
|
2007-10-14 15:16:37 +00:00
|
|
|
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &);
|
2009-04-03 19:30:25 +00:00
|
|
|
void toXml(QDomElement &) const;
|
2007-10-14 15:16:37 +00:00
|
|
|
void fromXml(QDomElement &);
|
2007-11-14 20:27:45 +00:00
|
|
|
void toSettings(QSettings &, const QString & = QString()) const;
|
|
|
|
void fromSettings(QSettings &, const QString & = QString());
|
2007-10-14 15:16:37 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Whether the singleline conductor should display the ground symbol
|
2007-10-14 15:16:37 +00:00
|
|
|
bool hasGround;
|
2012-11-09 21:09:24 +00:00
|
|
|
/// Whether the singleline conductor should display the neutral symbol
|
2007-10-14 15:16:37 +00:00
|
|
|
bool hasNeutral;
|
2012-08-12 20:32:53 +00:00
|
|
|
/// Protective Earth Neutral: visually merge neutral and ground
|
|
|
|
bool is_pen;
|
2007-10-14 15:16:37 +00:00
|
|
|
|
|
|
|
int operator==(const SingleLineProperties &) const;
|
|
|
|
int operator!=(const SingleLineProperties &) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned short int phases;
|
|
|
|
void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
|
|
|
void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
2012-08-12 20:32:53 +00:00
|
|
|
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
2007-10-14 15:16:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
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
|
|
|
*/
|
2015-08-29 14:18:30 +00:00
|
|
|
class ConductorProperties
|
|
|
|
{
|
2007-10-14 15:16:37 +00:00
|
|
|
public:
|
2015-08-29 14:18:30 +00:00
|
|
|
ConductorProperties();
|
|
|
|
virtual ~ConductorProperties();
|
2007-10-14 15:16:37 +00:00
|
|
|
|
2015-08-29 14:18:30 +00:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
ConductorType type;
|
|
|
|
QColor color;
|
|
|
|
QString text,
|
|
|
|
m_function,
|
|
|
|
m_tension_protocol;
|
|
|
|
int text_size;
|
2015-12-23 18:41:13 +00:00
|
|
|
int cond_size;
|
2015-08-29 14:18:30 +00:00
|
|
|
double verti_rotate_text;
|
|
|
|
double horiz_rotate_text;
|
|
|
|
bool m_show_text;
|
|
|
|
bool m_one_text_per_folio;
|
|
|
|
Qt::PenStyle style;
|
|
|
|
SingleLineProperties singleLineProperties;
|
2007-10-14 15:16:37 +00:00
|
|
|
|
2015-08-29 14:18:30 +00:00
|
|
|
// methods
|
|
|
|
void toXml(QDomElement &) const;
|
|
|
|
void fromXml(QDomElement &);
|
|
|
|
void toSettings(QSettings &, const QString & = QString()) const;
|
|
|
|
void fromSettings(QSettings &, const QString & = QString());
|
|
|
|
static QString typeToString(ConductorType);
|
2014-10-26 11:57:38 +00:00
|
|
|
|
2015-08-29 14:18:30 +00:00
|
|
|
static ConductorProperties defaultProperties();
|
2007-10-14 15:16:37 +00:00
|
|
|
|
2015-08-29 14:18:30 +00:00
|
|
|
// operators
|
|
|
|
bool operator==(const ConductorProperties &) const;
|
|
|
|
bool operator!=(const ConductorProperties &) const;
|
2009-11-22 16:12:22 +00:00
|
|
|
|
|
|
|
private:
|
2015-08-29 14:18:30 +00:00
|
|
|
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
|