KiCad PCB EDA Suite
ds_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 DS_DATA_ITEM (and DS_DATA_ITEM_TEXT) defines
28  * a basic shape of a drawing sheet (frame references and title block)
29  * Basic shapes are line, rect and texts
30  * the DS_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" (DS_DRAW_ITEM_BASE and derived items)
35 
36  * The list of these items is stored in a DS_DATA_MODEL instance.
37  *
38  * When building the draw list:
39  * the DS_DATA_MODEL is used to create a DS_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 DS_DATA_MODEL is created only once.
45  * the DS_DRAW_ITEM_LIST is created each time the drawing sheet is plotted/drawn
46  *
47  * the DS_DATA_MODEL instance is created from a S expression which
48  * describes the drawing sheet (can be the default drawing sheet or a custom file).
49  */
50 
51 #include <eda_rect.h>
52 #include <eda_draw_frame.h>
56 #include <base_units.h>
57 #include <page_info.h>
58 #include <layer_ids.h>
59 #include <gr_basic.h>
60 #include <trigo.h>
61 #include <render_settings.h>
62 
63 // ============================ BASE CLASS ==============================
64 
65 void DS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
66 {
67  aCount = 1;
68 
69  DS_DATA_ITEM* dataItem = GetPeer();
70 
71  if( !dataItem ) // No peer: this item is like a DS_DRAW_ITEM_PAGE
72  {
73  aLayers[0] = LAYER_DRAWINGSHEET;
74  return;
75  }
76 
77  if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
78  aLayers[0] = LAYER_DRAWINGSHEET_PAGE1;
79  else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
80  aLayers[0] = LAYER_DRAWINGSHEET_PAGEn;
81  else
82  aLayers[0] = LAYER_DRAWINGSHEET;
83 }
84 
85 
86 // A generic HitTest that can be used by some, but not all, sub-classes.
87 bool DS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
88 {
89  EDA_RECT sel = aRect;
90 
91  if ( aAccuracy )
92  sel.Inflate( aAccuracy );
93 
94  if( aContained )
95  return sel.Contains( GetBoundingBox() );
96 
97  return sel.Intersects( GetBoundingBox() );
98 }
99 
100 
102 {
103  wxString msg;
104  DS_DATA_ITEM* dataItem = GetPeer();
105 
106  if( dataItem == nullptr ) // Is only a pure graphic item used in drawing sheet editor to
107  // handle the page limits
108  return;
109 
110  switch( dataItem->GetType() )
111  {
113  aList.push_back( MSG_PANEL_ITEM( _( "Line" ), msg ) );
114  break;
115 
117  aList.push_back( MSG_PANEL_ITEM( _( "Rectangle" ), msg ) );
118  break;
119 
121  msg = static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText();
122  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), msg ) );
123  break;
124 
126  aList.push_back( MSG_PANEL_ITEM( _( "Imported Shape" ), msg ) );
127  break;
128 
130  aList.push_back( MSG_PANEL_ITEM( _( "Image" ), msg ) );
131  break;
132  }
133 
134  switch( dataItem->GetPage1Option() )
135  {
136  case FIRST_PAGE_ONLY: msg = _( "First Page Only" ); break;
137  case SUBSEQUENT_PAGES: msg = _( "Subsequent Pages" ); break;
138  default: msg = _( "All Pages" ); break;
139  }
140 
141  aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg ) );
142 
144  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg ) );
145 
147  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg ) );
148 
149  msg.Printf( wxT( "(%s, %s)" ),
150  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
151  MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
152 
153  aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg ) );
154 
155  aList.push_back( MSG_PANEL_ITEM( _( "Comment" ), dataItem->m_Info ) );
156 }
157 
158 
159 // ============================ TEXT ==============================
160 
161 void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
162 {
163  Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED );
164 }
165 
166 
168 {
169  return EDA_TEXT::GetTextBox();
170 }
171 
172 
173 bool DS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
174 {
175  return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
176 }
177 
178 
179 bool DS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
180 {
181  return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
182 }
183 
184 
186 {
187  return wxString::Format( _( "Text '%s'" ),
188  GetShownText() );
189 }
190 
191 
192 void DS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
193 {
195 }
196 
197 // ============================ POLYGON =================================
198 
200  const wxPoint& aOffset )
201 {
202  wxDC* DC = aSettings->GetPrintDC();
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 DS_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 DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const
251 {
252  return m_Polygons.Collide( aPosition, aAccuracy );
253 }
254 
255 
256 bool DS_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 DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
305 {
306  wxDC* DC = aSettings->GetPrintDC();
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 DS_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 
355 bool DS_DRAW_ITEM_RECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
356 {
357  EDA_RECT sel = aRect;
358 
359  if ( aAccuracy )
360  sel.Inflate( aAccuracy );
361 
362  if( aContained )
363  return sel.Contains( GetBoundingBox() );
364 
365  // For greedy we need to check each side of the rect as we're pretty much always inside the
366  // rect which defines the drawing-sheet frame.
367  EDA_RECT side = GetBoundingBox();
368  side.SetHeight( 0 );
369 
370  if( sel.Intersects( side ) )
371  return true;
372 
373  side.SetY( GetBoundingBox().GetBottom() );
374 
375  if( sel.Intersects( side ) )
376  return true;
377 
378  side = GetBoundingBox();
379  side.SetWidth( 0 );
380 
381  if( sel.Intersects( side ) )
382  return true;
383 
384  side.SetX( GetBoundingBox().GetRight() );
385 
386  if( sel.Intersects( side ) )
387  return true;
388 
389  return false;
390 }
391 
392 
394 {
395  return wxString::Format( _( "Rectangle, width %s height %s" ),
396  MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
397  MessageTextFromValue( aUnits, std::abs( GetStart().y - GetEnd().y ) ) );
398 }
399 
400 
401 // ============================ LINE ==============================
402 
403 void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
404 {
405  wxDC* DC = aSettings->GetPrintDC();
407  int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
408 
409  GRLine( nullptr, DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
410 }
411 
412 
414 {
415  return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
416 }
417 
418 
419 bool DS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
420 {
421  int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
422  return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
423 }
424 
425 
427 {
428  return wxString::Format( _( "Line, length %s" ),
429  MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
430 }
431 
432 
433 // ============== BITMAP ================
434 
435 void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
436 {
438 
439  if( !bitmap->m_ImageBitmap )
440  return;
441 
442  bitmap->m_ImageBitmap->DrawBitmap( aSettings->GetPrintDC(), m_pos + aOffset );
443 }
444 
445 
447 {
448  auto* bitmap = static_cast<const DS_DATA_ITEM_BITMAP*>( m_peer );
449  wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
450 
451  EDA_RECT bbox;
452  bbox.SetSize( bm_size );
453  bbox.SetOrigin( m_pos.x - bm_size.x/2, m_pos.y - bm_size.y/2 );
454 
455  return bbox;
456 }
457 
458 
459 bool DS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
460 {
461  EDA_RECT bbox = GetBoundingBox();
462  bbox.Inflate( aAccuracy );
463 
464  return bbox.Contains( aPosition );
465 }
466 
467 
468 bool DS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
469 {
470  return DS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
471 }
472 
473 
475 {
476  return _( "Image" );
477 }
478 
479 
481 {
482  return _( "Page Limits" );
483 }
484 
485 
487 {
488  EDA_RECT dummy;
489 
490  // We want this graphic item always visible. So gives the max size to the
491  // bounding box to avoid any clamping:
492  dummy.SetSize( wxSize( std::numeric_limits<int>::max(), std::numeric_limits<int>::max() ) );
493  return dummy;
494 }
495 
496 
497 // ====================== DS_DRAW_ITEM_LIST ==============================
498 
500  const TITLE_BLOCK& aTitleBlock )
501 {
503 
504  m_titleBlock = &aTitleBlock;
505  m_paperFormat = &aPageInfo.GetType();
506 
507  // Build the basic layout shape, if the layout list is empty
508  if( model.GetCount() == 0 && !model.VoidListAllowed() )
509  model.LoadDrawingSheet();
510 
511  model.SetupDrawEnvironment( aPageInfo, m_milsToIu );
512 
513  for( DS_DATA_ITEM* wsItem : model.GetItems() )
514  {
515  // Generate it only if the page option allows this
516  if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && !m_isFirstPage )
517  continue;
518  else if( wsItem->GetPage1Option() == SUBSEQUENT_PAGES && m_isFirstPage )
519  continue;
520 
521  wsItem->SyncDrawItems( this, nullptr );
522  }
523 }
524 
525 
526 /* Print the item list created by BuildDrawItemsList
527  * aDC = the current Device Context
528  * The not selected items are drawn first (most of items)
529  * The selected items are drawn after (usually 0 or 1)
530  * to be sure they are seen, even for overlapping items
531  */
533 {
534  std::vector<DS_DRAW_ITEM_BASE*> second_items;
535 
536  for( DS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
537  {
538  if( item->Type() == WSG_BITMAP_T )
539  item->PrintWsItem( aSettings );
540  else
541  second_items.push_back( item );
542  }
543 
544  for( auto item : second_items )
545  item->PrintWsItem( aSettings );
546 }
547 
548 
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
bool m_isFirstPage
Is this the first page or not.
Definition: ds_draw_item.h:570
wxString m_Info
Definition: ds_data_item.h:199
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const TITLE_BLOCK * m_titleBlock
Definition: ds_draw_item.h:573
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Implementation of conversion functions that require both schematic and board internal units.
coord_type GetX() const
Definition: box2.h:173
for drawingsheetEditor previewing
Definition: layer_ids.h:237
void PrintWsItem(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
DS_DATA_ITEM * m_peer
Definition: ds_draw_item.h:112
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:407
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
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:229
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void PrintWsItem(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
std::vector< DS_DATA_ITEM * > & GetItems()
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const wxString & GetType() const
Definition: page_info.h:94
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, const COLOR4D &aColor)
Definition: gr_basic.cpp:774
The base class for create windows for drawing purpose.
int PointCount() const
Return the number of points (vertices) in this line chain.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
const wxPoint & GetStart() const
Definition: ds_draw_item.h:133
const wxPoint & GetStart() const
Definition: ds_draw_item.h:219
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
void Print(const RENDER_SETTINGS *aSettings)
Draws the item list created by BuildDrawItemsList.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:71
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
DPOINT m_IncrementVector
Definition: ds_data_item.h:204
for drawingsheetEditor previewing
Definition: layer_ids.h:238
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
DS_DRAW_ITEM_BASE * GetNext()
Definition: ds_draw_item.h:494
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368
void Move(const VECTOR2I &aVector) override
void SetHeight(int val)
Definition: eda_rect.h:176
SHAPE_LINE_CHAIN & Outline(int aIndex)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
coord_type GetWidth() const
Definition: box2.h:180
void SetTextAngle(double aAngle) override
bool TestSegmentHit(const wxPoint &aRefPoint, const wxPoint &aStart, const wxPoint &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
int m_IncrementLabel
Definition: ds_data_item.h:205
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
#define _(s)
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void PrintWsItem(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
void SetX(int val)
Definition: eda_rect.h:158
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:212
wxDC * GetPrintDC() const
drawingsheet frame and titleblock
Definition: layer_ids.h:212
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, MSG_PANEL_ITEMS &aList) override
void SetWidth(int val)
Definition: eda_rect.h:170
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
void SetY(int val)
Definition: eda_rect.h:164
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS
Definition: eda_units.h:38
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
coord_type GetY() const
Definition: box2.h:174
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetSize(const wxSize &size)
Definition: eda_rect.h:134
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
SHAPE_POLY_SET m_Polygons
The list of polygons.
Definition: ds_draw_item.h:193
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
Represent a polyline (an zero-thickness chain of connected line segments).
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const wxString * m_paperFormat
Definition: ds_draw_item.h:574
void SetupDrawEnvironment(const PAGE_INFO &aPageInfo, double aMilsToIU)
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: ds_draw_item.h:91
Handle the component boundary box.
Definition: eda_rect.h:42
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:382
bool LoadDrawingSheet(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout or the default layout if no custom layout is available.
coord_type GetHeight() const
Definition: box2.h:181
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
unsigned GetCount() const
void DrawBitmap(wxDC *aDC, const wxPoint &aPos)
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
int GetDefaultPenWidth() const
bool VoidListAllowed()
Definition: ds_data_model.h:88
const wxPoint & GetEnd() const
Definition: ds_draw_item.h:221
virtual int GetPenWidth() const
Definition: ds_draw_item.h:70
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:167
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
Definition: gr_basic.cpp:497
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
const EDA_RECT GetBoundingBox() const override=0
Return the orthogonal bounding box of this object for display purposes.
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:254
DS_DRAW_ITEM_BASE * GetFirst()
Definition: ds_draw_item.h:484
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
void PrintWsItem(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:141
const wxPoint & GetEnd() const
Definition: ds_draw_item.h:135
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
PAGE_OPTION GetPage1Option() const
Definition: ds_data_item.h:133
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
void PrintWsItem(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
void SetPosition(const wxPoint &aPos) override