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 (C) 1992-2023 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 = 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{
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 for( const VECTOR2D& pos : { GetStartPos( ii ), GetEndPos( ii ) } )
347 {
348 if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
349 return false;
350
351 if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
352 return false;
353 }
354
355 return true;
356}
357
358
359const wxString DS_DATA_ITEM::GetClassName() const
360{
361 wxString name;
362
363 switch( GetType() )
364 {
365 case DS_TEXT: name = _( "Text" ); break;
366 case DS_SEGMENT: name = _( "Line" ); break;
367 case DS_RECT: name = _( "Rectangle" ); break;
368 case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
369 case DS_BITMAP: name = _( "Image" ); break;
370 }
371
372 return name;
373}
374
375
377 DS_DATA_ITEM( DS_POLYPOLYGON )
378{
379}
380
381
383{
384 std::map<int, EDA_ITEM_FLAGS> itemFlags;
385 DS_DRAW_ITEM_BASE* item = nullptr;
386
387 for( size_t i = 0; i < m_drawItems.size(); ++i )
388 {
389 item = m_drawItems[ i ];
390 itemFlags[ i ] = item->GetFlags();
391
392 if( aCollector )
393 aCollector->Remove( item );
394
395 if( aView )
396 aView->Remove( item );
397
398 delete item;
399 }
400
401 m_drawItems.clear();
402
403 for( int j = 0; j < m_RepeatCount; j++ )
404 {
405 if( j > 0 && !IsInsidePage( j ) )
406 continue;
407
408 int pensize = GetPenSizeIU();
409 auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
410 poly_shape->SetFlags( itemFlags[ j ] );
411 m_drawItems.push_back( poly_shape );
412
413 // Transfer all outlines (basic polygons)
414 SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
415
416 for( int kk = 0; kk < GetPolyCount(); kk++ )
417 {
418 // Create new outline
419 unsigned ist = GetPolyIndexStart( kk );
420 unsigned iend = GetPolyIndexEnd( kk );
421
422 polygons.NewOutline();
423
424 while( ist <= iend )
425 polygons.Append( GetCornerPositionIU( ist++, j ) );
426 }
427
428 if( aCollector )
429 aCollector->Append( poly_shape );
430
431 if( aView )
432 aView->Add( poly_shape );
433 }
434}
435
436
438{
439 return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
440}
441
442
443const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
444{
445 VECTOR2D pos = m_Corners[aIdx];
446
447 // Rotation:
448 RotatePoint( &pos.x, &pos.y, m_Orient );
449 pos += GetStartPos( aRepeat );
450 return pos;
451}
452
453
455{
456 if( m_Corners.size() == 0 )
457 {
458 m_minCoord.x = m_maxCoord.x = 0.0;
459 m_minCoord.y = m_maxCoord.y = 0.0;
460 return;
461 }
462
463 VECTOR2I pos;
464 pos = m_Corners[0];
465 RotatePoint( &pos.x, &pos.y, m_Orient );
466 m_minCoord = m_maxCoord = pos;
467
468 for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
469 {
470 pos = m_Corners[ii];
471 RotatePoint( &pos.x, &pos.y, m_Orient );
472
473 if( m_minCoord.x > pos.x )
474 m_minCoord.x = pos.x;
475
476 if( m_minCoord.y > pos.y )
477 m_minCoord.y = pos.y;
478
479 if( m_maxCoord.x < pos.x )
480 m_maxCoord.x = pos.x;
481
482 if( m_maxCoord.y < pos.y )
483 m_maxCoord.y = pos.y;
484 }
485}
486
487
489{
491
492 VECTOR2D pos = GetStartPos( ii );
493 pos += m_minCoord; // left top pos of bounding box
494
495 if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
496 return false;
497
498 pos = GetStartPos( ii );
499 pos += m_maxCoord; // right bottom pos of bounding box
500
501 if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
502 return false;
503
504 return true;
505}
506
507
508const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionIU( unsigned aIdx, int aRepeat ) const
509{
510 VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
512 return VECTOR2I( int( pos.x ), int( pos.y ) );
513}
514
515
516DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
517 DS_DATA_ITEM( DS_TEXT )
518{
519 m_TextBase = aTextBase;
523 m_Italic = false;
524 m_Bold = false;
525 m_Font = nullptr;
526 m_TextColor = COLOR4D::UNSPECIFIED;
527 m_Orient = 0.0;
528 m_LineWidth = 0.0; // 0 means use default value
529}
530
531
533{
534 int pensize = GetPenSizeIU();
535 bool multilines = false;
536
537 if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
538 {
540 }
541 else
542 {
543 m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
544 multilines = ReplaceAntiSlashSequence();
545 }
546
547 if( pensize == 0 )
548 pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
549
551 VECTOR2I textsize;
552
555
556 if( m_Bold )
557 pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
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{
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
685 if( m_BoundingBoxSize.x > 0 || m_BoundingBoxSize.y > 0 )
686 {
687 // to know the X and Y size of the line, we should use EDA_TEXT::GetTextBox()
688 // but this function uses integers
689 // So, to avoid truncations with our unit in mm, use microns.
690 VECTOR2I size_micron;
691 #define FSCALE 1000.0
692 int linewidth = 0;
693 size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
694 size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
695 DS_DRAW_ITEM_TEXT dummy( unityScale, this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron,
696 linewidth, m_Font, m_Italic, m_Bold, m_TextColor );
697 dummy.SetMultilineAllowed( true );
698 dummy.SetHorizJustify( m_Hjustify ) ;
699 dummy.SetVertJustify( m_Vjustify );
700 dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
701
702 BOX2I rect = dummy.GetTextBox();
703 VECTOR2D size;
704 size.x = KiROUND( (int) rect.GetWidth() / FSCALE );
705 size.y = KiROUND( (int) rect.GetHeight() / FSCALE );
706
707 if( m_BoundingBoxSize.x > 0 && size.x > m_BoundingBoxSize.x )
709
710 if( m_BoundingBoxSize.y > 0 && size.y > m_BoundingBoxSize.y )
712 }
713}
714
715
717{
718 std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
719 DS_DRAW_ITEM_BASE* item = nullptr;
720
721 for( size_t i = 0; i < m_drawItems.size(); ++i )
722 {
723 item = m_drawItems[ i ];
724 itemFlags[ i ] = item->GetFlags();
725
726 if( aCollector )
727 aCollector->Remove( item );
728
729 if( aView )
730 aView->Remove( item );
731
732 delete item;
733 }
734
735 if( aCollector )
736 {
737 double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI();
738 m_ImageBitmap->SetPixelSizeIu( pix_size_iu );
739 }
740
742 return;
743
744 m_drawItems.clear();
745
746 for( int j = 0; j < m_RepeatCount; j++ )
747 {
748 if( j > 0 && !IsInsidePage( j ) )
749 continue;
750
751 DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
752
753 bitmap->SetFlags( itemFlags[ j ] );
754 m_drawItems.push_back( bitmap );
755
756 if( aCollector )
757 aCollector->Append( bitmap );
758
759 if( aView )
760 aView->Add( bitmap );
761 }
762}
763
764
766{
767 if( m_ImageBitmap )
769
770 return 300;
771}
772
773
774void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
775{
776 if( m_ImageBitmap )
777 m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
778}
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
const wxImage * GetOriginalImageData() const
Definition: bitmap_base.h:71
double GetScale() const
Definition: bitmap_base.h:73
void SetPixelSizeIu(double aPixSize)
Definition: bitmap_base.h:66
int GetPPI() const
Definition: bitmap_base.h:118
void SetScale(double aScale)
Definition: bitmap_base.h:74
constexpr size_type GetWidth() const
Definition: box2.h:214
constexpr size_type GetHeight() const
Definition: box2.h:215
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
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
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
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
virtual int GetPenSizeIU() override
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()
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
Definition: ds_data_item.h:128
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
Definition: ds_data_item.h:211
const wxString GetClassName() const
const VECTOR2I GetStartPosIU(int ii=0) const
const VECTOR2I GetEndPosIU(int ii=0) const
VECTOR2D m_IncrementVector
Definition: ds_data_item.h:204
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:401
int GetDefaultPenSize() const
Definition: ds_draw_item.h:462
const EDA_IU_SCALE & GetIuScale() const
Definition: ds_draw_item.h:483
wxString BuildFullText(const wxString &aTextbase)
Definition: ds_painter.cpp:115
void Append(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:500
double GetMilsToIUfactor()
Get the scalar to convert pages units (mils) to draw/plot units.
Definition: ds_draw_item.h:475
void Remove(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:505
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:218
A graphic text.
Definition: ds_draw_item.h:313
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:127
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:130
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:68
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:317
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:357
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)
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
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
std::vector< FAB_LAYER_COLOR > dummy
@ 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:691