KiCad PCB EDA Suite
WORKSHEET_DATAITEM_POLYPOLYGON Class Reference

#include <class_worksheet_dataitem.h>

Inheritance diagram for WORKSHEET_DATAITEM_POLYPOLYGON:
WORKSHEET_DATAITEM

Public Types

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

Public Member Functions

 WORKSHEET_DATAITEM_POLYPOLYGON ()
 
virtual int GetPenSizeUi () override
 
virtual bool HasEndPoint () override
 
void AppendCorner (const DPOINT &aCorner)
 add a corner in corner list More...
 
void CloseContour ()
 Closes the current contour, by storing the index of the last corner of the current polygon in m_polyIndexEnd. More...
 
int GetPolyCount () const
 
unsigned GetPolyIndexStart (unsigned aContour) const
 
unsigned GetPolyIndexEnd (unsigned aContour) const
 
const DPOINT GetCornerPosition (unsigned aIdx, int aRepeat=0) const
 
const wxPoint GetCornerPositionUi (unsigned aIdx, int aRepeat=0) const
 
void SetBoundingBox ()
 calculate the bounding box of the set polygons More...
 
bool IsInsidePage (int ii) const override
 
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_ItemType GetType () const
 
int GetFlags () const
 
void SetFlags (int aMask)
 
void ClearFlags (int aMask)
 
int GetPage1Option ()
 
void SetPage1Option (int aChoice)
 Set the option for page 1. More...
 
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
 
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...
 
const wxString GetClassName () const
 
bool IsSelected ()
 
void SetSelected (bool aState)
 Function SetSelected Toggles on/off the selected flag (used in edition functions. More...
 
bool UseAltColor ()
 
COLOR4D GetItemColor ()
 

Static Public Member Functions

static int GetMarkerSizeUi ()
 

Public Attributes

double m_Orient
 
std::vector< DPOINTm_Corners
 
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
 

Static Public Attributes

static double m_WSunits2Iu = 1.0
 
static DPOINT m_RB_Corner
 
static DPOINT m_LT_Corner
 
static double m_DefaultLineWidth = 0.0
 
static DSIZE m_DefaultTextSize
 
static double m_DefaultTextThickness = 0.0
 
static bool m_SpecialMode = false
 
static COLOR4D m_Color = COLOR4D( RED )
 
static COLOR4D m_AltColor = COLOR4D( RED )
 
static COLOR4D m_SelectedColor = COLOR4D( BROWN )
 

Protected Attributes

WS_ItemType m_type
 
int m_flags
 

Private Attributes

std::vector< unsigned > m_polyIndexEnd
 
DPOINT m_minCoord
 
DPOINT m_maxCoord
 

Detailed Description

Definition at line 295 of file class_worksheet_dataitem.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

WORKSHEET_DATAITEM_POLYPOLYGON::WORKSHEET_DATAITEM_POLYPOLYGON ( )

Member Function Documentation

void WORKSHEET_DATAITEM_POLYPOLYGON::AppendCorner ( const DPOINT aCorner)
inline

add a corner in corner list

Parameters
aCornerthe item to append

Definition at line 323 of file class_worksheet_dataitem.h.

324  {
325  m_Corners.push_back( aCorner );
326  }
void WORKSHEET_DATAITEM::ClearFlags ( int  aMask)
inlineinherited
void WORKSHEET_DATAITEM_POLYPOLYGON::CloseContour ( )
inline

Closes the current contour, by storing the index of the last corner of the current polygon in m_polyIndexEnd.

Definition at line 332 of file class_worksheet_dataitem.h.

333  {
334  m_polyIndexEnd.push_back( m_Corners.size() -1 );
335  }
const wxString WORKSHEET_DATAITEM::GetClassName ( ) const
inherited

Definition at line 326 of file class_worksheet_dataitem.cpp.

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

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), and PL_EDITOR_FRAME::RebuildDesignTree().

