KiCad PCB EDA Suite
ds_data_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 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
26/*
27 * the class DS_DATA_ITEM (and derived) 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 <gr_text.h>
52#include <math/util.h> // for KiROUND
53#include <view/view.h>
54#include <title_block.h>
59#include <trigo.h>
60
61using KIGFX::COLOR4D;
62
63
65{
67 m_type = aType;
68 m_RepeatCount = 1;
70 m_LineWidth = 0;
71}
72
73
75{
76 for( DS_DRAW_ITEM_BASE* item : m_drawItems )
77 delete item;
78}
79
80
82{
83 int pensize = GetPenSizeUi();
84
85 if( pensize == 0 )
86 pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
87
88 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
89 DS_DRAW_ITEM_BASE* item = nullptr;
90
91 for( size_t i = 0; i < m_drawItems.size(); ++i )
92 {
93 item = m_drawItems[ i ];
94 itemFlags[ i ] = item->GetFlags();
95
96 if( aCollector )
97 aCollector->Remove( item );
98
99 if( aView )
100 aView->Remove( item );
101
102 delete item;
103 }
104
105 m_drawItems.clear();
106
107 for( int j = 0; j < m_RepeatCount; j++ )
108 {
109 if( j && ! IsInsidePage( j ) )
110 continue;
111
112 if( m_type == DS_SEGMENT )
113 item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
114 else if( m_type == DS_RECT )
115 item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
116 else
117 {
118 wxFAIL_MSG( "Unknown drawing sheet item type" );
119 continue;
120 }
121
122 item->SetFlags( itemFlags[ j ] );
123 m_drawItems.push_back( item );
124
125 if( aCollector )
126 aCollector->Append( item );
127
128 if( aView )
129 aView->Add( item );
130 }
131}
132
133
135{
137
138 if( m_LineWidth != 0 )
139 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
140 else
141 return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
142}
143
144
145void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition )
146{
147 VECTOR2D pos_mm;
148 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
149 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
150
151 MoveTo( pos_mm );
152}
153
154
155void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
156{
157 VECTOR2D vector = aPosition - GetStartPos();
158 VECTOR2D endpos = vector + GetEndPos();
159
160 MoveStartPointTo( aPosition );
161 MoveEndPointTo( endpos );
162
163 for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
164 {
165 drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
166 drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
167 }
168}
169
170
172{
174 VECTOR2D position;
175
176 // Calculate the position of the starting point
177 // relative to the reference corner
178 // aPosition is the position relative to the right top paper corner
179 switch( m_Pos.m_Anchor )
180 {
181 case RB_CORNER:
182 position = model.m_RB_Corner - aPosition;
183 break;
184
185 case RT_CORNER:
186 position.x = model.m_RB_Corner.x - aPosition.x;
187 position.y = aPosition.y - model.m_LT_Corner.y;
188 break;
189
190 case LB_CORNER:
191 position.x = aPosition.x - model.m_LT_Corner.x;
192 position.y = model.m_RB_Corner.y - aPosition.y;
193 break;
194
195 case LT_CORNER:
196 position = aPosition - model.m_LT_Corner;
197 break;
198 }
199
200 m_Pos.m_Pos = position;
201}
202
203
205{
208
209 MoveStartPointTo( pos_mm );
210}
211
212
214{
216 VECTOR2D position;
217
218 // Calculate the position of the starting point
219 // relative to the reference corner
220 // aPosition is the position relative to the right top paper corner
221 switch( m_End.m_Anchor )
222 {
223 case RB_CORNER:
224 position = model.m_RB_Corner - aPosition;
225 break;
226
227 case RT_CORNER:
228 position.x = model.m_RB_Corner.x - aPosition.x;
229 position.y = aPosition.y - model.m_LT_Corner.y;
230 break;
231
232 case LB_CORNER:
233 position.x = aPosition.x - model.m_LT_Corner.x;
234 position.y = model.m_RB_Corner.y - aPosition.y;
235 break;
236
237 case LT_CORNER:
238 position = aPosition - model.m_LT_Corner;
239 break;
240 }
241
242 // Modify m_End only for items having 2 coordinates
243 switch( GetType() )
244 {
245 case DS_SEGMENT:
246 case DS_RECT:
247 m_End.m_Pos = position;
248 break;
249
250 default:
251 break;
252 }
253}
254
255
257{
258 VECTOR2D pos_mm;
259 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
260 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
261
262 MoveEndPointTo( pos_mm );
263}
264
265
267{
269 VECTOR2D pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
270 m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
271
272 switch( m_Pos.m_Anchor )
273 {
274 case RB_CORNER: // right bottom corner
275 pos = model.m_RB_Corner - pos;
276 break;
277
278 case RT_CORNER: // right top corner
279 pos.x = model.m_RB_Corner.x - pos.x;
280 pos.y = model.m_LT_Corner.y + pos.y;
281 break;
282
283 case LB_CORNER: // left bottom corner
284 pos.x = model.m_LT_Corner.x + pos.x;
285 pos.y = model.m_RB_Corner.y - pos.y;
286 break;
287
288 case LT_CORNER: // left top corner
289 pos = model.m_LT_Corner + pos;
290 break;
291 }
292
293 return pos;
294}
295
296
298{
300 return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
301}
302
303
305{
306 VECTOR2D pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
307 m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
308
309 switch( m_End.m_Anchor )
310 {
311 case RB_CORNER: // right bottom corner
313 break;
314
315 case RT_CORNER: // right top corner
318 break;
319
320 case LB_CORNER: // left bottom corner
323 break;
324
325 case LT_CORNER: // left top corner
327 break;
328 }
329
330 return pos;
331}
332
333
335{
336 VECTOR2D pos = GetEndPos( ii );
338 return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
339}
340
341
342bool DS_DATA_ITEM::IsInsidePage( int ii ) const
343{
345
346 VECTOR2D pos = GetStartPos( ii );
347
348 for( int kk = 0; kk < 1; kk++ )
349 {
350 if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
351 return false;
352
353 if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
354 return false;
355
356 pos = GetEndPos( ii );
357 }
358
359 return true;
360}
361
362
363const wxString DS_DATA_ITEM::GetClassName() const
364{
365 wxString name;
366
367 switch( GetType() )
368 {
369 case DS_TEXT: name = _( "Text" ); break;
370 case DS_SEGMENT: name = _( "Line" ); break;
371 case DS_RECT: name = _( "Rectangle" ); break;
372 case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
373 case DS_BITMAP: name = _( "Image" ); break;
374 }
375
376 return name;
377}
378
379
381 DS_DATA_ITEM( DS_POLYPOLYGON )
382{
383}
384
385
387{
388 std::map<int, EDA_ITEM_FLAGS> itemFlags;
389 DS_DRAW_ITEM_BASE* item = nullptr;
390
391 for( size_t i = 0; i < m_drawItems.size(); ++i )
392 {
393 item = m_drawItems[ i ];
394 itemFlags[ i ] = item->GetFlags();
395
396 if( aCollector )
397 aCollector->Remove( item );
398
399 if( aView )
400 aView->Remove( item );
401
402 delete item;
403 }
404
405 m_drawItems.clear();
406
407 for( int j = 0; j < m_RepeatCount; j++ )
408 {
409 if( j && !IsInsidePage( j ) )
410 continue;
411
412 int pensize = GetPenSizeUi();
413 auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
414 poly_shape->SetFlags( itemFlags[ j ] );
415 m_drawItems.push_back( poly_shape );
416
417 // Transfer all outlines (basic polygons)
418 SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
419
420 for( int kk = 0; kk < GetPolyCount(); kk++ )
421 {
422 // Create new outline
423 unsigned ist = GetPolyIndexStart( kk );
424 unsigned iend = GetPolyIndexEnd( kk );
425
426 polygons.NewOutline();
427
428 while( ist <= iend )
429 polygons.Append( GetCornerPositionUi( ist++, j ) );
430 }
431
432 if( aCollector )
433 aCollector->Append( poly_shape );
434
435 if( aView )
436 aView->Add( poly_shape );
437 }
438}
439
440
442{
443 return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
444}
445
446
447const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
448{
449 VECTOR2D pos = m_Corners[aIdx];
450
451 // Rotation:
452 RotatePoint( &pos.x, &pos.y, m_Orient );
453 pos += GetStartPos( aRepeat );
454 return pos;
455}
456
457
459{
460 if( m_Corners.size() == 0 )
461 {
462 m_minCoord.x = m_maxCoord.x = 0.0;
463 m_minCoord.y = m_maxCoord.y = 0.0;
464 return;
465 }
466
467 VECTOR2I pos;
468 pos = m_Corners[0];
469 RotatePoint( &pos.x, &pos.y, m_Orient );
470 m_minCoord = m_maxCoord = pos;
471
472 for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
473 {
474 pos = m_Corners[ii];
475 RotatePoint( &pos.x, &pos.y, m_Orient );
476
477 if( m_minCoord.x > pos.x )
478 m_minCoord.x = pos.x;
479
480 if( m_minCoord.y > pos.y )
481 m_minCoord.y = pos.y;
482
483 if( m_maxCoord.x < pos.x )
484 m_maxCoord.x = pos.x;
485
486 if( m_maxCoord.y < pos.y )
487 m_maxCoord.y = pos.y;
488 }
489}
490
491
493{
495
496 VECTOR2D pos = GetStartPos( ii );
497 pos += m_minCoord; // left top pos of bounding box
498
499 if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
500 return false;
501
502 pos = GetStartPos( ii );
503 pos += m_maxCoord; // right bottom pos of bounding box
504
505 if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
506 return false;
507
508 return true;
509}
510
511
512const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
513{
514 VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
516 return VECTOR2I( int( pos.x ), int( pos.y ) );
517}
518
519
520DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
521 DS_DATA_ITEM( DS_TEXT )
522{
523 m_TextBase = aTextBase;
527 m_Italic = false;
528 m_Bold = false;
529 m_Font = nullptr;
530 m_TextColor = COLOR4D::UNSPECIFIED;
531 m_Orient = 0.0;
532 m_LineWidth = 0.0; // 0 means use default value
533}
534
535
537{
538 int pensize = GetPenSizeUi();
539 bool multilines = false;
540
541 if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
542 {
544 }
545 else
546 {
547 m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
548 multilines = ReplaceAntiSlashSequence();
549 }
550
551 if( pensize == 0 )
552 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
553
555 wxSize textsize;
556
559
560 if( m_Bold )
561 pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
562
563 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
564 DS_DRAW_ITEM_TEXT* text = nullptr;
565
566 for( size_t i = 0; i < m_drawItems.size(); ++i )
567 {
569 itemFlags[ i ] = text->GetFlags();
570
571 if( aCollector )
572 aCollector->Remove( text );
573
574 if( aView )
575 aView->Remove( text );
576
577 delete text;
578 }
579
580 m_drawItems.clear();
581
582 for( int j = 0; j < m_RepeatCount; ++j )
583 {
584 if( j > 0 && !IsInsidePage( j ) )
585 continue;
586
587 text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
589 text->SetFlags( itemFlags[ j ] );
590 m_drawItems.push_back( text );
591
592 if( aCollector )
593 aCollector->Append( text );
594
595 if( aView )
596 aView->Add( text );
597
598 text->SetHorizJustify( m_Hjustify ) ;
599 text->SetVertJustify( m_Vjustify );
600 text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
601 text->SetMultilineAllowed( multilines );
602
603 // Increment label for the next text (has no meaning for multiline texts)
604 if( m_RepeatCount > 1 && !multilines )
605 IncrementLabel(( j + 1 ) * m_IncrementLabel );
606 }
607}
608
609
611{
613
614 if( m_LineWidth != 0 )
615 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
616 else
617 return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
618}
619
620
622{
623 int last = m_TextBase.Len() -1;
624
625 wxChar lbchar = m_TextBase[last];
627 m_FullText.RemoveLast();
628
629 if( lbchar >= '0' && lbchar <= '9' )
630 // A number is expected:
631 m_FullText << (int)( aIncr + lbchar - '0' );
632 else
633 m_FullText << (wxChar) ( aIncr + lbchar );
634}
635
636
637// Replace the '\''n' sequence by EOL
638// and the sequence '\''\' by only one '\' in m_FullText
639// if m_FullText is a multiline text (i.e.contains '\n') return true
641{
642 bool multiline = false;
643
644 for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
645 {
646 if( m_FullText[ii] == '\n' )
647 multiline = true;
648
649 else if( m_FullText[ii] == '\\' )
650 {
651 if( ++ii >= m_FullText.Len() )
652 break;
653
654 if( m_FullText[ii] == '\\' )
655 {
656 // a double \\ sequence is replaced by a single \ char
657 m_FullText.Remove(ii, 1);
658 ii--;
659 }
660 else if( m_FullText[ii] == 'n' )
661 {
662 // Replace the "\n" sequence by a EOL char
663 multiline = true;
664 m_FullText[ii] = '\n';
665 m_FullText.Remove(ii-1, 1);
666 ii--;
667 }
668 }
669 }
670
671 return multiline;
672}
673
674
676{
678
679 if( m_ConstrainedTextSize.x == 0 )
681
682 if( m_ConstrainedTextSize.y == 0 )
684
686 {
687 // to know the X and Y size of the line, we should use
688 // EDA_TEXT::GetTextBox()
689 // but this function uses integers
690 // So, to avoid truncations with our unit in mm, use microns.
691 wxSize size_micron;
692 #define FSCALE 1000.0
693 int linewidth = 0;
694 size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
695 size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
696 DS_DRAW_ITEM_TEXT dummy( this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron, linewidth,
698 dummy.SetMultilineAllowed( true );
699 dummy.SetHorizJustify( m_Hjustify ) ;
700 dummy.SetVertJustify( m_Vjustify );
701 dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
702
703 BOX2I rect = dummy.GetTextBox();
704 VECTOR2D size;
705 size.x = rect.GetWidth() / FSCALE;
706 size.y = rect.GetHeight() / FSCALE;
707
708 if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
710
711 if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y )
713 }
714}
715
716
718{
719 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
720 DS_DRAW_ITEM_BASE* item = nullptr;
721
722 for( size_t i = 0; i < m_drawItems.size(); ++i )
723 {
724 item = m_drawItems[ i ];
725 itemFlags[ i ] = item->GetFlags();
726
727 if( aCollector )
728 aCollector->Remove( item );
729
730 if( aView )
731 aView->Remove( item );
732
733 delete item;
734 }
735
736 if( aCollector )
737 {
738 double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI();
739 m_ImageBitmap->SetPixelSizeIu( pix_size_iu );
740 }
741
742 m_drawItems.clear();
743
744 for( int j = 0; j < m_RepeatCount; j++ )
745 {
746 if( j && !IsInsidePage( j ) )
747 continue;
748
749 DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
750
751 bitmap->SetFlags( itemFlags[ j ] );
752 m_drawItems.push_back( bitmap );
753
754 if( aCollector )
755 aCollector->Append( bitmap );
756
757 if( aView )
758 aView->Add( bitmap );
759 }
760}
761
762
764{
765 if( m_ImageBitmap )
767
768 return 300;
769}
770
771
772void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
773{
774 if( m_ImageBitmap )
775 m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
776}
const char * name
Definition: DXF_plotter.cpp:56
double GetScale() const
Definition: bitmap_base.h:78
void SetPixelSizeIu(double aPixSize)
Definition: bitmap_base.h:67
int GetPPI() const
Definition: bitmap_base.h:134
void SetScale(double aScale)
Definition: bitmap_base.h:79
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:370
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
void SetPPI(int aBitmapPPI)
unsigned GetPolyIndexStart(unsigned aContour) const
Definition: ds_data_item.h:252
unsigned GetPolyIndexEnd(unsigned aContour) const
Definition: ds_data_item.h:264
int GetPolyCount() const
Definition: ds_data_item.h:246
void SetBoundingBox()
Calculate the bounding box of the set polygons.
const VECTOR2I GetCornerPositionUi(unsigned aIdx, int aRepeat=0) const
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
bool IsInsidePage(int ii) const override
virtual int GetPenSizeUi() override
const VECTOR2D GetCornerPosition(unsigned aIdx, int aRepeat=0) const
std::vector< VECTOR2D > m_Corners
Definition: ds_data_item.h:288
bool ReplaceAntiSlashSequence()
Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
virtual int GetPenSizeUi() override
void IncrementLabel(int aIncr)
Try to build text which is an increment of m_TextBase has meaning only if m_TextBase is a basic text ...
void SetConstrainedTextSize()
Calculate m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text sm...
KIFONT::FONT * m_Font
Definition: ds_data_item.h:342
GR_TEXT_H_ALIGN_T m_Hjustify
Definition: ds_data_item.h:338
KIGFX::COLOR4D m_TextColor
Definition: ds_data_item.h:344
VECTOR2D m_BoundingBoxSize
Definition: ds_data_item.h:345
VECTOR2D m_ConstrainedTextSize
Definition: ds_data_item.h:348
DS_DATA_ITEM_TEXT(const wxString &aTextBase)
GR_TEXT_V_ALIGN_T m_Vjustify
Definition: ds_data_item.h:339
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
virtual ~DS_DATA_ITEM()
void MoveToUi(const VECTOR2I &aPosition)
Move item to a new position.
DS_DATA_ITEM(DS_ITEM_TYPE aType)
const VECTOR2D GetEndPos(int ii=0) const
const VECTOR2D GetStartPos(int ii=0) const
void MoveStartPointTo(const VECTOR2D &aPosition)
Move the starting point of the item to a new position.
void MoveEndPointTo(const VECTOR2D &aPosition)
Move the ending point of the item to a new position.
virtual int GetPenSizeUi()
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
void MoveTo(const VECTOR2D &aPosition)
Move item to a new position.
const VECTOR2I GetStartPosUi(int ii=0) const
void MoveEndPointToUi(const VECTOR2I &aPosition)
Move the ending point of the item to a new position.
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211
const wxString GetClassName() const
void MoveStartPointToUi(const VECTOR2I &aPosition)
Move the starting point of the item to a new position.
VECTOR2D m_IncrementVector
Definition: ds_data_item.h:204
const VECTOR2I GetEndPosUi(int ii=0) const
POINT_COORD m_Pos
Definition: ds_data_item.h:200
virtual void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView)
PAGE_OPTION m_pageOption
Definition: ds_data_item.h:209
DS_ITEM_TYPE m_type
Definition: ds_data_item.h:208
virtual bool IsInsidePage(int ii) const
double m_LineWidth
Definition: ds_data_item.h:202
POINT_COORD m_End
Definition: ds_data_item.h:201
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
VECTOR2D m_DefaultTextSize
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
double m_DefaultLineWidth
double m_DefaultTextThickness
VECTOR2D m_RB_Corner
double m_WSunits2Iu
VECTOR2D m_LT_Corner
Base class to handle basic graphic items.
Definition: ds_draw_item.h:59
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ds_draw_item.h:385
int GetDefaultPenSize() const
Definition: ds_draw_item.h:447
wxString BuildFullText(const wxString &aTextbase)
Definition: ds_painter.cpp:113
void Append(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:474
double GetMilsToIUfactor()
Get the scalar to convert pages units (mils) to draw/plot units.
Definition: ds_draw_item.h:457
void Remove(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:479
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:208
A graphic text.
Definition: ds_draw_item.h:303
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:142
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:144
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:346
VECTOR2D m_Pos
Definition: ds_data_item.h:80
Represent a set of closed polygons.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
#define FSCALE
@ ALL_PAGES
Definition: ds_data_item.h:57
@ RB_CORNER
Definition: ds_data_item.h:49
@ RT_CORNER
Definition: ds_data_item.h:50
@ LT_CORNER
Definition: ds_data_item.h:52
@ LB_CORNER
Definition: ds_data_item.h:51
#define _(s)
@ DEGREES_T
Definition: eda_angle.h:31
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:40
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_CENTER
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618