KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DS_DATA_ITEM_TEXT Class Reference

#include <ds_data_item.h>

Inheritance diagram for DS_DATA_ITEM_TEXT:
DS_DATA_ITEM

Public Types

enum  DS_ITEM_TYPE {
  DS_TEXT , DS_SEGMENT , DS_RECT , DS_POLYPOLYGON ,
  DS_BITMAP
}
 

Public Member Functions

 DS_DATA_ITEM_TEXT (const wxString &aTextBase)
 
void SyncDrawItems (DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
 
virtual int GetPenSizeIU () override
 
void IncrementLabel (int aIncr)
 Try to build text which is an increment of m_TextBase has meaning only if m_TextBase is a basic text (one char) If the basic char is a digit, build a number If the basic char is a letter, use the letter with ASCII code aIncr + (basic char ascc code)
 
void SetConstrainedTextSize ()
 Calculate m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text smaller than m_BoundingBoxSize if m_BoundingBoxSize.x or m_BoundingBoxSize.y > 0 if m_BoundingBoxSize.x or m_BoundingBoxSize.y == 0 the corresponding text size is not constrained.
 
bool ReplaceAntiSlashSequence ()
 Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
 
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems () const
 
void SetStart (double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor=RB_CORNER)
 
void SetEnd (double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor=RB_CORNER)
 
DS_ITEM_TYPE GetType () const
 
PAGE_OPTION GetPage1Option () const
 
void SetPage1Option (PAGE_OPTION aChoice)
 
const VECTOR2I GetStartPosIU (int ii=0) const
 
const VECTOR2I GetEndPosIU (int ii=0) const
 
const VECTOR2D GetStartPos (int ii=0) const
 
const VECTOR2D GetEndPos (int ii=0) const
 
void MoveTo (const VECTOR2D &aPosition)
 Move item to a new position.
 
void MoveToIU (const VECTOR2I &aPosition)
 Move item to a new position.
 
void MoveStartPointTo (const VECTOR2D &aPosition)
 Move the starting point of the item to a new position.
 
void MoveStartPointToIU (const VECTOR2I &aPosition)
 Move the starting point of the item to a new position.
 
void MoveEndPointTo (const VECTOR2D &aPosition)
 Move the ending point of the item to a new position.
 
void MoveEndPointToIU (const VECTOR2I &aPosition)
 Move the ending point of the item to a new position.
 
virtual bool IsInsidePage (int ii) const
 
const wxString GetClassName () const
 

Public Attributes

wxString m_TextBase
 
wxString m_FullText
 
double m_Orient
 
GR_TEXT_H_ALIGN_T m_Hjustify
 
GR_TEXT_V_ALIGN_T m_Vjustify
 
bool m_Italic
 
bool m_Bold
 
KIFONT::FONTm_Font
 
VECTOR2D m_TextSize
 
KIGFX::COLOR4D m_TextColor
 
VECTOR2D m_BoundingBoxSize
 
VECTOR2D m_ConstrainedTextSize
 
wxString m_Name
 
wxString m_Info
 
POINT_COORD m_Pos
 
POINT_COORD m_End
 
double m_LineWidth
 
int m_RepeatCount
 
VECTOR2D m_IncrementVector
 
int m_IncrementLabel
 

Protected Attributes

DS_ITEM_TYPE m_type
 
PAGE_OPTION m_pageOption
 
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
 

Detailed Description

Definition at line 297 of file ds_data_item.h.

Member Enumeration Documentation

◆ DS_ITEM_TYPE

Enumerator
DS_TEXT 
DS_SEGMENT 
DS_RECT 
DS_POLYPOLYGON 
DS_BITMAP 

Definition at line 98 of file ds_data_item.h.

Constructor & Destructor Documentation

◆ DS_DATA_ITEM_TEXT()

Member Function Documentation

◆ GetClassName()

const wxString DS_DATA_ITEM::GetClassName ( ) const
inherited

◆ GetDrawItems()

◆ GetEndPos()

◆ GetEndPosIU()

const VECTOR2I DS_DATA_ITEM::GetEndPosIU ( int ii = 0) const
inherited

◆ GetPage1Option()

PAGE_OPTION DS_DATA_ITEM::GetPage1Option ( ) const
inlineinherited
Returns
true if the item has a end point (segment; rect) of false (text, polygon).

Definition at line 133 of file ds_data_item.h.

References m_pageOption.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DS_DATA_MODEL_IO::formatOptions(), and DS_DRAW_ITEM_BASE::GetMsgPanelInfo().

◆ GetPenSizeIU()

int DS_DATA_ITEM_TEXT::GetPenSizeIU ( )
overridevirtual

◆ GetStartPos()

◆ GetStartPosIU()

◆ GetType()

◆ IncrementLabel()

void DS_DATA_ITEM_TEXT::IncrementLabel ( int aIncr)

Try to build text which is an increment of m_TextBase has meaning only if m_TextBase is a basic text (one char) If the basic char is a digit, build a number If the basic char is a letter, use the letter with ASCII code aIncr + (basic char ascc code)

Parameters
aIncr= the increment value return the incremented label in m_FullText

Definition at line 621 of file ds_data_item.cpp.

References m_FullText, and m_TextBase.

Referenced by SyncDrawItems().

◆ IsInsidePage()

bool DS_DATA_ITEM::IsInsidePage ( int ii) const
virtualinherited
Returns
true if the item is inside the rectangle defined by the 4 corners, false otherwise.

Reimplemented in DS_DATA_ITEM_POLYGONS.

Definition at line 342 of file ds_data_item.cpp.

References GetEndPos(), GetStartPos(), DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_LT_Corner, DS_DATA_MODEL::m_RB_Corner, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), and DS_DATA_ITEM_TEXT::SyncDrawItems().

