KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_point.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#pragma once
26
27#include <board_item.h>
28
29
42class PCB_POINT : public BOARD_ITEM
43{
44public:
45
46 PCB_POINT( BOARD_ITEM* aParent );
47
51 PCB_POINT( BOARD_ITEM* aParent, const VECTOR2I& aPos, const int aSize);
52
53 static inline bool ClassOf( const EDA_ITEM* aItem )
54 {
55 return aItem && PCB_POINT_T == aItem->Type();
56 }
57
58 void SetPosition( const VECTOR2I& aPos ) override { m_pos = aPos; }
59 VECTOR2I GetPosition() const override { return m_pos; }
60
61 void SetSize( const int aSize ) { m_size = aSize; }
62 int GetSize() const { return m_size; }
63
64 void Move( const VECTOR2I& aMoveVector ) override
65 {
66 m_pos += aMoveVector;
67 }
68
69 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
70 std::vector<int> ViewGetLayers() const override;
71
72 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
73
74 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
75
76 wxString GetClass() const override
77 {
78 return wxT( "PCB_POINT" );
79 }
80
81 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
82 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
83
84 // Virtual function
85 const BOX2I GetBoundingBox() const override;
86
87 std::shared_ptr<SHAPE>
88 GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash = FLASHING::DEFAULT ) const override;
89
90 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
91
92 BITMAPS GetMenuImage() const override;
93
94 EDA_ITEM* Clone() const override;
95
96 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
97
110 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
111 int aError, ERROR_LOC aErrorLoc,
112 bool ignoreLineWidth = false ) const override;
113
114 double Similarity( const BOARD_ITEM& aBoardItem ) const override;
115
116 bool operator==( const PCB_POINT& aOther ) const;
117 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
118
119#if defined( DEBUG )
120 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
121#endif
122
123protected:
124 virtual void swapData( BOARD_ITEM* aImage ) override;
125
126private:
127 // Center of the point
129 // Visual size of the point in board space
131};
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:81
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Definition pcb_point.h:43
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
PCB_POINT(BOARD_ITEM *aParent)
Definition pcb_point.cpp:44
wxString GetClass() const override
Return the class name.
Definition pcb_point.h:76
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
VECTOR2I m_pos
Definition pcb_point.h:128
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_point.h:53
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition pcb_point.cpp:82
bool operator==(const PCB_POINT &aOther) const
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
int GetSize() const
Definition pcb_point.h:62
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition pcb_point.cpp:97
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_point.h:58
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition pcb_point.cpp:60
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
virtual void swapData(BOARD_ITEM *aImage) override
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void SetSize(const int aSize)
Definition pcb_point.h:61
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_point.h:64
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
VECTOR2I GetPosition() const override
Definition pcb_point.h:59
Represent a set of closed polygons.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:184
@ DEFAULT
Flashing follows connectivity.
Definition layer_ids.h:185
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
FLIP_DIRECTION
Definition mirror.h:27
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:112
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695