KiCad PCB EDA Suite
WS_DATA_ITEM_BITMAP Class Reference

#include <ws_data_item.h>

Inheritance diagram for WS_DATA_ITEM_BITMAP:
WS_DATA_ITEM

Public Types

enum  WS_ITEM_TYPE {
  WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON,
  WS_BITMAP
}
 

Public Member Functions

 WS_DATA_ITEM_BITMAP (BITMAP_BASE *aImage)
 
void SyncDrawItems (WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
 
int GetPPI () const
 
void SetPPI (int aBitmapPPI)
 
const std::vector< WS_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)
 
WS_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 (DPOINT aPosition)
 move item to a new position More...
 
void MoveToUi (wxPoint aPosition)
 move item to a new position More...
 
void MoveStartPointTo (DPOINT aPosition)
 move the starting point of the item to a new position More...
 
void MoveStartPointToUi (wxPoint aPosition)
 move the starting point of the item to a new position More...
 
void MoveEndPointTo (DPOINT aPosition)
 move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) More...
 
void MoveEndPointToUi (wxPoint aPosition)
 move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) 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

WS_ITEM_TYPE m_type
 
PAGE_OPTION m_pageOption
 
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
 

Detailed Description

Definition at line 363 of file ws_data_item.h.

Member Enumeration Documentation

◆ WS_ITEM_TYPE

Enumerator
WS_TEXT 
WS_SEGMENT 
WS_RECT 
WS_POLYPOLYGON 
WS_BITMAP 

Definition at line 96 of file ws_data_item.h.

Constructor & Destructor Documentation

◆ WS_DATA_ITEM_BITMAP()

WS_DATA_ITEM_BITMAP::WS_DATA_ITEM_BITMAP ( BITMAP_BASE aImage)
inline

Definition at line 369 of file ws_data_item.h.

371  {
372  m_ImageBitmap = aImage;
373  }
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
WS_DATA_ITEM(WS_ITEM_TYPE aType)

References m_ImageBitmap.

Member Function Documentation

◆ GetClassName()

const wxString WS_DATA_ITEM::GetClassName ( ) const
inherited

Definition at line 381 of file ws_data_item.cpp.

382 {
383  wxString name;
384 
385  switch( GetType() )
386  {
387  case WS_TEXT: name = wxT( "Text" ); break;
388  case WS_SEGMENT: name = wxT( "Line" ); break;
389  case WS_RECT: name = wxT( "Rectangle" ); break;
390  case WS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
391  case WS_BITMAP: name = wxT( "Image" ); break;
392  }
393 
394  return name;
395 }
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:147
const char * name
Definition: DXF_plotter.cpp:60

References WS_DATA_ITEM::GetType(), name, WS_DATA_ITEM::WS_BITMAP, WS_DATA_ITEM::WS_POLYPOLYGON, WS_DATA_ITEM::WS_RECT, WS_DATA_ITEM::WS_SEGMENT, and WS_DATA_ITEM::WS_TEXT.

◆ GetDrawItems()

const std::vector<WS_DRAW_ITEM_BASE*>& WS_DATA_ITEM::GetDrawItems ( ) const
inlineinherited

Definition at line 128 of file ws_data_item.h.

128 { return m_drawItems; }
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
Definition: ws_data_item.h:108

References WS_DATA_ITEM::m_drawItems.

Referenced by WS_PROXY_UNDO_ITEM::Restore(), and WS_PROXY_UNDO_ITEM::WS_PROXY_UNDO_ITEM().

◆ GetEndPos()

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

Definition at line 322 of file ws_data_item.cpp.

323 {
324  DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
325  m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
326 
327  switch( m_End.m_Anchor )
328  {
329  case RB_CORNER: // right bottom corner
331  break;
332 
333  case RT_CORNER: // right top corner
334  pos.x = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.x - pos.x;
335  pos.y = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.y + pos.y;
336  break;
337 
338  case LB_CORNER: // left bottom corner
339  pos.x = WS_DATA_MODEL::GetTheInstance().m_LT_Corner.x + pos.x;
340  pos.y = WS_DATA_MODEL::GetTheInstance().m_RB_Corner.y - pos.y;
341  break;
342 
343  case LT_CORNER: // left top corner
345  break;
346  }
347 
348  return pos;
349 }
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
POINT_COORD m_End
Definition: ws_data_item.h:116
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ws_data_item.h:71
DPOINT m_IncrementVector
Definition: ws_data_item.h:119

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

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

◆ GetEndPosUi()

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

Definition at line 352 of file ws_data_item.cpp.

