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-2023 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;
45class ROUTER_IFACE;
46
47}
48
49#define PNS_HEAD_TRACE 1
50#define PNS_HOVER_ITEM 2
51#define PNS_SEMI_SOLID 4
52#define PNS_COLLISION 8
53
54
56{
57public:
59 {
63 };
64
76 static constexpr double LayerDepthFactor = 0.0001;
77 static constexpr double PathOverlayDepth = LayerDepthFactor * static_cast<double>( LAYER_ZONE_END );
78
79 ROUTER_PREVIEW_ITEM( const SHAPE& aShape, PNS::ROUTER_IFACE* aIface, KIGFX::VIEW* aView );
80 ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, PNS::ROUTER_IFACE* aIface, KIGFX::VIEW* aView,
81 int aFlags = 0 );
83
84 void Update( const PNS::ITEM* aItem );
85
86 void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor; }
87 void SetDepth( double aDepth ) { m_depth = aDepth; }
88 void SetWidth( int aWidth ) { m_width = aWidth; }
89
90 void SetClearance( int aClearance ) { m_clearance = aClearance; }
91 void ShowClearance( bool aEnabled ) { m_showClearance = aEnabled; }
92
93 double GetOriginDepth() const { return m_originDepth; }
94
95#if defined(DEBUG)
96 void Show( int aA, std::ostream& aB ) const override {}
97#endif
98
102 virtual wxString GetClass() const override
103 {
104 return wxT( "ROUTER_PREVIEW_ITEM" );
105 }
106
107 const BOX2I ViewBBox() const override;
108
109 virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
110
111 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
112 {
113 aLayers[0] = m_layer;
114 aCount = 1;
115 }
116
117 void drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX::GAL* aGal ) const;
118
119 void drawShape( const SHAPE* aShape, KIGFX::GAL* aGal ) const;
120
121private:
122 const KIGFX::COLOR4D getLayerColor( int aLayer ) const;
123
124private:
126
128
131
133
140
142 double m_depth;
143
146};
147
148#endif
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
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(int aWidth)
void SetClearance(int aClearance)
static constexpr double PathOverlayDepth
void SetColor(const KIGFX::COLOR4D &aColor)
virtual wxString GetClass() const override
Get class name.
static constexpr double LayerDepthFactor
We draw this item on a single layer, but we stack up all the layers from the various components that ...
void Update(const PNS::ITEM *aItem)
double GetOriginDepth() const
const KIGFX::COLOR4D getLayerColor(int aLayer) const
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
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)
PNS::ROUTER_IFACE * m_iface
An abstract shape on 2D plane.
Definition: shape.h:126
@ LAYER_ZONE_END
Definition: layer_ids.h:258
Push and Shove diff pair dimensions (gap) settings dialog.