KiCad PCB EDA Suite
pns_kicad_iface.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2016 CERN
5 * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __PNS_KICAD_IFACE_H
23#define __PNS_KICAD_IFACE_H
24
25#include <unordered_set>
26
27#include "pns_router.h"
28
31
32class BOARD;
33class BOARD_COMMIT;
35class PCB_TOOL_BASE;
36class FOOTPRINT;
37class PAD;
38
39namespace PNS
40{
41 class SIZES_SETTINGS;
42}
43
44namespace KIGFX
45{
46 class VIEW;
47}
48
50{
51public:
54
55 void EraseView() override {};
56 void SetBoard( BOARD* aBoard );
57 void SyncWorld( PNS::NODE* aWorld ) override;
58 bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override { return true; };
59 bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
60 bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; };
61 void HideItem( PNS::ITEM* aItem ) override {}
62 void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override {}
63 void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override {}
64 void AddItem( PNS::ITEM* aItem ) override;
65 void UpdateItem( PNS::ITEM* aItem ) override;
66 void RemoveItem( PNS::ITEM* aItem ) override;
67 void Commit() override {}
68 bool ImportSizes( PNS::SIZES_SETTINGS& aSizes, PNS::ITEM* aStartItem, int aNet ) override;
69 int StackupHeight( int aFirstLayer, int aSecondLayer ) const override;
70
71 void UpdateNet( int aNetCode ) override {}
72
74
75 void SetStartLayer( int aLayer ) { m_startLayer = aLayer; }
76
77 virtual PNS::NODE* GetWorld() const override { return m_world; };
78
79 BOARD* GetBoard() const { return m_board; }
80
81 virtual EDA_UNITS GetUnits() const { return EDA_UNITS::MILLIMETRES; };
82
85
86protected:
89
90 std::unique_ptr<PNS::SOLID> syncPad( PAD* aPad );
91 std::unique_ptr<PNS::SEGMENT> syncTrack( PCB_TRACK* aTrack );
92 std::unique_ptr<PNS::ARC> syncArc( PCB_ARC* aArc );
93 std::unique_ptr<PNS::VIA> syncVia( PCB_VIA* aVia );
94 bool syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB_LAYER_ID aLayer );
95 bool syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aItem );
96 bool syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_SET* aBoardOutline );
97 bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );
98
99protected:
103};
104
106{
107public:
110
111 void SetHostTool( PCB_TOOL_BASE* aTool );
112
113 void SetView( KIGFX::VIEW* aView );
114 void EraseView() override;
115 bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override;
116 bool IsItemVisible( const PNS::ITEM* aItem ) const override;
117 void HideItem( PNS::ITEM* aItem ) override;
118 void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override;
119 void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override;
120 void Commit() override;
121 void AddItem( PNS::ITEM* aItem ) override;
122 void UpdateItem( PNS::ITEM* aItem ) override;
123 void RemoveItem( PNS::ITEM* aItem ) override;
124
125 void UpdateNet( int aNetCode ) override;
126
127 EDA_UNITS GetUnits() const override;
128
129private:
130 struct OFFSET
131 {
133 };
134
135 std::map<PAD*, OFFSET> m_fpOffsets;
138 std::unordered_set<BOARD_ITEM*> m_hiddenItems;
139
141 std::unique_ptr<BOARD_COMMIT> m_commit;
142};
143
144
145#endif
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:240
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:73
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:47
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
Represent a contiguous set of PCB layers.
Definition: pns_layerset.h:32
Definition: pad.h:59
Base class for PNS router board items.
Definition: pns_item.h:56
Keep the router "world" - i.e.
Definition: pns_node.h:150
bool syncGraphicalItem(PNS::NODE *aWorld, PCB_SHAPE *aItem)
bool inheritTrackWidth(PNS::ITEM *aItem, int *aInheritedWidth)
void AddItem(PNS::ITEM *aItem) override
virtual EDA_UNITS GetUnits() const
bool ImportSizes(PNS::SIZES_SETTINGS &aSizes, PNS::ITEM *aStartItem, int aNet) override
PNS::DEBUG_DECORATOR * m_debugDecorator
void SetDebugDecorator(PNS::DEBUG_DECORATOR *aDec)
bool syncZone(PNS::NODE *aWorld, ZONE *aZone, SHAPE_POLY_SET *aBoardOutline)
void SetBoard(BOARD *aBoard)
virtual PNS::NODE * GetWorld() const override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false) override
std::unique_ptr< PNS::ARC > syncArc(PCB_ARC *aArc)
void RemoveItem(PNS::ITEM *aItem) override
bool syncTextItem(PNS::NODE *aWorld, EDA_TEXT *aText, PCB_LAYER_ID aLayer)
PNS::RULE_RESOLVER * GetRuleResolver() override
void SetStartLayer(int aLayer)
void DisplayRatline(const SHAPE_LINE_CHAIN &aRatline, int aColor=-1) override
void HideItem(PNS::ITEM *aItem) override
void Commit() override
bool IsAnyLayerVisible(const LAYER_RANGE &aLayer) const override
bool IsItemVisible(const PNS::ITEM *aItem) const override
bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const override
BOARD * GetBoard() const
std::unique_ptr< PNS::SOLID > syncPad(PAD *aPad)
void SyncWorld(PNS::NODE *aWorld) override
int StackupHeight(int aFirstLayer, int aSecondLayer) const override
PNS::DEBUG_DECORATOR * GetDebugDecorator() override
std::unique_ptr< PNS::SEGMENT > syncTrack(PCB_TRACK *aTrack)
PNS_PCBNEW_RULE_RESOLVER * m_ruleResolver
void UpdateNet(int aNetCode) override
std::unique_ptr< PNS::VIA > syncVia(PCB_VIA *aVia)
void EraseView() override
void UpdateItem(PNS::ITEM *aItem) override
void SetView(KIGFX::VIEW *aView)
void RemoveItem(PNS::ITEM *aItem) override
void AddItem(PNS::ITEM *aItem) override
void UpdateItem(PNS::ITEM *aItem) override
std::map< PAD *, OFFSET > m_fpOffsets
void SetHostTool(PCB_TOOL_BASE *aTool)
std::unique_ptr< BOARD_COMMIT > m_commit
void UpdateNet(int aNetCode) override
void EraseView() override
void HideItem(PNS::ITEM *aItem) override
KIGFX::VIEW * m_view
bool IsItemVisible(const PNS::ITEM *aItem) const override
std::unordered_set< BOARD_ITEM * > m_hiddenItems
EDA_UNITS GetUnits() const override
bool IsAnyLayerVisible(const LAYER_RANGE &aLayer) const override
PCB_TOOL_BASE * m_tool
void DisplayRatline(const SHAPE_LINE_CHAIN &aRatline, int aColor=-1) override
void Commit() override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false) override
KIGFX::VIEW_GROUP * m_previewItems
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
Handle a list of polygons defining a copper zone.
Definition: zone.h:58
EDA_UNITS
Definition: eda_units.h:39
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243
Push and Shove diff pair dimensions (gap) settings dialog.