From 7ed178a57df2537a824580bdc086f10259b7dbd6 Mon Sep 17 00:00:00 2001 From: Lucas Keune Date: Thu, 23 Jul 2020 19:42:45 +0200 Subject: [PATCH] Implementation of "simplify" command - New Tool class created and added to GUI - Remove duplicate NetLines with the same start and end points - Merge NetPoints at the same location - Connect Vias with the NetPoints and NetLines at the same location - Connect NetPoints with NetLines at the same location - Plan out other simplifications - Simplify NetPoints forming a straight line - Add default nullptr when searching for items at location - Add myself to AUTHORS.md --- AUTHORS.md | 1 + libs/librepcb/project/boards/board.h | 29 +- .../project/boards/items/bi_netpoint.cpp | 16 +- .../projecteditor/boardeditor/boardeditor.cpp | 5 + .../projecteditor/boardeditor/boardeditor.ui | 14 + .../projecteditor/boardeditor/fsm/bes_fsm.cpp | 7 + .../projecteditor/boardeditor/fsm/bes_fsm.h | 1 + .../boardeditor/fsm/bes_simplify.cpp | 332 ++++++++++++++++++ .../boardeditor/fsm/bes_simplify.h | 73 ++++ .../boardeditor/fsm/boardeditorevent.h | 1 + libs/librepcb/projecteditor/projecteditor.pro | 2 + 11 files changed, 462 insertions(+), 19 deletions(-) create mode 100644 libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.cpp create mode 100644 libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.h diff --git a/AUTHORS.md b/AUTHORS.md index 497e617822..359530b065 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -16,3 +16,4 @@ yourself by creating a pull request (see [CONTRIBUTING.md](CONTRIBUTING.md)). - [@chrisgwerder](https://github.com/chrisgwerder) - [@0xB767B](https://github.com/0xB767B) - Josua Schmid ([@schmijos](https://github.com/schmijos)) +- Lucas Keune ([@5n8ke](https://github.com/5n8ke)) diff --git a/libs/librepcb/project/boards/board.h b/libs/librepcb/project/boards/board.h index d93304e72b..e1e3c5fd2d 100644 --- a/libs/librepcb/project/boards/board.h +++ b/libs/librepcb/project/boards/board.h @@ -150,20 +150,21 @@ class Board final : public QObject, } bool isEmpty() const noexcept; QList getItemsAtScenePos(const Point& pos) const noexcept; - QList getViasAtScenePos(const Point& pos, - const NetSignal* netsignal) const noexcept; - QList getNetPointsAtScenePos(const Point& pos, - const GraphicsLayer* layer, - const NetSignal* netsignal) const - noexcept; - QList getNetLinesAtScenePos(const Point& pos, - const GraphicsLayer* layer, - const NetSignal* netsignal) const - noexcept; - QList getPadsAtScenePos(const Point& pos, - const GraphicsLayer* layer, - const NetSignal* netsignal) const - noexcept; + QList getViasAtScenePos(const Point& pos, + const NetSignal* netsignal = nullptr) + const noexcept; + QList getNetPointsAtScenePos(const Point& pos, + const GraphicsLayer* layer = nullptr, + const NetSignal* netsignal = nullptr) + const noexcept; + QList getNetLinesAtScenePos(const Point& pos, + const GraphicsLayer* layer = nullptr, + const NetSignal* netsignal = nullptr) + const noexcept; + QList getPadsAtScenePos(const Point& pos, + const GraphicsLayer* layer = nullptr, + const NetSignal* netsignal = nullptr) + const noexcept; QList getAllItems() const noexcept; // Setters: General diff --git a/libs/librepcb/project/boards/items/bi_netpoint.cpp b/libs/librepcb/project/boards/items/bi_netpoint.cpp index ca60e82ec2..eddcf38011 100644 --- a/libs/librepcb/project/boards/items/bi_netpoint.cpp +++ b/libs/librepcb/project/boards/items/bi_netpoint.cpp @@ -142,11 +142,17 @@ void BI_NetPoint::removeFromBoard() { } void BI_NetPoint::registerNetLine(BI_NetLine& netline) { - if ((!isAddedToBoard()) || (mRegisteredNetLines.contains(&netline)) || - (&netline.getNetSegment() != &mNetSegment) || - ((mRegisteredNetLines.count() > 0) && - (&netline.getLayer() != getLayerOfLines()))) { - throw LogicError(__FILE__, __LINE__); + if (!isAddedToBoard()) { + throw LogicError(__FILE__, __LINE__, "NetPoint is not added to the board."); + } else if (mRegisteredNetLines.contains(&netline)) { + throw LogicError(__FILE__, __LINE__, + "NetLine already registered to NetPoint."); + } else if (&netline.getNetSegment() != &mNetSegment) { + throw LogicError(__FILE__, __LINE__, + "NetLine is part of a different NetSegment."); + } else if ((mRegisteredNetLines.count() > 0) && + (&netline.getLayer() != getLayerOfLines())) { + throw LogicError(__FILE__, __LINE__, "NetLine is on a different layer."); } mRegisteredNetLines.insert(&netline); netline.updateLine(); diff --git a/libs/librepcb/projecteditor/boardeditor/boardeditor.cpp b/libs/librepcb/projecteditor/boardeditor/boardeditor.cpp index 4c0b2ee45c..3c38d84d91 100644 --- a/libs/librepcb/projecteditor/boardeditor/boardeditor.cpp +++ b/libs/librepcb/projecteditor/boardeditor/boardeditor.cpp @@ -208,6 +208,8 @@ BoardEditor::BoardEditor(ProjectEditor& projectEditor, Project& project) mUi->actionToolAddText); mToolsActionGroup->addAction(BES_FSM::State::State_AddHole, mUi->actionToolAddHole); + mToolsActionGroup->addAction(BES_FSM::State::State_Simplify, + mUi->actionToolSimplify); mToolsActionGroup->setCurrentAction(mFsm->getCurrentState()); connect(mFsm, &BES_FSM::stateChanged, mToolsActionGroup.data(), &ExclusiveActionGroup::setCurrentAction); @@ -812,6 +814,9 @@ void BoardEditor::toolActionGroupChangeTriggered( case BES_FSM::State::State_AddHole: mFsm->processEvent(new BEE_Base(BEE_Base::StartAddHole), true); break; + case BES_FSM::State::State_Simplify: + mFsm->processEvent(new BEE_Base(BEE_Base::StartSimplify), true); + break; default: Q_ASSERT(false); qCritical() << "Unknown tool triggered!"; diff --git a/libs/librepcb/projecteditor/boardeditor/boardeditor.ui b/libs/librepcb/projecteditor/boardeditor/boardeditor.ui index 0258182ab7..2c416a4e40 100644 --- a/libs/librepcb/projecteditor/boardeditor/boardeditor.ui +++ b/libs/librepcb/projecteditor/boardeditor/boardeditor.ui @@ -138,6 +138,7 @@ + @@ -272,6 +273,7 @@ + @@ -926,6 +928,18 @@ Ctrl+A + + + + :/img/actions/ruler.png:/img/actions/ruler.png + + + Simplify + + + Simplify traces + + diff --git a/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.cpp b/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.cpp index d87bcfa95d..e7b3203875 100644 --- a/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.cpp +++ b/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.cpp @@ -31,6 +31,7 @@ #include "bes_drawpolygon.h" #include "bes_drawtrace.h" #include "bes_select.h" +#include "bes_simplify.h" #include "boardeditorevent.h" #include "ui_boardeditor.h" @@ -80,6 +81,9 @@ BES_FSM::BES_FSM(BoardEditor& editor, Ui::BoardEditor& editorUi, mSubStates.insert( State_AddHole, new BES_AddHole(mEditor, mEditorUi, mEditorGraphicsView, mUndoStack)); + mSubStates.insert( + State_Simplify, + new BES_Simplify(mEditor, mEditorUi, mEditorGraphicsView, mUndoStack)); // go to state "Select" if (mSubStates[State_Select]->entry(nullptr)) { @@ -190,6 +194,9 @@ BES_FSM::State BES_FSM::processEventFromChild(BEE_Base* event) noexcept { case BEE_Base::StartAddDevice: event->setAccepted(true); return State_AddDevice; + case BEE_Base::StartSimplify: + event->setAccepted(true); + return State_Simplify; case BEE_Base::GraphicsViewEvent: { QEvent* e = BEE_RedirectedQEvent::getQEventFromBEE(event); Q_ASSERT(e); diff --git a/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.h b/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.h index 106935f01f..1feb0e1e3c 100644 --- a/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.h +++ b/libs/librepcb/projecteditor/boardeditor/fsm/bes_fsm.h @@ -56,6 +56,7 @@ class BES_FSM final : public BES_Base { State_AddVia, ///< ::librepcb::project::editor::BES_AddVia State_AddDevice, ///< ::librepcb::project::editor::BES_AddDevice State_DrawPlane, ///< ::librepcb::project::editor::BES_DrawPlane + State_Simplify, ///< ::librepcb::project::editor::BES_Simplify }; // Constructors / Destructor diff --git a/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.cpp b/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.cpp new file mode 100644 index 0000000000..742465963d --- /dev/null +++ b/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.cpp @@ -0,0 +1,332 @@ +/* + * LibrePCB - Professional EDA for everyone! + * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors. + * https://librepcb.org/ + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program. If not, see . + */ + +/******************************************************************************* + * Includes + ******************************************************************************/ + +#include "bes_simplify.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/******************************************************************************* + * Namespace + ******************************************************************************/ +namespace librepcb { +namespace project { +namespace editor { + +/******************************************************************************* + * Constructors / Destructor + ******************************************************************************/ + +BES_Simplify::BES_Simplify(BoardEditor& editor, Ui::BoardEditor& editorUi, + GraphicsView& editorGraphicsView, + UndoStack& undoStack) + : BES_Base(editor, editorUi, editorGraphicsView, undoStack) { + +} + +BES_Simplify::~BES_Simplify() { + +} + +/******************************************************************************* + * General Methods + ******************************************************************************/ + +BES_Base::ProcRetVal BES_Simplify::process(BEE_Base* event) noexcept { + switch (event->getType()) { + case BEE_Base::GraphicsViewEvent: { + QEvent* qevent = BEE_RedirectedQEvent::getQEventFromBEE(event); + Q_ASSERT(qevent); + if (!qevent) return PassToParentState; + Board* board = mEditor.getActiveBoard(); + Q_ASSERT(board); + if (!board) return PassToParentState; + switch (qevent->type()) { + case QEvent::GraphicsSceneMousePress: { + QGraphicsSceneMouseEvent* sceneEvent = + dynamic_cast(qevent); + Point pos = Point::fromPx(sceneEvent->scenePos()); + switch (sceneEvent->button()) { + case Qt::LeftButton: + simplify(*board, pos); + return ForceStayInState; + default: + break; + } + break; + } + default: + break; + } + break; + } + default: + break; + } + return PassToParentState; +} + +bool BES_Simplify::entry(BEE_Base* event) noexcept { + Q_UNUSED(event); + return true; +} + +bool BES_Simplify::exit(BEE_Base* event) noexcept { + Q_UNUSED(event); + mCircuit.setHighlightedNetSignal(nullptr); + return true; +} + + +void BES_Simplify::simplify(Board& board, Point& pos) noexcept { + try { + QSet netSignals = findNetSignals(board, pos); + if (netSignals.empty()) return; + NetSignal* chosenSignal = *netSignals.begin(); + mCircuit.setHighlightedNetSignal(chosenSignal); + mUndoStack.beginCmdGroup(tr("Simplify Traces of \"%1\"") + .arg(*chosenSignal->getName())); + foreach(BI_NetSegment* segment, chosenSignal->getBoardNetSegments()) { + simplifySegment(segment); + } + //TODO(5n8ke): Connect disjunct net segments + mUndoStack.commitCmdGroup(); + } catch (...) { + } +} + +void BES_Simplify::simplifySegment(BI_NetSegment *segment) noexcept { + QScopedPointer cmdAdd(new + CmdBoardNetSegmentAddElements(*segment)); + QScopedPointer cmdRemove(new + CmdBoardNetSegmentRemoveElements(*segment)); + + removeDuplicateNetLines(segment); + combineDuplicateNetPoints(segment); + + // connect NetPoints with NetLines + foreach (BI_NetPoint* netpoint, Toolbox::toSet(segment->getNetPoints())) { + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + // get NetLines at the via position, but only consider the ones that are not + // connected to the via already + QList netlines = {}; + segment->getNetLinesAtScenePos(netpoint->getPosition(), + netpoint->getLayerOfLines(), netlines); + QSet notConnectedNetlines = Toolbox::toSet(netlines); + notConnectedNetlines -= netpoint->getNetLines(); + foreach(BI_NetLine* netline, notConnectedNetlines) { + cmdAdd->addNetLine(netline->getStartPoint(), *netpoint, + netline->getLayer(), netline->getWidth()); + cmdAdd->addNetLine(netline->getEndPoint(), *netpoint, + netline->getLayer(), netline->getWidth()); + cmdRemove->removeNetLine(*netline); + } + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + } + + // connect Vias with NetPoints and NetLines + foreach (BI_Via* via, Toolbox::toSet(segment->getVias())) { + // connect Vias with NetPoints + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + QList netpoints = {}; + segment->getNetPointsAtScenePos(via->getPosition(), nullptr, netpoints); + Q_ASSERT(netpoints.count() <= 1); + if (netpoints.count()) { + BI_NetPoint* netpoint = netpoints.first(); + foreach(BI_NetLine* netline, netpoint->getNetLines()) { + cmdAdd->addNetLine(*via, *netline->getOtherPoint(*netpoint), + netline->getLayer(), netline->getWidth()); + cmdRemove->removeNetLine(*netline); + } + cmdRemove->removeNetPoint(*netpoint); + } + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + + // connect Vias with NetLines + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + // get NetLines at the Via position, but only consider the ones that are not + // connected to the Via already + QList netlines = {}; + segment->getNetLinesAtScenePos(via->getPosition(), nullptr, netlines); + QSet notConnectedNetlines = Toolbox::toSet(netlines); + notConnectedNetlines -= via->getNetLines(); + foreach(BI_NetLine* netline, notConnectedNetlines) { + cmdAdd->addNetLine(netline->getStartPoint(), *via, + netline->getLayer(), netline->getWidth()); + cmdAdd->addNetLine(netline->getEndPoint(), *via, + netline->getLayer(), netline->getWidth()); + cmdRemove->removeNetLine(*netline); + } + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + } + + //TODO(5n8ke): Connect crossing NetLines + + removeDuplicateNetLines(segment); + + //Connect NetLines forming a straight line + foreach (BI_NetPoint* netpoint, Toolbox::toSet(segment->getNetPoints())) { + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + QList netlines = netpoint->getNetLines().values(); + if (netlines.count() == 2) { + BI_NetLineAnchor* A = netlines[0]->getOtherPoint(*netpoint); + BI_NetLineAnchor* B = netlines[1]->getOtherPoint(*netpoint); + Q_ASSERT(netlines[0]->getLayer().getName() + == netlines[1]->getLayer().getName()); + if (netlines[0]->getWidth() != netlines[1]->getWidth()) continue; + if (Toolbox::shortestDistanceBetweenPointAndLine(netpoint->getPosition(), + A->getPosition(), B->getPosition()) == 0) { + cmdAdd->addNetLine(*A, *B, netlines[0]->getLayer(), + netlines[0]->getWidth()); + cmdRemove->removeNetLine(*netlines[0]); + cmdRemove->removeNetLine(*netlines[1]); + cmdRemove->removeNetPoint(*netpoint); + } + } + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + } + + removeDuplicateNetLines(segment); +} + +void BES_Simplify::removeDuplicateNetLines(BI_NetSegment* segment) noexcept { + //Remove NetLines with the same start and end points + QScopedPointer cmdAdd(new + CmdBoardNetSegmentAddElements(*segment)); + QScopedPointer cmdRemove(new + CmdBoardNetSegmentRemoveElements(*segment)); + foreach (BI_NetLine* netline, Toolbox::toSet(segment->getNetLines())) { + if (!netline->isAddedToBoard()) continue; + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + BI_NetLineAnchor* startPoint = &netline->getStartPoint(); + BI_NetLineAnchor* endPoint = &netline->getEndPoint(); + QSet otherNetlines = startPoint->getNetLines(); + otherNetlines -= netline; + foreach (BI_NetLine* otherNetline, otherNetlines) { + if (otherNetline->getOtherPoint(*startPoint) == endPoint) { + cmdRemove->removeNetLine(*otherNetline); + } + } + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + } +} + +void BES_Simplify::combineDuplicateNetPoints(BI_NetSegment *segment) noexcept { + QScopedPointer cmdAdd(new + CmdBoardNetSegmentAddElements(*segment)); + QScopedPointer cmdRemove(new + CmdBoardNetSegmentRemoveElements(*segment)); + + QSet netpoints = Toolbox::toSet(segment->getNetPoints()); + // for every position and layer on the board choose a single NetPoint that + // will be kept. + QMap, BI_NetPoint*> uniquePositions = {}; + foreach (BI_NetPoint* netpoint, netpoints) { + QPair identifier(netpoint->getPosition(), + netpoint->getLayerOfLines()->getName()); + if (!uniquePositions.contains(identifier)) { + uniquePositions.insert(identifier, netpoint); + } + } + QSet netLinesToRemove = {}; + foreach (BI_NetPoint* netpoint, netpoints) { + QPair identifier(netpoint->getPosition(), + netpoint->getLayerOfLines()->getName()); + BI_NetPoint* replacementPoint = *uniquePositions.find(identifier); + if (netpoint != replacementPoint) { + cmdAdd.reset(new CmdBoardNetSegmentAddElements(*segment)); + cmdRemove.reset(new CmdBoardNetSegmentRemoveElements(*segment)); + foreach (BI_NetLine* netline, netpoint->getNetLines()) { + BI_NetLineAnchor* endAnchor = netline->getOtherPoint(*netpoint); + if (endAnchor != replacementPoint) { + cmdAdd->addNetLine(*replacementPoint, *endAnchor, + netline->getLayer(), netline->getWidth()); + } + cmdRemove->removeNetLine(*netline); + } + cmdRemove->removeNetPoint(*netpoint); + mUndoStack.appendToCmdGroup(cmdAdd.take()); + mUndoStack.appendToCmdGroup(cmdRemove.take()); + } + } +} + +QSet BES_Simplify::findNetSignals(Board& board, Point& pos, + QSet except) const noexcept { + QSet result = QSet(); + foreach (BI_Via* via, board.getViasAtScenePos(pos)) { + if (except.contains(via)) continue; + if (!result.contains(&via->getNetSignalOfNetSegment())) { + result.insert(&via->getNetSignalOfNetSegment()); + } + } + foreach (BI_NetPoint* netpoint, board.getNetPointsAtScenePos(pos)) { + if (except.contains(netpoint)) continue; + if (!result.contains(&netpoint->getNetSignalOfNetSegment())) { + result.insert(&netpoint->getNetSignalOfNetSegment()); + } + } + foreach (BI_NetLine* netline, board.getNetLinesAtScenePos(pos)) { + if (except.contains(netline)) continue; + if (!result.contains(&netline->getNetSignalOfNetSegment())) { + result.insert(&netline->getNetSignalOfNetSegment()); + } + } + foreach (BI_FootprintPad* pad, board.getPadsAtScenePos(pos)) { + if (except.contains(pad)) continue; + if (!result.contains(pad->getCompSigInstNetSignal())) { + result.insert(pad->getCompSigInstNetSignal()); + } + } + return result; +} + +/******************************************************************************* + * End of File + ******************************************************************************/ + +} // namespace editor +} // namespace project +} // namespace librepcb diff --git a/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.h b/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.h new file mode 100644 index 0000000000..a3e1299cda --- /dev/null +++ b/libs/librepcb/projecteditor/boardeditor/fsm/bes_simplify.h @@ -0,0 +1,73 @@ +/* + * LibrePCB - Professional EDA for everyone! + * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors. + * https://librepcb.org/ + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program. If not, see . + */ + + +#ifndef LIBREPCB_PROJECT_BES_SIMPLIFY_H +#define LIBREPCB_PROJECT_BES_SIMPLIFY_H + +/******************************************************************************* + * Includes + ******************************************************************************/ +#include "bes_base.h" + +#include +#include + +/******************************************************************************* + * Namespace / Forward Declarations + ******************************************************************************/ +namespace librepcb { +namespace project { +namespace editor { + +/******************************************************************************* + * Class BES_Simplify + ******************************************************************************/ + +class BES_Simplify final : public BES_Base { + Q_OBJECT +public: + explicit BES_Simplify(BoardEditor& editor, Ui::BoardEditor& editorUi, + GraphicsView& editorGraphicsView, + UndoStack& undoStack); + ~BES_Simplify(); + + // General Methods + ProcRetVal process(BEE_Base* event) noexcept override; + bool entry(BEE_Base* event) noexcept override; + bool exit(BEE_Base* event) noexcept override; + + void simplify(Board& board, Point& pos) noexcept; + void simplifySegment(BI_NetSegment* segment) noexcept; + void removeDuplicateNetLines(BI_NetSegment* segment) noexcept; + void combineDuplicateNetPoints(BI_NetSegment* segment) noexcept; + QSet findNetSignals(Board& board, Point& pos, + QSet except = {}) + const noexcept; +}; + +/******************************************************************************* + * End of File + ******************************************************************************/ + +} // namespace editor +} // namespace project +} // namespace librepcb + +#endif // LIBREPCB_PROJECT_BES_SIMPLIFY_H diff --git a/libs/librepcb/projecteditor/boardeditor/fsm/boardeditorevent.h b/libs/librepcb/projecteditor/boardeditor/fsm/boardeditorevent.h index d3668dfb06..dd4bc038f8 100644 --- a/libs/librepcb/projecteditor/boardeditor/fsm/boardeditorevent.h +++ b/libs/librepcb/projecteditor/boardeditor/fsm/boardeditorevent.h @@ -68,6 +68,7 @@ class BEE_Base { StartDrawPlane, ///< start command: draw plane StartDrawTrace, ///< start command: draw trace StartAddVia, ///< start command: add via + StartSimplify, ///< start command: simplify // StartAddNetLabel, ///< start command: add netlabel Edit_SelectAll, ///< select all elements (ctrl+a) Edit_Copy, ///< copy the selected elements to clipboard (ctrl+c) diff --git a/libs/librepcb/projecteditor/projecteditor.pro b/libs/librepcb/projecteditor/projecteditor.pro index 47bbadab19..7c98d2a95d 100644 --- a/libs/librepcb/projecteditor/projecteditor.pro +++ b/libs/librepcb/projecteditor/projecteditor.pro @@ -46,6 +46,7 @@ SOURCES += \ boardeditor/fsm/bes_drawtrace.cpp \ boardeditor/fsm/bes_fsm.cpp \ boardeditor/fsm/bes_select.cpp \ + boardeditor/fsm/bes_simplify.cpp \ boardeditor/fsm/boardeditorevent.cpp \ boardeditor/unplacedcomponentsdock.cpp \ cmd/cmdaddcomponenttocircuit.cpp \ @@ -114,6 +115,7 @@ HEADERS += \ boardeditor/fsm/bes_drawtrace.h \ boardeditor/fsm/bes_fsm.h \ boardeditor/fsm/bes_select.h \ + boardeditor/fsm/bes_simplify.h \ boardeditor/fsm/boardeditorevent.h \ boardeditor/unplacedcomponentsdock.h \ cmd/cmdaddcomponenttocircuit.h \