◆ MoveEndPointTo()

void DS_DATA_ITEM::MoveEndPointTo ( const VECTOR2D & aPosition)
inherited

Move the ending point of the item to a new position.

This has meaning only for items defined by 2 points (segments and rectangles).

Parameters
aPositionis the new position of the ending point, in mm.

Definition at line 213 of file ds_data_item.cpp.

References DS_RECT, DS_SEGMENT, DS_DATA_MODEL::GetTheInstance(), GetType(), LB_CORNER, LT_CORNER, m_End, DS_DATA_MODEL::m_LT_Corner, DS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MoveEndPointToIU(), and MoveTo().

◆ MoveEndPointToIU()

void DS_DATA_ITEM::MoveEndPointToIU ( const VECTOR2I & aPosition)
inherited

Move the ending point of the item to a new position.

This has meaning only for items defined by 2 points (segments and rectangles).

Parameters
aPositionis the new position of the ending point in graphic units

Definition at line 256 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, MoveEndPointTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_POINT_EDITOR::updateItem().

◆ MoveStartPointTo()

void DS_DATA_ITEM::MoveStartPointTo ( const VECTOR2D & aPosition)
inherited

Move the starting point of the item to a new position.

Parameters
aPositionthe new position of the starting point, in mm.

Definition at line 171 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), LB_CORNER, LT_CORNER, DS_DATA_MODEL::m_LT_Corner, m_Pos, DS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MoveStartPointToIU(), and MoveTo().

◆ MoveStartPointToIU()

void DS_DATA_ITEM::MoveStartPointToIU ( const VECTOR2I & aPosition)
inherited

Move the starting point of the item to a new position.

Parameters
aPositionis the new position of item in graphic units.

Definition at line 204 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), MoveStartPointTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_DRAWING_TOOLS::PlaceItem(), and PL_POINT_EDITOR::updateItem().

◆ MoveTo()

void DS_DATA_ITEM::MoveTo ( const VECTOR2D & aPosition)
inherited

Move item to a new position.

Parameters
aPositionthe new position of item, in mm.

Definition at line 155 of file ds_data_item.cpp.

