KiCad PCB EDA Suite
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-2021 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 <eda_rect.h>
53 #include <math/util.h> // for KiROUND
54 #include <view/view.h>
55 #include <title_block.h>
60 #include <trigo.h>
61 
62 using KIGFX::COLOR4D;
63 
64 
66 {
68  m_type = aType;
69  m_RepeatCount = 1;
70  m_IncrementLabel = 1;
71  m_LineWidth = 0;
72 }
73 
74 
76 {
77  for( DS_DRAW_ITEM_BASE* item : m_drawItems )
78  delete item;
79 }
80 
81 
83 {
84  int pensize = GetPenSizeUi();
85 
86  if( pensize == 0 )
87  pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
88 
89  std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
90  DS_DRAW_ITEM_BASE* item = nullptr;
91 
92  for( size_t i = 0; i < m_drawItems.size(); ++i )
93  {
94  item = m_drawItems[ i ];
95  itemFlags[ i ] = item->GetFlags();
96 
97  if( aCollector )
98  aCollector->Remove( item );
99 
100  if( aView )
101  aView->Remove( item );
102 
103  delete item;
104  }
105 
106  m_drawItems.clear();
107 
108  for( int j = 0; j < m_RepeatCount; j++ )
109  {
110  if( j && ! IsInsidePage( j ) )
111  continue;
112 
113  if( m_type == DS_SEGMENT )
114  item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
115  else if( m_type == DS_RECT )
116  item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
117  else
118  {
119  wxFAIL_MSG( "Unknown drawing sheet item type" );
120  continue;
121  }
122 
123  item->SetFlags( itemFlags[ j ] );
124  m_drawItems.push_back( item );
125 
126  if( aCollector )
127  aCollector->Append( item );
128 
129  if( aView )
130  aView->Add( item );
131  }
132 }
133 
134 
136 {
138 
139  if( m_LineWidth != 0 )
140  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
141  else
142  return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
143 }
144 
145 
146 void DS_DATA_ITEM::MoveToUi( const wxPoint& aPosition )
147 {
148  DPOINT pos_mm;
149  pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
150  pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
151 
152  MoveTo( pos_mm );
153 }
154 
155 
156 void DS_DATA_ITEM::MoveTo( const DPOINT& aPosition )
157 {
158  DPOINT vector = aPosition - GetStartPos();
159  DPOINT endpos = vector + GetEndPos();
160 
161  MoveStartPointTo( aPosition );
162  MoveEndPointTo( endpos );
163 
164  for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
165  {
166  drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
167  drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
168  }
169 }
170 
171 
172 void DS_DATA_ITEM::MoveStartPointTo( const DPOINT& aPosition )
173 {
175  DPOINT position;
176 
177  // Calculate the position of the starting point
178  // relative to the reference corner
179  // aPosition is the position relative to the right top paper corner
180  switch( m_Pos.m_Anchor )
181  {
182  case RB_CORNER:
183  position = model.m_RB_Corner - aPosition;
184  break;
185 
186  case RT_CORNER:
187  position.x = model.m_RB_Corner.x - aPosition.x;
188  position.y = aPosition.y - model.m_LT_Corner.y;
189  break;
190 
191  case LB_CORNER:
192  position.x = aPosition.x - model.m_LT_Corner.x;
193  position.y = model.m_RB_Corner.y - aPosition.y;
194  break;
195 
196  case LT_CORNER:
197  position = aPosition - model.m_LT_Corner;
198  break;
199  }
200 
201  m_Pos.m_Pos = position;
202 }
203 
204 
205 void DS_DATA_ITEM::MoveStartPointToUi( const wxPoint& aPosition )
206 {
207  DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
209 
210  MoveStartPointTo( pos_mm );
211 }
212 
213 
214 void DS_DATA_ITEM::MoveEndPointTo( const DPOINT& aPosition )
215 {
217  DPOINT position;
218 
219  // Calculate the position of the starting point
220  // relative to the reference corner
221  // aPosition is the position relative to the right top paper corner
222  switch( m_End.m_Anchor )
223  {
224  case RB_CORNER:
225  position = model.m_RB_Corner - aPosition;
226  break;
227 
228  case RT_CORNER:
229  position.x = model.m_RB_Corner.x - aPosition.x;
230  position.y = aPosition.y - model.m_LT_Corner.y;
231  break;
232 
233  case LB_CORNER:
234  position.x = aPosition.x - model.m_LT_Corner.x;
235  position.y = model.m_RB_Corner.y - aPosition.y;
236  break;
237 
238  case LT_CORNER:
239  position = aPosition - model.m_LT_Corner;
240  break;
241  }
242 
243  // Modify m_End only for items having 2 coordinates
244  switch( GetType() )
245  {
246  case DS_SEGMENT:
247  case DS_RECT:
248  m_End.m_Pos = position;
249  break;
250 
251  default:
252  break;
253  }
254 }
255 
256 
257 void DS_DATA_ITEM::MoveEndPointToUi( const wxPoint& aPosition )
258 {
259  DPOINT pos_mm;
260  pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
261  pos_mm.y = aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
262 
263  MoveEndPointTo( pos_mm );
264 }
265 
266 
267 const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const
268 {
270  DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
271  m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
272 
273  switch( m_Pos.m_Anchor )
274  {
275  case RB_CORNER: // right bottom corner
276  pos = model.m_RB_Corner - pos;
277  break;
278 
279  case RT_CORNER: // right top corner
280  pos.x = model.m_RB_Corner.x - pos.x;
281  pos.y = model.m_LT_Corner.y + pos.y;
282  break;
283 
284  case LB_CORNER: // left bottom corner
285  pos.x = model.m_LT_Corner.x + pos.x;
286  pos.y = model.m_RB_Corner.y - pos.y;
287  break;
288 
289  case LT_CORNER: // left top corner
290  pos = model.m_LT_Corner + pos;
291  break;
292  }
293 
294  return pos;
295 }
296 
297 
298 const wxPoint DS_DATA_ITEM::GetStartPosUi( int ii ) const
299 {
301  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
302 }
303 
304 
305 const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const
306 {
307  DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
308  m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
309 
310  switch( m_End.m_Anchor )
311  {
312  case RB_CORNER: // right bottom corner
314  break;
315 
316  case RT_CORNER: // right top corner
319  break;
320 
321  case LB_CORNER: // left bottom corner
324  break;
325 
326  case LT_CORNER: // left top corner
328  break;
329  }
330 
331  return pos;
332 }
333 
334 
335 const wxPoint DS_DATA_ITEM::GetEndPosUi( int ii ) const
336 {
337  DPOINT pos = GetEndPos( ii );
339  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
340 }
341 
342 
343 bool DS_DATA_ITEM::IsInsidePage( int ii ) const
344 {
346 
347  DPOINT pos = GetStartPos( ii );
348 
349  for( int kk = 0; kk < 1; kk++ )
350  {
351  if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
352  return false;
353 
354  if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
355  return false;
356 
357  pos = GetEndPos( ii );
358  }
359 
360  return true;
361 }
362 
363 
364 const wxString DS_DATA_ITEM::GetClassName() const
365 {
366  wxString name;
367 
368  switch( GetType() )
369  {
370  case DS_TEXT: name = _( "Text" ); break;
371  case DS_SEGMENT: name = _( "Line" ); break;
372  case DS_RECT: name = _( "Rectangle" ); break;
373  case DS_POLYPOLYGON: name = _( "Imported Shape" ); break;
374  case DS_BITMAP: name = _( "Image" ); break;
375  }
376 
377  return name;
378 }
379 
380 
382  DS_DATA_ITEM( DS_POLYPOLYGON )
383 {
384  m_Orient = 0.0;
385 }
386 
387 
389 {
390  std::map<int, EDA_ITEM_FLAGS> itemFlags;
391  DS_DRAW_ITEM_BASE* item = nullptr;
392 
393  for( size_t i = 0; i < m_drawItems.size(); ++i )
394  {
395  item = m_drawItems[ i ];
396  itemFlags[ i ] = item->GetFlags();
397 
398  if( aCollector )
399  aCollector->Remove( item );
400 
401  if( aView )
402  aView->Remove( item );
403 
404  delete item;
405  }
406 
407  m_drawItems.clear();
408 
409  for( int j = 0; j < m_RepeatCount; j++ )
410  {
411  if( j && !IsInsidePage( j ) )
412  continue;
413 
414  int pensize = GetPenSizeUi();
415  auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
416  poly_shape->SetFlags( itemFlags[ j ] );
417  m_drawItems.push_back( poly_shape );
418 
419  // Transfer all outlines (basic polygons)
420  SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
421  for( int kk = 0; kk < GetPolyCount(); kk++ )
422  {
423  // Create new outline
424  unsigned ist = GetPolyIndexStart( kk );
425  unsigned iend = GetPolyIndexEnd( kk );
426 
427  polygons.NewOutline();
428 
429  while( ist <= iend )
430  polygons.Append( GetCornerPositionUi( ist++, j ) );
431  }
432 
433  if( aCollector )
434  aCollector->Append( poly_shape );
435 
436  if( aView )
437  aView->Add( poly_shape );
438  }
439 }
440 
441 
443 {
444  return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
445 }
446 
447 
448 const DPOINT DS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
449 {
450  DPOINT pos = m_Corners[aIdx];
451 
452  // Rotation:
453  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
454  pos += GetStartPos( aRepeat );
455  return pos;
456 }
457 
458 
460 {
461  if( m_Corners.size() == 0 )
462  {
463  m_minCoord.x = m_maxCoord.x = 0.0;
464  m_minCoord.y = m_maxCoord.y = 0.0;
465  return;
466  }
467 
468  DPOINT pos;
469  pos = m_Corners[0];
470  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
471  m_minCoord = m_maxCoord = pos;
472 
473  for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
474  {
475  pos = m_Corners[ii];
476  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
477 
478  if( m_minCoord.x > pos.x )
479  m_minCoord.x = pos.x;
480 
481  if( m_minCoord.y > pos.y )
482  m_minCoord.y = pos.y;
483 
484  if( m_maxCoord.x < pos.x )
485  m_maxCoord.x = pos.x;
486 
487  if( m_maxCoord.y < pos.y )
488  m_maxCoord.y = pos.y;
489  }
490 }
491 
492 
494 {
496 
497  DPOINT pos = GetStartPos( ii );
498  pos += m_minCoord; // left top pos of bounding box
499 
500  if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
501  return false;
502 
503  pos = GetStartPos( ii );
504  pos += m_maxCoord; // right bottom pos of bounding box
505 
506  if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
507  return false;
508 
509  return true;
510 }
511 
512 
513 const wxPoint DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
514 {
515  DPOINT pos = GetCornerPosition( aIdx, aRepeat );
517  return wxPoint( int(pos.x), int(pos.y) );
518 }
519 
520 
521 DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
522  DS_DATA_ITEM( DS_TEXT )
523 {
524  m_TextBase = aTextBase;
525  m_IncrementLabel = 1;
528  m_Italic = false;
529  m_Bold = false;
530  m_Orient = 0.0;
531  m_LineWidth = 0.0; // 0 means use default value
532 }
533 
534 
536 {
537  int pensize = GetPenSizeUi();
538  bool multilines = false;
539 
540  if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
541  {
543  }
544  else
545  {
546  m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
547  multilines = ReplaceAntiSlashSequence();
548  }
549 
550  if( pensize == 0 )
551  pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
552 
554  wxSize textsize;
555 
558 
559  if( m_Bold )
560  pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
561 
562  std::map<size_t, EDA_ITEM_FLAGS> itemFlags;
563  DS_DRAW_ITEM_TEXT* text = nullptr;
564 
565  for( size_t i = 0; i < m_drawItems.size(); ++i )
566  {
568  itemFlags[ i ] = text->GetFlags();
569 
570  if( aCollector )
571  aCollector->Remove( text );
572 
573  if( aView )
574  aView->Remove( text );
575 
576  delete text;
577  }
578 
579  m_drawItems.clear();
580 
581  for( int j = 0; j < m_RepeatCount; ++j )
582  {
583  if( j > 0 && !IsInsidePage( j ) )
584  continue;
585 
586  text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
587  m_Italic, m_Bold );
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( m_Orient * 10 ); // graphic text orient unit = 0.1 degree
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 
685  {
686  // to know the X and Y size of the line, we should use
687  // EDA_TEXT::GetTextBox()
688  // but this function uses integers
689  // So, to avoid truncations with our unit in mm, use microns.
690  wxSize 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( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, wxPoint( 0, 0 ),
696  size_micron, linewidth, m_Italic, m_Bold ) );
697  dummy.SetMultilineAllowed( true );
698  dummy.SetHorizJustify( m_Hjustify ) ;
699  dummy.SetVertJustify( m_Vjustify );
700  dummy.SetTextAngle( m_Orient * 10 );
701 
702  EDA_RECT rect = dummy.GetTextBox();
703  DSIZE size;
704  size.x = rect.GetWidth() / FSCALE;
705  size.y = rect.GetHeight() / FSCALE;
706 
707  if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
709 
710  if( m_BoundingBoxSize.y && 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 
741  m_drawItems.clear();
742 
743  for( int j = 0; j < m_RepeatCount; j++ )
744  {
745  if( j && !IsInsidePage( j ) )
746  continue;
747 
748  DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
749 
750  bitmap->SetFlags( itemFlags[ j ] );
751  m_drawItems.push_back( bitmap );
752 
753  if( aCollector )
754  aCollector->Append( bitmap );
755 
756  if( aView )
757  aView->Add( bitmap );
758  }
759 }
760 
761 
763 {
764  if( m_ImageBitmap )
766 
767  return 300;
768 }
769 
770 
771 void DS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
772 {
773  if( m_ImageBitmap )
774  m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
775 }
const DPOINT GetEndPos(int ii=0) const
#define FSCALE
unsigned GetPolyIndexStart(unsigned aContour) const
Definition: ds_data_item.h:252
bool IsInsidePage(int ii) const override
Handle the graphic items list to draw/plot the frame and title block.
Definition: ds_data_model.h:38
void SetConstrainedTextSize()
Calculate m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text sm...
DS_DATA_ITEM(DS_ITEM_TYPE aType)
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ds_data_item.h:339
const DPOINT GetStartPos(int ii=0) const
wxString BuildFullText(const wxString &aTextbase)
Return the full text corresponding to the aTextbase, after replacing format symbols by the correspond...
Definition: ds_painter.cpp:104
int GetPenSizeForBold(int aTextSize)
Definition: gr_text.cpp:47
const wxPoint GetEndPosUi(int ii=0) const
int GetPolyCount() const
Definition: ds_data_item.h:246
void SetScale(double aScale)
Definition: bitmap_base.h:80
void SetBoundingBox()
Calculate the bounding box of the set polygons.
void MoveEndPointToUi(const wxPoint &aPosition)
Move the ending point of the item to a new position.
double m_DefaultLineWidth
virtual bool IsInsidePage(int ii) const
double GetScale() const
Definition: bitmap_base.h:79
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:351
int GetWidth() const
Definition: eda_rect.h:109
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
std::vector< DPOINT > m_Corners
Definition: ds_data_item.h:288
POINT_COORD m_End
Definition: ds_data_item.h:201
DPOINT m_RB_Corner
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
DS_DATA_ITEM_TEXT(const wxString &aTextBase)
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
virtual int GetPenSizeUi() override
unsigned GetPolyIndexEnd(unsigned aContour) const
Definition: ds_data_item.h:264
DPOINT m_LT_Corner
double m_DefaultTextThickness
virtual void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView)
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ds_data_item.h:338
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:71
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
A graphic text.
Definition: ds_draw_item.h:297
virtual ~DS_DATA_ITEM()
const wxPoint GetCornerPositionUi(unsigned aIdx, int aRepeat=0) const
void MoveTo(const DPOINT &aPosition)
Move item to a new position.
DPOINT m_IncrementVector
Definition: ds_data_item.h:204
void SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
double m_LineWidth
Definition: ds_data_item.h:202
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
DS_ITEM_TYPE GetType() const
Definition: ds_data_item.h:128
int GetDefaultPenSize() const
Definition: ds_draw_item.h:437
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
Definition: ds_data_item.h:211
DSIZE m_DefaultTextSize
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:368
const wxString GetClassName() const
Represent a set of closed polygons.
DPOINT m_Pos
Definition: ds_data_item.h:80
double GetMilsToIUfactor()
Get the scalar to convert pages units (mils) to draw/plot units.
Definition: ds_draw_item.h:450
int m_IncrementLabel
Definition: ds_data_item.h:205
PAGE_OPTION m_pageOption
Definition: ds_data_item.h:209
void SetPPI(int aBitmapPPI)
double m_WSunits2Iu
#define _(s)
int NewOutline()
Creates a new hole in a given outline.
int GetHeight() const
Definition: eda_rect.h:110
void SetPixelSizeIu(double aPixSize)
Definition: bitmap_base.h:68
const DPOINT GetCornerPosition(unsigned aIdx, int aRepeat=0) const
virtual int GetPenSizeUi() override
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:155
virtual int GetPenSizeUi()
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:205
void MoveStartPointToUi(const wxPoint &aPosition)
Move the starting point of the item to a new position.
void Append(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:473
DSIZE m_ConstrainedTextSize
Definition: ds_data_item.h:346
POINT_COORD m_Pos
Definition: ds_data_item.h:200
const char * name
Definition: DXF_plotter.cpp:59
bool ReplaceAntiSlashSequence()
Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
Handle the component boundary box.
Definition: eda_rect.h:42
void MoveStartPointTo(const DPOINT &aPosition)
Move the starting point of the item to a new position.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
void MoveEndPointTo(const DPOINT &aPosition)
Move the ending point of the item to a new position.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ds_draw_item.h:376
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:321
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
void MoveToUi(const wxPoint &aPosition)
Move item to a new position.
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 SyncDrawItems(DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
void Remove(DS_DRAW_ITEM_BASE *aItem)
Definition: ds_draw_item.h:478
DS_ITEM_TYPE m_type
Definition: ds_data_item.h:208
int GetPPI() const
Definition: bitmap_base.h:135
const wxPoint GetStartPosUi(int ii=0) const
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103