KiCad PCB EDA Suite
Loading...
Searching...
No Matches
router_preview_item.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2014 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 __ROUTER_PREVIEW_ITEM_H
23#define __ROUTER_PREVIEW_ITEM_H
24
25#include <cstdio>
26
27#include <view/view.h>
28#include <view/view_item.h>
29#include <view/view_group.h>
30
31#include <math/vector2d.h>
32#include <math/box2.h>
33
36
37#include <gal/color4d.h>
38
39#include <eda_item.h>
40
41namespace PNS {
42
43class ITEM;
44class ROUTER;
45
46}
47
49{
50public:
52 {
56 };
57
58 // fixme: shouldn't this go to VIEW?
59 static const int ClearanceOverlayDepth;
60 static const int BaseOverlayDepth;
61 static const int ViaOverlayDepth;
62 static const int PathOverlayDepth;
63
64 ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr);
65 ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr);
67
68 void Update( const PNS::ITEM* aItem );
69
70 void SetColor( const KIGFX::COLOR4D& aColor )
71 {
72 m_color = aColor;
73 }
74
75 void SetDepth( double aDepth )
76 {
77 m_depth = aDepth;
78 }
79
80 void SetWidth( double aWidth )
81 {
82 m_width = aWidth;
83 }
84
85 void SetClearance( int aClearance )
86 {
87 m_clearance = aClearance;
88 }
89
90 void ShowClearance( bool aEnabled )
91 {
92 m_showClearance = aEnabled;
93 }
94
95 void SetIsHeadTrace( bool aIsHead )
96 {
97 m_isHeadTrace = aIsHead;
98 }
99
100#if defined(DEBUG)
101 void Show( int aA, std::ostream& aB ) const override {}
102#endif
103
107 virtual wxString GetClass() const override
108 {
109 return wxT( "ROUTER_PREVIEW_ITEM" );
110 }
111
112 const BOX2I ViewBBox() const override;
113
114 virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
115
116 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
117 {
118 aLayers[0] = m_layer;
119 aCount = 1;
120 }
121
122 void drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX::GAL* aGal ) const;
123
124 void drawShape( const SHAPE* aShape, KIGFX::GAL* aGal ) const;
125
126private:
127 const KIGFX::COLOR4D assignColor( int aStyle ) const;
128 const KIGFX::COLOR4D getLayerColor( int aLayer ) const;
129
130private:
132
135
137
144
145 double m_depth;
146
149};
150
151#endif
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Abstract interface for drawing on a 2D-surface.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
Base class for PNS router board items.
Definition: pns_item.h:97
void SetWidth(double aWidth)
const KIGFX::COLOR4D assignColor(int aStyle) const
void SetClearance(int aClearance)
void SetColor(const KIGFX::COLOR4D &aColor)
virtual wxString GetClass() const override
Get class name.
void SetIsHeadTrace(bool aIsHead)
void Update(const PNS::ITEM *aItem)
const KIGFX::COLOR4D getLayerColor(int aLayer) const
static const int PathOverlayDepth
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
static const int ClearanceOverlayDepth
static const int ViaOverlayDepth
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
static const int BaseOverlayDepth
void drawLineChain(const SHAPE_LINE_CHAIN_BASE *aL, KIGFX::GAL *aGal) const
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetDepth(double aDepth)
void drawShape(const SHAPE *aShape, KIGFX::GAL *aGal) const
void ShowClearance(bool aEnabled)
An abstract shape on 2D plane.
Definition: shape.h:126
Push and Shove diff pair dimensions (gap) settings dialog.