mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-19 20:44:16 +02:00
34557928d1
Add two realistic drawing styles for the terminal strip plan, besides
the existing schematic one:
- Realistic (push-in) and Realistic (screw): the strip seen from above,
at scale (real width of each terminal), like a cabinet mounting
drawing: end stops, group marker carrier with the strip name, one row
of wire entries per level, bridge channels with red bridges, marker
tags with the terminal number, type symbol (fuse, LED, diode,
sectional, ground...), green/yellow PE and terminal color.
The style is chosen for each plan in the "Add terminal strip plan"
dialog and saved with the item (attribute draw_style of
terminal_strip_item). Items saved before keep the schematic style.
Several plans of the same strip can use different styles.
The values used by the realistic styles are in the layout (scale in
px/mm, terminal length in mm, end stops, group marker) and can be set
in the layout editor, whose style combo box only changes the preview.
Separator plates: a new "Separator plate after" check box column in
the terminal strip editor, stored in the terminal element informations
(key terminal_separator). Drawn as a plate at scale in the realistic
styles and as a thick line in the schematic style.
New files: realisticterminalstripdrawer.{h,cpp} (realistic drawing) and
terminalstripdrawerhelpers.h (helpers shared with the schematic drawer).
189 lines
4.2 KiB
C++
189 lines
4.2 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/>.
|
|
*/
|
|
#include "trueterminalstrip.h"
|
|
#include "../physicalterminal.h"
|
|
#include "../realterminal.h"
|
|
#include "../terminalstrip.h"
|
|
#include "../terminalstripbridge.h"
|
|
#include "../../autoNum/assignvariables.h"
|
|
|
|
#include "terminalstripdrawer.h"
|
|
|
|
namespace TerminalStripDrawer
|
|
{
|
|
/**
|
|
* @brief TrueTerminalStrip::TrueTerminalStrip
|
|
* Constructor, this class don't take ownership of @a strip
|
|
* @param strip
|
|
*/
|
|
TrueTerminalStrip::TrueTerminalStrip(TerminalStrip *strip) :
|
|
m_strip { strip }
|
|
{}
|
|
|
|
|
|
QString TrueTerminalStrip::installation() const
|
|
{
|
|
if (m_strip) {
|
|
return m_strip->installation();
|
|
} else {
|
|
return QString();
|
|
}
|
|
}
|
|
|
|
QString TrueTerminalStrip::location() const
|
|
{
|
|
if (m_strip) {
|
|
return m_strip->location();
|
|
} else {
|
|
return QString();
|
|
}
|
|
}
|
|
|
|
QString TrueTerminalStrip::name() const
|
|
{
|
|
if (m_strip) {
|
|
return m_strip->name();
|
|
} else {
|
|
return QString();
|
|
}
|
|
}
|
|
|
|
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> TrueTerminalStrip::physicalTerminal() const
|
|
{
|
|
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> vector_;
|
|
if (m_strip) {
|
|
for (const auto &phy : m_strip->physicalTerminal()) {
|
|
vector_.append(QSharedPointer<AbstractPhysicalTerminalInterface>{ new TruePhysicalTerminal(phy) });
|
|
}
|
|
}
|
|
|
|
return vector_;
|
|
}
|
|
|
|
TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical) :
|
|
m_physical { physical }
|
|
{}
|
|
|
|
QVector<QSharedPointer<AbstractRealTerminalInterface>> TruePhysicalTerminal::realTerminals() const
|
|
{
|
|
QVector<QSharedPointer<AbstractRealTerminalInterface>> vector_;
|
|
if (m_physical) {
|
|
for (const auto &real_ : m_physical->realTerminals()) {
|
|
vector_.append(QSharedPointer<AbstractRealTerminalInterface> { new TrueRealTerminal{ real_ }});
|
|
}
|
|
}
|
|
|
|
return vector_;
|
|
}
|
|
|
|
TrueRealTerminal::TrueRealTerminal(QSharedPointer<RealTerminal> real) :
|
|
m_real { real }
|
|
{}
|
|
|
|
QString TrueRealTerminal::label() const
|
|
{
|
|
if (m_real) {
|
|
return m_real->label();
|
|
} else {
|
|
return QString();
|
|
}
|
|
}
|
|
|
|
bool TrueRealTerminal::isBridged() const
|
|
{
|
|
if (m_real) {
|
|
return m_real->isBridged();
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//Return a raw pointer, the pointer is not managed by this class
|
|
AbstractBridgeInterface* TrueRealTerminal::bridge() const
|
|
{
|
|
return new TrueBridge(m_real->bridge());
|
|
}
|
|
|
|
QString TrueRealTerminal::xref() const
|
|
{
|
|
if (m_real && m_real->isElement()) {
|
|
return autonum::AssignVariables::genericXref(m_real->element());
|
|
} else {
|
|
return QString{};
|
|
}
|
|
}
|
|
|
|
ElementData::TerminalType TrueRealTerminal::type() const
|
|
{
|
|
return m_real ? m_real->type() : ElementData::TTGeneric;
|
|
}
|
|
|
|
bool TrueRealTerminal::isLed() const
|
|
{
|
|
return m_real ? m_real->isLed() : false;
|
|
}
|
|
|
|
QString TrueRealTerminal::cable() const
|
|
{
|
|
return m_real ? m_real->cable() : QString();
|
|
}
|
|
|
|
QString TrueRealTerminal::cableWire() const
|
|
{
|
|
return m_real ? m_real->cableWire() : QString();
|
|
}
|
|
|
|
bool TrueRealTerminal::isShield() const
|
|
{
|
|
return m_real ? m_real->isShield() : false;
|
|
}
|
|
|
|
QColor TrueRealTerminal::color() const
|
|
{
|
|
return m_real ? m_real->color() : QColor();
|
|
}
|
|
|
|
QColor TrueRealTerminal::stripeColor() const
|
|
{
|
|
return m_real ? m_real->stripeColor() : QColor();
|
|
}
|
|
|
|
qreal TrueRealTerminal::widthMm() const
|
|
{
|
|
return m_real ? m_real->widthMm() : 0;
|
|
}
|
|
|
|
bool TrueRealTerminal::hasSeparatorAfter() const
|
|
{
|
|
return m_real ? m_real->hasSeparatorAfter() : false;
|
|
}
|
|
|
|
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
|
m_bridge { bridge }
|
|
{}
|
|
|
|
QUuid TrueBridge::uuid() const
|
|
{
|
|
if (m_bridge) {
|
|
return m_bridge->uuid();
|
|
} else {
|
|
return QUuid();
|
|
}
|
|
}
|
|
}
|