KiCad PCB EDA Suite
FP_TEXT Class Reference

#include <fp_text.h>

Inheritance diagram for FP_TEXT:
BOARD_ITEM EDA_TEXT EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Types

enum  TEXT_TYPE { TEXT_is_REFERENCE = 0, TEXT_is_VALUE = 1, TEXT_is_DIVERS = 2 }
 Footprint text type: there must be only one (and only one) for each of the reference value texts in one footprint; others could be added for the user (DIVERS is French for 'others'). More...
 

Public Member Functions

 FP_TEXT (FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
 
 ~FP_TEXT ()
 
bool IsType (const KICAD_T aScanTypes[]) const override
 Check whether the item is one of the listed types. More...
 
wxString GetParentAsString () const
 
bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
virtual wxPoint GetPosition () const override
 
virtual void SetPosition (const wxPoint &aPos) override
 
void SetTextAngle (double aAngle) override
 
void KeepUpright (double aOldOrientation, double aNewOrientation)
 Called when rotating the parent footprint. More...
 
bool IsKeepUpright () const
 
void SetKeepUpright (bool aKeepUpright)
 
void Rotate (const wxPoint &aOffset, double aAngle) override
 Rotate text, in footprint editor (for instance in footprint rotation transform) More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Flip entity during footprint flip. More...
 
bool IsParentFlipped () const
 
void Mirror (const wxPoint &aCentre, bool aMirrorAroundXAxis)
 Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified, only position is mirrored. More...
 
void Move (const wxPoint &aMoveVector) override
 move text in move transform, in footprint editor More...
 
void SetType (TEXT_TYPE aType)
 
TEXT_TYPE GetType () const
 
void SetEffects (const FP_TEXT &aSrc)
 Set the text effects from another instance. More...
 
void SwapEffects (FP_TEXT &aTradingPartner)
 Swap the text effects of the two involved instances. More...
 
void SetPos0 (const wxPoint &aPos)
 
const wxPoint & GetPos0 () const
 
int GetLength () const
 
virtual double GetDrawRotation () const override
 
double GetDrawRotationRadians () const
 
const EDA_RECT GetBoundingBox () const override
 Set absolute coordinates. More...
 
void SetDrawCoord ()
 Set relative coordinates. More...
 
void SetLocalCoord ()
 
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. More...
 
bool TextHitTest (const wxPoint &aPoint, int aAccuracy=0) const override
 Test if aPoint is within the bounds of this object. More...
 
bool TextHitTest (const EDA_RECT &aRect, bool aContains, int aAccuracy=0) const override
 Test if object bounding box is contained within or intersects aRect. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy) const override
 Test if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth) const override
 Convert the item shape to a closed polygon. More...
 
void TransformTextShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc) const
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetShownText (int aDepth=0) const override
 Return the string actually shown after processing of the base text. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual PCB_LAYER_ID GetLayer () const
 Return the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Return a std::bitset of all layers on which the item physically resides. More...
 
virtual void SetLayerSet (LSET aLayers)
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
virtual void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Test to see if this object is on the given layer. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 
virtual const wxString & GetText () const
 Return the string associated with the text object. More...
 
wxString ShortenedShownText () const
 Returns a shortened version (max 15 characters) of the shown text. More...
 
bool HasTextVars () const
 Indicates the ShownText has text var references which need to be processed. More...
 
virtual void SetText (const wxString &aText)
 
void SetTextThickness (int aWidth)
 The TextThickness is that set by the user. More...
 
int GetTextThickness () const
 
int GetEffectiveTextPenWidth (int aDefaultWidth=0) const
 The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth. More...
 
double GetTextAngle () const
 
double GetTextAngleDegrees () const
 
double GetTextAngleRadians () const
 
void SetItalic (bool isItalic)
 
bool IsItalic () const
 
void SetBold (bool aBold)
 
bool IsBold () const
 
virtual void SetVisible (bool aVisible)
 
virtual bool IsVisible () const
 
void SetMirrored (bool isMirrored)
 
bool IsMirrored () const
 
void SetMultilineAllowed (bool aAllow)
 
bool IsMultilineAllowed () const
 
EDA_TEXT_HJUSTIFY_T GetHorizJustify () const
 
EDA_TEXT_VJUSTIFY_T GetVertJustify () const
 
void SetHorizJustify (EDA_TEXT_HJUSTIFY_T aType)
 
void SetVertJustify (EDA_TEXT_VJUSTIFY_T aType)
 
void SetEffects (const EDA_TEXT &aSrc)
 Set the text effects from another instance. More...
 
void SwapEffects (EDA_TEXT &aTradingPartner)
 Swap the text effects of the two involved instances. More...
 
void SwapText (EDA_TEXT &aTradingPartner)
 
void CopyText (const EDA_TEXT &aSrc)
 
bool Replace (const wxFindReplaceData &aSearchData)
 Helper function used in search and replace dialog. More...
 
bool IsDefaultFormatting () const
 
void SetTextSize (const wxSize &aNewSize)
 
const wxSize & GetTextSize () const
 
void SetTextWidth (int aWidth)
 
int GetTextWidth () const
 
void SetTextHeight (int aHeight)
 
int GetTextHeight () const
 
void SetTextPos (const wxPoint &aPoint)
 
const wxPoint & GetTextPos () const
 
void SetTextX (int aX)
 
void SetTextY (int aY)
 
void Offset (const wxPoint &aOffset)
 
void Empty ()
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
 Print this text object to the device context aDC. More...
 
std::vector< wxPoint > TransformToSegmentList () const
 Convert the text shape to a list of segment. More...
 
void TransformBoundingBoxWithClearanceToPolygon (SHAPE_POLY_SET *aCornerBuffer, int aClearanceValue) const
 Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical. More...
 
std::shared_ptr< SHAPE_COMPOUNDGetEffectiveTextShape () const
 
int LenSize (const wxString &aLine, int aThickness) const
 
EDA_RECT GetTextBox (int aLine=-1, bool aInvertY=false) const
 Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....) More...
 
int GetInterline () const
 Return the distance between two lines of text. More...
 
wxString GetTextStyleName () const
 
void GetLinePositions (std::vector< wxPoint > &aPositions, int aLineCount) const
 Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text. More...
 
virtual void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Output the object to aFormatter in s-expression form. More...
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static wxString ShowShape (SHAPE_T aShape)
 Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 
static EDA_TEXT_HJUSTIFY_T MapHorizJustify (int aHorizJustify)
 
static EDA_TEXT_VJUSTIFY_T MapVertJustify (int aVertJustify)
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Attributes

TEXT_TYPE m_Type
 0=ref, 1=val, etc. More...
 
wxPoint m_Pos0
 text coordinates relative to the footprint anchor, orient 0. More...
 
bool m_keepUpright
 if true, keep rotation angle between -90 . More...
 

Detailed Description

Definition at line 39 of file fp_text.h.

Member Enumeration Documentation

◆ TEXT_TYPE

Footprint text type: there must be only one (and only one) for each of the reference value texts in one footprint; others could be added for the user (DIVERS is French for 'others').

Reference and value always live on silkscreen (on the footprint side); other texts are planned to go on whatever layer the user wants.

Enumerator
TEXT_is_REFERENCE 
TEXT_is_VALUE 
TEXT_is_DIVERS 

Definition at line 48 of file fp_text.h.

Constructor & Destructor Documentation

◆ FP_TEXT()

FP_TEXT::FP_TEXT ( FOOTPRINT aParentFootprint,
TEXT_TYPE  text_type = TEXT_is_DIVERS 
)

Definition at line 39 of file fp_text.cpp.

