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;
45
46}
47
48#define PNS_HEAD_TRACE 1
49#define PNS_HOVER_ITEM 2
50#define PNS_SEMI_SOLID 4
51#define PNS_COLLISION 8
52
53
55{
56public:
58 {
62 };
63
75 static constexpr double LayerDepthFactor = 0.0001;
77
78 ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr );
79 ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr,
80 int aFlags = 0 );
82
83 void Update( const PNS::ITEM* aItem );
84
85 void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor; }
86 void SetDepth( double aDepth ) { m_depth = aDepth; }
87 void SetWidth( int aWidth ) { m_width = aWidth; }
88
89 void SetClearance( int aClearance ) { m_clearance = aClearance; }
90 void ShowClearance( bool aEnabled ) { m_showClearance = aEnabled; }
91
92 double GetOriginDepth() const { return m_originDepth; }
93
94#if defined(DEBUG)
95 void Show( int aA, std::ostream& aB ) const override {}
96#endif
97
101 virtual wxString GetClass() const override
102 {
103 return wxT( "ROUTER_PREVIEW_ITEM" );
104 }
105
106 const BOX2I ViewBBox() const override;
107
108 virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
109
110 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
111 {
112 aLayers[0] = m_layer;
113 aCount = 1;
114 }
115
116 void drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX::GAL* aGal ) const;
117
118 void drawShape( const SHAPE* aShape, KIGFX::GAL* aGal ) const;
119
120private:
121 const KIGFX::COLOR4D getLayerColor( int aLayer ) const;
122
123private:
125
128
130
137
139 double m_depth;
140
143};
144
145#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(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)
An abstract shape on 2D plane.
Definition: shape.h:126
@ LAYER_ZONE_END
Definition: layer_ids.h:257
Push and Shove diff pair dimensions (gap) settings dialog.