KiCad PCB EDA Suite
DS_DATA_ITEM Class Reference

Drawing sheet structure type definitions. More...

#include <ds_data_item.h>

Inheritance diagram for DS_DATA_ITEM:
DS_DATA_ITEM_BITMAP DS_DATA_ITEM_POLYGONS DS_DATA_ITEM_TEXT

Public Types

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

Public Member Functions

 DS_DATA_ITEM (DS_ITEM_TYPE aType)
 
virtual ~DS_DATA_ITEM ()
 
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems () const
 
virtual void SyncDrawItems (DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView)
 
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 wxPoint GetStartPosUi (int ii=0) const
 
const wxPoint GetEndPosUi (int ii=0) const
 
const DPOINT GetStartPos (int ii=0) const
 
const DPOINT GetEndPos (int ii=0) const
 
virtual int GetPenSizeUi ()
 
void MoveTo (const DPOINT &aPosition)
 Move item to a new position. More...
 
void MoveToUi (const wxPoint &aPosition)
 Move item to a new position. More...
 
void MoveStartPointTo (const DPOINT &aPosition)
 Move the starting point of the item to a new position. More...
 
void MoveStartPointToUi (const wxPoint &aPosition)
 Move the starting point of the item to a new position. More...
 
void MoveEndPointTo (const DPOINT &aPosition)
 Move the ending point of the item to a new position. More...
 
void MoveEndPointToUi (const wxPoint &aPosition)
 Move the ending point of the item to a new position. More...
 
virtual bool IsInsidePage (int ii) const
 
const wxString GetClassName () const
 

Public Attributes

wxString m_Name
 
wxString m_Info
 
POINT_COORD m_Pos
 
POINT_COORD m_End
 
double m_LineWidth
 
int m_RepeatCount
 
DPOINT 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

Drawing sheet structure type definitions.

