KiCad PCB EDA Suite
ws_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-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 /*
28  * the class WS_DATA_ITEM (and derived) defines
29  * a basic shape of a page layout ( frame references and title block )
30  * Basic shapes are line, rect and texts
31  * the WS_DATA_ITEM coordinates units is the mm, and are relative to
32  * one of 4 page corners.
33  *
34  * These items cannot be drawn or plot "as this". they should be converted
35  * to a "draw list" (WS_DRAW_ITEM_BASE and derived items)
36 
37  * The list of these items is stored in a WS_DATA_MODEL instance.
38  *
39  * When building the draw list:
40  * the WS_DATA_MODEL is used to create a WS_DRAW_ITEM_LIST
41  * coordinates are converted to draw/plot coordinates.
42  * texts are expanded if they contain format symbols.
43  * Items with m_RepeatCount > 1 are created m_RepeatCount times
44  *
45  * the WS_DATA_MODEL is created only once.
46  * the WS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
47  *
48  * the WS_DATA_MODEL instance is created from a S expression which
49  * describes the page layout (can be the default page layout or a custom file).
50  */
51 
52 #include <fctsys.h>
53 #include <gr_text.h>
54 #include <eda_rect.h>
55 #include <math/util.h> // for KiROUND
56 #include <view/view.h>
57 #include <ws_painter.h>
58 #include <title_block.h>
59 #include <ws_draw_item.h>
60 #include <ws_data_model.h>
61 
62 using KIGFX::COLOR4D;
63 
64 
65 // The constructor:
67 {
69  m_type = aType;
70  m_RepeatCount = 1;
71  m_IncrementLabel = 1;
72  m_LineWidth = 0;
73 }
74 
75 
77 {
78  for( WS_DRAW_ITEM_BASE* item : m_drawItems )
79  delete item;
80 }
81 
82 
84 {
85  int pensize = GetPenSizeUi();
86 
87  if( pensize == 0 )
88  pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
89 
90  std::map<int, STATUS_FLAGS> itemFlags;
91  WS_DRAW_ITEM_BASE* item = nullptr;
92 
93  for( size_t i = 0; i < m_drawItems.size(); ++i )
94  {
95  item = m_drawItems[ i ];
96  itemFlags[ i ] = item->GetFlags();
97 
98  if( aCollector )
99  aCollector->Remove( item );
100 
101  if( aView )
102  aView->Remove( item );
103 
104  delete item;
105  }
106 
107  m_drawItems.clear();
108 
109  for( int j = 0; j < m_RepeatCount; j++ )
110  {
111  if( j && ! IsInsidePage( j ) )
112  continue;
113 
114  if( m_type == WS_SEGMENT )
115  item = new WS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
116  else if( m_type == WS_RECT )
117  item = new WS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
118  else
119  {
120  wxFAIL_MSG( "Unknown worksheet draw item type" );
121  continue;
122  }
123 
124  item->SetFlags( itemFlags[ j ] );
125  m_drawItems.push_back( item );
126 
127  if( aCollector )
128  aCollector->Append( item );
129 
130  if( aView )
131  aView->Add( item );
132  }
133 }
134 
135 
137 {
139 
140  if( m_LineWidth != 0 )
141  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
142  else
143  return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
144 }
145 
146 
147 // move item to aPosition
148 // starting point is moved to aPosition
149 // the Ending point is moved to a position which keeps the item size
150 // (if both coordinates have the same corner reference)
151 // MoveToUi and MoveTo takes the graphic position (i.e relative to the left top
152 // paper corner
154 {
155  DPOINT pos_mm;
156  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
157  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
158 
159  MoveTo( pos_mm );
160 }
161 
162 
163 void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
164 {
165  DPOINT vector = aPosition - GetStartPos();
166  DPOINT endpos = vector + GetEndPos();
167 
168  MoveStartPointTo( aPosition );
169  MoveEndPointTo( endpos );
170 
171  for( WS_DRAW_ITEM_BASE* drawItem : m_drawItems )
172  {
173  drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
174  drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
175  }
176 }
177 
178 
179 /* move the starting point of the item to a new position
180  * aPosition = the new position of the starting point, in mm
181  */
183 {
185  DPOINT position;
186 
187  // Calculate the position of the starting point
188  // relative to the reference corner
189  // aPosition is the position relative to the right top paper corner
190  switch( m_Pos.m_Anchor )
191  {
192  case RB_CORNER:
193  position = model.m_RB_Corner - aPosition;
194  break;
195 
196  case RT_CORNER:
197  position.x = model.m_RB_Corner.x - aPosition.x;
198  position.y = aPosition.y - model.m_LT_Corner.y;
199  break;
200 
201  case LB_CORNER:
202  position.x = aPosition.x - model.m_LT_Corner.x;
203  position.y = model.m_RB_Corner.y - aPosition.y;
204  break;
205 
206  case LT_CORNER:
207  position = aPosition - model.m_LT_Corner;
208  break;
209  }
210 
211  m_Pos.m_Pos = position;
212 }
213 
214 
215 /* move the starting point of the item to a new position
216  * aPosition = the new position of the starting point in graphic units
217  */
219 {
220  DPOINT pos_mm( aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
222 
223  MoveStartPointTo( pos_mm );
224 }
225 
226 
234 {
236  DPOINT position;
237 
238  // Calculate the position of the starting point
239  // relative to the reference corner
240  // aPosition is the position relative to the right top paper corner
241  switch( m_End.m_Anchor )
242  {
243  case RB_CORNER:
244  position = model.m_RB_Corner - aPosition;
245  break;
246 
247  case RT_CORNER:
248  position.x = model.m_RB_Corner.x - aPosition.x;
249  position.y = aPosition.y - model.m_LT_Corner.y;
250  break;
251 
252  case LB_CORNER:
253  position.x = aPosition.x - model.m_LT_Corner.x;
254  position.y = model.m_RB_Corner.y - aPosition.y;
255  break;
256 
257  case LT_CORNER:
258  position = aPosition - model.m_LT_Corner;
259  break;
260  }
261 
262  // Modify m_End only for items having 2 coordinates
263  switch( GetType() )
264  {
265  case WS_SEGMENT:
266  case WS_RECT:
267  m_End.m_Pos = position;
268  break;
269 
270  default:
271  break;
272  }
273 }
274 
275 
276 /* move the ending point of the item to a new position
277  * has meaning only for items defined by 2 points
278  * (segments and rectangles)
279  * aPosition = the new position of the ending point in graphic units
280  */
282 {
283  DPOINT pos_mm;
284  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
285  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
286 
287  MoveEndPointTo( pos_mm );
288 }
289 
290 
291 const DPOINT WS_DATA_ITEM::GetStartPos( int ii ) const
292 {
294  DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
295  m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
296 
297  switch( m_Pos.m_Anchor )
298  {
299  case RB_CORNER: // right bottom corner
300  pos = model.m_RB_Corner - pos;
301  break;
302 
303  case RT_CORNER: // right top corner
304  pos.x = model.m_RB_Corner.x - pos.x;
305  pos.y = model.m_LT_Corner.y + pos.y;
306  break;
307 
308  case LB_CORNER: // left bottom corner
309  pos.x = model.m_LT_Corner.x + pos.x;
310  pos.y = model.m_RB_Corner.y - pos.y;
311  break;
312 
313  case LT_CORNER: // left top corner
314  pos = model.m_LT_Corner + pos;
315  break;
316  }
317 
318  return pos;
319 }
320 
321 
323 {
325  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
326 }
327 
328 
329 const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
330 {
331  DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
332  m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
333 
334  switch( m_End.m_Anchor )
335  {
336  case RB_CORNER: // right bottom corner
338  break;
339 
340  case RT_CORNER: // right top corner
343  break;
344 
345  case LB_CORNER: // left bottom corner
348  break;
349 
350  case LT_CORNER: // left top corner
352  break;
353  }
354 
355  return pos;
356 }
357 
358 
359 const wxPoint WS_DATA_ITEM::GetEndPosUi( int ii ) const
360 {
361  DPOINT pos = GetEndPos( ii );
363  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
364 }
365 
366 
367 bool WS_DATA_ITEM::IsInsidePage( int ii ) const
368 {
370 
371  DPOINT pos = GetStartPos( ii );
372 
373  for( int kk = 0; kk < 1; kk++ )
374  {
375  if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
376  return false;
377 
378  if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
379  return false;
380 
381  pos = GetEndPos( ii );
382  }
383 
384  return true;
385 }
386 
387 
388 const wxString WS_DATA_ITEM::GetClassName() const
389 {
390  wxString name;
391 
392  switch( GetType() )
393  {
394  case WS_TEXT: name = wxT( "Text" ); break;
395  case WS_SEGMENT: name = wxT( "Line" ); break;
396  case WS_RECT: name = wxT( "Rectangle" ); break;
397  case WS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
398  case WS_BITMAP: name = wxT( "Image" ); break;
399  }
400 
401  return name;
402 }
403 
404 
406  WS_DATA_ITEM( WS_POLYPOLYGON )
407 {
408  m_Orient = 0.0;
409 }
410 
411 
413 {
414  std::map<int, STATUS_FLAGS> itemFlags;
415  WS_DRAW_ITEM_BASE* item = nullptr;
416 
417  for( size_t i = 0; i < m_drawItems.size(); ++i )
418  {
419  item = m_drawItems[ i ];
420  itemFlags[ i ] = item->GetFlags();
421 
422  if( aCollector )
423  aCollector->Remove( item );
424 
425  if( aView )
426  aView->Remove( item );
427 
428  delete item;
429  }
430 
431  m_drawItems.clear();
432 
433  for( int j = 0; j < m_RepeatCount; j++ )
434  {
435  if( j && !IsInsidePage( j ) )
436  continue;
437 
438  int pensize = GetPenSizeUi();
439  auto poly_shape = new WS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
440  poly_shape->SetFlags( itemFlags[ j ] );
441  m_drawItems.push_back( poly_shape );
442 
443  // Transfer all outlines (basic polygons)
444  SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
445  for( int kk = 0; kk < GetPolyCount(); kk++ )
446  {
447  // Create new outline
448  unsigned ist = GetPolyIndexStart( kk );
449  unsigned iend = GetPolyIndexEnd( kk );
450 
451  polygons.NewOutline();
452 
453  while( ist <= iend )
454  polygons.Append( GetCornerPositionUi( ist++, j ) );
455  }
456 
457  if( aCollector )
458  aCollector->Append( poly_shape );
459 
460  if( aView )
461  aView->Add( poly_shape );
462  }
463 }
464 
465 
467 {
468  return KiROUND( m_LineWidth * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
469 }
470 
471 
472 const DPOINT WS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
473 {
474  DPOINT pos = m_Corners[aIdx];
475 
476  // Rotation:
477  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
478  pos += GetStartPos( aRepeat );
479  return pos;
480 }
481 
482 
484 {
485  if( m_Corners.size() == 0 )
486  {
487  m_minCoord.x = m_maxCoord.x = 0.0;
488  m_minCoord.y = m_maxCoord.y = 0.0;
489  return;
490  }
491 
492  DPOINT pos;
493  pos = m_Corners[0];
494  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
495  m_minCoord = m_maxCoord = pos;
496 
497  for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
498  {
499  pos = m_Corners[ii];
500  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
501 
502  if( m_minCoord.x > pos.x )
503  m_minCoord.x = pos.x;
504 
505  if( m_minCoord.y > pos.y )
506  m_minCoord.y = pos.y;
507 
508  if( m_maxCoord.x < pos.x )
509  m_maxCoord.x = pos.x;
510 
511  if( m_maxCoord.y < pos.y )
512  m_maxCoord.y = pos.y;
513  }
514 }
515 
516 
518 {
520 
521  DPOINT pos = GetStartPos( ii );
522  pos += m_minCoord; // left top pos of bounding box
523 
524  if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
525  return false;
526 
527  pos = GetStartPos( ii );
528  pos += m_maxCoord; // rignt bottom pos of bounding box
529 
530  if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
531  return false;
532 
533  return true;
534 }
535 
536 
537 const wxPoint WS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
538 {
539  DPOINT pos = GetCornerPosition( aIdx, aRepeat );
541  return wxPoint( int(pos.x), int(pos.y) );
542 }
543 
544 
545 WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
546  WS_DATA_ITEM( WS_TEXT )
547 {
548  m_TextBase = aTextBase;
549  m_IncrementLabel = 1;
552  m_Italic = false;
553  m_Bold = false;
554  m_Orient = 0.0;
555  m_LineWidth = 0.0; // 0 means use default value
556 }
557 
558 
560 {
561  int pensize = GetPenSizeUi();
562  bool multilines = false;
563 
564  if( WS_DATA_MODEL::GetTheInstance().m_EditMode )
566  else
567  {
568  m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
569  multilines = ReplaceAntiSlashSequence();
570  }
571 
572  if( pensize == 0 )
573  pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
574 
576  wxSize textsize;
577 
580 
581  if( m_Bold )
582  pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
583 
584  std::map<int, STATUS_FLAGS> itemFlags;
585  WS_DRAW_ITEM_TEXT* text = nullptr;
586 
587  for( size_t i = 0; i < m_drawItems.size(); ++i )
588  {
589  text = (WS_DRAW_ITEM_TEXT*) m_drawItems[ i ];
590  itemFlags[ i ] = text->GetFlags();
591 
592  if( aCollector )
593  aCollector->Remove( text );
594 
595  if( aView )
596  aView->Remove( text );
597 
598  delete text;
599  }
600 
601  m_drawItems.clear();
602 
603  for( int j = 0; j < m_RepeatCount; ++j )
604  {
605  if( j > 0 && !IsInsidePage( j ) )
606  continue;
607 
608  text = new WS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
609  m_Italic, m_Bold );
610  text->SetFlags( itemFlags[ j ] );
611  m_drawItems.push_back( text );
612 
613  if( aCollector )
614  aCollector->Append( text );
615 
616  if( aView )
617  aView->Add( text );
618 
619  text->SetHorizJustify( m_Hjustify ) ;
620  text->SetVertJustify( m_Vjustify );
621  text->SetTextAngle( m_Orient * 10 ); // graphic text orient unit = 0.1 degree
622  text->SetMultilineAllowed( multilines );
623 
624  // Increment label for the next text (has no meaning for multiline texts)
625  if( m_RepeatCount > 1 && !multilines )
626  IncrementLabel(( j + 1 ) * m_IncrementLabel );
627  }
628 }
629 
630 
632 {
634 
635  if( m_LineWidth != 0 )
636  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
637  else
638  return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
639 }
640 
641 
643 {
644  int last = m_TextBase.Len() -1;
645 
646  wxChar lbchar = m_TextBase[last];
648  m_FullText.RemoveLast();
649 
650  if( lbchar >= '0' && lbchar <= '9' )
651  // A number is expected:
652  m_FullText << (int)( aIncr + lbchar - '0' );
653  else
654  m_FullText << (wxChar) ( aIncr + lbchar );
655 }
656 
657 
658 // Replace the '\''n' sequence by EOL
659 // and the sequence '\''\' by only one '\' in m_FullText
660 // if m_FullText is a multiline text (i.e.contains '\n') return true
662 {
663  bool multiline = false;
664 
665  for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
666  {
667  if( m_FullText[ii] == '\n' )
668  multiline = true;
669 
670  else if( m_FullText[ii] == '\\' )
671  {
672  if( ++ii >= m_FullText.Len() )
673  break;
674 
675  if( m_FullText[ii] == '\\' )
676  {
677  // a double \\ sequence is replaced by a single \ char
678  m_FullText.Remove(ii, 1);
679  ii--;
680  }
681  else if( m_FullText[ii] == 'n' )
682  {
683  // Replace the "\n" sequence by a EOL char
684  multiline = true;
685  m_FullText[ii] = '\n';
686  m_FullText.Remove(ii-1, 1);
687  ii--;
688  }
689  }
690  }
691 
692  return multiline;
693 }
694 
695 
697 {
699 
700  if( m_ConstrainedTextSize.x == 0 )
702 
703  if( m_ConstrainedTextSize.y == 0 )
705 
707  {
708  // to know the X and Y size of the line, we should use
709  // EDA_TEXT::GetTextBox()
710  // but this function uses integers
711  // So, to avoid truncations with our unit in mm, use microns.
712  wxSize size_micron;
713  #define FSCALE 1000.0
714  int linewidth = 0;
715  size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
716  size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
717  WS_DRAW_ITEM_TEXT dummy( WS_DRAW_ITEM_TEXT( this, 0, this->m_FullText, wxPoint( 0, 0 ),
718  size_micron, linewidth, m_Italic, m_Bold ) );
719  dummy.SetMultilineAllowed( true );
720  dummy.SetHorizJustify( m_Hjustify ) ;
721  dummy.SetVertJustify( m_Vjustify );
722  dummy.SetTextAngle( m_Orient * 10 );
723 
724  EDA_RECT rect = dummy.GetTextBox();
725  DSIZE size;
726  size.x = rect.GetWidth() / FSCALE;
727  size.y = rect.GetHeight() / FSCALE;
728 
729  if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
731 
732  if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y )
734  }
735 }
736 
737 
739 {
740  std::map<int, STATUS_FLAGS> itemFlags;
741  WS_DRAW_ITEM_BASE* item = nullptr;
742 
743  for( size_t i = 0; i < m_drawItems.size(); ++i )
744  {
745  item = m_drawItems[ i ];
746  itemFlags[ i ] = item->GetFlags();
747 
748  if( aCollector )
749  aCollector->Remove( item );
750 
751  if( aView )
752  aView->Remove( item );
753 
754  delete item;
755  }
756 
757  m_drawItems.clear();
758 
759  for( int j = 0; j < m_RepeatCount; j++ )
760  {
761  if( j && !IsInsidePage( j ) )
762  continue;
763 
764  auto bitmap = new WS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
765  bitmap->SetFlags( itemFlags[ j ] );
766  m_drawItems.push_back( bitmap );
767 
768  if( aCollector )
769  aCollector->Append( bitmap );
770 
771  if( aView )
772  aView->Add( bitmap );
773  }
774 }
775 
776 
778 {
779  if( m_ImageBitmap )
781 
782  return 300;
783 }
784 
785 
786 void WS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
787 {
788  if( m_ImageBitmap )
789  m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
790 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
DPOINT m_RB_Corner
Definition: ws_data_model.h:53
void SyncDrawItems(WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
void Remove(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:464
void MoveToUi(wxPoint aPosition)
move item to a new position
void MoveEndPointToUi(wxPoint aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
const DPOINT GetStartPos(int ii=0) const
Work sheet structure type definitions.
Definition: ws_data_item.h:93
virtual bool IsInsidePage(int ii) const
std::vector< DPOINT > m_Corners
Definition: ws_data_item.h:219
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:51
void SetScale(double aScale)
Definition: bitmap_base.h:93
double GetScale() const
Definition: bitmap_base.h:92
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:380
bool IsInsidePage(int ii) const override
int GetWidth() const
Definition: eda_rect.h:119
virtual int GetPenSizeUi() override
void IncrementLabel(int aIncr)
Try to build text wihich is an increment of m_TextBase has meaning only if m_TextBase is a basic text...
void MoveEndPointTo(DPOINT aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
BITMAP_BASE * m_ImageBitmap
Definition: ws_data_item.h:366
POINT_COORD m_End
Definition: ws_data_item.h:116
const wxPoint GetCornerPositionUi(unsigned aIdx, int aRepeat=0) const
void SyncDrawItems(WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
unsigned GetPolyIndexStart(unsigned aContour) const
Definition: ws_data_item.h:260
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
DSIZE m_DefaultTextSize
Definition: ws_data_model.h:56
unsigned GetPolyIndexEnd(unsigned aContour) const
Definition: ws_data_item.h:272
void Append(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:459
DPOINT m_LT_Corner
Definition: ws_data_model.h:54
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ws_data_item.h:304
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
bool ReplaceAntiSlashSequence()
Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
virtual int GetPenSizeUi()
const wxPoint GetStartPosUi(int ii=0) const
const DPOINT GetEndPos(int ii=0) const
void SetTextAngle(double aAngle) override
Definition: ws_draw_item.h:296
WS_DATA_ITEM(WS_ITEM_TYPE aType)
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
WS_ITEM_TYPE m_type
Definition: ws_data_item.h:105
SHAPE_POLY_SET.
DPOINT m_Pos
Definition: ws_data_item.h:71
WS_DATA_ITEM_TEXT(const wxString &aTextBase)
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:203
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ws_data_item.h:305
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
Definition: ws_data_item.h:108
void SyncDrawItems(WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
const wxString GetClassName() const
int NewOutline()
Creates a new empty polygon in the set and returns its index
DPOINT m_IncrementVector
Definition: ws_data_item.h:119
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.h:196
int GetHeight() const
Definition: eda_rect.h:120
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:147
void MoveStartPointToUi(wxPoint aPosition)
move the starting point of the item to a new position
virtual void SyncDrawItems(WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView)
double m_LineWidth
Definition: ws_data_item.h:117
const wxPoint GetEndPosUi(int ii=0) const
int GetPolyCount() const
Definition: ws_data_item.h:254
virtual ~WS_DATA_ITEM()
const char * name
Definition: DXF_plotter.cpp:60
double m_DefaultLineWidth
Definition: ws_data_model.h:55
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
double m_WSunits2Iu
Definition: ws_data_model.h:51
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:202
wxString BuildFullText(const wxString &aTextbase)
Function BuildFullText returns the full text corresponding to the aTextbase, after replacing format s...
Definition: ws_painter.cpp:117
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
virtual int GetPenSizeUi() override
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:68
DSIZE m_ConstrainedTextSize
Definition: ws_data_item.h:314
double m_DefaultTextThickness
Definition: ws_data_model.h:57
const DPOINT GetCornerPosition(unsigned aIdx, int aRepeat=0) const
void SetBoundingBox()
calculate the bounding box of the set polygons
void MoveTo(DPOINT aPosition)
move item to a new position
void SetConstrainedTextSize()
Calculates m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text s...
int m_IncrementLabel
Definition: ws_data_item.h:121
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:350
void SetPPI(int aBitmapPPI)
PAGE_OPTION m_pageOption
Definition: ws_data_item.h:106
VIEW.
Definition: view.h:61
#define FSCALE
POINT_COORD m_Pos
Definition: ws_data_item.h:115
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:234
int GetDefaultPenSize() const
Definition: ws_draw_item.h:430
int GetPPI() const
Definition: bitmap_base.h:153
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)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99