KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21
22/*
23 * the class DS_DATA_ITEM (and derived) defines
24 * a basic shape of a drawing sheet (frame references and title block)
25 * Basic shapes are line, rect and texts
26 * the DS_DATA_ITEM coordinates units is the mm, and are relative to
27 * one of 4 page corners.
28 *
29 * These items cannot be drawn or plot "as this". they should be converted
30 * to a "draw list" (DS_DRAW_ITEM_BASE and derived items)
31
32 * The list of these items is stored in a DS_DATA_MODEL instance.
33 *
34 * When building the draw list:
35 * the DS_DATA_MODEL is used to create a DS_DRAW_ITEM_LIST
36 * coordinates are converted to draw/plot coordinates.
37 * texts are expanded if they contain format symbols.
38 * Items with m_RepeatCount > 1 are created m_RepeatCount times
39 *
40 * the DS_DATA_MODEL is created only once.
41 * the DS_DRAW_ITEM_LIST is created each time the drawing sheet is plotted/drawn
42 *
43 * the DS_DATA_MODEL instance is created from a S expression which
44 * describes the drawing sheet (can be the default drawing sheet or a custom file).
45 */
46
47#include <gr_text.h>
48#include <math/util.h> // for KiROUND
49#include <view/view.h>
50#include <title_block.h>
55#include <trigo.h>
56
57using KIGFX::COLOR4D;
58
59
68
69
71{
72 for( DS_DRAW_ITEM_BASE* item : m_drawItems )
73 delete item;
74}
75
76
78{
79 int pensize = GetPenSizeIU();
80
81 if( pensize == 0 )
82 pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
83
84 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
85 DS_DRAW_ITEM_BASE* item = nullptr;
86
87 for( size_t i = 0; i < m_drawItems.size(); ++i )
88 {
89 item = m_drawItems[ i ];
90 itemFlags[ i ] = item->GetFlags();
91
92 if( aCollector )
93 aCollector->Remove( item );
94
95 if( aView )
96 aView->Remove( item );
97
98 delete item;
99 }
100
101 m_drawItems.clear();
102
103 for( int j = 0; j < m_RepeatCount; j++ )
104 {
105 if( j > 0 && !IsInsidePage( j ) )
106 continue;
107
108 if( m_type == DS_SEGMENT )
109 item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
110 else if( m_type == DS_RECT )
111 item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
112 else
113 {
114 wxFAIL_MSG( wxS( "Unknown drawing sheet item type" ) );
115 continue;
116 }
117
118 item->SetFlags( itemFlags[ j ] );
119 m_drawItems.push_back( item );
120
121 if( aCollector )
122 aCollector->Append( item );
123
124 if( aView )
125 aView->Add( item );
126 }
127}
128
129
131{
133
134 if( m_LineWidth != 0 )
135 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
136 else
137 return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
138}
139
140
141void DS_DATA_ITEM::MoveToIU( const VECTOR2I& aPosition )
142{
143 VECTOR2D pos_mm;
144 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
145 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
146
147 MoveTo( pos_mm );
148}
149
150
151void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
152{
153 VECTOR2D vector = aPosition - GetStartPos();
154 VECTOR2D endpos = vector + GetEndPos();
155
156 MoveStartPointTo( aPosition );
157 MoveEndPointTo( endpos );
158
159 for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
160 {
161 drawItem->SetPosition( GetStartPosIU( drawItem->GetIndexInPeer() ) );
162 drawItem->SetEnd( GetEndPosIU( drawItem->GetIndexInPeer() ) );
163 }
164}
165
166
168{
170 VECTOR2D position;
171
172 // Calculate the position of the starting point
173 // relative to the reference corner
174 // aPosition is the position relative to the right top paper corner
175 switch( m_Pos.m_Anchor )
176 {
177 case RB_CORNER:
178 position = model.m_RB_Corner - aPosition;
179 break;
180
181 case RT_CORNER:
182 position.x = model.m_RB_Corner.x - aPosition.x;
183 position.y = aPosition.y - model.m_LT_Corner.y;
184 break;
185
186 case LB_CORNER:
187 position.x = aPosition.x - model.m_LT_Corner.x;
188 position.y = model.m_RB_Corner.y - aPosition.y;
189 break;
190
191 case LT_CORNER:
192 position = aPosition - model.m_LT_Corner;
193 break;
194 }
195
196 m_Pos.m_Pos = position;
197}
198
199
201{
202 VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
203 aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
204
205 MoveStartPointTo( pos_mm );
206}
207
208
210{
212 VECTOR2D position;
213
214 // Calculate the position of the starting point
215 // relative to the reference corner
216 // aPosition is the position relative to the right top paper corner
217 switch( m_End.m_Anchor )
218 {
219 case RB_CORNER:
220 position = model.m_RB_Corner - aPosition;
221 break;
222
223 case RT_CORNER:
224 position.x = model.m_RB_Corner.x - aPosition.x;
225 position.y = aPosition.y - model.m_LT_Corner.y;
226 break;
227
228 case LB_CORNER:
229 position.x = aPosition.x - model.m_LT_Corner.x;
230 position.y = model.m_RB_Corner.y - aPosition.y;
231 break;
232
233 case LT_CORNER:
234 position = aPosition - model.m_LT_Corner;
235 break;
236 }
237
238 // Modify m_End only for items having 2 coordinates
239 switch( GetType() )
240 {
241 case DS_SEGMENT:
242 case DS_RECT:
243 m_End.m_Pos = position;
244 break;
245
246 default:
247 break;
248 }
249}
250
251
253{
254 VECTOR2D pos_mm;
255 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
256 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
257
258 MoveEndPointTo( pos_mm );
259}
260
261
263{
265 VECTOR2D pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
266 m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
267
268 switch( m_Pos.m_Anchor )
269 {
270 case RB_CORNER: // right bottom corner
271 pos = model.m_RB_Corner - pos;
272 break;
273
274 case RT_CORNER: // right top corner
275 pos.x = model.m_RB_Corner.x - pos.x;
276 pos.y = model.m_LT_Corner.y + pos.y;
277 break;
278
279 case LB_CORNER: // left bottom corner
280 pos.x = model.m_LT_Corner.x + pos.x;
281 pos.y = model.m_RB_Corner.y - pos.y;
282 break;
283
284 case LT_CORNER: // left top corner
285 pos = model.m_LT_Corner + pos;
286 break;
287 }
288
289 return pos;
290}
291
292
294{
295 return KiROUND( GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
296}
297
298
300{
301 VECTOR2D pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
302 m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
303
304 switch( m_End.m_Anchor )
305 {
306 case RB_CORNER: // right bottom corner
308 break;
309
310 case RT_CORNER: // right top corner
313 break;
314
315 case LB_CORNER: // left bottom corner
318 break;
319
320 case LT_CORNER: // left top corner
322 break;
323 }
324
325 return pos;
326}
327
328
330{
331 VECTOR2D pos = GetEndPos( ii );
333 return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
334}
335
336
337bool DS_DATA_ITEM::IsInsidePage( int ii ) const
338{
340
341 for( const VECTOR2D& pos : { GetStartPos( ii ), GetEndPos( ii ) } )
342 {
343 if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
344 return false;
345
346 if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
347 return false;
348 }
349
350 return true;
351}
352
353
354const wxString DS_DATA_ITEM::GetClassName() const
355{
356 wxString name;
357
358 switch( GetType() )
359 {
360 case DS_TEXT: name = _( "Text" ); break;
361 case DS_SEGMENT: name = _( "Line" ); break;
362 case DS_RECT: name = _( "Rectangle" ); break;
363 case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
364 case DS_BITMAP: name = _( "Image" ); break;
365 }
366
367 return name;
368}
369
370
375
376
378{
379 std::map<int, EDA_ITEM_FLAGS> itemFlags;
380 DS_DRAW_ITEM_BASE* item = nullptr;
381
382 for( size_t i = 0; i < m_drawItems.size(); ++i )
383 {
384 item = m_drawItems[ i ];
385 itemFlags[ i ] = item->GetFlags();
386
387 if( aCollector )
388 aCollector->Remove( item );
389
390 if( aView )
391 aView->Remove( item );
392
393 delete item;
394 }
395
396 m_drawItems.clear();
397
398 for( int j = 0; j < m_RepeatCount; j++ )
399 {
400 if( j > 0 && !IsInsidePage( j ) )
401 continue;
402
403 int pensize = GetPenSizeIU();
404 auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
405 poly_shape->SetFlags( itemFlags[ j ] );
406 m_drawItems.push_back( poly_shape );
407
408 // Transfer all outlines (basic polygons)
409 SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
410
411 for( int kk = 0; kk < GetPolyCount(); kk++ )
412 {
413 // Create new outline
414 unsigned ist = GetPolyIndexStart( kk );
415 unsigned iend = GetPolyIndexEnd( kk );
416
417 polygons.NewOutline();
418
419 while( ist <= iend )
420 polygons.Append( GetCornerPositionIU( ist++, j ) );
421 }
422
423 if( aCollector )
424 aCollector->Append( poly_shape );
425
426 if( aView )
427 aView->Add( poly_shape );
428 }
429}
430
431
436
437
438const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
439{
440 VECTOR2D pos = m_Corners[aIdx];
441
442 // Rotation:
443 RotatePoint( &pos.x, &pos.y, m_Orient );
444 pos += GetStartPos( aRepeat );
445 return pos;
446}
447
448
450{
451 if( m_Corners.size() == 0 )
452 {
453 m_minCoord.x = m_maxCoord.x = 0.0;
454 m_minCoord.y = m_maxCoord.y = 0.0;
455 return;
456 }
457
458 VECTOR2I pos;
459 pos = m_Corners[0];
460 RotatePoint( &pos.x, &pos.y, m_Orient );
461 m_minCoord = m_maxCoord = pos;
462
463 for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
464 {
465 pos = m_Corners[ii];
466 RotatePoint( &pos.x, &pos.y, m_Orient );
467
468 if( m_minCoord.x > pos.x )
469 m_minCoord.x = pos.x;
470
471 if( m_minCoord.y > pos.y )
472 m_minCoord.y = pos.y;
473
474 if( m_maxCoord.x < pos.x )
475 m_maxCoord.x = pos.x;
476
477 if( m_maxCoord.y < pos.y )
478 m_maxCoord.y = pos.y;
479 }
480}
481
482
484{
486
487 VECTOR2D pos = GetStartPos( ii );
488 pos += m_minCoord; // left top pos of bounding box
489
490 if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
491 return false;
492
493 pos = GetStartPos( ii );
494 pos += m_maxCoord; // right bottom pos of bounding box
495
496 if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
497 return false;
498
499 return true;
500}
501
502
503const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionIU( unsigned aIdx, int aRepeat ) const
504{
505 VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
507 return VECTOR2I( int( pos.x ), int( pos.y ) );
508}
509
510
511DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
513{
514 m_TextBase = aTextBase;
518 m_Italic = false;
519 m_Bold = false;
520 m_Font = nullptr;
522 m_Orient = 0.0;
523 m_LineWidth = 0.0; // 0 means use default value
524}
525
526
528{
529 int pensize = GetPenSizeIU();
530 bool multilines = false;
531
532 if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
533 {
535 }
536 else
537 {
538 m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
539 multilines = ReplaceAntiSlashSequence();
540 }
541
542 if( pensize == 0 )
543 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
544
546 VECTOR2I textsize;
547
548 textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
549 textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
550
551 if( m_Bold )
552 pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
553
554 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
555 DS_DRAW_ITEM_TEXT* text = nullptr;
556
557 for( size_t i = 0; i < m_drawItems.size(); ++i )
558 {
560 itemFlags[ i ] = text->GetFlags();
561
562 if( aCollector )
563 aCollector->Remove( text );
564
565 if( aView )
566 aView->Remove( text );
567
568 delete text;
569 }
570
571 m_drawItems.clear();
572
573 for( int j = 0; j < m_RepeatCount; ++j )
574 {
575 if( j > 0 && !IsInsidePage( j ) )
576 continue;
577
578 EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
580
581 text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText, GetStartPosIU( j ), textsize,
582 pensize, m_Font, m_Italic, m_Bold, m_TextColor );
583
584 text->SetFlags( itemFlags[ j ] );
585 m_drawItems.push_back( text );
586
587 if( aCollector )
588 aCollector->Append( text );
589
590 if( aView )
591 aView->Add( text );
592
593 text->SetHorizJustify( m_Hjustify );
594 text->SetVertJustify( m_Vjustify );
595 text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
596 text->SetMultilineAllowed( multilines );
597
598 // Increment label for the next text (has no meaning for multiline texts)
599 if( m_RepeatCount > 1 && !multilines )
600 IncrementLabel( ( j + 1 ) * m_IncrementLabel );
601 }
602}
603
604
606{
608
609 if( m_LineWidth != 0 )
610 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
611 else
612 return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
613}
614
615
617{
618 int last = m_TextBase.Len() -1;
619
620 wxChar lbchar = m_TextBase[last];
622 m_FullText.RemoveLast();
623
624 if( lbchar >= '0' && lbchar <= '9' )
625 // A number is expected:
626 m_FullText << (int)( aIncr + lbchar - '0' );
627 else
628 m_FullText << (wxChar) ( aIncr + lbchar );
629}
630
631
632// Replace the '\''n' sequence by EOL
633// and the sequence '\''\' by only one '\' in m_FullText
634// if m_FullText is a multiline text (i.e.contains '\n') return true
636{
637 bool multiline = false;
638
639 for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
640 {
641 if( m_FullText[ii] == '\n' )
642 multiline = true;
643
644 else if( m_FullText[ii] == '\\' )
645 {
646 if( ++ii >= m_FullText.Len() )
647 break;
648
649 if( m_FullText[ii] == '\\' )
650 {
651 // a double \\ sequence is replaced by a single \ char
652 m_FullText.Remove(ii, 1);
653 ii--;
654 }
655 else if( m_FullText[ii] == 'n' )
656 {
657 // Replace the "\n" sequence by a EOL char
658 multiline = true;
659 m_FullText[ii] = '\n';
660 m_FullText.Remove(ii-1, 1);
661 ii--;
662 }
663 }
664 }
665
666 return multiline;
667}
668
669
671{
673
674 if( m_ConstrainedTextSize.x == 0 )
676
677 if( m_ConstrainedTextSize.y == 0 )
679
680 if( m_BoundingBoxSize.x > 0 || m_BoundingBoxSize.y > 0 )
681 {
682 // to know the X and Y size of the line, we should use EDA_TEXT::GetTextBox()
683 // but this function uses integers
684 // So, to avoid truncations with our unit in mm, use microns.
685 VECTOR2I size_micron;
686
687#define FSCALE 1000.0
688
689 int linewidth = 0;
690 size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
691 size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
692 DS_DRAW_ITEM_TEXT dummy( unityScale, this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron,
693 linewidth, m_Font, m_Italic, m_Bold, m_TextColor );
694 dummy.SetMultilineAllowed( true );
695 dummy.SetHorizJustify( m_Hjustify ) ;
696 dummy.SetVertJustify( m_Vjustify );
697 dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
698
699 BOX2I rect = dummy.GetTextBox( nullptr );
700 VECTOR2D size;
701 size.x = KiROUND( (int) rect.GetWidth() / FSCALE );
702 size.y = KiROUND( (int) rect.GetHeight() / FSCALE );
703
704 if( m_BoundingBoxSize.x > 0 && size.x > m_BoundingBoxSize.x )
706
707 if( m_BoundingBoxSize.y > 0 && size.y > m_BoundingBoxSize.y )
709 }
710}
711
712
714{
715 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
716 DS_DRAW_ITEM_BASE* item = nullptr;
717
718 for( size_t i = 0; i < m_drawItems.size(); ++i )
719 {
720 item = m_drawItems[ i ];
721 itemFlags[ i ] = item->GetFlags();
722
723 if( aCollector )
724 aCollector->Remove( item );
725
726 if( aView )
727 aView->Remove( item );
728
729 delete item;
730 }
731
732 if( aCollector )
733 {
734 double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI();
735 m_ImageBitmap->SetPixelSizeIu( pix_size_iu );
736 }
737
738 if( !m_ImageBitmap->GetOriginalImageData() )
739 return;
740
741 m_drawItems.clear();
742
743 for( int j = 0; j < m_RepeatCount; j++ )
744 {
745 if( j > 0 && !IsInsidePage( j ) )
746 continue;
747
748 DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
749
750 bitmap->SetFlags( itemFlags[ j ] );
751 m_drawItems.push_back( bitmap );
752
753 if( aCollector )
754 aCollector->Append( bitmap );
755
756 if( aView )
757 aView->Add( bitmap );
758 }
759}
760
761
763{
764 if( m_ImageBitmap )
765 return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale();
766
767 return 300;
768}
769
770
771void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
772{
773 if( m_ImageBitmap )
774 m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
775}
const char * name
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:124
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:986
constexpr size_type GetWidth() const
Definition box2.h:210
constexpr size_type GetHeight() const
Definition box2.h:211
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:398
BITMAP_BASE * m_ImageBitmap
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
void SetPPI(int aBitmapPPI)
unsigned GetPolyIndexStart(unsigned aContour) const
unsigned GetPolyIndexEnd(unsigned aContour) const
const VECTOR2I GetCornerPositionIU(unsigned aIdx, int aRepeat=0) const
void SetBoundingBox()
Calculate the bounding box of the set polygons.
virtual int GetPenSizeIU() override
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
bool IsInsidePage(int ii) const override
const VECTOR2D GetCornerPosition(unsigned aIdx, int aRepeat=0) const
std::vector< VECTOR2D > m_Corners
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
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
GR_TEXT_H_ALIGN_T m_Hjustify
KIGFX::COLOR4D m_TextColor
virtual int GetPenSizeIU() override
VECTOR2D m_BoundingBoxSize
VECTOR2D m_ConstrainedTextSize
DS_DATA_ITEM_TEXT(const wxString &aTextBase)
GR_TEXT_V_ALIGN_T m_Vjustify
virtual ~DS_DATA_ITEM()
DS_DATA_ITEM(DS_ITEM_TYPE aType)
const VECTOR2D GetEndPos(int ii=0) const
void MoveStartPointToIU(const VECTOR2I &aPosition)
Move the starting point of the item to a new position.
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 GetPenSizeIU()
void MoveEndPointToIU(const VECTOR2I &aPosition)
Move the ending point of the item to a new position.
DS_ITEM_TYPE GetType() const
void MoveTo(const VECTOR2D &aPosition)
Move item to a new position.
void MoveToIU(const VECTOR2I &aPosition)
Move item to a new position.
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
const wxString GetClassName() const
const VECTOR2I GetStartPosIU(int ii=0) const
const VECTOR2I GetEndPosIU(int ii=0) const
VECTOR2D m_IncrementVector
POINT_COORD m_Pos
virtual void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView)
PAGE_OPTION m_pageOption
DS_ITEM_TYPE m_type
virtual bool IsInsidePage(int ii) const
double m_LineWidth
POINT_COORD m_End
Handle the graphic items list to draw/plot the frame and title block.
VECTOR2D m_DefaultTextSize
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
VECTOR2D m_RB_Corner
VECTOR2D m_LT_Corner
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
int GetDefaultPenSize() const
const EDA_IU_SCALE & GetIuScale() const
wxString BuildFullText(const wxString &aTextbase)
void Append(DS_DRAW_ITEM_BASE *aItem)
double GetMilsToIUfactor()
Get the scalar to convert pages units (mils) to draw/plot units.
void Remove(DS_DRAW_ITEM_BASE *aItem)
Non filled rectangle with thick segment.
A graphic text.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:152
EDA_ITEM_FLAGS GetFlags() const
Definition eda_item.h:155
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:300
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:404
Represent a set of closed polygons.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
#define FSCALE
@ ALL_PAGES
@ RB_CORNER
@ RT_CORNER
@ LT_CORNER
@ LB_CORNER
#define _(s)
@ DEGREES_T
Definition eda_angle.h:31
int GetPenSizeForBold(int aTextSize)
Definition gr_text.cpp:33
std::vector< FAB_LAYER_COLOR > dummy
KIBIS_MODEL * model
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_CENTER
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition trigo.cpp:225
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682