References GetEndPos(), GetEndPosIU(), GetStartPos(), GetStartPosIU(), m_drawItems, MoveEndPointTo(), and MoveStartPointTo().

Referenced by MoveToIU().

◆ MoveToIU()

void DS_DATA_ITEM::MoveToIU ( const VECTOR2I & aPosition)
inherited

Move item to a new position.

Parameters
aPositionthe new position of the starting point in graphic units.

Definition at line 145 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_DRAWING_TOOLS::DrawShape(), and PL_EDIT_TOOL::moveItem().

◆ ReplaceAntiSlashSequence()

bool DS_DATA_ITEM_TEXT::ReplaceAntiSlashSequence ( )

Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.

Returns
true if the EOL symbol is found or is inserted (multiline text).

Definition at line 640 of file ds_data_item.cpp.

References m_FullText.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), and SyncDrawItems().

◆ SetConstrainedTextSize()

void DS_DATA_ITEM_TEXT::SetConstrainedTextSize ( )

Calculate m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text smaller than m_BoundingBoxSize if m_BoundingBoxSize.x or m_BoundingBoxSize.y > 0 if m_BoundingBoxSize.x or m_BoundingBoxSize.y == 0 the corresponding text size is not constrained.

Definition at line 675 of file ds_data_item.cpp.

References DEGREES_T, dummy, FSCALE, BOX2< Vec >::GetHeight(), DS_DATA_MODEL::GetTheInstance(), BOX2< Vec >::GetWidth(), KiROUND(), m_Bold, m_BoundingBoxSize, m_ConstrainedTextSize, DS_DATA_MODEL::m_DefaultTextSize, m_Font, m_FullText, m_Hjustify, m_Italic, m_Orient, m_TextColor, m_TextSize, m_Vjustify, unityScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SyncDrawItems().

◆ SetEnd()

void DS_DATA_ITEM::SetEnd ( double aPosx,
double aPosy,
enum CORNER_ANCHOR aAnchor = RB_CORNER )
inlineinherited

Definition at line 121 of file ds_data_item.h.

References m_End, and RB_CORNER.

◆ SetPage1Option()

void DS_DATA_ITEM::SetPage1Option ( PAGE_OPTION aChoice)
inlineinherited

◆ SetStart()

void DS_DATA_ITEM::SetStart ( double aPosx,
double aPosy,
enum CORNER_ANCHOR aAnchor = RB_CORNER )
inlineinherited

Definition at line 114 of file ds_data_item.h.

References m_Pos, and RB_CORNER.

◆ SyncDrawItems()

Member Data Documentation

◆ m_Bold

◆ m_BoundingBoxSize

◆ m_ConstrainedTextSize

VECTOR2D DS_DATA_ITEM_TEXT::m_ConstrainedTextSize

Definition at line 348 of file ds_data_item.h.

Referenced by SetConstrainedTextSize(), and SyncDrawItems().

◆ m_drawItems

◆ m_End

◆ m_Font

◆ m_FullText

wxString DS_DATA_ITEM_TEXT::m_FullText

◆ m_Hjustify

◆ m_IncrementLabel

◆ m_IncrementVector

◆ m_Info

◆ m_Italic

◆ m_LineWidth

◆ m_Name

◆ m_Orient

◆ m_pageOption

PAGE_OPTION DS_DATA_ITEM::m_pageOption
protectedinherited

Definition at line 209 of file ds_data_item.h.

Referenced by DS_DATA_ITEM(), GetPage1Option(), and SetPage1Option().

◆ m_Pos

◆ m_RepeatCount

◆ m_TextBase

◆ m_TextColor

◆ m_TextSize

◆ m_type

DS_ITEM_TYPE DS_DATA_ITEM::m_type
protectedinherited

Definition at line 208 of file ds_data_item.h.

Referenced by DS_DATA_ITEM(), GetType(), and SyncDrawItems().

◆ m_Vjustify


The documentation for this class was generated from the following files: