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-2022 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_draw_frame.h>
55#include <base_units.h>
56#include <page_info.h>
57#include <layer_ids.h>
58#include <gr_basic.h>
59#include <trigo.h>
60#include <render_settings.h>
61
62// ============================ BASE CLASS ==============================
63
64void DS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
65{
66 aCount = 1;
67
68 DS_DATA_ITEM* dataItem = GetPeer();
69
70 if( !dataItem ) // No peer: this item is like a DS_DRAW_ITEM_PAGE
71 {
72 aLayers[0] = LAYER_DRAWINGSHEET;
73 return;
74 }
75
76 if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
77 aLayers[0] = LAYER_DRAWINGSHEET_PAGE1;
78 else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
79 aLayers[0] = LAYER_DRAWINGSHEET_PAGEn;
80 else
81 aLayers[0] = LAYER_DRAWINGSHEET;
82}
83
84
85// A generic HitTest that can be used by some, but not all, sub-classes.
86bool DS_DRAW_ITEM_BASE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
87{
88 BOX2I sel = aRect;
89
90 if ( aAccuracy )
91 sel.Inflate( aAccuracy );
92
93 if( aContained )
94 return sel.Contains( GetBoundingBox() );
95
96 return sel.Intersects( GetBoundingBox() );
97}
98
99
101 std::vector<MSG_PANEL_ITEM>& aList )
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.emplace_back( _( "Line" ), wxEmptyString );
114 break;
115
117 aList.emplace_back( _( "Rectangle" ), wxEmptyString );
118 break;
119
121 aList.emplace_back( _( "Text" ), static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText() );
122 break;
123
125 aList.emplace_back( _( "Imported Shape" ), wxEmptyString );
126 break;
127
129 aList.emplace_back( _( "Image" ), wxEmptyString );
130 break;
131 }
132
133 switch( dataItem->GetPage1Option() )
134 {
135 case FIRST_PAGE_ONLY: msg = _( "First Page Only" ); break;
136 case SUBSEQUENT_PAGES: msg = _( "Subsequent Pages" ); break;
137 default: msg = _( "All Pages" ); break;
138 }
139
140 aList.emplace_back( _( "First Page Option" ), msg );
141
143 dataItem->m_RepeatCount );
144 aList.emplace_back( _( "Repeat Count" ), msg );
145
147 dataItem->m_IncrementLabel );
148 aList.emplace_back( _( "Repeat Label Increment" ), msg );
149
150 msg.Printf( wxT( "(%s, %s)" ),
151 aFrame->MessageTextFromValue( dataItem->m_IncrementVector.x ),
152 aFrame->MessageTextFromValue( dataItem->m_IncrementVector.y ) );
153
154 aList.emplace_back( _( "Repeat Position Increment" ), msg );
155
156 aList.emplace_back( _( "Comment" ), dataItem->m_Info );
157}
158
159
160// ============================ TEXT ==============================
161
162void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
163{
165
166 if( color == COLOR4D::UNSPECIFIED )
167 color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
168
169 Print( aSettings, aOffset, color, FILLED );
170}
171
172
174{
175 return EDA_TEXT::GetTextBox();
176}
177
178
179bool DS_DRAW_ITEM_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
180{
181 return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
182}
183
184
185bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
186{
187 return EDA_TEXT::TextHitTest( aRect, aContains, aAccuracy );
188}
189
190
192{
193 return wxString::Format( _( "Text '%s'" ), GetShownText() );
194}
195
196
197// ============================ POLYGON =================================
198
200 const VECTOR2I& aOffset )
201{
202 wxDC* DC = aSettings->GetPrintDC();
204 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
205
206 std::vector<VECTOR2I> 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( DC, points_moved.size(), &points_moved[0], true, penWidth, color, color );
220 }
221}
222
223
225{
226 // Note: m_pos is the anchor point of the shape.
227 VECTOR2I move_vect = aPos - m_pos;
228 m_pos = aPos;
229
230 // Move polygon corners to the new position:
231 m_Polygons.Move( move_vect );
232}
233
234
236{
237 return m_Polygons.BBox();
238}
239
240
241bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
242{
243 return m_Polygons.Collide( aPosition, aAccuracy );
244}
245
246
247bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
248{
249 BOX2I sel = aRect;
250
251 if ( aAccuracy )
252 sel.Inflate( aAccuracy );
253
254 if( aContained )
255 return sel.Contains( GetBoundingBox() );
256
257 // Fast test: if rect is outside the polygon bounding box, then they cannot intersect
258 if( !sel.Intersects( GetBoundingBox() ) )
259 return false;
260
261 for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
262 {
263 const SHAPE_LINE_CHAIN& outline = m_Polygons.COutline( idx );
264
265 for( int ii = 0; ii < outline.PointCount(); ii++ )
266 {
267 VECTOR2I corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
268
269 // Test if the point is within aRect
270 if( sel.Contains( corner ) )
271 return true;
272
273 // Test if this edge intersects aRect
274 int ii_next = (ii+1) % outline.PointCount();
275 VECTOR2I next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y );
276
277 if( sel.Intersects( corner, next_corner ) )
278 return true;
279 }
280 }
281
282 return false;
283}
284
285
287{
288 return _( "Imported Shape" );
289}
290
291
292// ============================ RECT ==============================
293
294void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
295{
296 wxDC* DC = aSettings->GetPrintDC();
298 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
299
300 GRRect( DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
301}
302
303
305{
306 return BOX2I( GetStart(), GetEnd() - GetStart() );
307}
308
309
310bool DS_DRAW_ITEM_RECT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
311{
312 int dist = aAccuracy + ( GetPenWidth() / 2 );
313 VECTOR2I start = GetStart();
314 VECTOR2I end;
315 end.x = GetEnd().x;
316 end.y = start.y;
317
318 // Upper line
319 if( TestSegmentHit( aPosition, start, end, dist ) )
320 return true;
321
322 // Right line
323 start = end;
324 end.y = GetEnd().y;
325 if( TestSegmentHit( aPosition, start, end, dist ) )
326 return true;
327
328 // lower line
329 start = end;
330 end.x = GetStart().x;
331 if( TestSegmentHit( aPosition, start, end, dist ) )
332 return true;
333
334 // left line
335 start = end;
336 end = GetStart();
337 if( TestSegmentHit( aPosition, start, end, dist ) )
338 return true;
339
340 return false;
341}
342
343
344bool DS_DRAW_ITEM_RECT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
345{
346 BOX2I sel = aRect;
347
348 if ( aAccuracy )
349 sel.Inflate( aAccuracy );
350
351 if( aContained )
352 return sel.Contains( GetBoundingBox() );
353
354 // For greedy we need to check each side of the rect as we're pretty much always inside the
355 // rect which defines the drawing-sheet frame.
356 BOX2I side = GetBoundingBox();
357 side.SetHeight( 0 );
358
359 if( sel.Intersects( side ) )
360 return true;
361
362 side.SetY( GetBoundingBox().GetBottom() );
363
364 if( sel.Intersects( side ) )
365 return true;
366
367 side = GetBoundingBox();
368 side.SetWidth( 0 );
369
370 if( sel.Intersects( side ) )
371 return true;
372
373 side.SetX( GetBoundingBox().GetRight() );
374
375 if( sel.Intersects( side ) )
376 return true;
377
378 return false;
379}
380
381
383{
384 return wxString::Format( _( "Rectangle, width %s height %s" ),
385 aUnitsProvider->MessageTextFromValue( std::abs( GetStart().x - GetEnd().x ) ),
386 aUnitsProvider->MessageTextFromValue( std::abs( GetStart().y - GetEnd().y ) ) );
387}
388
389
390// ============================ LINE ==============================
391
392void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
393{
394 wxDC* DC = aSettings->GetPrintDC();
396 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
397
398 GRLine( DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
399}
400
401
403{
404 return BOX2I( GetStart(), GetEnd() - GetStart() );
405}
406
407
408bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
409{
410 int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
411 return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
412}
413
414
416{
417 return wxString::Format( _( "Line, length %s" ),
418 aUnitsProvider->MessageTextFromValue( EuclideanNorm( GetStart() - GetEnd() ) ) );
419}
420
421
422// ============== BITMAP ================
423
424void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
425{
427
428 if( !bitmap->m_ImageBitmap )
429 return;
430
431 bitmap->m_ImageBitmap->DrawBitmap( aSettings->GetPrintDC(), m_pos + aOffset );
432}
433
434
436{
437 const DS_DATA_ITEM_BITMAP* bitmap = static_cast<const DS_DATA_ITEM_BITMAP*>( m_peer );
438 VECTOR2I bm_size = bitmap->m_ImageBitmap->GetSize();
439 BOX2I bbox;
440
441 bbox.SetSize( bm_size );
442 bbox.SetOrigin( m_pos.x - bm_size.x / 2, m_pos.y - bm_size.y / 2 );
443
444 return bbox;
445}
446
447
448bool DS_DRAW_ITEM_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
449{
450 BOX2I bbox = GetBoundingBox();
451 bbox.Inflate( aAccuracy );
452
453 return bbox.Contains( aPosition );
454}
455
456
457bool DS_DRAW_ITEM_BITMAP::HitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
458{
459 return DS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
460}
461
462
464{
465 return _( "Image" );
466}
467
468
470{
471 return _( "Page Limits" );
472}
473
474
476{
477 BOX2I dummy;
478
479 // We want this graphic item always visible. So gives the max size to the
480 // bounding box to avoid any clamping:
481 dummy.SetMaximum();
482
483 return dummy;
484}
485
486
487// ====================== DS_DRAW_ITEM_LIST ==============================
488
490 const TITLE_BLOCK& aTitleBlock )
491{
493
494 m_titleBlock = &aTitleBlock;
495 m_paperFormat = &aPageInfo.GetType();
496
497 // Build the basic layout shape, if the layout list is empty
498 if( model.GetCount() == 0 && !model.VoidListAllowed() )
499 model.LoadDrawingSheet();
500
501 model.SetupDrawEnvironment( aPageInfo, m_milsToIu );
502
503 for( DS_DATA_ITEM* wsItem : model.GetItems() )
504 {
505 // Generate it only if the page option allows this
506 if( wsItem->GetPage1Option() == FIRST_PAGE_ONLY && !m_isFirstPage )
507 continue;
508 else if( wsItem->GetPage1Option() == SUBSEQUENT_PAGES && m_isFirstPage )
509 continue;
510
511 wsItem->SyncDrawItems( this, nullptr );
512 }
513}
514
515
516/* Print the item list created by BuildDrawItemsList
517 * aDC = the current Device Context
518 * The not selected items are drawn first (most of items)
519 * The selected items are drawn after (usually 0 or 1)
520 * to be sure they are seen, even for overlapping items
521 */
523{
524 std::vector<DS_DRAW_ITEM_BASE*> second_items;
525
526 for( DS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
527 {
528 if( item->Type() == WSG_BITMAP_T )
529 item->PrintWsItem( aSettings );
530 else
531 second_items.push_back( item );
532 }
533
534 for( DS_DRAW_ITEM_BASE* item : second_items )
535 item->PrintWsItem( aSettings );
536}
537
538
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
BOX2< VECTOR2I > BOX2I
Definition: box2.h:847
void DrawBitmap(wxDC *aDC, const VECTOR2I &aPos)
VECTOR2I GetSize() const
void SetOrigin(const Vec &pos)
Definition: box2.h:202
void SetX(coord_type val)
Definition: box2.h:235
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
void SetY(coord_type val)
Definition: box2.h:240
void SetWidth(coord_type val)
Definition: box2.h:245
void SetSize(const Vec &size)
Definition: box2.h:213
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
void SetHeight(coord_type val)
Definition: box2.h:250
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:370
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
PAGE_OPTION GetPage1Option() const
Definition: ds_data_item.h:133
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
VECTOR2D m_IncrementVector
Definition: ds_data_item.h:204
wxString m_Info
Definition: ds_data_item.h:199
int m_IncrementLabel
Definition: ds_data_item.h:205
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:39
void SetupDrawEnvironment(const PAGE_INFO &aPageInfo, double aMilsToIU)
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
unsigned GetCount() const
bool VoidListAllowed()
Definition: ds_data_model.h:88
std::vector< DS_DATA_ITEM * > & GetItems()
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.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:59
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: ds_draw_item.h:91
const BOX2I GetBoundingBox() const override=0
Return the orthogonal bounding box of this object for display purposes.
virtual int GetPenWidth() const
Definition: ds_draw_item.h:70
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
DS_DATA_ITEM * GetPeer() const
Definition: ds_draw_item.h:63
DS_DATA_ITEM * m_peer
Definition: ds_draw_item.h:112
void PrintWsItem(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void PrintWsItem(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
const VECTOR2I & GetStart() const
Definition: ds_draw_item.h:133
const VECTOR2I & GetEnd() const
Definition: ds_draw_item.h:135
DS_DRAW_ITEM_BASE * GetFirst()
Definition: ds_draw_item.h:485
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void Print(const RENDER_SETTINGS *aSettings)
Draws the item list created by BuildDrawItemsList.
const TITLE_BLOCK * m_titleBlock
Definition: ds_draw_item.h:552
bool m_isFirstPage
Is this the first page or not.
Definition: ds_draw_item.h:549
const wxString * m_paperFormat
Definition: ds_draw_item.h:553
DS_DRAW_ITEM_BASE * GetNext()
Definition: ds_draw_item.h:495
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
SHAPE_POLY_SET m_Polygons
The list of polygons.
Definition: ds_draw_item.h:195
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetPosition(const VECTOR2I &aPos) override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void PrintWsItem(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
const VECTOR2I & GetEnd() const
Definition: ds_draw_item.h:223
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const VECTOR2I & GetStart() const
Definition: ds_draw_item.h:221
void PrintWsItem(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
A graphic text.
Definition: ds_draw_item.h:303
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) 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 VECTOR2I &aOffset) override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
The base class for create windows for drawing purpose.
BOX2I 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:503
COLOR4D GetTextColor() const
Definition: eda_text.h:198
virtual bool TextHitTest(const VECTOR2I &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:623
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:98
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
Definition: eda_text.cpp:648
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
const wxString & GetType() const
Definition: page_info.h:94
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
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,...
SHAPE_LINE_CHAIN & Outline(int aIndex)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void Move(const VECTOR2I &aVector) override
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
@ FIRST_PAGE_ONLY
Definition: ds_data_item.h:58
@ SUBSEQUENT_PAGES
Definition: ds_data_item.h:59
#define _(s)
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:387
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162
void GRPoly(wxDC *DC, int n, const VECTOR2I *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:332
@ LAYER_DRAWINGSHEET_PAGEn
for drawingsheetEditor previewing
Definition: layer_ids.h:247
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
Definition: layer_ids.h:217
@ LAYER_DRAWINGSHEET_PAGE1
for drawingsheetEditor previewing
Definition: layer_ids.h:246
wxString MessageTextFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
Definition: eda_units.cpp:319
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
@ FILLED
Definition: outline_mode.h:27
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
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129
@ WSG_BITMAP_T
Definition: typeinfo.h:225