KiCad PCB EDA Suite
DS_DATA_ITEM_BITMAP Class Reference

#include <ds_data_item.h>

Inheritance diagram for DS_DATA_ITEM_BITMAP:
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_BITMAP (BITMAP_BASE *aImage)
 
void SyncDrawItems (DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
 
int GetPPI () const
 
void SetPPI (int aBitmapPPI)
 
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 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

BITMAP_BASEm_ImageBitmap
 
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

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

DS_DATA_ITEM_BITMAP::DS_DATA_ITEM_BITMAP ( BITMAP_BASE aImage)
inline

Definition at line 356 of file ds_data_item.h.

356  :
358  {
359  m_ImageBitmap = aImage;
360  }
DS_DATA_ITEM(DS_ITEM_TYPE aType)
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368

References m_ImageBitmap.

Member Function Documentation

◆ GetClassName()

const wxString DS_DATA_ITEM::GetClassName ( ) const
inherited

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_DATA_ITEM::DS_BITMAP, DS_DATA_ITEM::DS_POLYPOLYGON, DS_DATA_ITEM::DS_RECT, DS_DATA_ITEM::DS_SEGMENT, DS_DATA_ITEM::DS_TEXT, DS_DATA_ITEM::GetType(), and name.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

◆ GetDrawItems()

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

◆ GetEndPos()

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

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, DS_DATA_ITEM::m_End, DS_DATA_ITEM::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 DS_DATA_ITEM::GetEndPosUi(), DS_DATA_ITEM::IsInsidePage(), and DS_DATA_ITEM::MoveTo().

◆ GetEndPosUi()

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

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 DS_DATA_ITEM::GetEndPos(), DS_DATA_MODEL::GetTheInstance(), KiROUND(), DS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ 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.

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

References DS_DATA_ITEM::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 ( )
virtualinherited

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, DS_DATA_ITEM::m_LineWidth, and DS_DATA_MODEL::m_WSunits2Iu.

Referenced by DS_DATA_ITEM::SyncDrawItems().

◆ GetPPI()

int DS_DATA_ITEM_BITMAP::GetPPI ( ) const

Definition at line 762 of file ds_data_item.cpp.

763 {
764  if( m_ImageBitmap )
766 
767  return 300;
768 }
double GetScale() const
Definition: bitmap_base.h:79
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368
int GetPPI() const
Definition: bitmap_base.h:135

References BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), and m_ImageBitmap.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

◆ GetStartPos()

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

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, DS_DATA_ITEM::m_IncrementVector, DS_DATA_MODEL::m_LT_Corner, POINT_COORD::m_Pos, DS_DATA_ITEM::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(), DS_DATA_ITEM::GetStartPosUi(), DS_DATA_ITEM::IsInsidePage(), DS_DATA_ITEM_POLYGONS::IsInsidePage(), and DS_DATA_ITEM::MoveTo().

◆ GetStartPosUi()

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

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 DS_DATA_ITEM::GetStartPos(), DS_DATA_MODEL::GetTheInstance(), KiROUND(), DS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ GetType()

◆ 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 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 DS_DATA_ITEM::GetEndPos(), DS_DATA_ITEM::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 DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_TEXT::SyncDrawItems(), and SyncDrawItems().

◆ MoveEndPointTo()

