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 <increment.h>
49#include <math/util.h> // for KiROUND
50#include <view/view.h>
51#include <title_block.h>
56#include <trigo.h>
57
58using KIGFX::COLOR4D;
59
60
69
70
72{
73 for( DS_DRAW_ITEM_BASE* item : m_drawItems )
74 delete item;
75}
76
77
79{
80 int pensize = GetPenSizeIU();
81
82 if( pensize == 0 )
83 pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
84
85 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
86 DS_DRAW_ITEM_BASE* item = nullptr;
87
88 for( size_t i = 0; i < m_drawItems.size(); ++i )
89 {
90 item = m_drawItems[ i ];
91 itemFlags[ i ] = item->GetFlags();
92
93 if( aCollector )
94 aCollector->Remove( item );
95
96 if( aView )
97 aView->Remove( item );
98
99 delete item;
100 }
101
102 m_drawItems.clear();
103
104 for( int j = 0; j < m_RepeatCount; j++ )
105 {
106 if( j > 0 && !IsInsidePage( j ) )
107 continue;
108
109 if( m_type == DS_SEGMENT )
110 item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
111 else if( m_type == DS_RECT )
112 item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
113 else
114 {
115 wxFAIL_MSG( wxS( "Unknown drawing sheet item type" ) );
116 continue;
117 }
118
119 item->SetFlags( itemFlags[ j ] );
120 m_drawItems.push_back( item );
121
122 if( aCollector )
123 aCollector->Append( item );
124
125 if( aView )
126 aView->Add( item );
127 }
128}
129
130
132{
134
135 if( m_LineWidth != 0 )
136 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
137 else
138 return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
139}
140
141
142void DS_DATA_ITEM::MoveToIU( const VECTOR2I& aPosition )
143{
144 VECTOR2D pos_mm;
145 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
146 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
147
148 MoveTo( pos_mm );
149}
150
151
152void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
153{
154 VECTOR2D vector = aPosition - GetStartPos();
155 VECTOR2D endpos = vector + GetEndPos();
156
157 MoveStartPointTo( aPosition );
158 MoveEndPointTo( endpos );
159
160 for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
161 {
162 drawItem->SetPosition( GetStartPosIU( drawItem->GetIndexInPeer() ) );
163 drawItem->SetEnd( GetEndPosIU( drawItem->GetIndexInPeer() ) );
164 }
165}
166
167
169{
171 VECTOR2D position;
172
173 // Calculate the position of the starting point
174 // relative to the reference corner
175 // aPosition is the position relative to the right top paper corner
176 switch( m_Pos.m_Anchor )
177 {
178 case RB_CORNER:
179 position = model.m_RB_Corner - aPosition;
180 break;
181
182 case RT_CORNER:
183 position.x = model.m_RB_Corner.x - aPosition.x;
184 position.y = aPosition.y - model.m_LT_Corner.y;
185 break;
186
187 case LB_CORNER:
188 position.x = aPosition.x - model.m_LT_Corner.x;
189 position.y = model.m_RB_Corner.y - aPosition.y;
190 break;
191
192 case LT_CORNER:
193 position = aPosition - model.m_LT_Corner;
194 break;
195 }
196
197 m_Pos.m_Pos = position;
198}
199
200
202{
203 VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
204 aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
205
206 MoveStartPointTo( pos_mm );
207}
208
209
211{
213 VECTOR2D position;
214
215 // Calculate the position of the starting point
216 // relative to the reference corner
217 // aPosition is the position relative to the right top paper corner
218 switch( m_End.m_Anchor )
219 {
220 case RB_CORNER:
221 position = model.m_RB_Corner - aPosition;
222 break;
223
224 case RT_CORNER:
225 position.x = model.m_RB_Corner.x - aPosition.x;
226 position.y = aPosition.y - model.m_LT_Corner.y;
227 break;
228
229 case LB_CORNER:
230 position.x = aPosition.x - model.m_LT_Corner.x;
231 position.y = model.m_RB_Corner.y - aPosition.y;
232 break;
233
234 case LT_CORNER:
235 position = aPosition - model.m_LT_Corner;
236 break;
237 }
238
239 // Modify m_End only for items having 2 coordinates
240 switch( GetType() )
241 {
242 case DS_SEGMENT:
243 case DS_RECT:
244 m_End.m_Pos = position;
245 break;
246
247 default:
248 break;
249 }
250}
251
252
254{
255 VECTOR2D pos_mm;
256 pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
257 pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
258
259 MoveEndPointTo( pos_mm );
260}
261
262
264{
266 VECTOR2D pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
267 m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
268
269 switch( m_Pos.m_Anchor )
270 {
271 case RB_CORNER: // right bottom corner
272 pos = model.m_RB_Corner - pos;
273 break;
274
275 case RT_CORNER: // right top corner
276 pos.x = model.m_RB_Corner.x - pos.x;
277 pos.y = model.m_LT_Corner.y + pos.y;
278 break;
279
280 case LB_CORNER: // left bottom corner
281 pos.x = model.m_LT_Corner.x + pos.x;
282 pos.y = model.m_RB_Corner.y - pos.y;
283 break;
284
285 case LT_CORNER: // left top corner
286 pos = model.m_LT_Corner + pos;
287 break;
288 }
289
290 return pos;
291}
292
293
295{
296 return KiROUND( GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
297}
298
299
301{
302 VECTOR2D pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
303 m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
304
305 switch( m_End.m_Anchor )
306 {
307 case RB_CORNER: // right bottom corner
309 break;
310
311 case RT_CORNER: // right top corner
314 break;
315
316 case LB_CORNER: // left bottom corner
319 break;
320
321 case LT_CORNER: // left top corner
323 break;
324 }
325
326 return pos;
327}
328
329
331{
332 VECTOR2D pos = GetEndPos( ii );
334 return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
335}
336
337
338bool DS_DATA_ITEM::IsInsidePage( int ii ) const
339{
341
342 BOX2D page( model.m_LT_Corner, model.m_RB_Corner - model.m_LT_Corner );
343
344 // The start of the run is a legitimate position even when it lies in the page
345 // margin, so cull a repeat only where the run walks off the page
346 page.Merge( GetStartPos( 0 ) );
347
348 // Text and bitmap have no real end point, so only test it for lines and rects.
349 if( GetType() == DS_SEGMENT || GetType() == DS_RECT )
350 {
351 page.Merge( GetEndPos( 0 ) );
352
353 if( !page.Contains( GetEndPos( ii ) ) )
354 return false;
355 }
356
357 return page.Contains( GetStartPos( ii ) );
358}
359
360
361const wxString DS_DATA_ITEM::GetClassName() const
362{
363 wxString name;
364
365 switch( GetType() )
366 {
367 case DS_TEXT: name = _( "Text" ); break;
368 case DS_SEGMENT: name = _( "Line" ); break;
369 case DS_RECT: name = _( "Rectangle" ); break;
370 case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
371 case DS_BITMAP: name = _( "Image" ); break;
372 }
373
374 return name;
375}
376
377
382
383
385{
386 std::map<int, EDA_ITEM_FLAGS> itemFlags;
387 DS_DRAW_ITEM_BASE* item = nullptr;
388
389 for( size_t i = 0; i < m_drawItems.size(); ++i )
390 {
391 item = m_drawItems[ i ];
392 itemFlags[ i ] = item->GetFlags();
393
394 if( aCollector )
395 aCollector->Remove( item );
396
397 if( aView )
398 aView->Remove( item );
399
400 delete item;
401 }
402
403 m_drawItems.clear();
404
405 for( int j = 0; j < m_RepeatCount; j++ )
406 {
407 if( j > 0 && !IsInsidePage( j ) )
408 continue;
409
410 int pensize = GetPenSizeIU();
411 auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
412 poly_shape->SetFlags( itemFlags[ j ] );
413 m_drawItems.push_back( poly_shape );
414
415 // Transfer all outlines (basic polygons)
416 SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
417
418 for( int kk = 0; kk < GetPolyCount(); kk++ )
419 {
420 // Create new outline
421 unsigned ist = GetPolyIndexStart( kk );
422 unsigned iend = GetPolyIndexEnd( kk );
423
424 polygons.NewOutline();
425
426 while( ist <= iend )
427 polygons.Append( GetCornerPositionIU( ist++, j ) );
428 }
429
430 if( aCollector )
431 aCollector->Append( poly_shape );
432
433 if( aView )
434 aView->Add( poly_shape );
435 }
436}
437
438
443
444
445const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
446{
447 VECTOR2D pos = m_Corners[aIdx];
448
449 // Rotation:
450 RotatePoint( &pos.x, &pos.y, m_Orient );
451 pos += GetStartPos( aRepeat );
452 return pos;
453}
454
455
457{
458 if( m_Corners.size() == 0 )
459 {
460 m_minCoord.x = m_maxCoord.x = 0.0;
461 m_minCoord.y = m_maxCoord.y = 0.0;
462 return;
463 }
464
465 VECTOR2I pos;
466 pos = m_Corners[0];
467 RotatePoint( &pos.x, &pos.y, m_Orient );
468 m_minCoord = m_maxCoord = pos;
469
470 for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
471 {
472 pos = m_Corners[ii];
473 RotatePoint( &pos.x, &pos.y, m_Orient );
474
475 if( m_minCoord.x > pos.x )
476 m_minCoord.x = pos.x;
477
478 if( m_minCoord.y > pos.y )
479 m_minCoord.y = pos.y;
480
481 if( m_maxCoord.x < pos.x )
482 m_maxCoord.x = pos.x;
483
484 if( m_maxCoord.y < pos.y )
485 m_maxCoord.y = pos.y;
486 }
487}
488
489
491{
493
494 BOX2D page( model.m_LT_Corner, model.m_RB_Corner - model.m_LT_Corner );
495
496 // The start of the run is a legitimate position even when it lies in the page
497 // margin, so cull a repeat only where the run walks off the page
498 page.Merge( GetStartPos( 0 ) + m_minCoord );
499 page.Merge( GetStartPos( 0 ) + m_maxCoord );
500
501 VECTOR2D pos = GetStartPos( ii );
502
503 return page.Contains( pos + m_minCoord ) && page.Contains( pos + m_maxCoord );
504}
505
506
507const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionIU( unsigned aIdx, int aRepeat ) const
508{
509 VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
511 return VECTOR2I( int( pos.x ), int( pos.y ) );
512}
513
514
515DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
517{
518 m_TextBase = aTextBase;
522 m_Italic = false;
523 m_Bold = false;
524 m_Font = nullptr;
526 m_Orient = 0.0;
527 m_LineWidth = 0.0; // 0 means use default value
528}
529
530
532{
533 int pensize = GetPenSizeIU();
534 bool multilines = false;
535
536 if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
537 {
539 }
540 else
541 {
542 m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
543 multilines = ReplaceAntiSlashSequence();
544 }
545
546 // Feed bold worksheet text an auto width so its Bold flag reproduces the historical bold
547 // pen size through the render-time multiplier; otherwise fall back to the default.
548 if( m_Bold )
549 pensize = 0;
550 else if( pensize == 0 )
551 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
552
554 VECTOR2I textsize;
555
556 textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
557 textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
558
559 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
560 DS_DRAW_ITEM_TEXT* text = nullptr;
561
562 for( size_t i = 0; i < m_drawItems.size(); ++i )
563 {
565 itemFlags[ i ] = text->GetFlags();
566
567 if( aCollector )
568 aCollector->Remove( text );
569
570 if( aView )
571 aView->Remove( text );
572
573 delete text;
574 }
575
576 m_drawItems.clear();
577
578 for( int j = 0; j < m_RepeatCount; ++j )
579 {
580 if( j > 0 && !IsInsidePage( j ) )
581 continue;
582
583 EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
585
586 text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText, GetStartPosIU( j ), textsize,
587 pensize, m_Font, m_Italic, m_Bold, m_TextColor );
588
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{
624 incrementer.SetSkipIOSQXZ( false ); // step through every letter
625 incrementer.SetAlphabeticMaxIndex( -1 ); // no upper bound on label length
626
627 // Step the rightmost letter or number, carrying within its own type so a
628 // letter rolls z -> aa instead of running into punctuation.
629 if( std::optional<wxString> stepped = incrementer.Increment( m_TextBase, aIncr, 0 ) )
630 m_FullText = *stepped;
631 else
633}
634
635
636// Replace the '\''n' sequence by EOL
637// and the sequence '\''\' by only one '\' in m_FullText
638// if m_FullText is a multiline text (i.e.contains '\n') return true
640{
641 bool multiline = false;
642
643 for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
644 {
645 if( m_FullText[ii] == '\n' )
646 multiline = true;
647
648 else if( m_FullText[ii] == '\\' )
649 {
650 if( ++ii >= m_FullText.Len() )
651 break;
652
653 if( m_FullText[ii] == '\\' )
654 {
655 // a double \\ sequence is replaced by a single \ char
656 m_FullText.Remove(ii, 1);
657 ii--;
658 }
659 else if( m_FullText[ii] == 'n' )
660 {
661 // Replace the "\n" sequence by a EOL char
662 multiline = true;
663 m_FullText[ii] = '\n';
664 m_FullText.Remove(ii-1, 1);
665 ii--;
666 }
667 }
668 }
669
670 return multiline;
671}
672
673
675{
677
678 if( m_ConstrainedTextSize.x == 0 )
680
681 if( m_ConstrainedTextSize.y == 0 )
683
684 if( m_BoundingBoxSize.x > 0 || m_BoundingBoxSize.y > 0 )
685 {
686 // to know the X and Y size of the line, we should use EDA_TEXT::GetTextBox()
687 // but this function uses integers
688 // So, to avoid truncations with our unit in mm, use microns.
689 VECTOR2I size_micron;
690
691#define FSCALE 1000.0
692
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( unityScale, this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron,
697 linewidth, m_Font, m_Italic, m_Bold, m_TextColor );
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( nullptr );
704 VECTOR2D size;
705 size.x = KiROUND( (int) rect.GetWidth() / FSCALE );
706 size.y = KiROUND( (int) rect.GetHeight() / FSCALE );
707
708 if( m_BoundingBoxSize.x > 0 && size.x > m_BoundingBoxSize.x )
710
711 if( m_BoundingBoxSize.y > 0 && 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 if( !m_ImageBitmap->GetOriginalImageData() )
743 return;
744
745 m_drawItems.clear();
746
747 for( int j = 0; j < m_RepeatCount; j++ )
748 {
749 if( j > 0 && !IsInsidePage( j ) )
750 continue;
751
752 DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
753
754 bitmap->SetFlags( itemFlags[ j ] );
755 m_drawItems.push_back( bitmap );
756
757 if( aCollector )
758 aCollector->Append( bitmap );
759
760 if( aView )
761 aView->Add( bitmap );
762 }
763}
764
765
767{
768 if( m_ImageBitmap )
769 return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale();
770
771 return 300;
772}
773
774
775void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
776{
777 if( m_ImageBitmap )
778 m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
779}
const char * name
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:124
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:995
BOX2< VECTOR2D > BOX2D
Definition box2.h:928
constexpr size_type GetWidth() const
Definition box2.h:211
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:653
constexpr size_type GetHeight() const
Definition box2.h:212
constexpr bool Contains(const Vec &aPoint) const
Definition box2.h:165
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:399
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)
Build an incremented copy of m_TextBase into m_FullText.
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:158
EDA_ITEM_FLAGS GetFlags() const
Definition eda_item.h:167
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:301
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:416
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.
Heuristically increment a string's n'th part from the right.
Definition increment.h:44
#define FSCALE
@ ALL_PAGES
@ RB_CORNER
@ RT_CORNER
@ LT_CORNER
@ LB_CORNER
#define _(s)
@ DEGREES_T
Definition eda_angle.h:31
std::vector< FAB_LAYER_COLOR > dummy
STRING_INCREMENTER incrementer
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