KiCad PCB EDA Suite
Go to the documentation of this file.
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2004-2022 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
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 *
20 * or you may search the 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 */
25#ifndef LIB_SHAPE_H
26#define LIB_SHAPE_H
28#include <lib_item.h>
29#include <eda_shape.h>
32class LIB_SHAPE : public LIB_ITEM, public EDA_SHAPE
35 LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth = 0,
36 FILL_T aFillType = FILL_T::NO_FILL, KICAD_T aType = LIB_SHAPE_T );
38 // Do not create a copy constructor. The one generated by the compiler is adequate.
42 wxString GetClass() const override
43 {
44 return wxT( "LIB_SHAPE" );
45 }
47 wxString GetTypeName() const override
48 {
49 return ShowShape();
50 }
52 STROKE_PARAMS GetStroke() const { return m_stroke; }
53 void SetStroke( const STROKE_PARAMS& aStroke ) { m_stroke = aStroke; }
55 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
56 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
58 int GetPenWidth() const override;
61 {
64 else
65 return m_stroke.GetPlotStyle();
66 }
68 const BOX2I GetBoundingBox() const override;
70 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
72 void BeginEdit( const VECTOR2I& aStartPoint ) override { beginEdit( aStartPoint ); }
73 bool ContinueEdit( const VECTOR2I& aPosition ) override { return continueEdit( aPosition ); }
74 void CalcEdit( const VECTOR2I& aPosition ) override { calcEdit( aPosition ); }
76 void EndEdit() override { endEdit( false ); }
77 void SetEditState( int aState ) { setEditState( aState ); }
79 void AddPoint( const VECTOR2I& aPosition );
81 void Offset( const VECTOR2I& aOffset ) override;
83 void MoveTo( const VECTOR2I& aPosition ) override;
85 VECTOR2I GetPosition() const override { return getPosition(); }
86 void SetPosition( const VECTOR2I& aPosition ) override { setPosition( aPosition ); }
88 VECTOR2I GetCenter() const { return getCenter(); }
96 virtual std::vector<SHAPE*> MakeEffectiveShapes( bool aEdgeOnly = false ) const override
97 {
98 return makeEffectiveShapes( aEdgeOnly, true );
99 }
101 void Normalize();
103 void MirrorHorizontal( const VECTOR2I& aCenter ) override;
104 void MirrorVertical( const VECTOR2I& aCenter ) override;
105 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
107 void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
108 const TRANSFORM& aTransform, bool aDimmed ) const override;
110 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
112 BITMAPS GetMenuImage() const override;
114 EDA_ITEM* Clone() const override;
116 void ViewGetLayers( int aLayers[], int& aCount ) const override;
127 int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
129 void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
130 const TRANSFORM& aTransform, bool aDimmed ) override;
132 EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
133 VECTOR2I getParentPosition() const override { return VECTOR2I(); }
137#endif // LIB_SHAPE_H
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
VECTOR2I getCenter() const
Definition: eda_shape.cpp:397
void calcEdit(const VECTOR2I &aPosition)
Definition: eda_shape.cpp:1268
bool continueEdit(const VECTOR2I &aPosition)
Definition: eda_shape.cpp:1241
wxString ShowShape() const
Definition: eda_shape.cpp:57
std::vector< SHAPE * > makeEffectiveShapes(bool aEdgeOnly, bool aLineChainOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.cpp:1079
void beginEdit(const VECTOR2I &aStartPoint)
Definition: eda_shape.cpp:1210
void endEdit(bool aClosed=true)
Finishes editing the shape.
Definition: eda_shape.cpp:1396
void setPosition(const VECTOR2I &aPos)
Definition: eda_shape.cpp:93
VECTOR2I getPosition() const
Definition: eda_shape.cpp:99
Definition: eda_shape.h:364
void setEditState(int aState)
Definition: eda_shape.h:348
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
Definition: lib_shape.h:40
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: lib_shape.cpp:46
STROKE_PARAMS GetStroke() const
Definition: lib_shape.h:52
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
Definition: lib_shape.cpp:272
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_shape.h:72
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_shape.cpp:444
EDA_ANGLE getParentOrientation() const override
Definition: lib_shape.h:132
void MirrorHorizontal(const VECTOR2I &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_shape.cpp:114
void SetStroke(const STROKE_PARAMS &aStroke)
Definition: lib_shape.h:53
void AddPoint(const VECTOR2I &aPosition)
Definition: lib_shape.cpp:501
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: lib_shape.cpp:452
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_shape.cpp:120
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_shape.cpp:81
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
Definition: lib_shape.cpp:134
void EndEdit() override
End an object editing action.
Definition: lib_shape.h:76
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_shape.cpp:64
int GetPenWidth() const override
Definition: lib_shape.cpp:266
const BOX2I GetBoundingBox() const override
Definition: lib_shape.cpp:434
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: lib_shape.h:60
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_shape.cpp:126
wxString GetClass() const override
Return the class name.
Definition: lib_shape.h:42
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_shape.cpp:70
VECTOR2I getParentPosition() const override
Definition: lib_shape.h:133
LIB_SHAPE(LIB_SYMBOL *aParent, SHAPE_T aShape, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, KICAD_T aType=LIB_SHAPE_T)
Definition: lib_shape.cpp:37
void SetEditState(int aState)
Definition: lib_shape.h:77
void SetPosition(const VECTOR2I &aPosition) override
Definition: lib_shape.h:86
bool ContinueEdit(const VECTOR2I &aPosition) override
Continue an edit in progress at aPosition.
Definition: lib_shape.h:73
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_shape.h:74
VECTOR2I GetCenter() const
Definition: lib_shape.h:88
wxString GetTypeName() const override
Provide a user-consumable name of the object type.
Definition: lib_shape.h:47
void MoveTo(const VECTOR2I &aPosition) override
Move a draw object to aPosition.
Definition: lib_shape.cpp:87
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_shape.cpp:484
void Normalize()
Definition: lib_shape.cpp:93
VECTOR2I GetPosition() const override
Definition: lib_shape.h:85
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
Definition: lib_shape.h:96
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_shape.cpp:519
Define a library symbol object.
Definition: lib_symbol.h:98
Base plotter engine class.
Definition: plotter.h:110
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
PLOT_DASH_TYPE GetPlotStyle() const
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412
Definition: eda_shape.h:41
Definition: eda_shape.h:54
Dashed line types.
Definition: stroke_params.h:48
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
Definition: typeinfo.h:199
Definition: vector2d.h:618