mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-05 10:34:13 +02:00
5d27ed8156
Discussion #1158, stacked on the limit itself. Two of QElectroTech's own tools wire several terminals as a star, every terminal to one of them: "create wires in a drawn polygon" (also qet.addConductor()), and deleting a symbol, which rewires the far ends to keep the potential. Six terminals give the hub five wires, which the project's limit forbids. When the project sets a limit (and the master switch is on), both now wire the terminals one after another instead, from the top left one to the nearest not yet wired (WiringRules::chainOrder()). The polygon tool also skips a wire whose terminal is already full. Without a limit, both build the star as before. tst_wiringrules: the chain order, and through the real binary that deleting a symbol wired to four others leaves them with at most two wires each under a limit, three on one of them without (checked to fail with chaining turned off). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015FPuYPS4T7QuEwjNu22rXD
57 lines
1.6 KiB
C++
57 lines
1.6 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 CONDUCTORCREATOR_H
|
|
#define CONDUCTORCREATOR_H
|
|
|
|
class Diagram;
|
|
class QPolygonF;
|
|
class Terminal;
|
|
class Conductor;
|
|
|
|
#include "../autoNum/assignvariables.h"
|
|
#include "../conductorproperties.h"
|
|
|
|
#include <QList>
|
|
|
|
/**
|
|
@brief The ConductorCreator class
|
|
This class create one or several or several conductors
|
|
in a given context
|
|
*/
|
|
class ConductorCreator
|
|
{
|
|
public:
|
|
ConductorCreator(Diagram *d, QList<Terminal *> terminals_list);
|
|
static void create(Diagram *d, const QPolygonF &polygon);
|
|
static bool needsPotentialChoice(const QList<Terminal *> &terminals_list);
|
|
|
|
private:
|
|
static QList<Conductor *> existingPotential(const QList<Terminal *> &terminals_list);
|
|
bool setUpPropertieToUse();
|
|
Terminal *hubTerminal();
|
|
QList<QPair<Terminal *, Terminal *>> terminalPairs(bool chain);
|
|
|
|
|
|
QList<Terminal *> m_terminals_list;
|
|
ConductorProperties m_properties;
|
|
autonum::sequentialNumbers m_sequential_number;
|
|
|
|
};
|
|
|
|
#endif // CONDUCTORCREATOR_H
|