KiCad PCB EDA Suite
ws_draw_item.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
5  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 /*
27  * the class WS_DATA_ITEM (and WS_DATA_ITEM_TEXT) defines
28  * a basic shape of a page layout ( frame references and title block )
29  * Basic shapes are line, rect and texts
30  * the WS_DATA_ITEM coordinates units is the mm, and are relative to
31  * one of 4 page corners.
32  *
33  * These items cannot be drawn or plot "as this". they should be converted
34  * to a "draw list" (WS_DRAW_ITEM_BASE and derived items)
35 
36  * The list of these items is stored in a WS_DATA_MODEL instance.
37  *
38  * When building the draw list:
39  * the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
40  * coordinates are converted to draw/plot coordinates.
41  * texts are expanded if they contain format symbols.
42  * Items with m_RepeatCount > 1 are created m_RepeatCount times
43  *
44  * the WS_DATA_MODEL is created only once.
45  * the WS_DRAW_ITEM_LIST is created each time the page layout is plotted/drawn
46  *
47  * the WS_DATA_MODEL instance is created from a S expression which
48  * describes the page layout (can be the default page layout or a custom file).
49  */
50 
51 #include <fctsys.h>
52 #include <eda_rect.h>
53 #include <eda_draw_frame.h>
54 #include <gr_text.h>
55 #include <ws_draw_item.h>
56 #include <ws_data_model.h>
57 #include <base_units.h>
58 #include <page_info.h>
60 
61 // ============================ BASE CLASS ==============================
62 
63 void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
64 {
65  aCount = 1;
66 
67  WS_DATA_ITEM* dataItem = GetPeer();
68 
69  if( !dataItem ) // No peer: this item is like a WS_DRAW_ITEM_PAGE
70  {
71  aLayers[0] = LAYER_WORKSHEET;
72  return;
73  }
74 
75  if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
76  aLayers[0] = LAYER_WORKSHEET_PAGE1;
77  else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
78  aLayers[0] = LAYER_WORKSHEET_PAGEn;
79  else
80  aLayers[0] = LAYER_WORKSHEET;
81 }
82 
83 
84 // A generic HitTest that can be used by some, but not all, sub-classes.
85 bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
86 {
87  EDA_RECT sel = aRect;
88 
89  if ( aAccuracy )
90  sel.Inflate( aAccuracy );
91 
92  if( aContained )
93  return sel.Contains( GetBoundingBox() );
94 
95  return sel.Intersects( GetBoundingBox() );
96 }
97 
98 
100 {
101  wxString msg;
102  WS_DATA_ITEM* dataItem = GetPeer();
103 
104  if( dataItem == nullptr ) // Is only a pure graphic item used in page layout editor
105  // to handle the page limits
106  return;
107 
108  switch( dataItem->GetType() )
109  {
111  aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg, DARKCYAN ) );
112  break;
113 
115  aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg, DARKCYAN ) );
116  break;
117 
119  msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText();
120  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg, DARKCYAN ) );
121  break;
122 
124  aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg, DARKCYAN ) );
125  break;
126 
128  aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg, DARKCYAN ) );
129  break;
130  }
131 
132  switch( dataItem->GetPage1Option() )
133  {
134  case FIRST_PAGE_ONLY: msg = _( "First Page Only" ); break;
135  case SUBSEQUENT_PAGES: msg = _( "Subsequent Pages" ); break;
136  default: msg = _( "All Pages" ); break;
137  }
138 
139  aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) );
140 
142  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) );
143 
145  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
146 
147  msg.Printf( wxT( "(%s, %s)" ),
148  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
149  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
150 
151  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg, RED ) );
152 
153  aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info, MAGENTA ) );
154 }
155 
156 
157 // ============================ TEXT ==============================
158 
159 void WS_DRAW_ITEM_TEXT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
160 {
161  Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_WORKSHEET ), FILLED );
162 }
163 
164 
166 {
167  return EDA_TEXT::GetTextBox();
168 }
169 
170 
171 bool WS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
172 {
173  return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
174 }
175 
176 
177 bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
178 {
179  return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
180 }
181 
182 
184 {
185  return wxString::Format( _( "Text %s at (%s, %s)" ),
186  GetShownText(),
187  MessageTextFromValue( aUnits, GetTextPos().x ),
188  MessageTextFromValue( aUnits, GetTextPos().y ) );
189 }
190 
191 
192 // ============================ POLYGON =================================
193 
195 {
196  wxDC* DC = aSettings->GetPrintDC();
197  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
198  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
199 
200  std::vector<wxPoint> points_moved;
201 
202  for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
203  {
204  points_moved.clear();
205  SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
206 
207  for( int ii = 0; ii < outline.PointCount(); ii++ )
208  {
209  points_moved.emplace_back( outline.CPoint( ii ).x + aOffset.x,
210  outline.CPoint( ii ).y + aOffset.y );
211  }
212 
213  GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], FILLED_SHAPE, penWidth,
214  color, color );
215  }
216 }
217 
218 
220 {
221  // Note: m_pos is the anchor point of the shape.
222  wxPoint move_vect = aPos - m_pos;
223  m_pos = aPos;
224 
225  // Move polygon corners to the new position:
226  m_Polygons.Move( move_vect );
227 }
228 
229 
231 {
232  EDA_RECT rect;
233  BOX2I box = m_Polygons.BBox();
234 
235  rect.SetX( box.GetX() );
236  rect.SetY( box.GetY() );
237  rect.SetWidth( box.GetWidth() );
238  rect.SetHeight( box.GetHeight() );
239 
240  return rect;
241 }
242 
243 
244 bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const
245 {
246  return m_Polygons.Collide( aPosition, aAccuracy );
247 }
248 
249 
250 bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
251 {
252  EDA_RECT sel = aRect;
253 
254  if ( aAccuracy )
255  sel.Inflate( aAccuracy );
256 
257  if( aContained )
258  return sel.Contains( GetBoundingBox() );
259 
260  // Fast test: if rect is outside the polygon bounding box, then they cannot intersect
261  if( !sel.Intersects( GetBoundingBox() ) )
262  return false;
263 
264  for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
265  {
266  const SHAPE_LINE_CHAIN& outline = m_Polygons.COutline( idx );
267 
268  for( int ii = 0; ii < outline.PointCount(); ii++ )
269  {
270  wxPoint corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
271 
272  // Test if the point is within aRect
273  if( sel.Contains( corner ) )
274  return true;
275 
276  // Test if this edge intersects aRect
277  int ii_next = (ii+1) % outline.PointCount();
278  wxPoint next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y );
279 
280  if( sel.Intersects( corner, next_corner ) )
281  return true;
282  }
283  }
284 
285  return false;
286 }
287 
288 
290 {
291  return wxString::Format( _( "Imported shape at (%s, %s)" ),
292  MessageTextFromValue( aUnits, GetPosition().x ),
293  MessageTextFromValue( aUnits, GetPosition().y ) );
294 }
295 
296 
297 // ============================ RECT ==============================
298 
299 void WS_DRAW_ITEM_RECT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
300 {
301  wxDC* DC = aSettings->GetPrintDC();
302  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
303  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
304 
305  GRRect( nullptr, DC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
306  GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, penWidth, color );
307 }
308 
309 
311 {
312  return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
313 }
314 
315 
316 bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
317 {
318  int dist = aAccuracy + ( GetPenWidth() / 2 );
319  wxPoint start = GetStart();
320  wxPoint end;
321  end.x = GetEnd().x;
322  end.y = start.y;
323 
324  // Upper line
325  if( TestSegmentHit( aPosition, start, end, dist ) )
326  return true;
327 
328  // Right line
329  start = end;
330  end.y = GetEnd().y;
331  if( TestSegmentHit( aPosition, start, end, dist ) )
332  return true;
333 
334  // lower line
335  start = end;
336  end.x = GetStart().x;
337  if( TestSegmentHit( aPosition, start, end, dist ) )
338  return true;
339 
340  // left line
341  start = end;
342  end = GetStart();
343  if( TestSegmentHit( aPosition, start, end, dist ) )
344  return true;
345 
346  return false;
347 }
348 
349 
351 {
352  return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ),
353  MessageTextFromValue( aUnits, GetStart().x ),
354  MessageTextFromValue( aUnits, GetStart().y ),
355  MessageTextFromValue( aUnits, GetEnd().x ),
356  MessageTextFromValue( aUnits, GetEnd().y ) );
357 }
358 
359 
360 // ============================ LINE ==============================
361 
362 void WS_DRAW_ITEM_LINE::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
363 {
364  wxDC* DC = aSettings->GetPrintDC();
365  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
366  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
367 
368  GRLine( nullptr, DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
369 }
370 
371 
373 {
374  return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
375 }
376 
377 
378 bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
379 {
380  int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
381  return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
382 }
383 
384 
386 {
387  return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ),
388  MessageTextFromValue( aUnits, GetStart().x ),
389  MessageTextFromValue( aUnits, GetStart().y ),
390  MessageTextFromValue( aUnits, GetEnd().x ),
391  MessageTextFromValue( aUnits, GetEnd().y ) );
392 }
393 
394 
395 // ============== BITMAP ================
396 
397 void WS_DRAW_ITEM_BITMAP::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
398 {
400 
401  if( bitmap->m_ImageBitmap )
402  bitmap->m_ImageBitmap->DrawBitmap( aSettings->GetPrintDC(), m_pos + aOffset );
403 }
404 
405 
407 {
408  auto* bitmap = static_cast<const WS_DATA_ITEM_BITMAP*>( m_peer );
409  wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
410 
411  // bm_size is in Eeschma unit (100nm), convert to iu (0.001 mm)
412  bm_size.x /= 10;
413  bm_size.y /= 10;
414 
415  EDA_RECT bbox;
416  bbox.SetSize( bm_size );
417  bbox.SetOrigin( m_pos.x - bm_size.x/2, m_pos.y - bm_size.y/2 );
418 
419  return bbox;
420 }
421 
422 
423 bool WS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
424 {
425  EDA_RECT bbox = GetBoundingBox();
426  bbox.Inflate( aAccuracy );
427 
428  return bbox.Contains( aPosition );
429 }
430 
431 
432 bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
433 {
434  return WS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
435 }
436 
437 
439 {
440  return wxString::Format( _( "Image at (%s, %s)" ),
441  MessageTextFromValue( aUnits, GetPosition().x ),
442  MessageTextFromValue( aUnits, GetPosition().y ) );
443 }
444 
445 
447 {
448  wxString txt( "Page limits" );
449  return txt;
450 }
451 
452 
454 {
455  EDA_RECT dummy;
456 
457  // We want this graphic item alway visible. So gives the max size to the
458  // bounding box to avoid any clamping:
459  dummy.SetSize( wxSize( std::numeric_limits<int>::max(), std::numeric_limits<int>::max() ) );
460  return dummy;
461 }
462 
463 // ====================== WS_DRAW_ITEM_LIST ==============================
464 
466  const TITLE_BLOCK& aTitleBlock )
467 {
469 
470  m_titleBlock = &aTitleBlock;
471  m_paperFormat = &aPageInfo.GetType();
472 
473  // Build the basic layout shape, if the layout list is empty
474  if( model.GetCount() == 0 && !model.VoidListAllowed() )
475  model.SetPageLayout();
476 
477  model.SetupDrawEnvironment( aPageInfo, m_milsToIu );
478 
479  for( WS_DATA_ITEM* wsItem : model.GetItems() )
480  {
481  // Generate it only if the page option allows this
482  if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && m_sheetNumber != 1 )
483  continue;
484  else if( wsItem->GetPage1Option() == SUBSEQUENT_PAGES && m_sheetNumber == 1 )
485  continue;
486 
487  wsItem->SyncDrawItems( this, nullptr );
488  }
489 }
490 
491 
492 /* Print the item list created by BuildWorkSheetGraphicList
493  * aDC = the current Device Context
494  * The not selected items are drawn first (most of items)
495  * The selected items are drawn after (usually 0 or 1)
496  * to be sure they are seen, even for overlapping items
497  */
499 {
500  std::vector<WS_DRAW_ITEM_BASE*> second_items;
501 
502  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
503  {
504  if( item->Type() == WSG_BITMAP_T )
505  item->PrintWsItem( aSettings );
506  else
507  second_items.push_back( item );
508  }
509 
510  for( auto item : second_items )
511  item->PrintWsItem( aSettings );
512 }
513 
514 
const wxPoint & GetStart() const
Definition: ws_draw_item.h:208
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Definition: colors.h:57
EDA_UNITS
Definition: common.h:196
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:67
const wxPoint & GetEnd() const
Definition: ws_draw_item.h:210
const wxString * m_paperFormat
Definition: ws_draw_item.h:363
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
int OutlineCount() const
Returns the number of outlines in the set
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
for pageLayout editor previewing
static const int dist[10][10]
Definition: ar_matrix.cpp:326
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Work sheet structure type definitions.
Definition: ws_data_item.h:93
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
const wxPoint & GetEnd() const
Definition: ws_draw_item.h:130
Implementation of conversion functions that require both schematic and board internal units.
coord_type GetX() const
Definition: box2.h:189
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:542
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
WS_DRAW_ITEM_BASE * GetNext()
Definition: ws_draw_item.h:477
Definition: colors.h:61
int color
Definition: DXF_plotter.cpp:61
const wxPoint GetPosition() const override
Definition: ws_draw_item.h:173
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:217
const TITLE_BLOCK * m_titleBlock
Definition: ws_draw_item.h:362
const COLOR4D & GetLayerColor(int aLayer) const
Function GetLayerColor Returns the color used to draw a layer.
SHAPE_POLY_SET m_Polygons
The list of polygons.
Definition: ws_draw_item.h:159
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
const wxString & GetType() const
Definition: page_info.h:97
std::vector< WS_DATA_ITEM * > & GetItems()
WS_DRAW_ITEM_BASE * GetFirst()
Definition: ws_draw_item.h:467
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
The base class for create windows for drawing purpose.
int PointCount() const
Function PointCount()
wxString m_Info
Definition: ws_data_item.h:113
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
bool Contains(const wxPoint &aPoint) const
Function Contains.
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
void Print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, EDA_DRAW_MODE_T aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:395
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
const VECTOR2I & CPoint(int aIndex) const
Function Point()
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:844
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
const EDA_RECT GetBoundingBox() const override=0
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
WS_DATA_ITEM * m_peer
Definition: ws_draw_item.h:51
void BuildWorkSheetGraphicList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Function BuildWorkSheetGraphicList is a core function for drawing or plotting the page layout with th...
void Move(const VECTOR2I &aVector) override
void SetHeight(int val)
Definition: eda_rect.h:186
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
coord_type GetWidth() const
Definition: box2.h:196
const wxPoint & GetStart() const
Definition: ws_draw_item.h:128
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: ws_draw_item.h:96
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void SetX(int val)
Definition: eda_rect.h:168
Definition: colors.h:60
bool Collide(const VECTOR2I &aP, int aClearance=0) const override
Function Collide Checks whether the point aP collides with the inside of the polygon set; if the poin...
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
void SetWidth(int val)
Definition: eda_rect.h:180
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:230
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
void SetY(int val)
Definition: eda_rect.h:174
virtual int GetPenWidth() const
Definition: ws_draw_item.h:75
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:147
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
void SetupDrawEnvironment(const PAGE_INFO &aPageInfo, double aMilsToIU)
coord_type GetY() const
Definition: box2.h:190
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
void Print(RENDER_SETTINGS *aSettings)
Draws the item list created by BuildWorkSheetGraphicList.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Board layer functions and definitions.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
bool VoidListAllowed()
const wxPoint GetPosition() const override
Definition: ws_draw_item.h:328
#define _(s)
Definition: 3d_actions.cpp:33
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:370
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
coord_type GetHeight() const
Definition: box2.h:197
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
void DrawBitmap(wxDC *aDC, const wxPoint &aPos)
int GetDefaultPenWidth() const
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, MSG_PANEL_ITEMS &aList) override
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
int m_IncrementLabel
Definition: ws_data_item.h:121
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void SetPosition(wxPoint aPos) override
for pageLayout editor previewing
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
const BOX2I BBox(int aClearance=0) const override
Function BBox()
PAGE_OPTION GetPage1Option() const
Definition: ws_data_item.h:153
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:133
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
unsigned GetCount() const
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40
Definition: colors.h:62
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...