mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 22:54:12 +02:00
bf9b34398d
Cables are drawn line objects (toolbar button next to the auto break/reconnect button, click-move-click, right click cancels), not components. The type comes from a CSV catalog following the material list pattern (designation, cores, core colours, editable through the entry dialog with "Nouvelle entrée" / "Modifier l'entrée"). Each core is bound to the wire its colour label stands on, and the cable reference is generated per core and written into the Conductor entry via Conductor::setCableReference(label, cable uuid, slot). The conductor entry is where it has to live because the terminal strip plan (Klemmenplan) consumes it in the next step. Numbering: "Cables" rule under Programmeinstellungen/Neues Projekt/Nummerierung auto (mirrored in project properties), literal "W" fallback without a rule, French gate dialog when no rule exists, Nummerierung menu with the renumber dialog (preferred axis, per-folio counter, rule and counter state written back, hand-typed names ask, whole-project scope). Also included: label block and under-line texts with per-text font and alignment plus the material-list cell margins, free-core placement and right-click removal, claim questions for wires of other cables, multi-selection drag as one undo step, type change with confirmation, cross-references for type "Cable" (%f-%l%c, own font, clickable links in exported PDFs), report propagation of the cable definition, Listes menu (table of contents, material list, terminal strip manager, terminal generator plugin, cable list), cable list with freely selectable columns (installation/localisation of cable, start and end, Blatt start/end, length, used cores...), CSV export dialog with column pick and preview in the Projekt menu, script API (addTable kind "cable_list", exportCableList) and a unit test for the type catalog.
155 lines
4.0 KiB
C++
155 lines
4.0 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
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/>.
|
|
*/
|
|
#ifndef CONDUCTOR_PROPERTIES_H
|
|
#define CONDUCTOR_PROPERTIES_H
|
|
|
|
#include "qet.h"
|
|
#include <QColor>
|
|
#include <QSettings>
|
|
#include <QUuid>
|
|
|
|
class QPainter;
|
|
|
|
/**
|
|
@brief The SingleLineProperties class
|
|
This class represents the properties of a singleline conductor.
|
|
*/
|
|
class SingleLineProperties {
|
|
public:
|
|
SingleLineProperties();
|
|
virtual ~SingleLineProperties();
|
|
|
|
void setPhasesCount(int);
|
|
unsigned short int phasesCount();
|
|
bool isPen() const;
|
|
void draw(QPainter *, QET::ConductorSegmentType, const QRectF &);
|
|
void toXml(QDomElement &) const;
|
|
void fromXml(QDomElement &);
|
|
void toSettings(QSettings &, const QString & = QString()) const;
|
|
void fromSettings(QSettings &, const QString & = QString());
|
|
|
|
/// Whether the singleline conductor should display the ground symbol
|
|
bool hasGround;
|
|
/// Whether the singleline conductor should display the neutral symbol
|
|
bool hasNeutral;
|
|
/// Protective Earth Neutral: visually merge neutral and ground
|
|
bool is_pen;
|
|
|
|
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 *, QPointF, qreal);
|
|
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
|
|
};
|
|
|
|
/**
|
|
@brief The ConductorProperties class
|
|
This class represents the functional properties of a particular conductor,
|
|
i.e. properties other than path and terminals.
|
|
*/
|
|
class ConductorProperties
|
|
{
|
|
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
|
|
ConductorType type;
|
|
|
|
QColor
|
|
color,
|
|
m_color_2,
|
|
text_color;
|
|
|
|
QString
|
|
text,
|
|
m_function,
|
|
m_tension_protocol,
|
|
m_wire_color,
|
|
m_wire_section,
|
|
m_formula,
|
|
m_bus,
|
|
m_cable;
|
|
|
|
/// The cable of the project this conductor is a core of, null
|
|
/// when it belongs to no cable. The text shown in m_cable is
|
|
/// generated from the cable and never typed in: this reference
|
|
/// plus the slot below is all it takes to work it out again.
|
|
QUuid m_cable_uuid;
|
|
/// Which core of that cable this conductor shows, -1 when none
|
|
int m_cable_slot = -1;
|
|
|
|
int
|
|
text_size,
|
|
m_dash_size = 1;
|
|
|
|
double
|
|
cond_size,
|
|
verti_rotate_text,
|
|
horiz_rotate_text;
|
|
|
|
bool
|
|
m_show_text,
|
|
m_one_text_per_folio,
|
|
m_bicolor = false;
|
|
|
|
Qt::Alignment
|
|
m_horizontal_alignment = Qt::AlignBottom,
|
|
m_vertical_alignment = Qt::AlignRight;
|
|
|
|
Qt::PenStyle style;
|
|
|
|
SingleLineProperties singleLineProperties;
|
|
|
|
// 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);
|
|
void applyForEqualAttributes(QList<ConductorProperties> list);
|
|
void applyChanges(const ConductorProperties &before,
|
|
const ConductorProperties &after);
|
|
|
|
static ConductorProperties defaultProperties();
|
|
|
|
// operators
|
|
bool operator==(const ConductorProperties &) const;
|
|
bool operator!=(const ConductorProperties &) const;
|
|
|
|
private:
|
|
void readStyle(const QString &);
|
|
QString writeStyle() const;
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(ConductorProperties)
|
|
|
|
#endif
|