327 {
328  wxString name;
329 
330  switch( GetType() )
331  {
332  case WS_TEXT: name = wxT( "Text" ); break;
333  case WS_SEGMENT: name = wxT( "Line" ); break;
334  case WS_RECT: name = wxT( "Rect" ); break;
335  case WS_POLYPOLYGON: name = wxT( "Poly" ); break;
336  case WS_BITMAP: name = wxT( "Bitmap" ); break;
337  }
338 
339  return name;
340 }
WS_ItemType GetType() const
const char * name
const DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition ( unsigned  aIdx,
int  aRepeat = 0 
) const
Returns
the coordinate (in mm) of the corner aIdx, for the repeated item aRepeat

Definition at line 384 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetStartPos(), m_Corners, m_Orient, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetCornerPositionUi().

386 {
387  DPOINT pos = m_Corners[aIdx];
388 
389  // Rotation:
390  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
391  pos += GetStartPos( aRepeat );
392  return pos;
393 }
const DPOINT GetStartPos(int ii=0) const
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
const wxPoint WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi ( unsigned  aIdx,
int  aRepeat = 0 
) const
Returns
the coordinate (in draw/plot units) of the corner aIdx, for the repeated item aRepeat

Definition at line 448 of file class_worksheet_dataitem.cpp.

References GetCornerPosition(), WORKSHEET_DATAITEM::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

