154 RotatePoint( pt, parentFootprint->GetPosition(), parentFootprint->GetOrientation() );
167 rotation += parentFootprint->GetOrientation();
182 if( parentFootprint->IsFlipped() )
183 std::swap( corners[1], corners[3] );
190 if( corners[1].y > corners[0].y )
191 std::swap( corners[1], corners[3] );
195 if( corners[1].x > corners[0].x )
196 std::swap( corners[1], corners[3] );
200 if( corners[1].y < corners[0].y )
201 std::swap( corners[1], corners[3] );
205 if( corners[1].x < corners[0].x )
206 std::swap( corners[1], corners[3] );
220 bool isFlipped =
false;
223 isFlipped = parentFootprint->IsFlipped();
227 std::swap( corners[0], corners[1] );
228 std::swap( corners[2], corners[3] );
238 switch( effectiveAlignment )
241 textAnchor = corners[0];
242 vMargin = ( corners[2] - corners[1] ).Resize(
GetTextMargin() );
243 hMargin = ( corners[1] - corners[0] ).Resize(
GetTextMargin() );
246 textAnchor = ( corners[0] + corners[1] ) / 2;
247 vMargin = ( corners[2] - corners[1] ).Resize(
GetTextMargin() );
250 textAnchor = corners[1];
251 vMargin = ( corners[2] - corners[1] ).Resize(
GetTextMargin() );
252 hMargin = ( corners[0] - corners[1] ).Resize(
GetTextMargin() );
256 return textAnchor + hMargin + vMargin;
340 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
343 aList.emplace_back(
_(
"Mirror" ),
IsMirrored() ?
_(
"Yes" ) :
_(
"No" ) );
346 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
352 aList.emplace_back(
_(
"Box Width" ), msg );
355 aList.emplace_back(
_(
"Box Height" ), msg );
393 constexpr double HIDE = (double)std::numeric_limits<double>::max();
428 std::function<bool( wxString* )> footprintResolver =
429 [&]( wxString* token ) ->
bool
431 return parentFootprint && parentFootprint->
ResolveTextVar( token, aDepth );
465 int aClearance,
int aError,
ERROR_LOC aErrorLoc )
const
490 for(
const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
491 buffer.
Append( point.x, point.y );
505 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
506 bool aIgnoreLineWidth )
const
511 int width =
GetWidth() + ( 2 * aClearance );
546 std::vector<VECTOR2I> poly;
558 aBuffer.
Append( point.x, point.y );
562 VECTOR2I pt1( poly[poly.size() - 1] );
586 return fp->GetReference();
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
bool Intersects(const BOX2< Vec > &aRect) const
coord_type GetTop() const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
coord_type GetRight() const
coord_type GetLeft() const
coord_type GetBottom() const
EDA_ANGLE Normalized() const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM * m_parent
Linked list: Link (parent struct)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void DupPolyPointsList(std::vector< VECTOR2I > &aBuffer) const
Duplicate the list of corners in a std::vector<VECTOR2I>
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
std::vector< VECTOR2I > GetRectCorners() const
wxString SHAPE_T_asString() const
bool IsPolyShapeValid() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
int GetTextHeight() const
const VECTOR2I & GetTextPos() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
void SetMirrored(bool isMirrored)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
void Offset(const VECTOR2I &aOffset)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
virtual KIFONT::FONT * getDrawFont() const
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, bool aUseTextRotation=true) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
int GetTextThickness() const
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
void SetMultilineAllowed(bool aAllow)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
bool IsParentFlipped() const
VECTOR2I m_start0
Start point or circle center, relative to footprint origin, orient 0.
virtual void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip entity relative to aCentre.
VECTOR2I m_end0
End point or circle edge, relative to footprint origin, orient 0.
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Mirror horizontally or vertically.
virtual void SetLocalCoord()
Set relative coordinates from draw coordinates.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy) const override
Test if aPosition is inside or on the boundary of this item.
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
FP_TEXTBOX(FOOTPRINT *aParentFootprint)
void SetBottom(int aVal) override
void SetTop(int aVal) override
wxString GetParentAsString() const
int GetTextMargin() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
VECTOR2I GetDrawPos() const override
void SetTextAngle(const EDA_ANGLE &aAngle) override
void SetRight(int aVal) override
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
virtual EDA_ANGLE GetDrawRotation() const 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 Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Mirror the textbox's position, but not the text (or its justification).
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip entity relative to aCentre.
void SetLeft(int aVal) override
std::vector< VECTOR2I > GetNormalizedCorners() const
std::vector< VECTOR2I > GetCorners() const override
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
void Rotate(const VECTOR2I &aOffset, const EDA_ANGLE &aAngle) override
Rotate this object.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
VECTOR2I GetTopLeft() const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
VECTOR2I GetBotRight() const override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
FONT is an abstract base class for both outline and stroke fonts.
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
void LinebreakText(wxString &aText, int aColumnWidth, const VECTOR2I &aGlyphSize, int aThickness, bool aBold, bool aItalic) const
Insert characters into text to ensure that no lines are wider than aColumnWidth.
A color representation with 4 components: red, green, blue, alpha.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
wxString AsString() const
static LSET SideSpecificMask()
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
EDA_ANGLE getParentOrientation() const override
FOOTPRINT * GetParentFootprint() const
Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Make a set of SHAPE objects representing the PCB_SHAPE.
virtual std::vector< VECTOR2I > GetCorners() const
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
VECTOR2I getParentPosition() const override
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a set of closed polygons.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
void Simplify(POLYGON_MODE aFastMode)
int NewOutline()
Creates a new hole in a given outline.
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
static constexpr EDA_ANGLE & ANGLE_180
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_270
#define PCB_EDIT_FRAME_NAME
static struct FP_TEXTBOX_DESC _FP_TEXTBOX_DESC
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_MOD_FR
show footprints on front
@ LAYER_MOD_BK
show footprints on back
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
#define NO_SETTER(owner, type)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString UnescapeString(const wxString &aSource)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double EuclideanNorm(const VECTOR2I &vector)
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".