39  :
40  BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
41  EDA_TEXT()
42 {
43  FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
44 
45  m_Type = text_type;
46  m_keepUpright = true;
47 
48  // Set text thickness to a default value
50  SetLayer( F_SilkS );
51 
52  // Set position and give a default layer if a valid parent footprint exists
53  if( parentFootprint && parentFootprint->Type() == PCB_FOOTPRINT_T )
54  {
55  SetTextPos( parentFootprint->GetPosition() );
56 
57  if( IsBackLayer( parentFootprint->GetLayer() ) )
58  {
59  SetLayer( B_SilkS );
60  SetMirrored( true );
61  }
62  }
63 
64  SetDrawCoord();
65 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:188
EDA_TEXT(const wxString &text=wxEmptyString)
Definition: eda_text.cpp:91
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:190
#define DEFAULT_TEXT_WIDTH
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:886
bool m_keepUpright
if true, keep rotation angle between -90 .
Definition: fp_text.h:245
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:240
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
Definition: board_item.h:83
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
wxPoint GetPosition() const override
Definition: footprint.h:186
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:159
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References B_SilkS, DEFAULT_TEXT_WIDTH, F_SilkS, BOARD_ITEM::GetLayer(), FOOTPRINT::GetPosition(), IsBackLayer(), m_keepUpright, EDA_ITEM::m_parent, m_Type, Millimeter2iu(), PCB_FOOTPRINT_T, SetDrawCoord(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetMirrored(), EDA_TEXT::SetTextPos(), EDA_TEXT::SetTextThickness(), and EDA_ITEM::Type().

Referenced by Clone().

◆ ~FP_TEXT()

FP_TEXT::~FP_TEXT ( )

Definition at line 68 of file fp_text.cpp.

69 {
70 }

Member Function Documentation

◆ ClassOf()

static bool FP_TEXT::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 62 of file fp_text.h.

63  {
64  return aItem && aItem->Type() == PCB_FP_TEXT_T;
65  }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_FP_TEXT_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * FP_TEXT::Clone ( ) const
overridevirtual

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 334 of file fp_text.cpp.

335 {
336  return new FP_TEXT( *this );
337 }
FP_TEXT(FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
Definition: fp_text.cpp:39

References FP_TEXT().

Referenced by ROUTER_TOOL::InlineDrag().

◆ CopyText()

void EDA_TEXT::CopyText ( const EDA_TEXT aSrc)
inherited

Definition at line 121 of file eda_text.cpp.

122 {
123  m_text = aSrc.m_text;
124  m_shown_text = aSrc.m_shown_text;
126 }
wxString m_shown_text
Definition: eda_text.h:386
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:387
wxString m_text
Definition: eda_text.h:385

References EDA_TEXT::m_shown_text, EDA_TEXT::m_shown_text_has_text_var_refs, and EDA_TEXT::m_text.

Referenced by LIB_FIELD::Copy(), and CLIPBOARD_IO::SaveSelection().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 140 of file board_item.cpp.

141 {
142  BOARD_ITEM_CONTAINER* parent = GetParent();
143 
144  if( parent )
145  parent->Remove( this );
146 
147  delete this;
148 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

Referenced by BOARD::PadDelete(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 200 of file board_item.h.

201  {
202  EDA_ITEM* dupe = Clone();
203  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
204 
205  return static_cast<BOARD_ITEM*>( dupe );
206  }
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:475
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References EDA_ITEM::Clone(), and EDA_ITEM::m_Uuid.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ Empty()

void EDA_TEXT::Empty ( )
inlineinherited

Definition at line 254 of file eda_text.h.

254 { m_text.Empty(); }
wxString m_text
Definition: eda_text.h:385

References EDA_TEXT::m_text.

Referenced by SCH_LEGACY_PLUGIN_CACHE::LoadPart().

◆ Flip() [1/2]

void FP_TEXT::Flip ( const wxPoint &  aCentre,
bool  aFlipLeftRight 
)
overridevirtual

Flip entity during footprint flip.

Reimplemented from BOARD_ITEM.

Definition at line 137 of file fp_text.cpp.

138 {
139  // flipping the footprint is relative to the X axis
140  if( aFlipLeftRight )
141  {
142  SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
144  }
145  else
146  {
147  SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
148  SetTextAngle( 1800 - GetTextAngle() );
149  }
150 
151  SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
153  SetLocalCoord();
154 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:188
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
void SetTextAngle(double aAngle) override
Definition: fp_text.cpp:73
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521
double GetTextAngle() const
Definition: eda_text.h:174
void SetTextX(int aX)
Definition: eda_text.h:249
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:886
void SetLocalCoord()
Definition: fp_text.cpp:209
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
void SetTextY(int aY)
Definition: eda_text.h:250

References FlipLayer(), BOARD_ITEM::GetBoard(), BOARD_ITEM::GetLayer(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), IsBackLayer(), MIRRORVAL(), BOARD_ITEM::SetLayer(), SetLocalCoord(), EDA_TEXT::SetMirrored(), SetTextAngle(), EDA_TEXT::SetTextX(), and EDA_TEXT::SetTextY().

Referenced by FOOTPRINT::Flip().

◆ Flip() [2/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 304 of file board_item.h.

305  {
306  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
307  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:197

References BOARD_ITEM::Flip(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Format()

void EDA_TEXT::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtualinherited

Output the object to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
aNestLevelThe indentation next level.
aControlBitsThe control bit definition for object specific formatting.
Exceptions
IO_ERRORon write error.

Definition at line 526 of file eda_text.cpp.

527 {
528 #ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
529  // and does not define FormatInternalUnits, used here
530  // however this function should exist
531 
532  aFormatter->Print( aNestLevel + 1, "(effects" );
533 
534  // Text size
535  aFormatter->Print( 0, " (font" );
536 
537  aFormatter->Print( 0, " (size %s %s)",
538  FormatInternalUnits( GetTextHeight() ).c_str(),
539  FormatInternalUnits( GetTextWidth() ).c_str() );
540 
541  if( GetTextThickness() )
542  aFormatter->Print( 0, " (thickness %s)",
543  FormatInternalUnits( GetTextThickness() ).c_str() );
544 
545  if( IsBold() )
546  aFormatter->Print( 0, " bold" );
547 
548  if( IsItalic() )
549  aFormatter->Print( 0, " italic" );
550 
551  aFormatter->Print( 0, ")"); // (font
552 
553  if( IsMirrored() ||
556  {
557  aFormatter->Print( 0, " (justify");
558 
560  aFormatter->Print( 0,
561  ( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ) ? " left" : " right" );
562 
564  aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
565 
566  if( IsMirrored() )
567  aFormatter->Print( 0, " mirror" );
568 
569  aFormatter->Print( 0, ")" ); // (justify
570  }
571 
572  if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
573  aFormatter->Print( 0, " hide" );
574 
575  aFormatter->Print( 0, ")\n" ); // (justify
576 
577 #endif
578 }
bool IsBold() const
Definition: eda_text.h:183
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
bool IsMirrored() const
Definition: eda_text.h:189
int GetTextThickness() const
Definition: eda_text.h:160
int GetTextHeight() const
Definition: eda_text.h:244
bool IsItalic() const
Definition: eda_text.h:180
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
virtual bool IsVisible() const
Definition: eda_text.h:186
int GetTextWidth() const
Definition: eda_text.h:241
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
#define CTL_OMIT_HIDE
Definition: eda_text.h:56
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:485

References CTL_OMIT_HIDE, FormatInternalUnits(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsVisible(), and OUTPUTFORMATTER::Print().

Referenced by SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveText(), and SCH_SEXPR_PLUGIN_CACHE::saveText().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
inlineinherited

Definition at line 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetBoard() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 50 of file board_item.cpp.

51 {
52  if( Type() == PCB_T )
53  return static_cast<const BOARD*>( this );
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return nullptr;
61 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), PCB_T, and EDA_ITEM::Type().

Referenced by ZONE_FILLER::addHoleKnockout(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), calcIsInsideArea(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_LAYER_VALUE::EqualTo(), existsOnLayer(), exprFromTo(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_SHAPE::Flip(), PCB_VIA::Flip(), ZONE::Flip(), PCB_EXPR_CONTEXT::GetBoard(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), PCB_VIA::GetEffectiveShape(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), PCB_TRACK::GetWidthConstraints(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 64 of file board_item.cpp.

65 {
66  if( Type() == PCB_T )
67  return static_cast<BOARD*>( this );
68 
69  BOARD_ITEM* parent = GetParent();
70 
71  if( parent )
72  return parent->GetBoard();
73 
74  return nullptr;
75 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), PCB_T, and EDA_ITEM::Type().

◆ GetBoundingBox()

const EDA_RECT FP_TEXT::GetBoundingBox ( ) const
overridevirtual

Set absolute coordinates.

Reimplemented from EDA_ITEM.

Definition at line 227 of file fp_text.cpp.

228 {
229  double angle = GetDrawRotation();
230  EDA_RECT text_area = GetTextBox();
231 
232  if( angle )
233  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
234 
235  return text_area;
236 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:229
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
const EDA_RECT GetBoundingBoxRotated(const wxPoint &aRotCenter, double aAngle) const
Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees.
Definition: eda_rect.cpp:513

References PNS::angle(), EDA_RECT::GetBoundingBoxRotated(), GetDrawRotation(), EDA_TEXT::GetTextBox(), and EDA_TEXT::GetTextPos().

Referenced by FOOTPRINT::GetBoundingBox(), and TextHitTest().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented in PCB_ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 112 of file board_item.h.

113  {
114  return GetBoundingBox().GetCenter();
115  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:104

References EDA_ITEM::GetBoundingBox(), and EDA_RECT::GetCenter().

Referenced by PCB_GRID_HELPER::computeAnchors(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), and ALTIUM_PCB::HelperParseDimensions6Radial().

◆ GetClass()

wxString FP_TEXT::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 212 of file fp_text.h.

213  {
214  return wxT( "MTEXT" );
215  }

◆ GetDrawRotation()

double FP_TEXT::GetDrawRotation ( ) const
overridevirtual
Returns
the text rotation for drawings and plotting the footprint rotation is taken in account.

Reimplemented from EDA_TEXT.

Definition at line 239 of file fp_text.cpp.

240 {
241  FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
242  double rotation = GetTextAngle();
243 
244  if( parentFootprint )
245  rotation += parentFootprint->GetOrientation();
246 
247  if( m_keepUpright )
248  {
249  // Keep angle between 0 .. 90 deg. Otherwise the text is not easy to read
250  while( rotation > 900 )
251  rotation -= 1800;
252 
253  while( rotation < 0 )
254  rotation += 1800;
255  }
256  else
257  {
258  NORMALIZE_ANGLE_POS( rotation );
259  }
260 
261  return rotation;
262 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
double GetOrientation() const
Definition: footprint.h:190
double GetTextAngle() const
Definition: eda_text.h:174
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
bool m_keepUpright
if true, keep rotation angle between -90 .
Definition: fp_text.h:245

References FOOTPRINT::GetOrientation(), EDA_TEXT::GetTextAngle(), m_keepUpright, EDA_ITEM::m_parent, and NORMALIZE_ANGLE_POS().

Referenced by GetBoundingBox(), GetDrawRotationRadians(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), TextHitTest(), TransformShapeWithClearanceToPolygon(), TransformTextShapeWithClearanceToPolygon(), and ViewBBox().

◆ GetDrawRotationRadians()

double FP_TEXT::GetDrawRotationRadians ( ) const
inline

Definition at line 175 of file fp_text.h.

175 { return GetDrawRotation() * M_PI/1800; }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239

References GetDrawRotation().

Referenced by KIGFX::PCB_PAINTER::draw().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > FP_TEXT::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
overridevirtual

Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.

This routine returns a COMPOUND shape (set of simple shapes which make up the pad for use with routing, collision determination, etc).

Note
This list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).
Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented from BOARD_ITEM.

Definition at line 449 of file fp_text.cpp.

450 {
451  return GetEffectiveTextShape();
452 }
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape() const
Definition: eda_text.cpp:633

References EDA_TEXT::GetEffectiveTextShape().

◆ GetEffectiveTextPenWidth()

int EDA_TEXT::GetEffectiveTextPenWidth ( int  aDefaultWidth = 0) const
inherited

The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.

Definition at line 149 of file eda_text.cpp.

150 {
151  int width = GetTextThickness();
152 
153  if( width <= 1 )
154  {
155  width = aDefaultWidth;
156 
157  if( IsBold() )
158  width = GetPenSizeForBold( GetTextWidth() );
159  else if( width <= 1 )
160  width = GetPenSizeForNormal( GetTextWidth() );
161  }
162 
163  // Clip pen size for small texts:
165 
166  return width;
167 }
bool IsBold() const
Definition: eda_text.h:183
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:46
int GetTextThickness() const
Definition: eda_text.h:160
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:67
const wxSize & GetTextSize() const
Definition: eda_text.h:238
int GetPenSizeForNormal(int aTextSize)
Definition: gr_text.cpp:52
#define ALLOW_BOLD_THICKNESS
Definition: base_units.h:56
int GetTextWidth() const
Definition: eda_text.h:241

References ALLOW_BOLD_THICKNESS, Clamp_Text_PenSize(), GetPenSizeForBold(), GetPenSizeForNormal(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), and EDA_TEXT::IsBold().

Referenced by BOARD_ADAPTER::addShapeWithClearance(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), SCH_HIERLABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBoxBase(), EDA_TEXT::GetEffectiveTextShape(), LIB_TEXT::GetPenWidth(), LIB_FIELD::GetPenWidth(), SCH_FIELD::GetPenWidth(), SCH_TEXT::GetPenWidth(), EDA_TEXT::GetTextBox(), KIGFX::SCH_PAINTER::getTextThickness(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_TEXT::print(), SCH_FIELD::Print(), EDA_TEXT::printOneLineOfText(), PNS_KICAD_IFACE_BASE::syncTextItem(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformTextShapeWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ GetEffectiveTextShape()

std::shared_ptr< SHAPE_COMPOUND > EDA_TEXT::GetEffectiveTextShape ( ) const
inherited

Definition at line 633 of file eda_text.cpp.

634 {
635  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
636  int penWidth = GetEffectiveTextPenWidth();
637  std::vector<wxPoint> pts = TransformToSegmentList();
638 
639  for( unsigned jj = 0; jj < pts.size(); jj += 2 )
640  shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
641 
642  return shape;
643 }
std::vector< wxPoint > TransformToSegmentList() const
Convert the text shape to a list of segment.
Definition: eda_text.cpp:593
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:149

References EDA_TEXT::GetEffectiveTextPenWidth(), and EDA_TEXT::TransformToSegmentList().

Referenced by PCB_TEXT::GetEffectiveShape(), and GetEffectiveShape().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 259 of file eda_item.h.

259 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::GetHorizJustify ( ) const
inlineinherited

Definition at line 198 of file eda_text.h.

198 { return EDA_TEXT_HJUSTIFY_T( m_e.hjustify ); };
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:61
TEXT_EFFECTS m_e
Definition: eda_text.h:389
signed char hjustify
horizontal justification
Definition: eda_text.h:101

References TEXT_EFFECTS::hjustify, and EDA_TEXT::m_e.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), EDA_TEXT_DESC::EDA_TEXT_DESC(), AUTOPLACER::fieldHorizPlacement(), EDA_TEXT::Format(), EDA_TEXT::GetTextBox(), EDA_TEXT::IsDefaultFormatting(), SCH_FIELD::IsHorizJustifyFlipped(), KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), LIB_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), KIGFX::GAL::SetTextAttributes(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetInterline()

int EDA_TEXT::GetInterline ( ) const
inherited

Return the distance between two lines of text.

Calculates the distance (pitch) between two lines of text. This distance includes the interline distance plus room for characters like j, {, and [. It also used for single line text, to calculate the text bounding box.

Definition at line 223 of file eda_text.cpp.

224 {
226 }
static double GetInterline(double aGlyphHeight)
Compute the distance (interline) between 2 lines of text (for multiline texts).
int GetTextHeight() const
Definition: eda_text.h:244
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References KIGFX::STROKE_FONT::GetInterline(), EDA_TEXT::GetTextHeight(), and KiROUND().

Referenced by CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), EDA_TEXT::GetLinePositions(), and EDA_TEXT::GetTextBox().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 171 of file board_item.h.

171 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:353

References BOARD_ITEM::m_layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addFootprintShapesWithClearance(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanup(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), CreateRoutesSection(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), Flip(), PCB_DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), PCB_ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT::GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), BOARD::GetPad(), PCB_TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), isEdge(), PAD::IsFlipped(), FOOTPRINT::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PCB_TRACK::cmp_tracks::operator()(), PCB_SHAPE::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbShape(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotPcbText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), FOOTPRINT::TransformFPShapesWithClearanceToPolygon(), PCB_TRACK::ViewGetLayers(), ViewGetLayers(), ViewGetLOD(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 87 of file board_item.cpp.

88 {
89  const BOARD* board = GetBoard();
90 
91  if( board )
92  return board->GetLayerName( m_layer );
93 
94  // If no parent, return standard name
96 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:353
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605

References BOARD_ITEM::GetBoard(), BOARD::GetLayerName(), BOARD::GetStandardLayerName(), and BOARD_ITEM::m_layer.

Referenced by PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_DIMENSION_BASE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

◆ GetLength()

int FP_TEXT::GetLength ( ) const

Definition at line 184 of file fp_text.cpp.

185 {
186  return GetText().Len();
187 }
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133

References EDA_TEXT::GetText().

Referenced by FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary().

◆ GetLinePositions()

void EDA_TEXT::GetLinePositions ( std::vector< wxPoint > &  aPositions,
int  aLineCount 
) const
inherited

Populate aPositions with the position of each line of a multiline text, according to the vertical justification and the rotation of the whole text.

Parameters
aPositionsis the list to populate by the wxPoint positions.
aLineCountis the number of lines (not recalculated here for efficiency reasons.

Definition at line 430 of file eda_text.cpp.

431 {
432  wxPoint pos = GetTextPos(); // Position of first line of the
433  // multiline text according to
434  // the center of the multiline text block
435 
436  wxPoint offset; // Offset to next line.
437 
438  offset.y = GetInterline();
439 
440  if( aLineCount > 1 )
441  {
442  switch( GetVertJustify() )
443  {
445  break;
446 
448  pos.y -= ( aLineCount - 1 ) * offset.y / 2;
449  break;
450 
452  pos.y -= ( aLineCount - 1 ) * offset.y;
453  break;
454  }
455  }
456 
457  // Rotate the position of the first line
458  // around the center of the multiline text block
459  RotatePoint( &pos, GetTextPos(), GetTextAngle() );
460 
461  // Rotate the offset lines to increase happened in the right direction
462  RotatePoint( &offset, GetTextAngle() );
463 
464  for( int ii = 0; ii < aLineCount; ii++ )
465  {
466  aPositions.push_back( pos );
467  pos += offset;
468  }
469 }
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:223
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
double GetTextAngle() const
Definition: eda_text.h:174
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
const wxPoint & GetTextPos() const
Definition: eda_text.h:247

References EDA_TEXT::GetInterline(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetVertJustify(), GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, and RotatePoint().

Referenced by SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), EDA_TEXT::Print(), and EDA_TEXT::TransformToSegmentList().

◆ GetMenuImage()

BITMAPS FP_TEXT::GetMenuImage ( ) const
overridevirtual

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 328 of file fp_text.cpp.

329 {
330  return BITMAPS::text;
331 }

References text.

◆ GetMsgPanelInfo()

void FP_TEXT::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 265 of file fp_text.cpp.

266 {
267  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
268  wxString msg;
269 
270  static const wxString text_type_msg[3] =
271  {
272  _( "Ref." ), _( "Value" ), _( "Text" )
273  };
274 
275  aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
276 
277  // Don't use GetShownText() here; we want to show the user the variable references
278  aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
279 
280  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
281  aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
282 
283  if( IsLocked() )
284  aList.emplace_back( _( "Status" ), _( "Locked" ) );
285 
286  aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
287 
288  // Display text layer
289  aList.emplace_back( _( "Layer" ), GetLayerName() );
290 
291  aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
292 
293  msg.Printf( wxT( "%g" ), GetTextAngleDegrees() );
294  aList.emplace_back( _( "Angle" ), msg );
295 
296  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() );
297  aList.emplace_back( _( "Thickness" ), msg );
298 
299  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() );
300  aList.emplace_back( _( "Width" ), msg );
301 
302  msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() );
303  aList.emplace_back( _( "Height" ), msg );
304 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
bool IsMirrored() const
Definition: eda_text.h:189
int GetTextThickness() const
Definition: eda_text.h:160
virtual bool IsLocked() const
Definition: board_item.cpp:78
int GetTextHeight() const
Definition: eda_text.h:244
virtual bool IsVisible() const
Definition: eda_text.h:186
const wxString & GetReference() const
Definition: footprint.h:430
#define _(s)
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:240
wxString UnescapeString(const wxString &aSource)
double GetTextAngleDegrees() const
Definition: eda_text.h:176
int GetTextWidth() const
Definition: eda_text.h:241
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:87
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, BOARD_ITEM::GetLayerName(), FOOTPRINT::GetReference(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngleDegrees(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetTextWidth(), EDA_BASE_FRAME::GetUserUnits(), BOARD_ITEM::IsLocked(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsVisible(), EDA_ITEM::m_parent, m_Type, MessageTextFromValue(), TEXT_is_DIVERS, TEXT_is_REFERENCE, and UnescapeString().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 166 of file board_item.h.

166 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), GetSelectMenuText(), PCB_TEXT::GetShownText(), GetShownText(), getTopLevelGroup(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isInsideArea(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentAsString()

wxString FP_TEXT::GetParentAsString ( ) const
inline

Definition at line 81 of file fp_text.h.

81 { return m_parent->m_Uuid.AsString(); }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
wxString AsString() const
Definition: kiid.cpp:218
const KIID m_Uuid
Definition: eda_item.h:475

References KIID::AsString(), EDA_ITEM::m_parent, and EDA_ITEM::m_Uuid.

Referenced by FP_TEXT_DESC::FP_TEXT_DESC().

◆ GetParentGroup()

◆ GetPos0()

const wxPoint& FP_TEXT::GetPos0 ( ) const
inline

Definition at line 166 of file fp_text.h.

166 { return m_Pos0; }
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:242

References m_Pos0.

Referenced by PCB_IO::format(), getMatchingTextItem(), and FOOTPRINT::MoveAnchorPosition().

◆ GetPosition()

virtual wxPoint FP_TEXT::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 88 of file fp_text.h.

89  {
90  return EDA_TEXT::GetTextPos();
91  }
const wxPoint & GetTextPos() const
Definition: eda_text.h:247

References EDA_TEXT::GetTextPos().

◆ GetSelectMenuText()

wxString FP_TEXT::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 307 of file fp_text.cpp.

308 {
309  switch( m_Type )
310  {
311  case TEXT_is_REFERENCE:
312  return wxString::Format( _( "Reference '%s'" ),
313  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
314 
315  case TEXT_is_VALUE:
316  return wxString::Format( _( "Value '%s' of %s" ),
317  GetShownText(),
318  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
319 
320  default:
321  return wxString::Format( _( "Footprint Text '%s' of %s" ),
323  static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
324  }
325 }
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:208
#define _(s)
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:240
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:414

References _, Format(), BOARD_ITEM::GetParent(), GetShownText(), m_Type, EDA_TEXT::ShortenedShownText(), TEXT_is_REFERENCE, and TEXT_is_VALUE.

◆ GetShownText()

wxString FP_TEXT::GetShownText ( int  aDepth = 0) const
overridevirtual

Return the string actually shown after processing of the base text.

Parameters
aDepthis used to prevent infinite recursions and loops when expanding text variables.

Reimplemented from EDA_TEXT.

Definition at line 414 of file fp_text.cpp.

415 {
416  const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
417  wxASSERT( parentFootprint );
418  const BOARD* board = parentFootprint->GetBoard();
419 
420  std::function<bool( wxString* )> footprintResolver =
421  [&]( wxString* token ) -> bool
422  {
423  return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
424  };
425 
426  std::function<bool( wxString* )> boardTextResolver =
427  [&]( wxString* token ) -> bool
428  {
429  return board->ResolveTextVar( token, aDepth + 1 );
430  };
431 
432  wxString text = EDA_TEXT::GetShownText();
433 
434  if( HasTextVars() )
435  {
436  PROJECT* project = nullptr;
437 
438  if( parentFootprint && parentFootprint->GetParent() )
439  project = static_cast<BOARD*>( parentFootprint->GetParent() )->GetProject();
440 
441  if( aDepth < 10 )
442  text = ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
443  }
444 
445  return text;
446 }
Container for project specific data.
Definition: project.h:62
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:64
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:477
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
Definition: eda_text.h:151
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:239
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

References ExpandTextVars(), BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), EDA_TEXT::GetShownText(), EDA_TEXT::HasTextVars(), project, BOARD::ResolveTextVar(), FOOTPRINT::ResolveTextVar(), and text.

Referenced by KIGFX::PCB_PAINTER::draw(), FOOTPRINT::GetMsgPanelInfo(), GetSelectMenuText(), idf_export_footprint(), DIALOG_PAD_PROPERTIES::initValues(), Matches(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), FOOTPRINT::ResolveTextVar(), and TransformTextShapeWithClearanceToPolygon().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ GetText()

virtual const wxString& EDA_TEXT::GetText ( ) const
inlinevirtualinherited

Return the string associated with the text object.

Returns
a const wxString reference containing the string of the item.

Definition at line 133 of file eda_text.h.

133 { return m_text; }
wxString m_text
Definition: eda_text.h:385

References EDA_TEXT::m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), NETLIST_EXPORTER_XML::addSymbolFields(), SIM_PLOT_FRAME::AddTuner(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CONNECTION_GRAPH::buildConnectionGraph(), LIB_TEXT::Clone(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySymbol(), SCH_FIELD::DoHypertextMenu(), KIGFX::SCH_PAINTER::draw(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CONNECTION_GRAPH::ercCheckHierSheets(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), LIB_SYMBOL::Flatten(), PCB_IO::format(), FormatProbeItem(), SCH_SYMBOL::GetFootprint(), LIB_FIELD::GetFullText(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), GetLength(), getMatchingTextItem(), PCB_TEXT::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_SYMBOL::GetRef(), FOOTPRINT::GetReference(), LIB_SYMBOL::GetSearchText(), PCB_DIMENSION_BASE::GetText(), FOOTPRINT::GetValue(), SCH_SYMBOL::GetValue(), LIB_FIELD::HitTest(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_TEXT::IncrementLabel(), GENERAL_COLLECTOR::Inspect(), SCH_FIELD::IsVoid(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSegments(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), LIB_FIELD::operator=(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceText(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), DIALOG_RESCUE_EACH::PopulateInstanceList(), LIB_FIELD::print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_EDIT_FRAME::RecomputeIntersheetRefs(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_SHEET::SymbolCount(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TUNER_SLIDER::TUNER_SLIDER(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo(), and ViewGetLOD().

◆ GetTextAngle()

double EDA_TEXT::GetTextAngle ( ) const
inlineinherited

Definition at line 174 of file eda_text.h.

174 { return m_e.angle; }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
double angle
now: 0.1 degrees; future: degrees
Definition: eda_text.h:105

References TEXT_EFFECTS::angle, and EDA_TEXT::m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOARD_ADAPTER::addShapeWithClearance(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), PCB_TEXT::Flip(), Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), GetDrawRotation(), EDA_TEXT::GetDrawRotation(), EDA_TEXT::GetLinePositions(), EDA_TEXT::GetTextAngleDegrees(), EDA_TEXT::GetTextAngleRadians(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), KeepUpright(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), ALTIUM_PCB::ParseTexts6Data(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotPcbText(), positioningChanged(), LIB_TEXT::print(), SCH_FIELD::Print(), LIB_FIELD::print(), EDA_TEXT::printOneLineOfText(), SCH_EDIT_TOOL::Rotate(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), Rotate(), LIB_FIELD::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), EDA_TEXT::TextHitTest(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and DIALOG_SCH_FIELD_PROPERTIES::UpdateField().

◆ GetTextAngleDegrees()

double EDA_TEXT::GetTextAngleDegrees ( ) const
inlineinherited

◆ GetTextAngleRadians()

double EDA_TEXT::GetTextAngleRadians ( ) const
inlineinherited

◆ GetTextBox()

EDA_RECT EDA_TEXT::GetTextBox ( int  aLine = -1,
bool  aInvertY = false 
) const
inherited

Useful in multiline texts to calculate the full text or a line area (for zones filling, locate functions....)

Parameters
aLineThe line of text to consider. Pass -1 for all lines.
aInvertYInvert the Y axis when calculating bounding box.
Returns
the rect containing the line of text (i.e. the position and the size of one line) this rectangle is calculated for 0 orient text. If orientation is not 0 the rect must be rotated to match the physical area

Definition at line 229 of file eda_text.cpp.

230 {
231  EDA_RECT rect;
232  wxArrayString strings;
233  wxString text = GetShownText();
234  int thickness = GetEffectiveTextPenWidth();
235  int linecount = 1;
236  bool hasOverBar = false; // true if the first line of text as an overbar
237 
238  if( IsMultilineAllowed() )
239  {
240  wxStringSplit( text, strings, '\n' );
241 
242  if( strings.GetCount() ) // GetCount() == 0 for void strings
243  {
244  if( aLine >= 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
245  text = strings.Item( aLine );
246  else
247  text = strings.Item( 0 );
248 
249  linecount = strings.GetCount();
250  }
251  }
252 
253  // Search for overbar symbol. Only text is scanned,
254  // because only this line can change the bounding box
255  for( unsigned ii = 1; ii < text.size(); ii++ )
256  {
257  if( text[ii-1] == '~' && text[ii] == '{' )
258  {
259  hasOverBar = true;
260  break;
261  }
262  }
263 
264  // calculate the H and V size
265  const auto& font = basic_gal.GetStrokeFont();
266  VECTOR2D fontSize( GetTextSize() );
267  double penWidth( thickness );
268  int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
269  int dy = GetInterline();
270 
271  // Creates bounding box (rectangle) for horizontal, left and top justified text. The
272  // bounding box will be moved later according to the actual text options
273  wxSize textsize = wxSize( dx, dy );
274  wxPoint pos = GetTextPos();
275 
276  if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
277  {
278  pos.y -= aLine * GetInterline();
279  }
280 
281  if( aInvertY )
282  pos.y = -pos.y;
283 
284  rect.SetOrigin( pos );
285 
286  if( hasOverBar )
287  { // A overbar adds an extra size to the text
288  // Height from the base line text of chars like [ or {
289  double curr_height = GetTextHeight() * 1.15;
290  double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y );
291  int extra_height = KiROUND( overbarPosition - curr_height );
292 
293  extra_height += thickness / 2;
294  textsize.y += extra_height;
295  rect.Move( wxPoint( 0, -extra_height ) );
296  }
297 
298  // for multiline texts and aLine < 0, merge all rectangles
299  // ( if aLine < 0, we want the full text bounding box )
300  if( IsMultilineAllowed() && aLine < 0 )
301  {
302  for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
303  {
304  text = strings.Item( ii );
305  dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth ).x );
306  textsize.x = std::max( textsize.x, dx );
307  textsize.y += dy;
308  }
309  }
310 
311  rect.SetSize( textsize );
312 
313  /* Now, calculate the rect origin, according to text justification
314  * At this point the rectangle origin is the text origin (m_Pos).
315  * This is true only for left and top text justified texts (using top to bottom Y axis
316  * orientation). and must be recalculated for others justifications
317  * also, note the V justification is relative to the first line
318  */
319  switch( GetHorizJustify() )
320  {
322  if( IsMirrored() )
323  rect.SetX( rect.GetX() - rect.GetWidth() );
324  break;
325 
327  rect.SetX( rect.GetX() - (rect.GetWidth() / 2) );
328  break;
329 
331  if( !IsMirrored() )
332  rect.SetX( rect.GetX() - rect.GetWidth() );
333  break;
334  }
335 
336  switch( GetVertJustify() )
337  {
339  break;
340 
342  rect.SetY( rect.GetY() - ( dy / 2) );
343  break;
344 
346  rect.SetY( rect.GetY() - dy );
347  break;
348  }
349 
350  if( linecount > 1 )
351  {
352  int yoffset;
353  linecount -= 1;
354 
355  switch( GetVertJustify() )
356  {
358  break;
359 
361  yoffset = linecount * GetInterline() / 2;
362  rect.SetY( rect.GetY() - yoffset );
363  break;
364 
366  yoffset = linecount * GetInterline();
367  rect.SetY( rect.GetY() - yoffset );
368  break;
369  }
370  }
371 
372  // Many fonts draw diacriticals, descenders, etc. outside the X-height of the font. This
373  // will cacth most (but probably not all) of them.
374  rect.Inflate( 0, thickness * 1.5 );
375 
376  rect.Normalize(); // Make h and v sizes always >= 0
377 
378  return rect;
379 }
const STROKE_FONT & GetStrokeFont() const
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:223
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
bool IsMirrored() const
Definition: eda_text.h:189
int GetX() const
Definition: eda_rect.h:98
int GetWidth() const
Definition: eda_rect.h:109
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:149
int GetTextHeight() const
Definition: eda_text.h:244
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
const wxSize & GetTextSize() const
Definition: eda_text.h:238
void SetX(int val)
Definition: eda_rect.h:158
bool IsMultilineAllowed() const
Definition: eda_text.h:196
void SetY(int val)
Definition: eda_rect.h:164
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void SetSize(const wxSize &size)
Definition: eda_rect.h:134
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:99
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
BASIC_GAL basic_gal(basic_displayOptions)
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References basic_gal, EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetInterline(), EDA_TEXT::GetShownText(), KIGFX::GAL::GetStrokeFont(), EDA_TEXT::GetTextHeight(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, EDA_RECT::Inflate(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), KiROUND(), EDA_RECT::Move(), EDA_RECT::Normalize(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), EDA_RECT::SetX(), EDA_RECT::SetY(), text, wxStringSplit(), and VECTOR2< T >::y.

Referenced by LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), GetBoundingBox(), SCH_TEXT::GetBoundingBox(), PCB_DIMENSION_BASE::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), DS_DRAW_ITEM_TEXT::GetBoundingBox(), LIB_TEXT::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), LIB_TEXT::NormalizeJustification(), PCB_TEXT::TextHitTest(), TextHitTest(), EDA_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and ViewBBox().

◆ GetTextHeight()

◆ GetTextPos()

const wxPoint& EDA_TEXT::GetTextPos ( ) const
inlineinherited

Definition at line 247 of file eda_text.h.

247 { return m_e.pos; }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
wxPoint pos
Definition: eda_text.h:106

References EDA_TEXT::m_e, and TEXT_EFFECTS::pos.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), LIB_TEXT::compare(), LIB_FIELD::compare(), SCH_SHEET_PIN::ConstrainOnEdge(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), SCH_LABEL::doIsConnected(), SCH_GLOBALLABEL::doIsConnected(), SCH_HIERLABEL::doIsConnected(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), PCB_TEXT::Flip(), Flip(), PCB_IO::format(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), PCB_TEXT::GetBoundingBox(), GetBoundingBox(), SCH_TEXT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBoxBase(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_SHEET_PIN::GetEndPoints(), SCH_TEXT::GetEndPoints(), SCH_FIELD::GetLibPosition(), EDA_TEXT::GetLinePositions(), PCB_TEXT::GetPosition(), GetPosition(), LIB_TEXT::GetPosition(), LIB_FIELD::GetPosition(), SCH_FIELD::GetPosition(), SCH_TEXT::GetPosition(), DS_DRAW_ITEM_TEXT::GetPosition(), EDA_TEXT::GetTextBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), Mirror(), PCB_DIMENSION_BASE::Mirror(), LIB_TEXT::MirrorHorizontal(), LIB_FIELD::MirrorHorizontal(), SCH_SHEET_PIN::MirrorHorizontally(), SCH_TEXT::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), LIB_FIELD::MirrorVertical(), SCH_SHEET_PIN::MirrorVertically(), SCH_TEXT::MirrorVertically(), SCH_GLOBALLABEL::MirrorVertically(), LIB_TEXT::NormalizeJustification(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DRAWING_TOOL::PlaceText(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_FIELD::print(), EDA_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), Rotate(), SCH_SHEET_PIN::Rotate(), LIB_FIELD::Rotate(), SCH_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SetDrawCoord(), SetLocalCoord(), TextHitTest(), EDA_TEXT::TextHitTest(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TransformShapeWithClearanceToPolygon(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), SCH_TEXT::UpdateDanglingState(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and ViewBBox().

◆ GetTextSize()

◆ GetTextStyleName()

wxString EDA_TEXT::GetTextStyleName ( ) const
inherited
Returns
a wxString with the style name( Normal, Italic, Bold, Bold+Italic).

Definition at line 491 of file eda_text.cpp.

492 {
493  int style = 0;
494 
495  if( IsItalic() )
496  style = 1;
497 
498  if( IsBold() )
499  style += 2;
500 
501  wxString stylemsg[4] = {
502  _("Normal"),
503  _("Italic"),
504  _("Bold"),
505  _("Bold+Italic")
506  };
507 
508  return stylemsg[style];
509 }
bool IsBold() const
Definition: eda_text.h:183
bool IsItalic() const
Definition: eda_text.h:180
#define _(s)

References _, EDA_TEXT::IsBold(), and EDA_TEXT::IsItalic().

Referenced by LIB_FIELD::GetMsgPanelInfo().

◆ GetTextThickness()

◆ GetTextWidth()

◆ GetType()

TEXT_TYPE FP_TEXT::GetType ( ) const
inline

◆ GetVertJustify()

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ HasFlag()

◆ HasTextVars()

bool EDA_TEXT::HasTextVars ( ) const
inlineinherited

Indicates the ShownText has text var references which need to be processed.

Definition at line 151 of file eda_text.h.

bool m_shown_text_has_text_var_refs
Definition: eda_text.h:387

References EDA_TEXT::m_shown_text_has_text_var_refs.

Referenced by PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), and GetShownText().

◆ HitTest() [1/2]

bool FP_TEXT::HitTest ( const wxPoint &  aPosition,
int  aAccuracy 
) const
inlineoverridevirtual

Test if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 191 of file fp_text.h.

192  {
193  return TextHitTest( aPosition, aAccuracy );
194  }
bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition: fp_text.cpp:79

References TextHitTest().

◆ HitTest() [2/2]

bool FP_TEXT::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
inlineoverridevirtual

Test if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 196 of file fp_text.h.

197  {
198  return TextHitTest( aRect, aContained, aAccuracy );
199  }
bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Definition: fp_text.cpp:79

References TextHitTest().

◆ IsBold()

◆ IsBrightened()

◆ IsConnected()

◆ IsDefaultFormatting()

bool EDA_TEXT::IsDefaultFormatting ( ) const
inherited

Definition at line 512 of file eda_text.cpp.

513 {
514  return ( IsVisible()
515  && !IsMirrored()
518  && GetTextThickness() == 0
519  && !IsItalic()
520  && !IsBold()
521  && !IsMultilineAllowed()
522  );
523 }
bool IsBold() const
Definition: eda_text.h:183
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
bool IsMirrored() const
Definition: eda_text.h:189
int GetTextThickness() const
Definition: eda_text.h:160
bool IsItalic() const
Definition: eda_text.h:180
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
virtual bool IsVisible() const
Definition: eda_text.h:186
bool IsMultilineAllowed() const
Definition: eda_text.h:196

References EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextThickness(), EDA_TEXT::GetVertJustify(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), and EDA_TEXT::IsVisible().

Referenced by SCH_SEXPR_PLUGIN::saveField().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsItalic()

◆ IsKeepUpright()

bool FP_TEXT::IsKeepUpright ( ) const
inline
Returns
force the text rotation to be always between -90 .. 90 deg. Otherwise the text is not easy to read if false, the text rotation is free.

Definition at line 110 of file fp_text.h.

111  {
112  return m_keepUpright;
113  }
bool m_keepUpright
if true, keep rotation angle between -90 .
Definition: fp_text.h:245

References m_keepUpright.

Referenced by PCB_IO::format(), KeepUpright(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

◆ IsLocked()

bool BOARD_ITEM::IsLocked ( ) const
virtualinherited
Returns
true if the object is locked, else false.

Reimplemented in FOOTPRINT, and PAD.

Definition at line 78 of file board_item.cpp.

79 {
80  if( GetParentGroup() )
81  return GetParentGroup()->IsLocked();
82 
83  return GetState( LOCKED );
84 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual bool IsLocked() const
Definition: board_item.cpp:78
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:137

References BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetState(), BOARD_ITEM::IsLocked(), and LOCKED.

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_IO::format(), PCB_TEXT::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), ROUTER_TOOL::InlineDrag(), GENERAL_COLLECTOR::Inspect(), PAD::IsLocked(), BOARD_ITEM::IsLocked(), PCB_SELECTION_TOOL::itemPassesFilter(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), TRACKS_CLEANER::mergeCollinearSegments(), BOARD_EDITOR_CONTROL::modifyLockSelected(), PCB_POINT_EDITOR::OnSelectionChange(), ZONE_SETTINGS::operator<<(), POSITION_RELATIVE_TOOL::PositionRelative(), processTextItem(), PCB_SELECTION_TOOL::RequestSelection(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow().

◆ IsMirrored()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsMultilineAllowed()

◆ IsNew()

◆ IsOnCopperLayer()

virtual bool BOARD_ITEM::IsOnCopperLayer ( ) const
inlinevirtualinherited
Returns
true if the object is on any copper layer, false otherwise.

Reimplemented in PAD, PCB_TRACK, and ZONE.

Definition at line 142 of file board_item.h.

143  {
144  return IsCopperLayer( GetLayer() );
145  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171

References BOARD_ITEM::GetLayer(), and IsCopperLayer().

Referenced by CN_CONNECTIVITY_ALGO::Add(), DRC_ENGINE::EvalRules(), and BOARD_CONNECTED_ITEM::SetNetCode().

◆ IsOnLayer()

virtual bool BOARD_ITEM::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlinevirtualinherited

Test to see if this object is on the given layer.

Virtual so objects like PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
true if on given layer, else false.

Reimplemented in PAD, PCB_VIA, FOOTPRINT, ZONE, and PCB_GROUP.

Definition at line 229 of file board_item.h.

230  {
231  return m_layer == aLayer;
232  }
PCB_LAYER_ID m_layer
Definition: board_item.h:353

References BOARD_ITEM::m_layer.

Referenced by BOARD_ADAPTER::createLayers(), existsOnLayer(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), and PNS_KICAD_IFACE::IsItemVisible().

◆ IsParentFlipped()

bool FP_TEXT::IsParentFlipped ( ) const

Definition at line 156 of file fp_text.cpp.

157 {
158  if( GetParent() && GetParent()->GetLayer() == B_Cu )
159  return true;
160  return false;
161 }
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171

References B_Cu, BOARD_ITEM::GetLayer(), and BOARD_ITEM::GetParent().

Referenced by ViewGetLOD().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define SELECTED

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 239 of file board_item.h.

240  {
241  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
242  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_TRACE_T, PCB_VIA_T, and EDA_ITEM::Type().

◆ IsType()

bool FP_TEXT::IsType ( const KICAD_T  aScanTypes[]) const
inlineoverridevirtual

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented from EDA_ITEM.

Definition at line 67 of file fp_text.h.

68  {
69  if( BOARD_ITEM::IsType( aScanTypes ) )
70  return true;
71 
72  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
73  {
74  if( *p == PCB_LOCATE_TEXT_T )
75  return true;
76  }
77 
78  return false;
79  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183

References EOT, EDA_ITEM::IsType(), and PCB_LOCATE_TEXT_T.

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ KeepUpright()

void FP_TEXT::KeepUpright ( double  aOldOrientation,
double  aNewOrientation 
)

Called when rotating the parent footprint.

Definition at line 105 of file fp_text.cpp.

106 {
107  if( !IsKeepUpright() )
108  return;
109 
110  double newAngle = GetTextAngle() + aNewOrientation;
111  NORMALIZE_ANGLE_POS( newAngle );
112  bool needsFlipped = newAngle >= 1800.0;
113 
114  if( needsFlipped )
115  {
116  SetHorizJustify( static_cast<EDA_TEXT_HJUSTIFY_T>( -GetHorizJustify() ) );
117  SetTextAngle( GetTextAngle() + 1800.0 );
118  SetDrawCoord();
119  }
120 }
bool IsKeepUpright() const
Definition: fp_text.h:110
void SetTextAngle(double aAngle) override
Definition: fp_text.cpp:73
double GetTextAngle() const
Definition: eda_text.h:174
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:190
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:201

References EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextAngle(), IsKeepUpright(), NORMALIZE_ANGLE_POS(), SetDrawCoord(), EDA_TEXT::SetHorizJustify(), and SetTextAngle().

Referenced by FOOTPRINT::Rotate().

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

Return a string (to be shown to the user) describing a layer mask.

The BOARD is needed because layer names are customizable.

Reimplemented in PCB_VIA.

Definition at line 99 of file board_item.cpp.

100 {
101  const BOARD* board = GetBoard();
102  LSET layers = GetLayerSet();
103 
104  // Try to be smart and useful. Check all copper first.
105  if( layers[F_Cu] && layers[B_Cu] )
106  return _( "all copper layers" );
107 
108  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
109  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
110 
111  for( LSET testLayers : { copperLayers, techLayers, layers } )
112  {
113  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
114  {
115  if( testLayers[ bit ] )
116  {
117  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
118 
119  if( testLayers.count() > 1 )
120  layerInfo << wxS( " " ) + _( "and others" );
121 
122  return layerInfo;
123  }
124  }
125  }
126 
127  // No copper, no technicals: no layer
128  return _( "no layers" );
129 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:466
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
Definition: layer_ids.h:70
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:176

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, F_Cu, BOARD_ITEM::GetBoard(), BOARD::GetEnabledLayers(), BOARD::GetLayerName(), BOARD_ITEM::GetLayerSet(), PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

Referenced by PCB_TRACK::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::GetSelectMenuText().

◆ LenSize()

int EDA_TEXT::LenSize ( const wxString &  aLine,
int  aThickness 
) const
inherited
Returns
the text length in internal units.
Parameters
aLinethe line of text to consider. For single line text, this parameter is always m_Text.
aThicknessthe stroke width of the text.

Definition at line 194 of file eda_text.cpp.

195 {
198  basic_gal.SetFontUnderlined( false );
199  basic_gal.SetLineWidth( (float) aThickness );
201 
202  VECTOR2D tsize = basic_gal.GetTextLineSize( aLine );
203 
204  return KiROUND( tsize.x );
205 }
bool IsBold() const
Definition: eda_text.h:183
void SetFontBold(bool aBold)
Set bold property of current font.
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsItalic() const
Definition: eda_text.h:180
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const wxSize & GetTextSize() const
Definition: eda_text.h:238
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
BASIC_GAL basic_gal(basic_displayOptions)

References basic_gal, KIGFX::GAL::GetTextLineSize(), EDA_TEXT::GetTextSize(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), KiROUND(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetLineWidth(), and VECTOR2< T >::x.

Referenced by SCH_GLOBALLABEL::CreateGraphicShape(), SCH_HIERLABEL::GetBoundingBox(), and SCH_GLOBALLABEL::GetBoundingBoxBase().

◆ MapHorizJustify()

EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify ( int  aHorizJustify)
staticinherited

Definition at line 63 of file eda_text.cpp.

64 {
65  wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
66 
67  if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
69 
70  if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
71  return GR_TEXT_HJUSTIFY_LEFT;
72 
73  return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
74 }

References GR_TEXT_HJUSTIFY_LEFT, and GR_TEXT_HJUSTIFY_RIGHT.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ MapVertJustify()

EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify ( int  aVertJustify)
staticinherited

Definition at line 77 of file eda_text.cpp.

78 {
79  wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
80 
81  if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
83 
84  if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
85  return GR_TEXT_VJUSTIFY_TOP;
86 
87  return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
88 }

References GR_TEXT_VJUSTIFY_BOTTOM, and GR_TEXT_VJUSTIFY_TOP.

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ Matches() [1/2]

bool FP_TEXT::Matches ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
) const
inlineoverridevirtual

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented from EDA_ITEM.

Definition at line 83 of file fp_text.h.

84  {
85  return BOARD_ITEM::Matches( GetShownText(), aSearchData );
86  }
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:365
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:414

References GetShownText(), and EDA_ITEM::Matches().

Referenced by DIALOG_FIND::search().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const wxFindReplaceData &  aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return text.MakeUpper().Matches( searchText.MakeUpper() );
136  }
137 
138  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
139  return aText.Find( searchText ) != wxNOT_FOUND;
140 
141  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
142 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:403

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, EDA_ITEM::IsReplaceable(), and text.

◆ Mirror()

void FP_TEXT::Mirror ( const wxPoint &  aCentre,
bool  aMirrorAroundXAxis 
)

Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified, only position is mirrored.

(use Flip to change layer to its paired and mirror the text in fp editor).

Definition at line 164 of file fp_text.cpp.

165 {
166  // the position is mirrored, but the text itself is not mirrored
167 
168  if( aMirrorAroundXAxis )
169  SetTextY( ::MIRRORVAL( GetTextPos().y, aCentre.y ) );
170  else
171  SetTextX( ::MIRRORVAL( GetTextPos().x, aCentre.x ) );
172 
173  SetLocalCoord();
174 }
void SetTextX(int aX)
Definition: eda_text.h:249
void SetLocalCoord()
Definition: fp_text.cpp:209
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:31
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
void SetTextY(int aY)
Definition: eda_text.h:250

References EDA_TEXT::GetTextPos(), MIRRORVAL(), SetLocalCoord(), EDA_TEXT::SetTextX(), and EDA_TEXT::SetTextY().

◆ Move() [1/2]

void FP_TEXT::Move ( const wxPoint &  aMoveVector)
overridevirtual

move text in move transform, in footprint editor

Reimplemented from BOARD_ITEM.

Definition at line 177 of file fp_text.cpp.

178 {
179  Offset( aMoveVector );
180  SetLocalCoord();
181 }
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:252
void SetLocalCoord()
Definition: fp_text.cpp:209

References EDA_TEXT::Offset(), and SetLocalCoord().

◆ Move() [2/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 278 of file board_item.h.

279  {
280  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
281  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:272

References BOARD_ITEM::Move(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Offset()

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 171 of file eda_item.cpp.

172 {
173  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
174  GetClass() ) );
175 
176  return false;
177 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

References Format(), and EDA_ITEM::GetClass().

◆ Print()

void EDA_TEXT::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
const COLOR4D aColor,
OUTLINE_MODE  aDisplay_mode = FILLED 
)
inherited

Print this text object to the device context aDC.

Parameters
aDCthe current Device Context.
aOffsetdraw offset (usually (0,0)).
aColortext color.
aDisplay_modeFILLED or SKETCH.

Definition at line 407 of file eda_text.cpp.

409 {
410  if( IsMultilineAllowed() )
411  {
412  std::vector<wxPoint> positions;
413  wxArrayString strings;
414  wxStringSplit( GetShownText(), strings, '\n' );
415 
416  positions.reserve( strings.Count() );
417 
418  GetLinePositions( positions, strings.Count() );
419 
420  for( unsigned ii = 0; ii < strings.Count(); ii++ )
421  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
422  }
423  else
424  {
425  printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
426  }
427 }
void printOneLineOfText(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aFillMode, const wxString &aText, const wxPoint &aPos)
Print each line of this EDA_TEXT.
Definition: eda_text.cpp:471
bool IsMultilineAllowed() const
Definition: eda_text.h:196
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:430
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

References EDA_TEXT::GetLinePositions(), EDA_TEXT::GetShownText(), EDA_TEXT::GetTextPos(), EDA_TEXT::IsMultilineAllowed(), EDA_TEXT::printOneLineOfText(), and wxStringSplit().

Referenced by SCH_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), and DS_DRAW_ITEM_TEXT::PrintWsItem().

◆ Replace() [1/3]

bool EDA_TEXT::Replace ( const wxFindReplaceData &  aSearchData)
inherited

Helper function used in search and replace dialog.

Perform a text replace using the find and replace criteria in aSearchData.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
Returns
True if the text item was modified, otherwise false.

Definition at line 170 of file eda_text.cpp.

171 {
172  bool retval = EDA_ITEM::Replace( aSearchData, m_text );
173  cacheShownText();
174 
175  return retval;
176 }
void cacheShownText()
Definition: eda_text.cpp:179
wxString m_text
Definition: eda_text.h:385
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition: eda_item.cpp:145

References EDA_TEXT::cacheShownText(), EDA_TEXT::m_text, and EDA_ITEM::Replace().

Referenced by SCH_SHEET_PIN::Replace(), SCH_FIELD::Replace(), and SCH_TEXT::Replace().

◆ Replace() [2/3]

bool EDA_ITEM::Replace ( const wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 145 of file eda_item.cpp.

146 {
147  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
148 
149  int result = searchString.Find( ( aSearchData.GetFlags() & wxFR_MATCHCASE ) ?
150  aSearchData.GetFindString() :
151  aSearchData.GetFindString().Upper() );
152 
153  if( result == wxNOT_FOUND )
154  return false;
155 
156  wxString prefix = aText.Left( result );
157  wxString suffix;
158 
159  if( aSearchData.GetFindString().length() + result < aText.length() )
160  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
161 
162  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
163  aText, prefix, aSearchData.GetReplaceString(), suffix );
164 
165  aText = prefix + aSearchData.GetReplaceString() + suffix;
166 
167  return true;
168 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Replace() [3/3]

virtual bool EDA_ITEM::Replace ( const wxFindReplaceData &  aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 392 of file eda_item.h.

393  {
394  return false;
395  }

◆ Rotate() [1/2]

void FP_TEXT::Rotate ( const wxPoint &  aOffset,
double  aAngle 
)
overridevirtual

Rotate text, in footprint editor (for instance in footprint rotation transform)

Reimplemented from BOARD_ITEM.

Definition at line 123 of file fp_text.cpp.

124 {
125  // Used in footprint editing
126  // Note also in footprint editor, m_Pos0 = m_Pos
127 
128  wxPoint pt = GetTextPos();
129  RotatePoint( &pt, aRotCentre, aAngle );
130  SetTextPos( pt );
131 
132  SetTextAngle( GetTextAngle() + aAngle );
133  SetLocalCoord();
134 }
void SetTextAngle(double aAngle) override
Definition: fp_text.cpp:73
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
double GetTextAngle() const
Definition: eda_text.h:174
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
void SetLocalCoord()
Definition: fp_text.cpp:209
const wxPoint & GetTextPos() const
Definition: eda_text.h:247

References EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), RotatePoint(), SetLocalCoord(), SetTextAngle(), and EDA_TEXT::SetTextPos().

◆ Rotate() [2/2]

void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 291 of file board_item.h.

292  {
293  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
294  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.cpp:191

References BOARD_ITEM::Rotate(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Set() [1/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ SetBold()

◆ SetBrightened()

◆ SetDrawCoord()

void FP_TEXT::SetDrawCoord ( )

Set relative coordinates.

Definition at line 190 of file fp_text.cpp.

191 {
192  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
193 
194  SetTextPos( m_Pos0 );
195 
196  if( parentFootprint )
197  {
198  double angle = parentFootprint->GetOrientation();
199 
200  wxPoint pt = GetTextPos();
201  RotatePoint( &pt, angle );
202  SetTextPos( pt );
203 
204  Offset( parentFootprint->GetPosition() );
205  }
206 }
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:252
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
double GetOrientation() const
Definition: footprint.h:190
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:242
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
wxPoint GetPosition() const override
Definition: footprint.h:186
const wxPoint & GetTextPos() const
Definition: eda_text.h:247

References PNS::angle(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), EDA_TEXT::GetTextPos(), EDA_ITEM::m_parent, m_Pos0, EDA_TEXT::Offset(), RotatePoint(), and EDA_TEXT::SetTextPos().

Referenced by PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), FP_TEXT(), KeepUpright(), LEGACY_PLUGIN::loadMODULE_TEXT(), FOOTPRINT::MoveAnchorPosition(), FOOTPRINT::SetOrientation(), and SetPos0().

◆ SetEffects() [1/2]

void FP_TEXT::SetEffects ( const FP_TEXT aSrc)
inline

Set the text effects from another instance.

Definition at line 146 of file fp_text.h.

147  {
148  EDA_TEXT::SetEffects( aSrc );
149  SetLocalCoord();
150  // SetType( aSrc.GetType() );
151  }
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
Definition: eda_text.cpp:129
void SetLocalCoord()
Definition: fp_text.cpp:209

References EDA_TEXT::SetEffects(), and SetLocalCoord().

Referenced by processTextItem().

◆ SetEffects() [2/2]

void EDA_TEXT::SetEffects ( const EDA_TEXT aSrc)
inherited

Set the text effects from another instance.

TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual text string itself.

Definition at line 129 of file eda_text.cpp.

130 {
131  m_e = aSrc.m_e;
132 }
TEXT_EFFECTS m_e
Definition: eda_text.h:389

References EDA_TEXT::m_e.

Referenced by LIB_TEXT::Clone(), LIB_FIELD::Copy(), SCH_FIELD::ImportValues(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), LIB_FIELD::operator=(), DIALOG_CHANGE_SYMBOLS::processSymbol(), CLIPBOARD_IO::SaveSelection(), and SetEffects().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 153 of file eda_item.h.

153 { m_flags |= aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 204 of file eda_item.h.

204 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetHorizJustify()

void EDA_TEXT::SetHorizJustify ( EDA_TEXT_HJUSTIFY_T  aType)
inlineinherited

Definition at line 201 of file eda_text.h.

201 { m_e.hjustify = aType; };
TEXT_EFFECTS m_e
Definition: eda_text.h:389
signed char hjustify
horizontal justification
Definition: eda_text.h:101

References TEXT_EFFECTS::hjustify, and EDA_TEXT::m_e.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_GLOBALLABEL::AutoplaceFields(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), eagleToKicadAlignment(), EDA_TEXT_DESC::EDA_TEXT_DESC(), ALTIUM_PCB::HelperParseDimensions6Radial(), AUTOPLACER::justifyField(), KeepUpright(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EDIT_TOOL::Mirror(), LIB_TEXT::MirrorHorizontal(), SCH_GLOBALLABEL::MirrorHorizontally(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MirrorVertical(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), ALTIUM_PCB::ParseTexts6Data(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), PCAD2KICAD::SetTextJustify(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetItalic()

void EDA_TEXT::SetItalic ( bool  isItalic)
inlineinherited

Definition at line 179 of file eda_text.h.

179 { m_e.Bit( TE_ITALIC, isItalic ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

References TEXT_EFFECTS::Bit(), EDA_TEXT::m_e, and EDA_TEXT::TE_ITALIC.

Referenced by PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT_DESC::EDA_TEXT_DESC(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), SCH_LEGACY_PLUGIN_CACHE::loadField(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_LEGACY_PLUGIN::loadSymbol(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseLabel(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetKeepUpright()

◆ SetLayer()

virtual void BOARD_ITEM::SetLayer ( PCB_LAYER_ID  aLayer)
inlinevirtualinherited

Set the layer this item is on.

This method is virtual because some items (in fact: class DIMENSION) have a slightly different initialization.

Parameters
aLayerThe layer number.

Reimplemented in PCB_DIMENSION_BASE, ZONE, and PCB_GROUP.

Definition at line 192 of file board_item.h.

193  {
194  m_layer = aLayer;
195  }
PCB_LAYER_ID m_layer
Definition: board_item.h:353

References BOARD_ITEM::m_layer.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToFootprint(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), PCAD2KICAD::PCB_LINE::AddToFootprint(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), BOOST_AUTO_TEST_CASE(), ZONE_CREATE_HELPER::commitZone(), CONVERT_TOOL::CreateLines(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), MICROWAVE_TOOL::createPolygonShape(), CONVERT_TOOL::CreatePolys(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), PAD_TOOL::explodePad(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), Flip(), FOOTPRINT::Flip(), PCB_ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), FP_TEXT(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), initTextTable(), LEGACY_PLUGIN::loadFOOTPRINT(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), FABMASTER::loadPolygon(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), main(), DSN::SPECCTRA_DB::makeTRACK(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), GRAPHICS_CLEANER::mergeRects(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), DRAWING_TOOL::PlaceCharacteristics(), DRAWING_TOOL::PlaceStackup(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), DIALOG_PAD_PROPERTIES::redraw(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_DIMENSION_BASE::SetLayer(), GLOBAL_EDIT_TOOL::swapBoardItem(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetLayerSet()

virtual void BOARD_ITEM::SetLayerSet ( LSET  aLayers)
inlinevirtualinherited

Reimplemented in PAD, PCB_VIA, and ZONE.

Definition at line 177 of file board_item.h.

178  {
179  wxFAIL_MSG( "Attempted to SetLayerSet() on a single-layer object." );
180 
181  // Derived classes which support multiple layers must implement this
182  }

Referenced by PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ SetLocalCoord()

void FP_TEXT::SetLocalCoord ( )

Definition at line 209 of file fp_text.cpp.

210 {
211  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
212 
213  if( parentFootprint )
214  {
215  m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
216 
217  double angle = parentFootprint->GetOrientation();
218 
219  RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
220  }
221  else
222  {
223  m_Pos0 = GetTextPos();
224  }
225 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
double GetOrientation() const
Definition: footprint.h:190
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:242
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
wxPoint GetPosition() const override
Definition: footprint.h:186
const wxPoint & GetTextPos() const
Definition: eda_text.h:247

References PNS::angle(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), EDA_TEXT::GetTextPos(), EDA_ITEM::m_parent, m_Pos0, and RotatePoint().

Referenced by Flip(), EAGLE_PLUGIN::loadElements(), FABMASTER::loadFootprints(), Mirror(), Move(), ALTIUM_PCB::ParseTexts6Data(), Rotate(), SetEffects(), SetPosition(), SwapEffects(), and DIALOG_TEXT_PROPERTIES::TransferDataFromWindow().

◆ SetLocked()

◆ SetMirrored()

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetMultilineAllowed()

void EDA_TEXT::SetMultilineAllowed ( bool  aAllow)
inlineinherited
Parameters
aAllowtrue if ok to use multiline option, false if ok to use only single line text. (Single line is faster in calculations than multiline.)

Definition at line 195 of file eda_text.h.

195 { m_e.Bit( TE_MULTILINE, aAllow ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

References TEXT_EFFECTS::Bit(), EDA_TEXT::m_e, and EDA_TEXT::TE_MULTILINE.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), PCB_TEXT::PCB_TEXT(), SCH_HIERLABEL::SCH_HIERLABEL(), SCH_LABEL::SCH_LABEL(), and SCH_TEXT::SCH_TEXT().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in PCB_DIMENSION_BASE.

Definition at line 116 of file eda_item.h.

116 { m_parent = aParent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479

References EDA_ITEM::m_parent.

Referenced by FOOTPRINT::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), FOOTPRINT::operator=(), LIB_SYMBOL::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_SHEET::SwapData(), SCH_GLOBALLABEL::SwapData(), SCH_SYMBOL::SwapData(), and SwapItemData().

◆ SetParentGroup()

void BOARD_ITEM::SetParentGroup ( PCB_GROUP aGroup)
inlineinherited

Definition at line 90 of file board_item.h.

90 { m_group = aGroup; }
PCB_GROUP * m_group
Definition: board_item.h:354

References BOARD_ITEM::m_group.

Referenced by PCB_GROUP::AddItem(), and PCB_GROUP::RemoveItem().

◆ SetPos0()

void FP_TEXT::SetPos0 ( const wxPoint &  aPos)
inline

Definition at line 165 of file fp_text.h.

165 { m_Pos0 = aPos; SetDrawCoord(); }
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:190
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
Definition: fp_text.h:242

References m_Pos0, and SetDrawCoord().

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), LEGACY_PLUGIN::loadMODULE_TEXT(), FOOTPRINT::MoveAnchorPosition(), and EAGLE_PLUGIN::packageText().

◆ SetPosition()

virtual void FP_TEXT::SetPosition ( const wxPoint &  aPos)
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 93 of file fp_text.h.

94  {
95  EDA_TEXT::SetTextPos( aPos );
96  SetLocalCoord();
97  }
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:246
void SetLocalCoord()
Definition: fp_text.cpp:209

References SetLocalCoord(), and EDA_TEXT::SetTextPos().

Referenced by MICROWAVE_TOOL::createMicrowaveInductor(), and PCB_BASE_FRAME::CreateNewFootprint().

◆ SetSelected()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 142 of file eda_item.h.

143  {
144  if( state )
145  m_status |= type; // state = ON or OFF
146  else
147  m_status &= ~type;
148  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), and BOARD_ITEM::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 151 of file eda_item.h.

151 { m_status = aStatus; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetText()

void EDA_TEXT::SetText ( const wxString &  aText)
virtualinherited

Definition at line 114 of file eda_text.cpp.

115 {
116  m_text = aText;
117  cacheShownText();
118 }
void cacheShownText()
Definition: eda_text.cpp:179
wxString m_text
Definition: eda_text.h:385

References EDA_TEXT::cacheShownText(), and EDA_TEXT::m_text.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), LIB_TEXT::Clone(), createBoard(), PCB_BASE_FRAME::CreateNewFootprint(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), FOOTPRINT::DuplicateItem(), EDA_TEXT_DESC::EDA_TEXT_DESC(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_FIELD::HitTest(), SCH_TEXT::IncrementLabel(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_LEGACY_PLUGIN_CACHE::loadField(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadFrame(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_LEGACY_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), TUNER_SLIDER::onSave(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), LIB_FIELD::operator=(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetEntry(), SCH_ALTIUM_PLUGIN::ParseSheetName(), ALTIUM_PCB::ParseTexts6Data(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), LIB_SYMBOL::PlotLibFields(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), CLIPBOARD_IO::SaveSelection(), SCH_SYMBOL::SCH_SYMBOL(), LIB_SYMBOL::SetName(), SCH_SYMBOL::SetRef(), FOOTPRINT::SetReference(), FOOTPRINT::SetValue(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_LIB_FIELD_PROPERTIES::UpdateField(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), SCH_SYMBOL::UpdateFields(), SCH_SHEET_LIST::UpdateSymbolInstances(), and PCB_DIMENSION_BASE::updateText().

◆ SetTextAngle()

void FP_TEXT::SetTextAngle ( double  aAngle)
overridevirtual

Reimplemented from EDA_TEXT.

Definition at line 73 of file fp_text.cpp.

74 {
76 }
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:167
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition: trigo.h:254

References NormalizeAngle360Min(), and EDA_TEXT::SetTextAngle().

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), Flip(), KeepUpright(), LEGACY_PLUGIN::loadMODULE_TEXT(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), ALTIUM_PCB::ParseTexts6Data(), and Rotate().

◆ SetTextHeight()

void EDA_TEXT::SetTextHeight ( int  aHeight)
inlineinherited

◆ SetTextPos()

void EDA_TEXT::SetTextPos ( const wxPoint &  aPoint)
inlineinherited

Definition at line 246 of file eda_text.h.

246 { m_e.pos = aPoint; }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
wxPoint pos
Definition: eda_text.h:106

References EDA_TEXT::m_e, and TEXT_EFFECTS::pos.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(), SCH_GLOBALLABEL::AutoplaceFields(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_TEXT::CalcEdit(), LIB_FIELD::CalcEdit(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), FP_TEXT(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_LEGACY_PLUGIN::loadSymbol(), PCB_DIMENSION_BASE::Mirror(), SCH_GLOBALLABEL::MirrorSpinStyle(), LIB_TEXT::MoveTo(), LIB_FIELD::MoveTo(), LIB_TEXT::NormalizeJustification(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseSchText(), DRAWING_TOOL::PlaceText(), DIALOG_CHANGE_SYMBOLS::processSymbol(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), Rotate(), LIB_FIELD::Rotate(), SCH_TEXT::Rotate(), PCB_DIMENSION_BASE::Rotate(), SCH_GLOBALLABEL::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_FIELD::SCH_FIELD(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SCH_TEXT::SCH_TEXT(), SetDrawCoord(), PCB_TEXT::SetPosition(), SetPosition(), SCH_FIELD::SetPosition(), SCH_TEXT::SetPosition(), DS_DRAW_ITEM_TEXT::SetPosition(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), SCH_SYMBOL::UpdateFields(), DIALOG_FIELD_PROPERTIES::updateText(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_ORTHOGONAL::updateText().

◆ SetTextSize()

void EDA_TEXT::SetTextSize ( const wxSize &  aNewSize)
inlineinherited

Definition at line 237 of file eda_text.h.

237 { m_e.size = aNewSize; }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
wxSize size
Definition: eda_text.h:103

References EDA_TEXT::m_e, and TEXT_EFFECTS::size.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), SCH_EAGLE_PLUGIN::addImplicitConnections(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT::EDA_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), LIB_TEXT::LIB_TEXT(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), SCH_EAGLE_PLUGIN::loadFrame(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSheet(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseLabel(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BACK_ANNOTATE::processNetNameChange(), PCB_DIMENSION_BASE::SetTextSize(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), SCH_GLOBALLABEL::UpdateIntersheetRefProps(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetTextThickness()

void EDA_TEXT::SetTextThickness ( int  aWidth)
inlineinherited

The TextThickness is that set by the user.

The EffectiveTextPenWidth also factors in bold text and thickness clamping.

Definition at line 159 of file eda_text.h.

159 { m_e.penwidth = aWidth; };
TEXT_EFFECTS m_e
Definition: eda_text.h:389
int penwidth
Definition: eda_text.h:104

References EDA_TEXT::m_e, and TEXT_EFFECTS::penwidth.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), GRAPHICS_IMPORTER_PCBNEW::AddText(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), SCH_EDIT_TOOL::ChangeTextType(), MICROWAVE_TOOL::createBaseFootprint(), PCB_BASE_FRAME::CreateNewFootprint(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawSpecificationStackup(), DS_DRAW_ITEM_TEXT::DS_DRAW_ITEM_TEXT(), EDA_TEXT_DESC::EDA_TEXT_DESC(), FP_TEXT(), ALTIUM_PCB::HelperParseDimensions6Linear(), ALTIUM_PCB::HelperParseDimensions6Radial(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadTextAttributes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::orientFPText(), EAGLE_PLUGIN::packageText(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), ALTIUM_PCB::ParseTexts6Data(), DRAWING_TOOL::PlaceText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), LIB_TEXT::SetWidth(), LIB_FIELD::SetWidth(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), and SCH_GLOBALLABEL::UpdateIntersheetRefProps().

◆ SetTextWidth()

void EDA_TEXT::SetTextWidth ( int  aWidth)
inlineinherited

◆ SetTextX()

◆ SetTextY()

void EDA_TEXT::SetTextY ( int  aY)
inlineinherited

◆ SetType()

void FP_TEXT::SetType ( TEXT_TYPE  aType)
inline
Deprecated:
it seems (but the type is used to 'protect'

Definition at line 140 of file fp_text.h.

140 { m_Type = aType; }
TEXT_TYPE m_Type
0=ref, 1=val, etc.
Definition: fp_text.h:240

References m_Type.

Referenced by PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), FOOTPRINT::DuplicateItem(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), and LEGACY_PLUGIN::loadMODULE_TEXT().

◆ SetVertJustify()

◆ SetVisible()

virtual void EDA_TEXT::SetVisible ( bool  aVisible)
inlinevirtualinherited

Reimplemented in PCB_TEXT.

Definition at line 185 of file eda_text.h.

185 { m_e.Bit( TE_VISIBLE, aVisible ); }
TEXT_EFFECTS m_e
Definition: eda_text.h:389
void Bit(int aBit, bool aValue)
Definition: eda_text.h:108

References TEXT_EFFECTS::Bit(), EDA_TEXT::m_e, and EDA_TEXT::TE_VISIBLE.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), SCH_EDITOR_CONTROL::AssignFootprints(), PCB_BASE_FRAME::CreateNewFootprint(), EDA_TEXT_DESC::EDA_TEXT_DESC(), LIB_FIELD::Init(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_EAGLE_PLUGIN::loadFieldAttributes(), FABMASTER::loadFootprints(), SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_LEGACY_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), ALTIUM_PCB::ParseComponents6Data(), SCH_ALTIUM_PLUGIN::ParseDesignator(), SCH_SEXPR_PARSER::parseEDA_TEXT(), PCB_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseFileName(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseSheetName(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), DIALOG_CHANGE_SYMBOLS::processSymbol(), processTextItem(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_FIELD::SCH_FIELD(), SCH_EDIT_FRAME::ShowAllIntersheetRefs(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_FIELD_PROPERTIES::updateText().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 128 of file eda_item.h.

128 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 117 of file board_item.h.

118  {
119  wxPoint p( aX, GetY() );
120  SetPosition( p );
121  }
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:253
int GetY() const
Definition: board_item.h:101

References BOARD_ITEM::GetY(), and EDA_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ SetY()

void BOARD_ITEM::SetY ( int  aY)
inlineinherited

Definition at line 123 of file board_item.h.

124  {
125  wxPoint p( GetX(), aY );
126  SetPosition( p );
127  }
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:253
int GetX() const
Definition: board_item.h:95

References BOARD_ITEM::GetX(), and EDA_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ ShortenedShownText()

wxString EDA_TEXT::ShortenedShownText ( ) const
inherited

Returns a shortened version (max 15 characters) of the shown text.

Definition at line 208 of file eda_text.cpp.

209 {
210  wxString tmp = GetShownText();
211 
212  tmp.Replace( wxT( "\n" ), wxT( " " ) );
213  tmp.Replace( wxT( "\r" ), wxT( " " ) );
214  tmp.Replace( wxT( "\t" ), wxT( " " ) );
215 
216  if( tmp.Length() > 36 )
217  tmp = tmp.Left( 34 ) + wxT( "..." );
218 
219  return tmp;
220 }
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141

References EDA_TEXT::GetShownText().

Referenced by LIB_TEXT::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), LIB_FIELD::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), SCH_FIELD::GetSelectMenuText(), GetSelectMenuText(), SCH_TEXT::GetSelectMenuText(), SCH_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), and SCH_HIERLABEL::GetSelectMenuText().

◆ ShowShape()

wxString BOARD_ITEM::ShowShape ( SHAPE_T  aShape)
staticinherited

Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.

Definition at line 35 of file board_item.cpp.

36 {
37  switch( aShape )
38  {
39  case SHAPE_T::SEGMENT: return _( "Line" );
40  case SHAPE_T::RECT: return _( "Rect" );
41  case SHAPE_T::ARC: return _( "Arc" );
42  case SHAPE_T::CIRCLE: return _( "Circle" );
43  case SHAPE_T::BEZIER: return _( "Bezier Curve" );
44  case SHAPE_T::POLY: return _( "Polygon" );
45  default: return wxT( "??" );
46  }
47 }
Arcs (with rounded ends)
Bezier Curve.
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
#define _(s)
segment with non rounded ends

References _, ARC, BEZIER, CIRCLE, POLY, RECT, and SEGMENT.

Referenced by ConvertOutlineToPolygon(), PCB_SHAPE::GetLength(), FP_SHAPE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 421 of file eda_item.h.

421 { return *aLeft < *aRight; }

◆ SwapData()

void BOARD_ITEM::SwapData ( BOARD_ITEM aImage)
virtualinherited

Swap data between aItem and aImage.

aItem and aImage should have the same type.

Used in undo and redo commands to swap values between an item and its copy. Only values like layer, size .. which are modified by editing are swapped.

Parameters
aImagethe item image which contains data to swap.

Reimplemented in ZONE, FOOTPRINT, PAD, PCB_DIM_CENTER, PCB_DIM_LEADER, PCB_VIA, PCB_DIM_ORTHOGONAL, PCB_DIM_ALIGNED, PCB_SHAPE, PCB_ARC, PCB_TRACK, PCB_TEXT, PCB_GROUP, and PCB_TARGET.

Definition at line 151 of file board_item.cpp.

152 {
153 }

Referenced by BOARD_COMMIT::Revert(), and SwapItemData().

◆ SwapEffects() [1/2]

void FP_TEXT::SwapEffects ( FP_TEXT aTradingPartner)
inline

Swap the text effects of the two involved instances.

Definition at line 156 of file fp_text.h.

157  {
158  EDA_TEXT::SwapEffects( aTradingPartner );
159  SetLocalCoord();
160  aTradingPartner.SetLocalCoord();
161  // std::swap( m_Type, aTradingPartner.m_Type );
162  }
void SwapEffects(EDA_TEXT &aTradingPartner)
Swap the text effects of the two involved instances.
Definition: eda_text.cpp:143
void SetLocalCoord()
Definition: fp_text.cpp:209

References SetLocalCoord(), and EDA_TEXT::SwapEffects().

◆ SwapEffects() [2/2]

void EDA_TEXT::SwapEffects ( EDA_TEXT aTradingPartner)
inherited

Swap the text effects of the two involved instances.

TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual text string itself.

Definition at line 143 of file eda_text.cpp.

144 {
145  std::swap( m_e, aTradingPartner.m_e );
146 }
TEXT_EFFECTS m_e
Definition: eda_text.h:389

References EDA_TEXT::m_e.

Referenced by SCH_FIELD::SwapData(), SCH_TEXT::SwapData(), and SwapEffects().

◆ SwapText()

void EDA_TEXT::SwapText ( EDA_TEXT aTradingPartner)
inherited

Definition at line 135 of file eda_text.cpp.

136 {
137  std::swap( m_text, aTradingPartner.m_text );
138  std::swap( m_shown_text, aTradingPartner.m_shown_text );
140 }
wxString m_shown_text
Definition: eda_text.h:386
bool m_shown_text_has_text_var_refs
Definition: eda_text.h:387
wxString m_text
Definition: eda_text.h:385

References EDA_TEXT::m_shown_text, EDA_TEXT::m_shown_text_has_text_var_refs, and EDA_TEXT::m_text.

Referenced by SCH_FIELD::SwapData(), and SCH_TEXT::SwapData().

◆ TextHitTest() [1/2]

bool FP_TEXT::TextHitTest ( const wxPoint &  aPoint,
int  aAccuracy = 0 
) const
overridevirtual

Test if aPoint is within the bounds of this object.

Parameters
aPointA wxPoint to test.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented from EDA_TEXT.

Definition at line 79 of file fp_text.cpp.

80 {
81  EDA_RECT rect = GetTextBox();
82  wxPoint location = aPoint;
83 
84  rect.Inflate( aAccuracy );
85 
86  RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
87 
88  return rect.Contains( location );
89 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:229
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), GetDrawRotation(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), EDA_RECT::Inflate(), and RotatePoint().

Referenced by HitTest().

◆ TextHitTest() [2/2]

bool FP_TEXT::TextHitTest ( const EDA_RECT aRect,
bool  aContains,
int  aAccuracy = 0 
) const
overridevirtual

Test if object bounding box is contained within or intersects aRect.

Parameters
aRectRect to test against.
aContainsTest for containment instead of intersection if true.
aAccuracyAmount to inflate the bounding box.
Returns
true if a hit, else false.

Reimplemented from EDA_TEXT.

Definition at line 92 of file fp_text.cpp.

93 {
94  EDA_RECT rect = aRect;
95 
96  rect.Inflate( aAccuracy );
97 
98  if( aContains )
99  return rect.Contains( GetBoundingBox() );
100  else
101  return rect.Intersects( GetTextBox(), GetDrawRotation() );
102 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:229
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
Definition: fp_text.cpp:227
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), GetBoundingBox(), GetDrawRotation(), EDA_TEXT::GetTextBox(), EDA_RECT::Inflate(), and EDA_RECT::Intersects().

◆ TransformBoundingBoxWithClearanceToPolygon()

void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aClearanceValue 
) const
inherited

Convert the text bounding box to a rectangular polygon depending on the text orientation, the bounding box is not always horizontal or vertical.

Used in filling zones calculations Circles and arcs are approximated by segments

Parameters
aCornerBuffera buffer to store the polygon.
aClearanceValuethe clearance around the text bounding box to the real clearance value (usually near from 1.0).

Definition at line 358 of file board_items_to_polygon_shape_transform.cpp.

360 {
361  if( GetText().Length() == 0 )
362  return;
363 
364  wxPoint corners[4]; // Buffer of polygon corners
365 
366  EDA_RECT rect = GetTextBox();
367  rect.Inflate( aClearanceValue + Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
368  corners[0].x = rect.GetOrigin().x;
369  corners[0].y = rect.GetOrigin().y;
370  corners[1].y = corners[0].y;
371  corners[1].x = rect.GetRight();
372  corners[2].x = corners[1].x;
373  corners[2].y = rect.GetBottom();
374  corners[3].y = corners[2].y;
375  corners[3].x = corners[0].x;
376 
377  aCornerBuffer->NewOutline();
378 
379  for( wxPoint& corner : corners )
380  {
381  // Rotate polygon
382  RotatePoint( &corner.x, &corner.y, GetTextPos().x, GetTextPos().y, GetTextAngle() );
383  aCornerBuffer->Append( corner.x, corner.y );
384  }
385 }
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:229
double GetTextAngle() const
Definition: eda_text.h:174
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int GetBottom() const
Definition: eda_rect.h:114
#define DEFAULT_TEXT_WIDTH
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
int GetRight() const
Definition: eda_rect.h:111
int NewOutline()
Creates a new hole in a given outline.
Handle the component boundary box.
Definition: eda_rect.h:42
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
static constexpr int Millimeter2iu(double mm)
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
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...

References SHAPE_POLY_SET::Append(), DEFAULT_TEXT_WIDTH, EDA_RECT::GetBottom(), EDA_RECT::GetOrigin(), EDA_RECT::GetRight(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextPos(), EDA_RECT::Inflate(), Millimeter2iu(), SHAPE_POLY_SET::NewOutline(), and RotatePoint().

Referenced by PCB_TEXT::TransformShapeWithClearanceToPolygon(), and TransformShapeWithClearanceToPolygon().

◆ TransformShapeWithClearanceToPolygon()

void FP_TEXT::TransformShapeWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
PCB_LAYER_ID  aLayer,
int  aClearanceValue,
int  aError,
ERROR_LOC  aErrorLoc,
bool  ignoreLineWidth 
) const
overridevirtual

Convert the item shape to a closed polygon.

Used in filling zones calculations. Circles and arcs are approximated by segments.

Parameters
aCornerBuffera buffer to store the polygon.
aClearanceValuethe clearance around the pad.
aErrorthe maximum deviation from true circle.
aErrorLocshould the approximation error be placed outside or inside the polygon?
ignoreLineWidthused for edge cut items where the line width is only for visualization.

Reimplemented from BOARD_ITEM.

Definition at line 309 of file board_items_to_polygon_shape_transform.cpp.

313 {
314  SHAPE_POLY_SET buffer;
316 
317  const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
318 
319  if( parentFootprint )
320  buffer.Rotate( DECIDEG2RAD( GetDrawRotation() ), GetTextPos() );
321 
322  aCornerBuffer.Append( buffer );
323 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void TransformBoundingBoxWithClearanceToPolygon(SHAPE_POLY_SET *aCornerBuffer, int aClearanceValue) const
Convert the text bounding box to a rectangular polygon depending on the text orientation,...
Represent a set of closed polygons.
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
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...

References SHAPE_POLY_SET::Append(), DECIDEG2RAD(), GetDrawRotation(), EDA_TEXT::GetTextPos(), EDA_ITEM::m_parent, SHAPE_POLY_SET::Rotate(), and EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon().

◆ TransformTextShapeWithClearanceToPolygon()

void FP_TEXT::TransformTextShapeWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
PCB_LAYER_ID  aLayer,
int  aClearanceValue,
int  aError,
ERROR_LOC  aErrorLoc 
) const

Definition at line 290 of file board_items_to_polygon_shape_transform.cpp.

293 {
294  prms.m_cornerBuffer = &aCornerBuffer;
295  prms.m_textWidth = GetEffectiveTextPenWidth() + ( 2 * aClearance );
296  prms.m_error = aError;
297  wxSize size = GetTextSize();
298  int penWidth = GetEffectiveTextPenWidth();
299 
300  if( IsMirrored() )
301  size.x = -size.x;
302 
303  GRText( nullptr, GetTextPos(), BLACK, GetShownText(), GetDrawRotation(), size,
304  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
306 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:239
bool IsBold() const
Definition: eda_text.h:183
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
bool IsMirrored() const
Definition: eda_text.h:189
static void addTextSegmToPoly(int x0, int y0, int xf, int yf, void *aData)
void GRText(wxDC *aDC, const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
Definition: gr_text.cpp:129
Definition: color4d.h:44
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:149
bool IsItalic() const
Definition: eda_text.h:180
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
TSEGM_2_POLY_PRMS prms
const wxSize & GetTextSize() const
Definition: eda_text.h:238
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:414

References addTextSegmToPoly(), BLACK, GetDrawRotation(), EDA_TEXT::GetEffectiveTextPenWidth(), EDA_TEXT::GetHorizJustify(), GetShownText(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), GRText(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), TSEGM_2_POLY_PRMS::m_cornerBuffer, TSEGM_2_POLY_PRMS::m_error, TSEGM_2_POLY_PRMS::m_textWidth, and prms.

◆ TransformToSegmentList()

std::vector< wxPoint > EDA_TEXT::TransformToSegmentList ( ) const
inherited

Convert the text shape to a list of segment.

Each segment is stored as 2 wxPoints: the starting point and the ending point there are therefore 2*n points.

Definition at line 593 of file eda_text.cpp.

594 {
595  std::vector<wxPoint> cornerBuffer;
596  wxSize size = GetTextSize();
597 
598  if( IsMirrored() )
599  size.x = -size.x;
600 
601  bool forceBold = true;
602  int penWidth = 0; // use max-width for bold text
603 
604  COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
605 
606  if( IsMultilineAllowed() )
607  {
608  wxArrayString strings_list;
609  wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
610  std::vector<wxPoint> positions;
611  positions.reserve( strings_list.Count() );
612  GetLinePositions( positions, strings_list.Count() );
613 
614  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
615  {
616  wxString txt = strings_list.Item( ii );
617  GRText( nullptr, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
618  GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
619  &cornerBuffer );
620  }
621  }
622  else
623  {
624  GRText( nullptr, GetTextPos(), color, GetShownText(), GetDrawRotation(), size,
625  GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), forceBold,
626  addTextSegmToBuffer, &cornerBuffer );
627  }
628 
629  return cornerBuffer;
630 }
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:199
bool IsMirrored() const
Definition: eda_text.h:189
int color
Definition: DXF_plotter.cpp:57
static void addTextSegmToBuffer(int x0, int y0, int xf, int yf, void *aData)
Definition: eda_text.cpp:585
void GRText(wxDC *aDC, const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
Definition: gr_text.cpp:129
virtual double GetDrawRotation() const
Definition: eda_text.cpp:646
Definition: color4d.h:44
bool IsItalic() const
Definition: eda_text.h:180
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:198
const wxSize & GetTextSize() const
Definition: eda_text.h:238
bool IsMultilineAllowed() const
Definition: eda_text.h:196
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:430
const wxPoint & GetTextPos() const
Definition: e