Basic items are:

  • segment and rect (defined by 2 points)
  • text (defined by a coordinate), the text and its justifications
  • poly polygon defined by a coordinate, and a set of list of corners ( because we use it for logos, there are more than one polygon in this description

Definition at line 95 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()

DS_DATA_ITEM::DS_DATA_ITEM ( DS_ITEM_TYPE  aType)

Definition at line 65 of file ds_data_item.cpp.

66 {
68  m_type = aType;
69  m_RepeatCount = 1;
70  m_IncrementLabel = 1;
71  m_LineWidth = 0;
72 }
double m_LineWidth
Definition: ds_data_item.h:202
int m_IncrementLabel
Definition: ds_data_item.h:205
PAGE_OPTION m_pageOption
Definition: ds_data_item.h:209
DS_ITEM_TYPE m_type
Definition: ds_data_item.h:208

References ALL_PAGES, m_IncrementLabel, m_LineWidth, m_pageOption, m_RepeatCount, and m_type.

◆ ~DS_DATA_ITEM()

DS_DATA_ITEM::~DS_DATA_ITEM ( )
virtual

Definition at line 75 of file ds_data_item.cpp.

76 {
77  for( DS_DRAW_ITEM_BASE* item : m_drawItems )
78  delete item;
79 }
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211

References m_drawItems.

Member Function Documentation

◆ GetClassName()

const wxString DS_DATA_ITEM::GetClassName ( ) const

Definition at line 364 of file ds_data_item.cpp.

365 {
366  wxString name;
367 
368  switch( GetType() )
369  {
370  case DS_TEXT: name = _( "Text" ); break;
371  case DS_SEGMENT: name = _( "Line" ); break;
372  case DS_RECT: name = _( "Rectangle" ); break;
373  case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
374  case DS_BITMAP: name = _( "Image" ); break;
375  }
376 
377  return name;
378 }
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
#define _(s)
const char * name
Definition: DXF_plotter.cpp:56

References _, DS_BITMAP, DS_POLYPOLYGON, DS_RECT, DS_SEGMENT, DS_TEXT, GetType(), and name.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

◆ GetDrawItems()

const std::vector<DS_DRAW_ITEM_BASE*>& DS_DATA_ITEM::GetDrawItems ( ) const
inline

◆ GetEndPos()

const DPOINT DS_DATA_ITEM::GetEndPos ( int  ii = 0) const

Definition at line 305 of file ds_data_item.cpp.

306 {
307  DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
308  m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
309 
310  switch( m_End.m_Anchor )
311  {
312  case RB_CORNER: // right bottom corner
314  break;
315 
316  case RT_CORNER: // right top corner
317  pos.x = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x;
318  pos.y = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y;
319  break;
320 
321  case LB_CORNER: // left bottom corner
322  pos.x = DS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x;
323  pos.y = DS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y;
324  break;
325 
326  case LT_CORNER: // left top corner
328  break;
329  }
330 
331  return pos;
332 }
POINT_COORD m_End
Definition: ds_data_item.h:201
DPOINT m_RB_Corner
DPOINT m_LT_Corner
DPOINT m_IncrementVector
Definition: ds_data_item.h:204
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ds_data_item.h:80

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

Referenced by GetEndPosUi(), IsInsidePage(), and MoveTo().

◆ GetEndPosUi()

const wxPoint DS_DATA_ITEM::GetEndPosUi ( int  ii = 0) const

Definition at line 335 of file ds_data_item.cpp.

336 {
337  DPOINT pos = GetEndPos( ii );
339  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
340 }
const DPOINT GetEndPos(int ii=0) const
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu
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 GetEndPos(), DS_DATA_MODEL::GetTheInstance(), KiROUND(), DS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MoveTo(), SyncDrawItems(), and PL_POINT_EDITOR::updateItem().

◆ GetPage1Option()

PAGE_OPTION DS_DATA_ITEM::GetPage1Option ( ) const
inline
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.

133 { return m_pageOption; }
PAGE_OPTION m_pageOption
Definition: ds_data_item.h:209

References m_pageOption.

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

◆ GetPenSizeUi()

int DS_DATA_ITEM::GetPenSizeUi ( )
virtual

Reimplemented in DS_DATA_ITEM_TEXT, and DS_DATA_ITEM_POLYGONS.

Definition at line 135 of file ds_data_item.cpp.

136 {
138 
139  if( m_LineWidth != 0 )
140  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
141  else
142  return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
143 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
double m_DefaultLineWidth
double m_LineWidth
Definition: ds_data_item.h:202
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu
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 DS_DATA_MODEL::GetTheInstance(), KiROUND(), DS_DATA_MODEL::m_DefaultLineWidth, m_LineWidth, and DS_DATA_MODEL::m_WSunits2Iu.

Referenced by SyncDrawItems().

◆ GetStartPos()

const DPOINT DS_DATA_ITEM::GetStartPos ( int  ii = 0) const

Definition at line 267 of file ds_data_item.cpp.

268 {
270  DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
271  m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
272 
273  switch( m_Pos.m_Anchor )
274  {
275  case RB_CORNER: // right bottom corner
276  pos = model.m_RB_Corner - pos;
277  break;
278 
279  case RT_CORNER: // right top corner
280  pos.x = model.m_RB_Corner.x - pos.x;
281  pos.y = model.m_LT_Corner.y + pos.y;
282  break;
283 
284  case LB_CORNER: // left bottom corner
285  pos.x = model.m_LT_Corner.x + pos.x;
286  pos.y = model.m_RB_Corner.y - pos.y;
287  break;
288 
289  case LT_CORNER: // left top corner
290  pos = model.m_LT_Corner + pos;
291  break;
292  }
293 
294  return pos;
295 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
DPOINT m_RB_Corner
DPOINT m_LT_Corner
DPOINT m_IncrementVector
Definition: ds_data_item.h:204
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ds_data_item.h:80
POINT_COORD m_Pos
Definition: ds_data_item.h:200

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

Referenced by DS_DATA_ITEM_POLYGONS::GetCornerPosition(), GetStartPosUi(), IsInsidePage(), DS_DATA_ITEM_POLYGONS::IsInsidePage(), and MoveTo().

◆ GetStartPosUi()

const wxPoint DS_DATA_ITEM::GetStartPosUi ( int  ii = 0) const

Definition at line 298 of file ds_data_item.cpp.

299 {
301  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
302 }
const DPOINT GetStartPos(int ii=0) const
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu
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 GetStartPos(), DS_DATA_MODEL::GetTheInstance(), KiROUND(), DS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_EDIT_TOOL::moveItem(), MoveTo(), PL_DRAWING_TOOLS::PlaceItem(), SyncDrawItems(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), DS_DATA_ITEM_TEXT::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), and PL_POINT_EDITOR::updateItem().

◆ GetType()

◆ IsInsidePage()

bool DS_DATA_ITEM::IsInsidePage ( int  ii) const
virtual
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 343 of file ds_data_item.cpp.

344 {
346 
347  DPOINT pos = GetStartPos( ii );
348 
349  for( int kk = 0; kk < 1; kk++ )
350  {
351  if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
352  return false;
353 
354  if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
355  return false;
356 
357  pos = GetEndPos( ii );
358  }
359 
360  return true;
361 }
const DPOINT GetEndPos(int ii=0) const
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
const DPOINT GetStartPos(int ii=0) const
DPOINT m_RB_Corner
DPOINT m_LT_Corner
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application

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_TEXT::SyncDrawItems(), and DS_DATA_ITEM_BITMAP::SyncDrawItems().

◆ MoveEndPointTo()

void DS_DATA_ITEM::MoveEndPointTo ( const DPOINT aPosition)

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 214 of file ds_data_item.cpp.

215 {
217  DPOINT position;
218 
219  // Calculate the position of the starting point
220  // relative to the reference corner
221  // aPosition is the position relative to the right top paper corner
222  switch( m_End.m_Anchor )
223  {
224  case RB_CORNER:
225  position = model.m_RB_Corner - aPosition;
226  break;
227 
228  case RT_CORNER:
229  position.x = model.m_RB_Corner.x - aPosition.x;
230  position.y = aPosition.y - model.m_LT_Corner.y;
231  break;
232 
233  case LB_CORNER:
234  position.x = aPosition.x - model.m_LT_Corner.x;
235  position.y = model.m_RB_Corner.y - aPosition.y;
236  break;
237 
238  case LT_CORNER:
239  position = aPosition - model.m_LT_Corner;
240  break;
241  }
242 
243  // Modify m_End only for items having 2 coordinates
244  switch( GetType() )
245  {
246  case DS_SEGMENT:
247  case DS_RECT:
248  m_End.m_Pos = position;
249  break;
250 
251  default:
252  break;
253  }
254 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
POINT_COORD m_End
Definition: ds_data_item.h:201
DPOINT m_RB_Corner
DPOINT m_LT_Corner
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
DPOINT m_Pos
Definition: ds_data_item.h:80

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

Referenced by MoveEndPointToUi(), and MoveTo().

◆ MoveEndPointToUi()

void DS_DATA_ITEM::MoveEndPointToUi ( const wxPoint &  aPosition)

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 257 of file ds_data_item.cpp.

258 {
259  DPOINT pos_mm;
260  pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
261  pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
262 
263  MoveEndPointTo( pos_mm );
264 }
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu
void MoveEndPointTo(const DPOINT &aPosition)
Move the ending point of the item to a new position.

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 DPOINT aPosition)

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

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

Definition at line 172 of file ds_data_item.cpp.

173 {
175  DPOINT position;
176 
177  // Calculate the position of the starting point
178  // relative to the reference corner
179  // aPosition is the position relative to the right top paper corner
180  switch( m_Pos.m_Anchor )
181  {
182  case RB_CORNER:
183  position = model.m_RB_Corner - aPosition;
184  break;
185 
186  case RT_CORNER:
187  position.x = model.m_RB_Corner.x - aPosition.x;
188  position.y = aPosition.y - model.m_LT_Corner.y;
189  break;
190 
191  case LB_CORNER:
192  position.x = aPosition.x - model.m_LT_Corner.x;
193  position.y = model.m_RB_Corner.y - aPosition.y;
194  break;
195 
196  case LT_CORNER:
197  position = aPosition - model.m_LT_Corner;
198  break;
199  }
200 
201  m_Pos.m_Pos = position;
202 }
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
DPOINT m_RB_Corner
DPOINT m_LT_Corner
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ds_data_item.h:80
POINT_COORD m_Pos
Definition: ds_data_item.h:200

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

Referenced by MoveStartPointToUi(), and MoveTo().

◆ MoveStartPointToUi()

void DS_DATA_ITEM::MoveStartPointToUi ( const wxPoint &  aPosition)

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

Parameters
aPositionis the new position of item in graphic units.

Definition at line 205 of file ds_data_item.cpp.

206 {
207  DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
209 
210  MoveStartPointTo( pos_mm );
211 }
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu
void MoveStartPointTo(const DPOINT &aPosition)
Move the starting point of the item to a new position.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, and MoveStartPointTo().

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

◆ MoveTo()

void DS_DATA_ITEM::MoveTo ( const DPOINT aPosition)

Move item to a new position.

Parameters
aPositionthe new position of item, in mm.

Definition at line 156 of file ds_data_item.cpp.

157 {
158  DPOINT vector = aPosition - GetStartPos();
159  DPOINT endpos = vector + GetEndPos();
160 
161  MoveStartPointTo( aPosition );
162  MoveEndPointTo( endpos );
163 
164  for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
165  {
166  drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
167  drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
168  }
169 }
const DPOINT GetEndPos(int ii=0) const
const DPOINT GetStartPos(int ii=0) const
const wxPoint GetEndPosUi(int ii=0) const
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211
void MoveStartPointTo(const DPOINT &aPosition)
Move the starting point of the item to a new position.
void MoveEndPointTo(const DPOINT &aPosition)
Move the ending point of the item to a new position.
const wxPoint GetStartPosUi(int ii=0) const

References GetEndPos(), GetEndPosUi(), GetStartPos(), GetStartPosUi(), m_drawItems, MoveEndPointTo(), and MoveStartPointTo().

Referenced by MoveToUi().

◆ MoveToUi()

void DS_DATA_ITEM::MoveToUi ( const wxPoint &  aPosition)

Move item to a new position.

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

Definition at line 146 of file ds_data_item.cpp.

147 {
148  DPOINT pos_mm;
149  pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
150  pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
151 
152  MoveTo( pos_mm );
153 }
void MoveTo(const DPOINT &aPosition)
Move item to a new position.
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_WSunits2Iu

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().

◆ SetEnd()

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

Definition at line 121 of file ds_data_item.h.

122  {
123  m_End.m_Pos.x = aPosx;
124  m_End.m_Pos.y = aPosy;
125  m_End.m_Anchor = aAnchor;
126  }
POINT_COORD m_End
Definition: ds_data_item.h:201
DPOINT m_Pos
Definition: ds_data_item.h:80

References POINT_COORD::m_Anchor, m_End, POINT_COORD::m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetPage1Option()

void DS_DATA_ITEM::SetPage1Option ( PAGE_OPTION  aChoice)
inline

Definition at line 134 of file ds_data_item.h.

134 { m_pageOption = aChoice; }
PAGE_OPTION m_pageOption
Definition: ds_data_item.h:209

References m_pageOption.

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), and DRAWING_SHEET_PARSER::readOption().

◆ SetStart()

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

Definition at line 114 of file ds_data_item.h.

115  {
116  m_Pos.m_Pos.x = aPosx;
117  m_Pos.m_Pos.y = aPosy;
118  m_Pos.m_Anchor = aAnchor;
119  }
DPOINT m_Pos
Definition: ds_data_item.h:80
POINT_COORD m_Pos
Definition: ds_data_item.h:200

References POINT_COORD::m_Anchor, POINT_COORD::m_Pos, m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SyncDrawItems()

void DS_DATA_ITEM::SyncDrawItems ( DS_DRAW_ITEM_LIST aCollector,
KIGFX::VIEW aView 
)
virtual

Reimplemented in DS_DATA_ITEM_BITMAP, DS_DATA_ITEM_TEXT, and DS_DATA_ITEM_POLYGONS.

Definition at line 82 of file ds_data_item.cpp.

83 {
84  int pensize = GetPenSizeUi();
85 
86  if( pensize == 0 )
87  pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
88 
89  std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
90  DS_DRAW_ITEM_BASE* item = nullptr;
91 
92  for( size_t i = 0; i < m_drawItems.size(); ++i )
93  {
94  item = m_drawItems[ i ];
95  itemFlags[ i ] = item->GetFlags();
96 
97  if( aCollector )
98  aCollector->Remove( item );
99 
100  if( aView )
101  aView->Remove( item );
102 
103  delete item;
104  }
105 
106  m_drawItems.clear();
107 
108  for( int j = 0; j < m_RepeatCount; j++ )
109  {
110  if( j && ! IsInsidePage( j ) )
111  continue;
112 
113  if( m_type == DS_SEGMENT )
114  item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
115  else if( m_type == DS_RECT )
116  item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
117  else
118  {
119  wxFAIL_MSG( "Unknown drawing sheet item type" );
120  continue;
121  }
122 
123  item->SetFlags( itemFlags[ j ] );
124  m_drawItems.push_back( item );
125 
126  if( aCollector )
127  aCollector->Append( item );
128 
129  if( aView )
130  aView->Add( item );
131  }
132 }
const wxPoint GetEndPosUi(int ii=0) const
virtual bool IsInsidePage(int ii) const
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:348
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
int GetDefaultPenSize() const
Definition: ds_draw_item.h:437
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:155
virtual int GetPenSizeUi()
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:205
void Append(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:473
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:318
void Remove(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:478
DS_ITEM_TYPE m_type
Definition: ds_data_item.h:208
const wxPoint GetStartPosUi(int ii=0) const

References KIGFX::VIEW::Add(), DS_DRAW_ITEM_LIST::Append(), DS_RECT, DS_SEGMENT, DS_DRAW_ITEM_LIST::GetDefaultPenSize(), GetEndPosUi(), EDA_ITEM::GetFlags(), GetPenSizeUi(), GetStartPosUi(), IsInsidePage(), m_drawItems, m_RepeatCount, m_type, KIGFX::VIEW::Remove(), DS_DRAW_ITEM_LIST::Remove(), and EDA_ITEM::SetFlags().

Referenced by PL_EDITOR_FRAME::AddDrawingSheetItem(), and DS_PROXY_UNDO_ITEM::Restore().

Member Data Documentation

◆ m_drawItems

◆ m_End

◆ m_IncrementLabel

◆ m_IncrementVector

◆ m_Info

◆ m_LineWidth

◆ m_Name

◆ m_pageOption

PAGE_OPTION DS_DATA_ITEM::m_pageOption
protected

Definition at line 209 of file ds_data_item.h.

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

◆ m_Pos

◆ m_RepeatCount

◆ m_type

DS_ITEM_TYPE DS_DATA_ITEM::m_type
protected

Definition at line 208 of file ds_data_item.h.

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


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