KiCad PCB EDA Suite
fp_shape.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#ifndef FP_SHAPE_H
27#define FP_SHAPE_H
28
29
30#include <pcb_shape.h>
31
32
33class LINE_READER;
34class MSG_PANEL_ITEM;
35
36
37class FP_SHAPE : public PCB_SHAPE
38{
39public:
40 FP_SHAPE( FOOTPRINT* aParent, SHAPE_T aShape = SHAPE_T::SEGMENT,
41 KICAD_T aItemType = PCB_FP_SHAPE_T );
42
43 // Do not create a copy constructor & operator=.
44 // The ones generated by the compiler are adequate.
45
46 ~FP_SHAPE();
47
48 static inline bool ClassOf( const EDA_ITEM* aItem )
49 {
50 return aItem && PCB_FP_SHAPE_T == aItem->Type();
51 }
52
53 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
54 {
55 if( PCB_SHAPE::IsType( aScanTypes ) )
56 return true;
57
58 // No special processing above and beyond PCB_SHAPE at present....
59
60 return false;
61 }
62
67 void SetArcAngleAndEnd0( const EDA_ANGLE& aAngle, bool aCheckNegativeAngle = false );
68
69 void SetArcGeometry0( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
70
71 void Move( const VECTOR2I& aMoveVector ) override;
72
76 void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
77
78 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
79
87 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
88
89 bool IsParentFlipped() const;
90
91 void SetStart0( const VECTOR2I& aPoint ) { m_start0 = aPoint; }
92 const VECTOR2I& GetStart0() const { return m_start0; }
93
94 void SetEnd0( const VECTOR2I& aPoint ) { m_end0 = aPoint; }
95 const VECTOR2I& GetEnd0() const { return m_end0; }
96
97 void SetBezierC1_0( const VECTOR2I& aPoint ) { m_bezierC1_0 = aPoint; }
98 const VECTOR2I& GetBezierC1_0() const { return m_bezierC1_0; }
99
100 void SetBezierC2_0( const VECTOR2I& aPoint ) { m_bezierC2_0 = aPoint; }
101 const VECTOR2I& GetBezierC2_0() const { return m_bezierC2_0; }
102
103 VECTOR2I GetCenter0() const;
104 void SetCenter0( const VECTOR2I& aPt );
105
106 VECTOR2I GetArcMid0() const;
107
113 virtual void SetLocalCoord();
114
119 virtual void SetDrawCoord();
120
121 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
122
123 wxString GetClass() const override
124 {
125 return wxT( "MGRAPHIC" );
126 }
127
128 wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
129
130 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
131
132 BITMAPS GetMenuImage() const override;
133
134 EDA_ITEM* Clone() const override;
135
136 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
137
138#if defined(DEBUG)
139 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
140#endif
141
142protected:
148
150};
151
152#endif // FP_SHAPE_H
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
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:85
const KIID m_Uuid
Definition: eda_item.h:492
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:496
bool IsParentFlipped() const
Definition: fp_shape.cpp:285
VECTOR2I GetArcMid0() const
Definition: fp_shape.cpp:179
const VECTOR2I & GetBezierC1_0() const
Definition: fp_shape.h:98
const VECTOR2I & GetEnd0() const
Definition: fp_shape.h:95
void SetEnd0(const VECTOR2I &aPoint)
Definition: fp_shape.h:94
VECTOR2I m_start0
Start point or circle center, relative to footprint origin, orient 0.
Definition: fp_shape.h:143
static bool ClassOf(const EDA_ITEM *aItem)
Definition: fp_shape.h:48
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: fp_shape.cpp:132
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: fp_shape.cpp:138
void SetStart0(const VECTOR2I &aPoint)
Definition: fp_shape.h:91
void SetBezierC2_0(const VECTOR2I &aPoint)
Definition: fp_shape.h:100
const VECTOR2I & GetBezierC2_0() const
Definition: fp_shape.h:101
wxString GetClass() const override
Return the class name.
Definition: fp_shape.h:123
virtual void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:80
VECTOR2I GetCenter0() const
Definition: fp_shape.cpp:144
VECTOR2I m_arcCenter0
Center of arc, relative to footprint origin, orient 0.
Definition: fp_shape.h:145
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip entity relative to aCentre.
Definition: fp_shape.cpp:219
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: fp_shape.h:53
VECTOR2I m_end0
End point or circle edge, relative to footprint origin, orient 0.
Definition: fp_shape.h:144
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Mirror horizontally or vertically.
Definition: fp_shape.cpp:292
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.
Definition: fp_shape.cpp:109
virtual void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:52
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: fp_shape.cpp:124
wxString GetParentAsString() const
Definition: fp_shape.h:128
void SetArcAngleAndEnd0(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: fp_shape.cpp:193
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: fp_shape.cpp:343
ARC_MID m_arcMidData_0
Originating Arc data, orient 0.
Definition: fp_shape.h:149
void SetCenter0(const VECTOR2I &aPt)
Definition: fp_shape.cpp:161
const VECTOR2I & GetStart0() const
Definition: fp_shape.h:92
VECTOR2I m_bezierC2_0
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:147
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: fp_shape.cpp:389
void SetBezierC1_0(const VECTOR2I &aPoint)
Definition: fp_shape.h:97
void SetArcGeometry0(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Definition: fp_shape.cpp:205
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: fp_shape.cpp:355
VECTOR2I m_bezierC1_0
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:146
~FP_SHAPE()
Definition: fp_shape.cpp:47
FP_SHAPE(FOOTPRINT *aParent, SHAPE_T aShape=SHAPE_T::SEGMENT, KICAD_T aItemType=PCB_FP_SHAPE_T)
Definition: fp_shape.cpp:40
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
wxString AsString() const
Definition: kiid.cpp:249
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_shape.cpp:57
SHAPE_T
Definition: eda_shape.h:41
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94