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-2020 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 <eda_rect.h>
52 #include <eda_draw_frame.h>
53 #include <fill_type.h>
57 #include <base_units.h>
58 #include <page_info.h>
60 #include <gr_basic.h>
61 #include <trigo.h>
62 #include <render_settings.h>
63 
64 // ============================ BASE CLASS ==============================
65 
66 void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
67 {
68  aCount = 1;
69 
70  WS_DATA_ITEM* dataItem = GetPeer();
71 
72  if( !dataItem ) // No peer: this item is like a WS_DRAW_ITEM_PAGE
73  {
74  aLayers[0] = LAYER_WORKSHEET;
75  return;
76  }
77 
78  if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
79  aLayers[0] = LAYER_WORKSHEET_PAGE1;
80  else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
81  aLayers[0] = LAYER_WORKSHEET_PAGEn;
82  else
83  aLayers[0] = LAYER_WORKSHEET;
84 }
85 
86 
87 // A generic HitTest that can be used by some, but not all, sub-classes.
88 bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
89 {
90  EDA_RECT sel = aRect;
91 
92  if ( aAccuracy )
93  sel.Inflate( aAccuracy );
94 
95  if( aContained )
96  return sel.Contains( GetBoundingBox() );
97 
98  return sel.Intersects( GetBoundingBox() );
99 }
100 
101 
103 {
104  wxString msg;
105  WS_DATA_ITEM* dataItem = GetPeer();
106 
107  if( dataItem == nullptr ) // Is only a pure graphic item used in page layout editor
108  // to handle the page limits
109  return;
110 
111  switch( dataItem->GetType() )
112  {
114  aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg, DARKCYAN ) );
115  break;
116 
118  aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg, DARKCYAN ) );
119  break;
120 
122  msg = static_cast<WS_DRAW_ITEM_TEXT*>( this )->GetShownText();
123  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg, DARKCYAN ) );
124  break;
125 
127  aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg, DARKCYAN ) );
128  break;
129 
131  aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg, DARKCYAN ) );
132  break;
133  }
134 
135  switch( dataItem->GetPage1Option() )
136  {
137  case FIRST_PAGE_ONLY: msg = _( "First Page Only" ); break;
138  case SUBSEQUENT_PAGES: msg = _( "Subsequent Pages" ); break;
139  default: msg = _( "All Pages" ); break;
140  }
141 
142  aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) );
143 
145  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) );
146 
148  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
149 
150  msg.Printf( wxT( "(%s, %s)" ),
151  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
152  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
153 
154  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg, RED ) );
155 
156  aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info, MAGENTA ) );
157 }
158 
159 
160 // ============================ TEXT ==============================
161 
162 void WS_DRAW_ITEM_TEXT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
163 {
164  Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_WORKSHEET ), FILLED );
165 }
166 
167 
169 {
170  return EDA_TEXT::GetTextBox();
171 }
172 
173 
174 bool WS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
175 {
176  return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
177 }
178 
179 
180 bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
181 {
182  return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
183 }
184 
185 
187 {
188  return wxString::Format( _( "Text '%s'" ),
189  GetShownText() );
190 }
191 
192 
193 void WS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
194 {
196 }
197 
198 // ============================ POLYGON =================================
199 
200 void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
201 {
202  wxDC* DC = aSettings->GetPrintDC();
203  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
204  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
205 
206  std::vector<wxPoint> points_moved;
207 
208  for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
209  {
210  points_moved.clear();
211  SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
212 
213  for( int ii = 0; ii < outline.PointCount(); ii++ )
214  {
215  points_moved.emplace_back( outline.CPoint( ii ).x + aOffset.x,
216  outline.CPoint( ii ).y + aOffset.y );
217  }
218 
219  GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], true, penWidth,
220  color, color );
221  }
222 }
223 
224 
225 void WS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos )
226 {
227  // Note: m_pos is the anchor point of the shape.
228  wxPoint move_vect = aPos - m_pos;
229  m_pos = aPos;
230 
231  // Move polygon corners to the new position:
232  m_Polygons.Move( move_vect );
233 }
234 
235 
237 {
238  EDA_RECT rect;
239  BOX2I box = m_Polygons.BBox();
240 
241  rect.SetX( box.GetX() );
242  rect.SetY( box.GetY() );
243  rect.SetWidth( box.GetWidth() );
244  rect.SetHeight( box.GetHeight() );
245 
246  return rect;
247 }
248 
249 
250 bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const
251 {
252  return m_Polygons.Collide( aPosition, aAccuracy );
253 }
254 
255 
256 bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
257  int aAccuracy ) const
258 {
259  EDA_RECT sel = aRect;
260 
261  if ( aAccuracy )
262  sel.Inflate( aAccuracy );
263 
264  if( aContained )
265  return sel.Contains( GetBoundingBox() );
266 
267  // Fast test: if rect is outside the polygon bounding box, then they cannot intersect
268  if( !sel.Intersects( GetBoundingBox() ) )
269  return false;
270 
271  for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
272  {
273  const SHAPE_LINE_CHAIN& outline = m_Polygons.COutline( idx );
274 
275  for( int ii = 0; ii < outline.PointCount(); ii++ )
276  {
277  wxPoint corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
278 
279  // Test if the point is within aRect
280  if( sel.Contains( corner ) )
281  return true;
282 
283  // Test if this edge intersects aRect
284  int ii_next = (ii+1) % outline.PointCount();
285  wxPoint next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y );
286 
287  if( sel.Intersects( corner, next_corner ) )
288  return true;
289  }
290  }
291 
292  return false;
293 }
294 
295 
297 {
298  return wxString::Format( _( "Imported Shape" ) );
299 }
300 
301 
302 // ============================ RECT ==============================
303 
304 void WS_DRAW_ITEM_RECT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
305 {
306  wxDC* DC = aSettings->GetPrintDC();
307  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
308  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
309 
310  GRRect( nullptr, DC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
311  GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, penWidth, color );
312 }
313 
314 
316 {
317  return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
318 }
319 
320 
321 bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
322 {
323  int dist = aAccuracy + ( GetPenWidth() / 2 );
324  wxPoint start = GetStart();
325  wxPoint end;
326  end.x = GetEnd().x;
327  end.y = start.y;
328 
329  // Upper line
330  if( TestSegmentHit( aPosition, start, end, dist ) )
331  return true;
332 
333  // Right line
334  start = end;
335  end.y = GetEnd().y;
336  if( TestSegmentHit( aPosition, start, end, dist ) )
337  return true;
338 
339  // lower line
340  start = end;
341  end.x = GetStart().x;
342  if( TestSegmentHit( aPosition, start, end, dist ) )
343  return true;
344 
345  // left line
346  start = end;
347  end = GetStart();
348  if( TestSegmentHit( aPosition, start, end, dist ) )
349  return true;
350 
351  return false;
352 }
353 
354 
356 {
357  return wxString::Format( _( "Rectangle, width %s height %s" ),
358  MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
359  MessageTextFromValue( aUnits, std::abs( GetStart().y - GetEnd().y ) ) );
360 }
361 
362 
363 // ============================ LINE ==============================
364 
365 void WS_DRAW_ITEM_LINE::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
366 {
367  wxDC* DC = aSettings->GetPrintDC();
368  COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
369  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
370 
371  GRLine( nullptr, DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
372 }
373 
374 
376 {
377  return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
378 }
379 
380 
381 bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
382 {
383  int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
384  return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
385 }
386 
387 
389 {
390  return wxString::Format( _( "Line, length %s" ),
391  MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
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 Eeschema 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 _( "Image" );
441 }
442 
443 
445 {
446  return _( "Page Limits" );
447 }
448 
449 
451 {
452  EDA_RECT dummy;
453 
454  // We want this graphic item always visible. So gives the max size to the
455  // bounding box to avoid any clamping:
456  dummy.SetSize( wxSize( std::numeric_limits<int>::max(), std::numeric_limits<int>::max() ) );
457  return dummy;
458 }
459 
460 
461 // ====================== WS_DRAW_ITEM_LIST ==============================
462 
464  const TITLE_BLOCK& aTitleBlock )
465 {
467 
468  m_titleBlock = &aTitleBlock;
469  m_paperFormat = &aPageInfo.GetType();
470 
471  // Build the basic layout shape, if the layout list is empty
472  if( model.GetCount() == 0 && !model.VoidListAllowed() )
473  model.SetPageLayout();
474 
475  model.SetupDrawEnvironment( aPageInfo, m_milsToIu );
476 
477  for( WS_DATA_ITEM* wsItem : model.GetItems() )
478  {
479  // Generate it only if the page option allows this
480  if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && !m_isFirstPage )
481  continue;
482  else if( wsItem->GetPage1Option() == SUBSEQUENT_PAGES && m_isFirstPage )
483  continue;
484 
485  wsItem->SyncDrawItems( this, nullptr );
486  }
487 }
488 
489 
490 /* Print the item list created by BuildWorkSheetGraphicList
491  * aDC = the current Device Context
492  * The not selected items are drawn first (most of items)
493  * The selected items are drawn after (usually 0 or 1)
494  * to be sure they are seen, even for overlapping items
495  */
497 {
498  std::vector<WS_DRAW_ITEM_BASE*> second_items;
499 
500  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
501  {
502  if( item->Type() == WSG_BITMAP_T )
503  item->PrintWsItem( aSettings );
504  else
505  second_items.push_back( item );
506  }
507 
508  for( auto item : second_items )
509  item->PrintWsItem( aSettings );
510 }
511 
512 
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:134
const wxPoint & GetStart() const
Definition: ws_draw_item.h:217
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:38
WS_DATA_ITEM * GetPeer() const
Definition: ws_draw_item.h:75
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Definition: base_units.cpp:123
const wxPoint & GetEnd() const
Definition: ws_draw_item.h:219
const wxString * m_paperFormat
Definition: ws_draw_item.h:372
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
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Work sheet structure type definitions.
Definition: ws_data_item.h:97
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:137
Implementation of conversion functions that require both schematic and board internal units.
coord_type GetX() const
Definition: box2.h:190
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:540
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:490
int color
Definition: DXF_plotter.cpp:60
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:222
const TITLE_BLOCK * m_titleBlock
Definition: ws_draw_item.h:371
Definition: color4d.h:62
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:167
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:370
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:98
std::vector< WS_DATA_ITEM * > & GetItems()
WS_DRAW_ITEM_BASE * GetFirst()
Definition: ws_draw_item.h:480
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:117
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.
Definition: eda_rect.cpp:57
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void SetPosition(const wxPoint &aPos) override
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
void SetTextAngle(double aAngle) override
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:842
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:59
void BuildWorkSheetGraphicList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the page layout.
void Move(const VECTOR2I &aVector) override
bool m_isFirstPage
Is this the first page or not.
Definition: ws_draw_item.h:368
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:197
const wxPoint & GetStart() const
Definition: ws_draw_item.h:135
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:103
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void Print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset, COLOR4D aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:400
void SetX(int val)
Definition: eda_rect.h:168
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:228
Definition: color4d.h:60
DPOINT m_IncrementVector
Definition: ws_data_item.h:123
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:82
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:151
EDA_UNITS
Definition: eda_units.h:38
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Function Collide()
void SetupDrawEnvironment(const PAGE_INFO &aPageInfo, double aMilsToIU)
coord_type GetY() const
Definition: box2.h:191
void PrintWsItem(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
Definition: color4d.h:57
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:201
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
bool VoidListAllowed()
#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:375
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:198
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:103
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Definition: eda_rect.cpp:150
Helper classes to handle basic graphic items used to draw/plot title blocks and frame references segm...
Definition: ws_draw_item.h:56
void DrawBitmap(wxDC *aDC, const wxPoint &aPos)
int GetDefaultPenWidth() const
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:125
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.
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:173
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:54
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition: trigo.h:243
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:157
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:140
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.
Definition: eda_rect.cpp:363
unsigned GetCount() const
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...