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 std::vector<VECTOR2D> corners = { GetStartPos( ii ) };
343
344 // Text and bitmap have no real end point, so only test it for lines and rects.
345 if( GetType() == DS_SEGMENT || GetType() == DS_RECT )
346 corners.push_back( GetEndPos( ii ) );
347
348 for( const VECTOR2D& pos : corners )
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
357 return true;
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 VECTOR2D pos = GetStartPos( ii );
495 pos += m_minCoord; // left top pos of bounding box
496
497 if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
498 return false;
499
500 pos = GetStartPos( ii );
501 pos += m_maxCoord; // right bottom pos of bounding box
502
503 if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
504 return false;
505
506 return true;
507}
508
509
510const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionIU( unsigned aIdx, int aRepeat ) const
511{
512 VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
514 return VECTOR2I( int( pos.x ), int( pos.y ) );
515}
516
517
518DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
520{
521 m_TextBase = aTextBase;
525 m_Italic = false;
526 m_Bold = false;
527 m_Font = nullptr;
529 m_Orient = 0.0;
530 m_LineWidth = 0.0; // 0 means use default value
531}
532
533
535{
536 int pensize = GetPenSizeIU();
537 bool multilines = false;
538
539 if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
540 {
542 }
543 else
544 {
545 m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
546 multilines = ReplaceAntiSlashSequence();
547 }
548
549 if( pensize == 0 )
550 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
551
553 VECTOR2I textsize;
554
555 textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
556 textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
557
558 if( m_Bold )
559 pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
560
561 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
562 DS_DRAW_ITEM_TEXT* text = nullptr;
563
564 for( size_t i = 0; i < m_drawItems.size(); ++i )
565 {
567 itemFlags[ i ] = text->GetFlags();
568
569 if( aCollector )
570 aCollector->Remove( text );
571
572 if( aView )
573 aView->Remove( text );
574
575 delete text;
576 }
577
578 m_drawItems.clear();
579
580 for( int j = 0; j < m_RepeatCount; ++j )
581 {
582 if( j > 0 && !IsInsidePage( j ) )
583 continue;
584
585 EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
587
588 text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText, GetStartPosIU( j ), textsize,
589 pensize, m_Font, m_Italic, m_Bold, m_TextColor );
590
591 text->SetFlags( itemFlags[ j ] );
592 m_drawItems.push_back( text );
593
594 if( aCollector )
595 aCollector->Append( text );
596
597 if( aView )
598 aView->Add( text );
599
600 text->SetHorizJustify( m_Hjustify );
601 text->SetVertJustify( m_Vjustify );
602 text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
603 text->SetMultilineAllowed( multilines );
604
605 // Increment label for the next text (has no meaning for multiline texts)
606 if( m_RepeatCount > 1 && !multilines )
607 IncrementLabel( ( j + 1 ) * m_IncrementLabel );
608 }
609}
610
611
613{
615
616 if( m_LineWidth != 0 )
617 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
618 else
619 return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
620}
621
622
624{
625 STRING_INCREMENTER incrementer;
626 incrementer.SetSkipIOSQXZ( false ); // step through every letter
627 incrementer.SetAlphabeticMaxIndex( -1 ); // no upper bound on label length
628
629 // Step the rightmost letter or number, carrying within its own type so a
630 // letter rolls z -> aa instead of running into punctuation.
631 if( std::optional<wxString> stepped = incrementer.Increment( m_TextBase, aIncr, 0 ) )
632 m_FullText = *stepped;
633 else
635}
636
637
638// Replace the '\''n' sequence by EOL
639// and the sequence '\''\' by only one '\' in m_FullText
640// if m_FullText is a multiline text (i.e.contains '\n') return true
642{
643 bool multiline = false;
644
645 for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
646 {
647 if( m_FullText[ii] == '\n' )
648 multiline = true;
649
650 else if( m_FullText[ii] == '\\' )
651 {
652 if( ++ii >= m_FullText.Len() )
653 break;
654
655 if( m_FullText[ii] == '\\' )
656 {
657 // a double \\ sequence is replaced by a single \ char
658 m_FullText.Remove(ii, 1);
659 ii--;
660 }
661 else if( m_FullText[ii] == 'n' )
662 {
663 // Replace the "\n" sequence by a EOL char
664 multiline = true;
665 m_FullText[ii] = '\n';
666 m_FullText.Remove(ii-1, 1);
667 ii--;
668 }
669 }
670 }
671
672 return multiline;
673}
674
675
677{
679
680 if( m_ConstrainedTextSize.x == 0 )
682
683 if( m_ConstrainedTextSize.y == 0 )
685
686 if( m_BoundingBoxSize.x > 0 || m_BoundingBoxSize.y > 0 )
687 {
688 // to know the X and Y size of the line, we should use EDA_TEXT::GetTextBox()
689 // but this function uses integers
690 // So, to avoid truncations with our unit in mm, use microns.
691 VECTOR2I size_micron;
692
693#define FSCALE 1000.0
694
695 int linewidth = 0;
696 size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
697 size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
698 DS_DRAW_ITEM_TEXT dummy( unityScale, this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron,
699 linewidth, m_Font, m_Italic, m_Bold, m_TextColor );
700 dummy.SetMultilineAllowed( true );
701 dummy.SetHorizJustify( m_Hjustify ) ;
702 dummy.SetVertJustify( m_Vjustify );
703 dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
704
705 BOX2I rect = dummy.GetTextBox( nullptr );
706 VECTOR2D size;
707 size.x = KiROUND( (int) rect.GetWidth() / FSCALE );
708 size.y = KiROUND( (int) rect.GetHeight() / FSCALE );
709
710 if( m_BoundingBoxSize.x > 0 && size.x > m_BoundingBoxSize.x )
712
713 if( m_BoundingBoxSize.y > 0 && size.y > m_BoundingBoxSize.y )
715 }
716}
717
718
720{
721 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
722 DS_DRAW_ITEM_BASE* item = nullptr;
723
724 for( size_t i = 0; i < m_drawItems.size(); ++i )
725 {
726 item = m_drawItems[ i ];
727 itemFlags[ i ] = item->GetFlags();
728
729 if( aCollector )
730 aCollector->Remove( item );
731
732 if( aView )
733 aView->Remove( item );
734
735 delete item;
736 }
737
738 if( aCollector )
739 {
740 double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI();
741 m_ImageBitmap->SetPixelSizeIu( pix_size_iu );
742 }
743
744 if( !m_ImageBitmap->GetOriginalImageData() )
745 return;
746
747 m_drawItems.clear();
748
749 for( int j = 0; j < m_RepeatCount; j++ )
750 {
751 if( j > 0 && !IsInsidePage( j ) )
752 continue;
753
754 DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
755
756 bitmap->SetFlags( itemFlags[ j ] );
757 m_drawItems.push_back( bitmap );
758
759 if( aCollector )
760 aCollector->Append( bitmap );
761
762 if( aView )
763 aView->Add( bitmap );
764 }
765}
766
767
769{
770 if( m_ImageBitmap )
771 return m_ImageBitmap->GetPPI() / m_ImageBitmap->GetScale();
772
773 return 300;
774}
775
776
777void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
778{
779 if( m_ImageBitmap )
780 m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
781}
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)
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: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.
Heuristically increment a string's n'th part from the right.
Definition increment.h:44
void SetAlphabeticMaxIndex(int aMaxIndex)
Set the maximum index for alphabetic parts.
Definition increment.h:62
void SetSkipIOSQXZ(bool aSkip)
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z.
Definition increment.h:50
std::optional< wxString > Increment(const wxString &aStr, int aDelta, size_t aRightIndex) const
Increment the n-th part from the right of the given string.
Definition increment.cpp:82
#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