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, 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
72
73
75{
76 for( DS_DRAW_ITEM_BASE* item : m_drawItems )
77 delete item;
78}
79
80
82{
83 int pensize = GetPenSizeIU();
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 > 0 && !IsInsidePage( j ) )
110 continue;
111
112 if( m_type == DS_SEGMENT )
113 item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
114 else if( m_type == DS_RECT )
115 item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
116 else
117 {
118 wxFAIL_MSG( wxS( "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::MoveToIU( 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( GetStartPosIU( drawItem->GetIndexInPeer() ) );
166 drawItem->SetEnd( GetEndPosIU( 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{
206 VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
207 aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
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{
299 return KiROUND( GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
300}
301
302
304{
305 VECTOR2D pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
306 m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
307
308 switch( m_End.m_Anchor )
309 {
310 case RB_CORNER: // right bottom corner
312 break;
313
314 case RT_CORNER: // right top corner
317 break;
318
319 case LB_CORNER: // left bottom corner
322 break;
323
324 case LT_CORNER: // left top corner
326 break;
327 }
328
329 return pos;
330}
331
332
334{
335 VECTOR2D pos = GetEndPos( ii );
337 return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
338}
339
340
341bool DS_DATA_ITEM::IsInsidePage( int ii ) const
342{
344
345 for( const VECTOR2D& pos : { GetStartPos( ii ), GetEndPos( ii ) } )
346 {
347 if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
348 return false;
349
350 if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
351 return false;
352 }
353
354 return true;
355}
356
357
358const wxString DS_DATA_ITEM::GetClassName() const
359{
360 wxString name;
361
362 switch( GetType() )
363 {
364 case DS_TEXT: name = _( "Text" ); break;
365 case DS_SEGMENT: name = _( "Line" ); break;
366 case DS_RECT: name = _( "Rectangle" ); break;
367 case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
368 case DS_BITMAP: name = _( "Image" ); break;
369 }
370
371 return name;
372}
373
374
379
380
382{
383 std::map<int, EDA_ITEM_FLAGS> itemFlags;
384 DS_DRAW_ITEM_BASE* item = nullptr;
385
386 for( size_t i = 0; i < m_drawItems.size(); ++i )
387 {
388 item = m_drawItems[ i ];
389 itemFlags[ i ] = item->GetFlags();
390
391 if( aCollector )
392 aCollector->Remove( item );
393
394 if( aView )
395 aView->Remove( item );
396
397 delete item;
398 }
399
400 m_drawItems.clear();
401
402 for( int j = 0; j < m_RepeatCount; j++ )
403 {
404 if( j > 0 && !IsInsidePage( j ) )
405 continue;
406
407 int pensize = GetPenSizeIU();
408 auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
409 poly_shape->SetFlags( itemFlags[ j ] );
410 m_drawItems.push_back( poly_shape );
411
412 // Transfer all outlines (basic polygons)
413 SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
414
415 for( int kk = 0; kk < GetPolyCount(); kk++ )
416 {
417 // Create new outline
418 unsigned ist = GetPolyIndexStart( kk );
419 unsigned iend = GetPolyIndexEnd( kk );
420
421 polygons.NewOutline();
422
423 while( ist <= iend )
424 polygons.Append( GetCornerPositionIU( ist++, j ) );
425 }
426
427 if( aCollector )
428 aCollector->Append( poly_shape );
429
430 if( aView )
431 aView->Add( poly_shape );
432 }
433}
434
435
440
441
442const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
443{
444 VECTOR2D pos = m_Corners[aIdx];
445
446 // Rotation:
447 RotatePoint( &pos.x, &pos.y, m_Orient );
448 pos += GetStartPos( aRepeat );
449 return pos;
450}
451
452
454{
455 if( m_Corners.size() == 0 )
456 {
457 m_minCoord.x = m_maxCoord.x = 0.0;
458 m_minCoord.y = m_maxCoord.y = 0.0;
459 return;
460 }
461
462 VECTOR2I pos;
463 pos = m_Corners[0];
464 RotatePoint( &pos.x, &pos.y, m_Orient );
465 m_minCoord = m_maxCoord = pos;
466
467 for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
468 {
469 pos = m_Corners[ii];
470 RotatePoint( &pos.x, &pos.y, m_Orient );
471
472 if( m_minCoord.x > pos.x )
473 m_minCoord.x = pos.x;
474
475 if( m_minCoord.y > pos.y )
476 m_minCoord.y = pos.y;
477
478 if( m_maxCoord.x < pos.x )
479 m_maxCoord.x = pos.x;
480
481 if( m_maxCoord.y < pos.y )
482 m_maxCoord.y = pos.y;
483 }
484}
485
486
488{
490
491 VECTOR2D pos = GetStartPos( ii );
492 pos += m_minCoord; // left top pos of bounding box
493
494 if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
495 return false;
496
497 pos = GetStartPos( ii );
498 pos += m_maxCoord; // right bottom pos of bounding box
499
500 if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
501 return false;
502
503 return true;
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 if( pensize == 0 )
547 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
548
550 VECTOR2I textsize;
551
552 textsize.x = KiROUND( m_ConstrainedTextSize.x * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
553 textsize.y = KiROUND( m_ConstrainedTextSize.y * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
554
555 if( m_Bold )
556 pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
557
558 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
559 DS_DRAW_ITEM_TEXT* text = nullptr;
560
561 for( size_t i = 0; i < m_drawItems.size(); ++i )
562 {
564 itemFlags[ i ] = text->GetFlags();
565
566 if( aCollector )
567 aCollector->Remove( text );
568
569 if( aView )
570 aView->Remove( text );
571
572 delete text;
573 }
574
575 m_drawItems.clear();
576
577 for( int j = 0; j < m_RepeatCount; ++j )
578 {
579 if( j > 0 && !IsInsidePage( j ) )
580 continue;
581
582 EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
584
585 text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText, GetStartPosIU( j ), textsize,
586 pensize, m_Font, m_Italic, m_Bold, m_TextColor );
587
588 text->SetFlags( itemFlags[ j ] );
589 m_drawItems.push_back( text );
590
591 if( aCollector )
592 aCollector->Append( text );
593
594 if( aView )
595 aView->Add( text );
596
597 text->SetHorizJustify( m_Hjustify );
598 text->SetVertJustify( m_Vjustify );
599 text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
600 text->SetMultilineAllowed( multilines );
601
602 // Increment label for the next text (has no meaning for multiline texts)
603 if( m_RepeatCount > 1 && !multilines )
604 IncrementLabel( ( j + 1 ) * m_IncrementLabel );
605 }
606}
607
608
610{
612
613 if( m_LineWidth != 0 )
614 return KiROUND( m_LineWidth * model.m_WSunits2Iu );
615 else
616 return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
617}
618
619
621{
622 int last = m_TextBase.Len() -1;
623
624 wxChar lbchar = m_TextBase[last];
626 m_FullText.RemoveLast();
627
628 if( lbchar >= '0' && lbchar <= '9' )
629 // A number is expected:
630 m_FullText << (int)( aIncr + lbchar - '0' );
631 else
632 m_FullText << (wxChar) ( aIncr + lbchar );
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:115
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
constexpr size_type GetWidth() const
Definition box2.h:214
constexpr size_type GetHeight() const
Definition box2.h:215
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)
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:142
EDA_ITEM_FLAGS GetFlags() const
Definition eda_item.h:145
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:298
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:341
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:37
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:229
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR2< double > VECTOR2D
Definition vector2d.h:694