450 {
451  DPOINT pos = GetCornerPosition( aIdx, aRepeat );
452  pos = pos * m_WSunits2Iu;
453  return wxPoint( int(pos.x), int(pos.y) );
454 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
const DPOINT GetCornerPosition(unsigned aIdx, int aRepeat=0) const
const DPOINT WORKSHEET_DATAITEM::GetEndPos ( int  ii = 0) const
inherited

Definition at line 268 of file class_worksheet_dataitem.cpp.

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

Referenced by WORKSHEET_DATAITEM::GetEndPosUi(), WORKSHEET_DATAITEM::IsInsidePage(), PL_EDITOR_FRAME::MoveItem(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

269 {
270  DPOINT pos;
271  pos.x = m_End.m_Pos.x + ( m_IncrementVector.x * ii );
272  pos.y = m_End.m_Pos.y + ( m_IncrementVector.y * ii );
273 
274  switch( m_End.m_Anchor )
275  {
276  case RB_CORNER: // right bottom corner
277  pos = m_RB_Corner - pos;
278  break;
279 
280  case RT_CORNER: // right top corner
281  pos.x = m_RB_Corner.x - pos.x;
282  pos.y = m_LT_Corner.y + pos.y;
283  break;
284 
285  case LB_CORNER: // left bottom corner
286  pos.x = m_LT_Corner.x + pos.x;
287  pos.y = m_RB_Corner.y - pos.y;
288  break;
289 
290  case LT_CORNER: // left top corner
291  pos = m_LT_Corner + pos;
292  break;
293  }
294 
295  return pos;
296 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
const wxPoint WORKSHEET_DATAITEM::GetEndPosUi ( int  ii = 0) const
inherited

Definition at line 299 of file class_worksheet_dataitem.cpp.

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

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), moveItem(), and PL_EDITOR_FRAME::MoveItem().

300 {
301  DPOINT pos = GetEndPos( ii );
302  pos = pos * m_WSunits2Iu;
303  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
304 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
const DPOINT GetEndPos(int ii=0) const
int WORKSHEET_DATAITEM::GetFlags ( ) const
inlineinherited
COLOR4D WORKSHEET_DATAITEM::GetItemColor ( )
inlineinherited
static int WORKSHEET_DATAITEM::GetMarkerSizeUi ( )
inlinestaticinherited

Definition at line 208 of file class_worksheet_dataitem.h.

References KiROUND().

Referenced by WS_DRAW_ITEM_LIST::Draw(), WS_DRAW_ITEM_LINE::HitTestEndPoint(), WS_DRAW_ITEM_RECT::HitTestEndPoint(), WS_DRAW_ITEM_LINE::HitTestStartPoint(), WS_DRAW_ITEM_POLYGON::HitTestStartPoint(), WS_DRAW_ITEM_RECT::HitTestStartPoint(), WS_DRAW_ITEM_TEXT::HitTestStartPoint(), and WS_DRAW_ITEM_BITMAP::HitTestStartPoint().

209  {
210  return KiROUND( 0.5 * m_WSunits2Iu );
211  }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int WORKSHEET_DATAITEM::GetPage1Option ( )
inherited
Returns
0 if the item has no specific option for page 1 1 if the item is only on page 1 -1 if the item is not on page 1

Definition at line 347 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_flags, PAGE1OPTION, PAGE1OPTION_NOTONPAGE1, and PAGE1OPTION_PAGE1ONLY.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), and PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

348 {
350  return -1;
351 
352  if(( m_flags & PAGE1OPTION) == PAGE1OPTION_PAGE1ONLY )
353  return 1;
354 
355  return 0;
356 }
#define PAGE1OPTION_NOTONPAGE1
#define PAGE1OPTION_PAGE1ONLY
#define PAGE1OPTION
virtual int WORKSHEET_DATAITEM_POLYPOLYGON::GetPenSizeUi ( )
inlineoverridevirtual

Reimplemented from WORKSHEET_DATAITEM.

Definition at line 309 of file class_worksheet_dataitem.h.

References KiROUND(), WORKSHEET_DATAITEM::m_LineWidth, and WORKSHEET_DATAITEM::m_WSunits2Iu.

310  {
311  return KiROUND( m_LineWidth * m_WSunits2Iu );
312  }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyCount ( ) const
inline
Returns
the count of contours in the poly polygon

Definition at line 340 of file class_worksheet_dataitem.h.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

340 { return (int) m_polyIndexEnd.size(); }
unsigned WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyIndexEnd ( unsigned  aContour) const
inline
Returns
the index of the last corner of the contour aCountour
Parameters
aContour= the index of the contour

Definition at line 358 of file class_worksheet_dataitem.h.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

359  {
360  return m_polyIndexEnd[aContour];
361  }
unsigned WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyIndexStart ( unsigned  aContour) const
inline
Returns
the index of the first corner of the contour aCountour
Parameters
aContour= the index of the contour

Definition at line 346 of file class_worksheet_dataitem.h.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

347  {
348  if( aContour == 0 )
349  return 0;
350  else
351  return m_polyIndexEnd[aContour-1] + 1;
352  }
const DPOINT WORKSHEET_DATAITEM::GetStartPos ( int  ii = 0) const
inherited

Definition at line 229 of file class_worksheet_dataitem.cpp.

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

Referenced by GetCornerPosition(), WORKSHEET_DATAITEM::GetStartPosUi(), WORKSHEET_DATAITEM::IsInsidePage(), IsInsidePage(), PL_EDITOR_FRAME::MoveItem(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

230 {
231  DPOINT pos;
232  pos.x = m_Pos.m_Pos.x + ( m_IncrementVector.x * ii );
233  pos.y = m_Pos.m_Pos.y + ( m_IncrementVector.y * ii );
234 
235  switch( m_Pos.m_Anchor )
236  {
237  case RB_CORNER: // right bottom corner
238  pos = m_RB_Corner - pos;
239  break;
240 
241  case RT_CORNER: // right top corner
242  pos.x = m_RB_Corner.x - pos.x;
243  pos.y = m_LT_Corner.y + pos.y;
244  break;
245 
246  case LB_CORNER: // left bottom corner
247  pos.x = m_LT_Corner.x + pos.x;
248  pos.y = m_RB_Corner.y - pos.y;
249  break;
250 
251  case LT_CORNER: // left top corner
252  pos = m_LT_Corner + pos;
253  break;
254  }
255 
256  return pos;
257 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
const wxPoint WORKSHEET_DATAITEM::GetStartPosUi ( int  ii = 0) const
inherited

Definition at line 260 of file class_worksheet_dataitem.cpp.

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

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), EVT_MENU_RANGE(), moveItem(), PL_EDITOR_FRAME::MoveItem(), and PL_EDITOR_FRAME::UpdateStatusBar().

261 {
262  DPOINT pos = GetStartPos( ii );
263  pos = pos * m_WSunits2Iu;
264  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
265 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
const DPOINT GetStartPos(int ii=0) const
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
virtual bool WORKSHEET_DATAITEM_POLYPOLYGON::HasEndPoint ( )
inlineoverridevirtual
Returns
false (no end point)

Reimplemented from WORKSHEET_DATAITEM.

Definition at line 317 of file class_worksheet_dataitem.h.

317 { return false; }
bool WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage ( int  ii) const
overridevirtual
Returns
true if the item is inside the rectangle defined by the 4 corners, false otherwise.

Reimplemented from WORKSHEET_DATAITEM.

Definition at line 430 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetStartPos(), WORKSHEET_DATAITEM::m_LT_Corner, m_maxCoord, m_minCoord, WORKSHEET_DATAITEM::m_RB_Corner, VECTOR2< T >::x, and VECTOR2< T >::y.

431 {
432  DPOINT pos = GetStartPos( ii );
433  pos += m_minCoord; // left top pos of bounding box
434 
435  if( m_LT_Corner.x > pos.x || m_LT_Corner.y > pos.y )
436  return false;
437 
438  pos = GetStartPos( ii );
439  pos += m_maxCoord; // rignt bottom pos of bounding box
440 
441  if( m_RB_Corner.x < pos.x || m_RB_Corner.y < pos.y )
442  return false;
443 
444  return true;
445 }
const DPOINT GetStartPos(int ii=0) const
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
bool WORKSHEET_DATAITEM::IsSelected ( )
inlineinherited
Returns
true if the selected state on ON

Definition at line 265 of file class_worksheet_dataitem.h.

References SELECTED_STATE.

Referenced by WORKSHEET_DATAITEM::GetItemColor().

265 { return (m_flags & SELECTED_STATE) != 0; }
#define SELECTED_STATE
void WORKSHEET_DATAITEM::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 172 of file class_worksheet_dataitem.cpp.

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

Referenced by abortMoveItem(), WORKSHEET_DATAITEM::MoveEndPointToUi(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

173 {
174  DPOINT position;
175 
176  // Calculate the position of the starting point
177  // relative to the reference corner
178  // aPosition is the position relative to the right top paper corner
179  switch( m_End.m_Anchor )
180  {
181  case RB_CORNER:
182  position = m_RB_Corner - aPosition;
183  break;
184 
185  case RT_CORNER:
186  position.x = m_RB_Corner.x - aPosition.x;
187  position.y = aPosition.y - m_LT_Corner.y;
188  break;
189 
190  case LB_CORNER:
191  position.x = aPosition.x - m_LT_Corner.x;
192  position.y = m_RB_Corner.y - aPosition.y;
193  break;
194 
195  case LT_CORNER:
196  position = aPosition - m_LT_Corner;
197  break;
198  }
199 
200  // Modify m_End only for items having 2 coordinates
201  switch( GetType() )
202  {
203  case WS_SEGMENT:
204  case WS_RECT:
205  m_End.m_Pos = position;
206  break;
207 
208  default:
209  break;
210  }
211 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
WS_ItemType GetType() const
void WORKSHEET_DATAITEM::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 219 of file class_worksheet_dataitem.cpp.

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

Referenced by moveItem().

220 {
221  DPOINT pos_mm;
222  pos_mm.x = aPosition.x / m_WSunits2Iu;
223  pos_mm.y = aPosition.y / m_WSunits2Iu;
224 
225  MoveEndPointTo( pos_mm );
226 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
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 WORKSHEET_DATAITEM::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 121 of file class_worksheet_dataitem.cpp.

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

Referenced by abortMoveItem(), WORKSHEET_DATAITEM::MoveStartPointToUi(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

122 {
123  DPOINT position;
124 
125  // Calculate the position of the starting point
126  // relative to the reference corner
127  // aPosition is the position relative to the right top paper corner
128  switch( m_Pos.m_Anchor )
129  {
130  case RB_CORNER:
131  position = m_RB_Corner - aPosition;
132  break;
133 
134  case RT_CORNER:
135  position.x = m_RB_Corner.x - aPosition.x;
136  position.y = aPosition.y - m_LT_Corner.y;
137  break;
138 
139  case LB_CORNER:
140  position.x = aPosition.x - m_LT_Corner.x;
141  position.y = m_RB_Corner.y - aPosition.y;
142  break;
143 
144  case LT_CORNER:
145  position = aPosition - m_LT_Corner;
146  break;
147  }
148 
149  m_Pos.m_Pos = position;
150 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
void WORKSHEET_DATAITEM::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 156 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_WSunits2Iu, WORKSHEET_DATAITEM::MoveStartPointTo(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by moveItem().

157 {
158  DPOINT pos_mm;
159  pos_mm.x = aPosition.x / m_WSunits2Iu;
160  pos_mm.y = aPosition.y / m_WSunits2Iu;
161 
162  MoveStartPointTo( pos_mm );
163 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
void WORKSHEET_DATAITEM::MoveTo ( DPOINT  aPosition)
inherited

move item to a new position

Parameters
aPosition= the new position of item, in mm

Definition at line 108 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetEndPos(), WORKSHEET_DATAITEM::GetStartPos(), WORKSHEET_DATAITEM::MoveEndPointTo(), and WORKSHEET_DATAITEM::MoveStartPointTo().

Referenced by abortMoveItem(), WORKSHEET_DATAITEM::MoveToUi(), and PL_EDITOR_FRAME::PlaceItem().

109 {
110  DPOINT vector = aPosition - GetStartPos();
111  DPOINT endpos = vector + GetEndPos();
112 
113  MoveStartPointTo( aPosition );
114  MoveEndPointTo( endpos );
115 }
const DPOINT GetStartPos(int ii=0) const
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
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 DPOINT GetEndPos(int ii=0) const
void WORKSHEET_DATAITEM::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 98 of file class_worksheet_dataitem.cpp.

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

Referenced by moveItem().

99 {
100  DPOINT pos_mm;
101  pos_mm.x = aPosition.x / m_WSunits2Iu;
102  pos_mm.y = aPosition.y / m_WSunits2Iu;
103 
104  MoveTo( pos_mm );
105 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
void MoveTo(DPOINT aPosition)
move item to a new position
void WORKSHEET_DATAITEM_POLYPOLYGON::SetBoundingBox ( )

calculate the bounding box of the set polygons

Definition at line 396 of file class_worksheet_dataitem.cpp.

References m_Corners, m_maxCoord, m_minCoord, m_Orient, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

397 {
398  if( m_Corners.size() == 0 )
399  {
400  m_minCoord.x = m_maxCoord.x = 0.0;
401  m_minCoord.y = m_maxCoord.y = 0.0;
402  return;
403  }
404 
405  DPOINT pos;
406  pos = m_Corners[0];
407  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
408  m_minCoord = m_maxCoord = pos;
409 
410  for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
411  {
412  pos = m_Corners[ii];
413  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
414 
415  if( m_minCoord.x > pos.x )
416  m_minCoord.x = pos.x;
417 
418  if( m_minCoord.y > pos.y )
419  m_minCoord.y = pos.y;
420 
421  if( m_maxCoord.x < pos.x )
422  m_maxCoord.x = pos.x;
423 
424  if( m_maxCoord.y < pos.y )
425  m_maxCoord.y = pos.y;
426  }
427 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
void WORKSHEET_DATAITEM::SetEnd ( double  aPosx,
double  aPosy,
enum corner_anchor  aAnchor = RB_CORNER 
)
inlineinherited

Definition at line 161 of file class_worksheet_dataitem.h.

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

162  {
163  m_End.m_Pos.x = aPosx;
164  m_End.m_Pos.y = aPosy;
165  m_End.m_Anchor = aAnchor;
166  }
void WORKSHEET_DATAITEM::SetFlags ( int  aMask)
inlineinherited
void WORKSHEET_DATAITEM::SetPage1Option ( int  aChoice)
inherited

Set the option for page 1.

Parameters
aChoice= 0 if the item has no specific option for page 1

0 if the item is only on page 1

< 0 if the item is not on page 1

Definition at line 364 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::ClearFlags(), PAGE1OPTION, PAGE1OPTION_NOTONPAGE1, PAGE1OPTION_PAGE1ONLY, and WORKSHEET_DATAITEM::SetFlags().

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem().

365 {
367 
368  if( aChoice > 0 )
370 
371  else if( aChoice < 0 )
373 
374 }
#define PAGE1OPTION_NOTONPAGE1
#define PAGE1OPTION_PAGE1ONLY
#define PAGE1OPTION
void WORKSHEET_DATAITEM::SetSelected ( bool  aState)
inlineinherited

Function SetSelected Toggles on/off the selected flag (used in edition functions.

Parameters
aState= the flag value

Definition at line 272 of file class_worksheet_dataitem.h.

References SELECTED_STATE.

Referenced by PL_EDITOR_FRAME::RedrawActiveWindow().

273  {
274  if( aState )
276  else
278  }
#define SELECTED_STATE
void WORKSHEET_DATAITEM::SetStart ( double  aPosx,
double  aPosy,
enum corner_anchor  aAnchor = RB_CORNER 
)
inlineinherited

Definition at line 154 of file class_worksheet_dataitem.h.

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

Referenced by PL_EDITOR_FRAME::UpdateStatusBar().

155  {
156  m_Pos.m_Pos.x = aPosx;
157  m_Pos.m_Pos.y = aPosy;
158  m_Pos.m_Anchor = aAnchor;
159  }
bool WORKSHEET_DATAITEM::UseAltColor ( )
inlineinherited

Definition at line 280 of file class_worksheet_dataitem.h.

References USE_ALT_COLOR.

Referenced by WORKSHEET_DATAITEM::GetItemColor().

Member Data Documentation

COLOR4D WORKSHEET_DATAITEM::m_AltColor = COLOR4D( RED )
staticinherited
COLOR4D WORKSHEET_DATAITEM::m_Color = COLOR4D( RED )
staticinherited
std::vector<DPOINT> WORKSHEET_DATAITEM_POLYPOLYGON::m_Corners

Definition at line 299 of file class_worksheet_dataitem.h.

Referenced by GetCornerPosition(), and SetBoundingBox().

wxString WORKSHEET_DATAITEM::m_Info
inherited
DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::m_maxCoord
private

Definition at line 304 of file class_worksheet_dataitem.h.

Referenced by IsInsidePage(), and SetBoundingBox().

DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::m_minCoord
private

Definition at line 303 of file class_worksheet_dataitem.h.

Referenced by IsInsidePage(), and SetBoundingBox().

wxString WORKSHEET_DATAITEM::m_Name
inherited
std::vector<unsigned> WORKSHEET_DATAITEM_POLYPOLYGON::m_polyIndexEnd
private

Definition at line 302 of file class_worksheet_dataitem.h.

COLOR4D WORKSHEET_DATAITEM::m_SelectedColor = COLOR4D( BROWN )
staticinherited
WS_ItemType WORKSHEET_DATAITEM::m_type
protectedinherited

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