353 {
354  DPOINT pos = GetEndPos( ii );
356  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
357 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
const DPOINT GetEndPos(int ii=0) const
double m_WSunits2Iu
Definition: ws_data_model.h:51
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:61

References WS_DATA_ITEM::GetEndPos(), WS_DATA_MODEL::GetTheInstance(), KiROUND(), WS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DATA_ITEM::MoveTo(), and WS_DATA_ITEM::SyncDrawItems().

◆ GetPage1Option()

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

Definition at line 153 of file ws_data_item.h.

153 { return m_pageOption; }
PAGE_OPTION m_pageOption
Definition: ws_data_item.h:106

References WS_DATA_ITEM::m_pageOption.

Referenced by WS_DATA_MODEL_IO::formatOptions(), WS_DRAW_ITEM_BASE::GetMsgPanelInfo(), and WS_DRAW_ITEM_BASE::ViewGetLayers().

◆ GetPenSizeUi()

int WS_DATA_ITEM::GetPenSizeUi ( )
virtualinherited

Reimplemented in WS_DATA_ITEM_TEXT, and WS_DATA_ITEM_POLYGONS.

Definition at line 129 of file ws_data_item.cpp.

130 {
132 
133  if( m_LineWidth != 0 )
134  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
135  else
136  return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
137 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
double m_LineWidth
Definition: ws_data_item.h:117
double m_DefaultLineWidth
Definition: ws_data_model.h:55
double m_WSunits2Iu
Definition: ws_data_model.h:51
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:61

References WS_DATA_MODEL::GetTheInstance(), KiROUND(), WS_DATA_MODEL::m_DefaultLineWidth, WS_DATA_ITEM::m_LineWidth, and WS_DATA_MODEL::m_WSunits2Iu.

Referenced by WS_DATA_ITEM::SyncDrawItems().

◆ GetPPI()

int WS_DATA_ITEM_BITMAP::GetPPI ( ) const

Definition at line 770 of file ws_data_item.cpp.

771 {
772  if( m_ImageBitmap )
774 
775  return 300;
776 }
double GetScale() const
Definition: bitmap_base.h:92
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
int GetPPI() const
Definition: bitmap_base.h:153

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

◆ GetStartPos()

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

Definition at line 284 of file ws_data_item.cpp.

285 {
287  DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
288  m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
289 
290  switch( m_Pos.m_Anchor )
291  {
292  case RB_CORNER: // right bottom corner
293  pos = model.m_RB_Corner - pos;
294  break;
295 
296  case RT_CORNER: // right top corner
297  pos.x = model.m_RB_Corner.x - pos.x;
298  pos.y = model.m_LT_Corner.y + pos.y;
299  break;
300 
301  case LB_CORNER: // left bottom corner
302  pos.x = model.m_LT_Corner.x + pos.x;
303  pos.y = model.m_RB_Corner.y - pos.y;
304  break;
305 
306  case LT_CORNER: // left top corner
307  pos = model.m_LT_Corner + pos;
308  break;
309  }
310 
311  return pos;
312 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ws_data_item.h:71
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
POINT_COORD m_Pos
Definition: ws_data_item.h:115

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

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

◆ GetStartPosUi()

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

Definition at line 315 of file ws_data_item.cpp.

316 {
318  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
319 }
const DPOINT GetStartPos(int ii=0) const
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
double m_WSunits2Iu
Definition: ws_data_model.h:51
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:61

References WS_DATA_ITEM::GetStartPos(), WS_DATA_MODEL::GetTheInstance(), KiROUND(), WS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DATA_ITEM::MoveTo(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_POLYGONS::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), and SyncDrawItems().

◆ GetType()

◆ IsInsidePage()

bool WS_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 WS_DATA_ITEM_POLYGONS.

Definition at line 360 of file ws_data_item.cpp.

361 {
363 
364  DPOINT pos = GetStartPos( ii );
365 
366  for( int kk = 0; kk < 1; kk++ )
367  {
368  if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
369  return false;
370 
371  if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
372  return false;
373 
374  pos = GetEndPos( ii );
375  }
376 
377  return true;
378 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
const DPOINT GetStartPos(int ii=0) const
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
const DPOINT GetEndPos(int ii=0) const

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

Referenced by WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), and SyncDrawItems().

◆ MoveEndPointTo()

void WS_DATA_ITEM::MoveEndPointTo ( DPOINT  aPosition)
inherited

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles)

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) aPosition = the new position of the ending point, in mm

Parameters
aPosition= the new position of the ending point, in mm

Definition at line 226 of file ws_data_item.cpp.

227 {
229  DPOINT position;
230 
231  // Calculate the position of the starting point
232  // relative to the reference corner
233  // aPosition is the position relative to the right top paper corner
234  switch( m_End.m_Anchor )
235  {
236  case RB_CORNER:
237  position = model.m_RB_Corner - aPosition;
238  break;
239 
240  case RT_CORNER:
241  position.x = model.m_RB_Corner.x - aPosition.x;
242  position.y = aPosition.y - model.m_LT_Corner.y;
243  break;
244 
245  case LB_CORNER:
246  position.x = aPosition.x - model.m_LT_Corner.x;
247  position.y = model.m_RB_Corner.y - aPosition.y;
248  break;
249 
250  case LT_CORNER:
251  position = aPosition - model.m_LT_Corner;
252  break;
253  }
254 
255  // Modify m_End only for items having 2 coordinates
256  switch( GetType() )
257  {
258  case WS_SEGMENT:
259  case WS_RECT:
260  m_End.m_Pos = position;
261  break;
262 
263  default:
264  break;
265  }
266 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
POINT_COORD m_End
Definition: ws_data_item.h:116
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ws_data_item.h:71
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:147

References WS_DATA_MODEL::GetTheInstance(), WS_DATA_ITEM::GetType(), LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, WS_DATA_ITEM::m_End, WS_DATA_MODEL::m_LT_Corner, POINT_COORD::m_Pos, WS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, WS_DATA_ITEM::WS_RECT, WS_DATA_ITEM::WS_SEGMENT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DATA_ITEM::MoveEndPointToUi(), and WS_DATA_ITEM::MoveTo().

◆ MoveEndPointToUi()

void WS_DATA_ITEM::MoveEndPointToUi ( wxPoint  aPosition)
inherited

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles)

Parameters
aPosition= the new position of the ending point in graphic units

Definition at line 274 of file ws_data_item.cpp.

275 {
276  DPOINT pos_mm;
277  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
278  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
279 
280  MoveEndPointTo( pos_mm );
281 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
void MoveEndPointTo(DPOINT aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
double m_WSunits2Iu
Definition: ws_data_model.h:51

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

◆ MoveStartPointTo()

void WS_DATA_ITEM::MoveStartPointTo ( DPOINT  aPosition)
inherited

move the starting point of the item to a new position

Parameters
aPosition= the new position of the starting point, in mm

Definition at line 175 of file ws_data_item.cpp.

176 {
178  DPOINT position;
179 
180  // Calculate the position of the starting point
181  // relative to the reference corner
182  // aPosition is the position relative to the right top paper corner
183  switch( m_Pos.m_Anchor )
184  {
185  case RB_CORNER:
186  position = model.m_RB_Corner - aPosition;
187  break;
188 
189  case RT_CORNER:
190  position.x = model.m_RB_Corner.x - aPosition.x;
191  position.y = aPosition.y - model.m_LT_Corner.y;
192  break;
193 
194  case LB_CORNER:
195  position.x = aPosition.x - model.m_LT_Corner.x;
196  position.y = model.m_RB_Corner.y - aPosition.y;
197  break;
198 
199  case LT_CORNER:
200  position = aPosition - model.m_LT_Corner;
201  break;
202  }
203 
204  m_Pos.m_Pos = position;
205 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
DPOINT m_Pos
Definition: ws_data_item.h:71
POINT_COORD m_Pos
Definition: ws_data_item.h:115

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

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

◆ MoveStartPointToUi()

void WS_DATA_ITEM::MoveStartPointToUi ( wxPoint  aPosition)
inherited

move the starting point of the item to a new position

Parameters
aPosition= the new position of item in graphic units

Definition at line 211 of file ws_data_item.cpp.

212 {
213  DPOINT pos_mm( aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
215 
216  MoveStartPointTo( pos_mm );
217 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
double m_WSunits2Iu
Definition: ws_data_model.h:51

References WS_DATA_MODEL::GetTheInstance(), WS_DATA_MODEL::m_WSunits2Iu, WS_DATA_ITEM::MoveStartPointTo(), wxPoint::x, and wxPoint::y.

◆ MoveTo()

void WS_DATA_ITEM::MoveTo ( DPOINT  aPosition)
inherited

move item to a new position

Parameters
aPosition= the new position of item, in mm

Definition at line 156 of file ws_data_item.cpp.

157 {
158  DPOINT vector = aPosition - GetStartPos();
159  DPOINT endpos = vector + GetEndPos();
160 
161  MoveStartPointTo( aPosition );
162  MoveEndPointTo( endpos );
163 
164  for( WS_DRAW_ITEM_BASE* drawItem : m_drawItems )
165  {
166  drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
167  drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
168  }
169 }
const DPOINT GetStartPos(int ii=0) const
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
void MoveEndPointTo(DPOINT aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
const wxPoint GetStartPosUi(int ii=0) const
const DPOINT GetEndPos(int ii=0) const
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
Definition: ws_data_item.h:108
const wxPoint GetEndPosUi(int ii=0) const

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

Referenced by WS_DATA_ITEM::MoveToUi().

◆ MoveToUi()

void WS_DATA_ITEM::MoveToUi ( wxPoint  aPosition)
inherited

move item to a new position

Parameters
aPosition= the new position of the starting point in graphic units

Definition at line 146 of file ws_data_item.cpp.

147 {
148  DPOINT pos_mm;
149  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
150  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
151 
152  MoveTo( pos_mm );
153 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
double m_WSunits2Iu
Definition: ws_data_model.h:51
void MoveTo(DPOINT aPosition)
move item to a new position

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

◆ SetEnd()

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

Definition at line 139 of file ws_data_item.h.

140  {
141  m_End.m_Pos.x = aPosx;
142  m_End.m_Pos.y = aPosy;
143  m_End.m_Anchor = aAnchor;
144  }
POINT_COORD m_End
Definition: ws_data_item.h:116
DPOINT m_Pos
Definition: ws_data_item.h:71

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

◆ SetPage1Option()

void WS_DATA_ITEM::SetPage1Option ( PAGE_OPTION  aChoice)
inlineinherited

Definition at line 154 of file ws_data_item.h.

154 { m_pageOption = aChoice; }
PAGE_OPTION m_pageOption
Definition: ws_data_item.h:106

References WS_DATA_ITEM::m_pageOption.

Referenced by PAGE_LAYOUT_READER_PARSER::readOption().

◆ SetPPI()

void WS_DATA_ITEM_BITMAP::SetPPI ( int  aBitmapPPI)

Definition at line 779 of file ws_data_item.cpp.

780 {
781  if( m_ImageBitmap )
782  m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
783 }
void SetScale(double aScale)
Definition: bitmap_base.h:93
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
int GetPPI() const
Definition: bitmap_base.h:153

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

◆ SetStart()

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

Definition at line 132 of file ws_data_item.h.

133  {
134  m_Pos.m_Pos.x = aPosx;
135  m_Pos.m_Pos.y = aPosy;
136  m_Pos.m_Anchor = aAnchor;
137  }
DPOINT m_Pos
Definition: ws_data_item.h:71
POINT_COORD m_Pos
Definition: ws_data_item.h:115

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

◆ SyncDrawItems()

void WS_DATA_ITEM_BITMAP::SyncDrawItems ( WS_DRAW_ITEM_LIST aCollector,
KIGFX::VIEW aView 
)
overridevirtual

Reimplemented from WS_DATA_ITEM.

Definition at line 731 of file ws_data_item.cpp.

732 {
733  std::map<int, STATUS_FLAGS> itemFlags;
734  WS_DRAW_ITEM_BASE* item = nullptr;
735 
736  for( size_t i = 0; i < m_drawItems.size(); ++i )
737  {
738  item = m_drawItems[ i ];
739  itemFlags[ i ] = item->GetFlags();
740 
741  if( aCollector )
742  aCollector->Remove( item );
743 
744  if( aView )
745  aView->Remove( item );
746 
747  delete item;
748  }
749 
750  m_drawItems.clear();
751 
752  for( int j = 0; j < m_RepeatCount; j++ )
753  {
754  if( j && !IsInsidePage( j ) )
755  continue;
756 
757  auto bitmap = new WS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
758  bitmap->SetFlags( itemFlags[ j ] );
759  m_drawItems.push_back( bitmap );
760 
761  if( aCollector )
762  aCollector->Append( bitmap );
763 
764  if( aView )
765  aView->Add( bitmap );
766  }
767 }
void Remove(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:460
virtual bool IsInsidePage(int ii) const
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
void Append(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:455
const wxPoint GetStartPosUi(int ii=0) const
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
Definition: ws_data_item.h:108
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:257

References KIGFX::VIEW::Add(), WS_DRAW_ITEM_LIST::Append(), EDA_ITEM::GetFlags(), WS_DATA_ITEM::GetStartPosUi(), WS_DATA_ITEM::IsInsidePage(), WS_DATA_ITEM::m_drawItems, WS_DATA_ITEM::m_RepeatCount, KIGFX::VIEW::Remove(), and WS_DRAW_ITEM_LIST::Remove().

Member Data Documentation

◆ m_drawItems

◆ m_End

◆ m_ImageBitmap

◆ m_IncrementLabel

◆ m_IncrementVector

◆ m_Info

◆ m_LineWidth

◆ m_Name

◆ m_pageOption

PAGE_OPTION WS_DATA_ITEM::m_pageOption
protectedinherited

◆ m_Pos

◆ m_RepeatCount

◆ m_type

WS_ITEM_TYPE WS_DATA_ITEM::m_type
protectedinherited

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