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 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
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 
32 class BOARD;
33 class BOARD_COMMIT;
35 class PCB_TOOL_BASE;
36 class MODULE;
37 class D_PAD;
38 
39 namespace KIGFX
40 {
41  class VIEW;
42 }
43 
45 public:
48 
49  void SetRouter( PNS::ROUTER* aRouter ) override;
50  void SetHostTool( PCB_TOOL_BASE* aTool );
51  void SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions );
52 
53  void EraseView() override {};
54  void SetBoard( BOARD* aBoard );
55  void SyncWorld( PNS::NODE* aWorld ) override;
56  bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) override { return true; };
57  bool IsItemVisible( const PNS::ITEM* aItem ) override { return true; }
58  void HideItem( PNS::ITEM* aItem ) override {}
59  void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override {}
60  void AddItem( PNS::ITEM* aItem ) override;
61  void RemoveItem( PNS::ITEM* aItem ) override;
62  void Commit() override {}
63 
64  void UpdateNet( int aNetCode ) override {}
65 
67 
70 
71 protected:
74 
75  std::unique_ptr<PNS::SOLID> syncPad( D_PAD* aPad );
76  std::unique_ptr<PNS::SEGMENT> syncTrack( TRACK* aTrack );
77  std::unique_ptr<PNS::ARC> syncArc( ARC* aArc );
78  std::unique_ptr<PNS::VIA> syncVia( VIA* aVia );
79  bool syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB_LAYER_ID aLayer );
80  bool syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem );
81  bool syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone );
82 
85 };
86 
88 public:
91 
92  void SetHostTool( PCB_TOOL_BASE* aTool );
93  void SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions );
94 
95  void SetView( KIGFX::VIEW* aView );
96  void EraseView() override;
97  bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) override;
98  bool IsItemVisible( const PNS::ITEM* aItem ) override;
99  void HideItem( PNS::ITEM* aItem ) override;
100  void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override;
101  void Commit() override;
102  void AddItem( PNS::ITEM* aItem ) override;
103  void RemoveItem( PNS::ITEM* aItem ) override;
104 
105  void UpdateNet( int aNetCode ) override;
106 
107 private:
108  struct OFFSET {
110  };
111 
112  std::map<D_PAD*, OFFSET> m_moduleOffsets;
115  std::unordered_set<BOARD_CONNECTED_ITEM*> m_hiddenItems;
116 
118  std::unique_ptr<BOARD_COMMIT> m_commit;
120 };
121 
122 
123 #endif
void SetHostTool(PCB_TOOL_BASE *aTool)
std::unique_ptr< PNS::VIA > syncVia(VIA *aVia)
ITEM.
Definition: pns_item.h:53
bool syncTextItem(PNS::NODE *aWorld, EDA_TEXT *aText, PCB_LAYER_ID aLayer)
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
bool IsAnyLayerVisible(const LAYER_RANGE &aLayer) override
void SetView(KIGFX::VIEW *aView)
void SetRouter(PNS::ROUTER *aRouter) override
PNS::RULE_RESOLVER * GetRuleResolver() override
std::unique_ptr< PNS::SOLID > syncPad(D_PAD *aPad)
NODE.
Definition: pns_node.h:145
void DisplayItem(const PNS::ITEM *aItem, int aColor=0, int aClearance=0, bool aEdit=false) override
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS *aDispOptions)
bool syncGraphicalItem(PNS::NODE *aWorld, DRAWSEGMENT *aItem)
PNS::DEBUG_DECORATOR * m_debugDecorator
bool IsItemVisible(const PNS::ITEM *aItem) override
std::unordered_set< BOARD_CONNECTED_ITEM * > m_hiddenItems
void UpdateNet(int aNetCode) override
void SetDebugDecorator(PNS::DEBUG_DECORATOR *aDec)
bool IsAnyLayerVisible(const LAYER_RANGE &aLayer) override
RULE_RESOLVER.
Definition: pns_node.h:57
void HideItem(PNS::ITEM *aItem) override
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:112
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
PCB_LAYER_ID
A quick note on layer IDs:
void Commit() override
void UpdateNet(int aNetCode) override
void SetHostTool(PCB_TOOL_BASE *aTool)
std::unique_ptr< BOARD_COMMIT > m_commit
PNS::DEBUG_DECORATOR * GetDebugDecorator() override
KIGFX::VIEW_GROUP * m_previewItems
bool syncZone(PNS::NODE *aWorld, ZONE_CONTAINER *aZone)
void SyncWorld(PNS::NODE *aWorld) override
void AddItem(PNS::ITEM *aItem) override
const PCB_DISPLAY_OPTIONS * m_dispOptions
void Commit() override
PNS::ROUTER * m_router
void SetBoard(BOARD *aBoard)
void EraseView() override
bool IsItemVisible(const PNS::ITEM *aItem) override
std::unique_ptr< PNS::ARC > syncArc(ARC *aArc)
KIGFX::VIEW * m_view
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
void RemoveItem(PNS::ITEM *aItem) override
void AddItem(PNS::ITEM *aItem) override
PCB_TOOL_BASE * m_tool
void EraseView() override
std::map< D_PAD *, OFFSET > m_moduleOffsets
PNS_PCBNEW_RULE_RESOLVER * m_ruleResolver
VIEW.
Definition: view.h:61
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS *aDispOptions)
void DisplayItem(const PNS::ITEM *aItem, int aColor=0, int aClearance=0, bool aEdit=false) override
std::unique_ptr< PNS::SEGMENT > syncTrack(TRACK *aTrack)
LAYER_RANGE.
Definition: pns_layerset.h:32
void RemoveItem(PNS::ITEM *aItem) override
void HideItem(PNS::ITEM *aItem) override