void DS_DATA_ITEM::MoveEndPointTo ( const DPOINT 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 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_DATA_ITEM::DS_RECT, DS_DATA_ITEM::DS_SEGMENT, DS_DATA_MODEL::GetTheInstance(), DS_DATA_ITEM::GetType(), LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, DS_DATA_ITEM::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 DS_DATA_ITEM::MoveEndPointToUi(), and DS_DATA_ITEM::MoveTo().

◆ MoveEndPointToUi()

void DS_DATA_ITEM::MoveEndPointToUi ( const wxPoint &  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 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, DS_DATA_ITEM::MoveEndPointTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_POINT_EDITOR::updateItem().

◆ MoveStartPointTo()

void DS_DATA_ITEM::MoveStartPointTo ( const DPOINT 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 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, DS_DATA_ITEM::m_Pos, DS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DS_DATA_ITEM::MoveStartPointToUi(), and DS_DATA_ITEM::MoveTo().

◆ MoveStartPointToUi()

void DS_DATA_ITEM::MoveStartPointToUi ( const wxPoint &  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 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 DS_DATA_ITEM::MoveStartPointTo().

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

◆ MoveTo()

void DS_DATA_ITEM::MoveTo ( const DPOINT aPosition)
inherited

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 DS_DATA_ITEM::GetEndPos(), DS_DATA_ITEM::GetEndPosUi(), DS_DATA_ITEM::GetStartPos(), DS_DATA_ITEM::GetStartPosUi(), DS_DATA_ITEM::m_drawItems, DS_DATA_ITEM::MoveEndPointTo(), and DS_DATA_ITEM::MoveStartPointTo().

Referenced by DS_DATA_ITEM::MoveToUi().

◆ MoveToUi()

void DS_DATA_ITEM::MoveToUi ( const wxPoint &  aPosition)
inherited

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, DS_DATA_ITEM::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 
)
inlineinherited

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, DS_DATA_ITEM::m_End, POINT_COORD::m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetPage1Option()

void DS_DATA_ITEM::SetPage1Option ( PAGE_OPTION  aChoice)
inlineinherited

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 DS_DATA_ITEM::m_pageOption.

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

◆ SetPPI()

void DS_DATA_ITEM_BITMAP::SetPPI ( int  aBitmapPPI)

Definition at line 771 of file ds_data_item.cpp.

772 {
773  if( m_ImageBitmap )
774  m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
775 }
void SetScale(double aScale)
Definition: bitmap_base.h:80
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368
int GetPPI() const
Definition: bitmap_base.h:135

References BITMAP_BASE::GetPPI(), m_ImageBitmap, and BITMAP_BASE::SetScale().

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem().

◆ 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.

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, DS_DATA_ITEM::m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SyncDrawItems()

void DS_DATA_ITEM_BITMAP::SyncDrawItems ( DS_DRAW_ITEM_LIST aCollector,
KIGFX::VIEW aView 
)
overridevirtual

Reimplemented from DS_DATA_ITEM.

Definition at line 716 of file ds_data_item.cpp.

717 {
718  std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
719  DS_DRAW_ITEM_BASE* item = nullptr;
720 
721  for( size_t i = 0; i < m_drawItems.size(); ++i )
722  {
723  item = m_drawItems[ i ];
724  itemFlags[ i ] = item->GetFlags();
725 
726  if( aCollector )
727  aCollector->Remove( item );
728 
729  if( aView )
730  aView->Remove( item );
731 
732  delete item;
733  }
734 
735  if( aCollector )
736  {
737  double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI();
738  m_ImageBitmap->SetPixelSizeIu( pix_size_iu );
739  }
740 
741  m_drawItems.clear();
742 
743  for( int j = 0; j < m_RepeatCount; j++ )
744  {
745  if( j && !IsInsidePage( j ) )
746  continue;
747 
748  DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
749 
750  bitmap->SetFlags( itemFlags[ j ] );
751  m_drawItems.push_back( bitmap );
752 
753  if( aCollector )
754  aCollector->Append( bitmap );
755 
756  if( aView )
757  aView->Add( bitmap );
758  }
759 }
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
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368
double GetMilsToIUfactor()
Get the scalar to convert pages units (mils) to draw/plot units.
Definition: ds_draw_item.h:450
void SetPixelSizeIu(double aPixSize)
Definition: bitmap_base.h:68
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:155
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
int GetPPI() const
Definition: bitmap_base.h:135
const wxPoint GetStartPosUi(int ii=0) const

References KIGFX::VIEW::Add(), DS_DRAW_ITEM_LIST::Append(), EDA_ITEM::GetFlags(), DS_DRAW_ITEM_LIST::GetMilsToIUfactor(), BITMAP_BASE::GetPPI(), DS_DATA_ITEM::GetStartPosUi(), DS_DATA_ITEM::IsInsidePage(), DS_DATA_ITEM::m_drawItems, m_ImageBitmap, DS_DATA_ITEM::m_RepeatCount, KIGFX::VIEW::Remove(), DS_DRAW_ITEM_LIST::Remove(), EDA_ITEM::SetFlags(), and BITMAP_BASE::SetPixelSizeIu().

Member Data Documentation

◆ m_drawItems

◆ m_End

◆ m_ImageBitmap

◆ m_IncrementLabel

◆ m_IncrementVector

◆ m_Info

◆ m_LineWidth

◆ m_Name

◆ m_pageOption

PAGE_OPTION DS_DATA_ITEM::m_pageOption
protectedinherited

◆ m_Pos

◆ m_RepeatCount

◆ m_type

DS_ITEM_TYPE DS_DATA_ITEM::m_type
protectedinherited

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