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 <gr_text.h>
53 #include <eda_rect.h>
54 #include <math/util.h> // for KiROUND
55 #include <view/view.h>
56 #include <title_block.h>
60 #include <page_layout/ws_painter.h>
61 #include <trigo.h>
62 
63 using KIGFX::COLOR4D;
64 
65 
66 // The constructor:
68 {
70  m_type = aType;
71  m_RepeatCount = 1;
72  m_IncrementLabel = 1;
73  m_LineWidth = 0;
74 }
75 
76 
78 {
79  for( WS_DRAW_ITEM_BASE* item : m_drawItems )
80  delete item;
81 }
82 
83 
85 {
86  int pensize = GetPenSizeUi();
87 
88  if( pensize == 0 )
89  pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
90 
91  std::map<int, STATUS_FLAGS> itemFlags;
92  WS_DRAW_ITEM_BASE* item = nullptr;
93 
94  for( size_t i = 0; i < m_drawItems.size(); ++i )
95  {
96  item = m_drawItems[ i ];
97  itemFlags[ i ] = item->GetFlags();
98 
99  if( aCollector )
100  aCollector->Remove( item );
101 
102  if( aView )
103  aView->Remove( item );
104 
105  delete item;
106  }
107 
108  m_drawItems.clear();
109 
110  for( int j = 0; j < m_RepeatCount; j++ )
111  {
112  if( j && ! IsInsidePage( j ) )
113  continue;
114 
115  if( m_type == WS_SEGMENT )
116  item = new WS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
117  else if( m_type == WS_RECT )
118  item = new WS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
119  else
120  {
121  wxFAIL_MSG( "Unknown worksheet draw item type" );
122  continue;
123  }
124 
125  item->SetFlags( itemFlags[ j ] );
126  m_drawItems.push_back( item );
127 
128  if( aCollector )
129  aCollector->Append( item );
130 
131  if( aView )
132  aView->Add( item );
133  }
134 }
135 
136 
138 {
140 
141  if( m_LineWidth != 0 )
142  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
143  else
144  return KiROUND( model.m_DefaultLineWidth * model.m_WSunits2Iu );
145 }
146 
147 
148 // move item to aPosition
149 // starting point is moved to aPosition
150 // the Ending point is moved to a position which keeps the item size
151 // (if both coordinates have the same corner reference)
152 // MoveToUi and MoveTo takes the graphic position (i.e relative to the left top
153 // paper corner
155 {
156  DPOINT pos_mm;
157  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
158  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
159 
160  MoveTo( pos_mm );
161 }
162 
163 
164 void WS_DATA_ITEM::MoveTo( DPOINT aPosition )
165 {
166  DPOINT vector = aPosition - GetStartPos();
167  DPOINT endpos = vector + GetEndPos();
168 
169  MoveStartPointTo( aPosition );
170  MoveEndPointTo( endpos );
171 
172  for( WS_DRAW_ITEM_BASE* drawItem : m_drawItems )
173  {
174  drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
175  drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
176  }
177 }
178 
179 
180 /* move the starting point of the item to a new position
181  * aPosition = the new position of the starting point, in mm
182  */
184 {
186  DPOINT position;
187 
188  // Calculate the position of the starting point
189  // relative to the reference corner
190  // aPosition is the position relative to the right top paper corner
191  switch( m_Pos.m_Anchor )
192  {
193  case RB_CORNER:
194  position = model.m_RB_Corner - aPosition;
195  break;
196 
197  case RT_CORNER:
198  position.x = model.m_RB_Corner.x - aPosition.x;
199  position.y = aPosition.y - model.m_LT_Corner.y;
200  break;
201 
202  case LB_CORNER:
203  position.x = aPosition.x - model.m_LT_Corner.x;
204  position.y = model.m_RB_Corner.y - aPosition.y;
205  break;
206 
207  case LT_CORNER:
208  position = aPosition - model.m_LT_Corner;
209  break;
210  }
211 
212  m_Pos.m_Pos = position;
213 }
214 
215 
216 /* move the starting point of the item to a new position
217  * aPosition = the new position of the starting point in graphic units
218  */
220 {
221  DPOINT pos_mm( aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
223 
224  MoveStartPointTo( pos_mm );
225 }
226 
227 
235 {
237  DPOINT position;
238 
239  // Calculate the position of the starting point
240  // relative to the reference corner
241  // aPosition is the position relative to the right top paper corner
242  switch( m_End.m_Anchor )
243  {
244  case RB_CORNER:
245  position = model.m_RB_Corner - aPosition;
246  break;
247 
248  case RT_CORNER:
249  position.x = model.m_RB_Corner.x - aPosition.x;
250  position.y = aPosition.y - model.m_LT_Corner.y;
251  break;
252 
253  case LB_CORNER:
254  position.x = aPosition.x - model.m_LT_Corner.x;
255  position.y = model.m_RB_Corner.y - aPosition.y;
256  break;
257 
258  case LT_CORNER:
259  position = aPosition - model.m_LT_Corner;
260  break;
261  }
262 
263  // Modify m_End only for items having 2 coordinates
264  switch( GetType() )
265  {
266  case WS_SEGMENT:
267  case WS_RECT:
268  m_End.m_Pos = position;
269  break;
270 
271  default:
272  break;
273  }
274 }
275 
276 
277 /* move the ending point of the item to a new position
278  * has meaning only for items defined by 2 points
279  * (segments and rectangles)
280  * aPosition = the new position of the ending point in graphic units
281  */
283 {
284  DPOINT pos_mm;
285  pos_mm.x = aPosition.x / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
286  pos_mm.y = aPosition.y / WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
287 
288  MoveEndPointTo( pos_mm );
289 }
290 
291 
292 const DPOINT WS_DATA_ITEM::GetStartPos( int ii ) const
293 {
295  DPOINT pos( m_Pos.m_Pos.x + ( m_IncrementVector.x * ii ),
296  m_Pos.m_Pos.y + ( m_IncrementVector.y * ii ) );
297 
298  switch( m_Pos.m_Anchor )
299  {
300  case RB_CORNER: // right bottom corner
301  pos = model.m_RB_Corner - pos;
302  break;
303 
304  case RT_CORNER: // right top corner
305  pos.x = model.m_RB_Corner.x - pos.x;
306  pos.y = model.m_LT_Corner.y + pos.y;
307  break;
308 
309  case LB_CORNER: // left bottom corner
310  pos.x = model.m_LT_Corner.x + pos.x;
311  pos.y = model.m_RB_Corner.y - pos.y;
312  break;
313 
314  case LT_CORNER: // left top corner
315  pos = model.m_LT_Corner + pos;
316  break;
317  }
318 
319  return pos;
320 }
321 
322 
324 {
326  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
327 }
328 
329 
330 const DPOINT WS_DATA_ITEM::GetEndPos( int ii ) const
331 {
332  DPOINT pos( m_End.m_Pos.x + ( m_IncrementVector.x * ii ),
333  m_End.m_Pos.y + ( m_IncrementVector.y * ii ) );
334 
335  switch( m_End.m_Anchor )
336  {
337  case RB_CORNER: // right bottom corner
339  break;
340 
341  case RT_CORNER: // right top corner
344  break;
345 
346  case LB_CORNER: // left bottom corner
349  break;
350 
351  case LT_CORNER: // left top corner
353  break;
354  }
355 
356  return pos;
357 }
358 
359 
360 const wxPoint WS_DATA_ITEM::GetEndPosUi( int ii ) const
361 {
362  DPOINT pos = GetEndPos( ii );
364  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
365 }
366 
367 
368 bool WS_DATA_ITEM::IsInsidePage( int ii ) const
369 {
371 
372  DPOINT pos = GetStartPos( ii );
373 
374  for( int kk = 0; kk < 1; kk++ )
375  {
376  if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
377  return false;
378 
379  if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
380  return false;
381 
382  pos = GetEndPos( ii );
383  }
384 
385  return true;
386 }
387 
388 
389 const wxString WS_DATA_ITEM::GetClassName() const
390 {
391  wxString name;
392 
393  switch( GetType() )
394  {
395  case WS_TEXT: name = wxT( "Text" ); break;
396  case WS_SEGMENT: name = wxT( "Line" ); break;
397  case WS_RECT: name = wxT( "Rectangle" ); break;
398  case WS_POLYPOLYGON: name = wxT( "Imported Shape" ); break;
399  case WS_BITMAP: name = wxT( "Image" ); break;
400  }
401 
402  return name;
403 }
404 
405 
407  WS_DATA_ITEM( WS_POLYPOLYGON )
408 {
409  m_Orient = 0.0;
410 }
411 
412 
414 {
415  std::map<int, STATUS_FLAGS> itemFlags;
416  WS_DRAW_ITEM_BASE* item = nullptr;
417 
418  for( size_t i = 0; i < m_drawItems.size(); ++i )
419  {
420  item = m_drawItems[ i ];
421  itemFlags[ i ] = item->GetFlags();
422 
423  if( aCollector )
424  aCollector->Remove( item );
425 
426  if( aView )
427  aView->Remove( item );
428 
429  delete item;
430  }
431 
432  m_drawItems.clear();
433 
434  for( int j = 0; j < m_RepeatCount; j++ )
435  {
436  if( j && !IsInsidePage( j ) )
437  continue;
438 
439  int pensize = GetPenSizeUi();
440  auto poly_shape = new WS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
441  poly_shape->SetFlags( itemFlags[ j ] );
442  m_drawItems.push_back( poly_shape );
443 
444  // Transfer all outlines (basic polygons)
445  SHAPE_POLY_SET& polygons = poly_shape->GetPolygons();
446  for( int kk = 0; kk < GetPolyCount(); kk++ )
447  {
448  // Create new outline
449  unsigned ist = GetPolyIndexStart( kk );
450  unsigned iend = GetPolyIndexEnd( kk );
451 
452  polygons.NewOutline();
453 
454  while( ist <= iend )
455  polygons.Append( GetCornerPositionUi( ist++, j ) );
456  }
457 
458  if( aCollector )
459  aCollector->Append( poly_shape );
460 
461  if( aView )
462  aView->Add( poly_shape );
463  }
464 }
465 
466 
468 {
469  return KiROUND( m_LineWidth * WS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
470 }
471 
472 
473 const DPOINT WS_DATA_ITEM_POLYGONS::GetCornerPosition( unsigned aIdx, int aRepeat ) const
474 {
475  DPOINT pos = m_Corners[aIdx];
476 
477  // Rotation:
478  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
479  pos += GetStartPos( aRepeat );
480  return pos;
481 }
482 
483 
485 {
486  if( m_Corners.size() == 0 )
487  {
488  m_minCoord.x = m_maxCoord.x = 0.0;
489  m_minCoord.y = m_maxCoord.y = 0.0;
490  return;
491  }
492 
493  DPOINT pos;
494  pos = m_Corners[0];
495  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
496  m_minCoord = m_maxCoord = pos;
497 
498  for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
499  {
500  pos = m_Corners[ii];
501  RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
502 
503  if( m_minCoord.x > pos.x )
504  m_minCoord.x = pos.x;
505 
506  if( m_minCoord.y > pos.y )
507  m_minCoord.y = pos.y;
508 
509  if( m_maxCoord.x < pos.x )
510  m_maxCoord.x = pos.x;
511 
512  if( m_maxCoord.y < pos.y )
513  m_maxCoord.y = pos.y;
514  }
515 }
516 
517 
519 {
521 
522  DPOINT pos = GetStartPos( ii );
523  pos += m_minCoord; // left top pos of bounding box
524 
525  if( model.m_LT_Corner.x > pos.x || model.m_LT_Corner.y > pos.y )
526  return false;
527 
528  pos = GetStartPos( ii );
529  pos += m_maxCoord; // rignt bottom pos of bounding box
530 
531  if( model.m_RB_Corner.x < pos.x || model.m_RB_Corner.y < pos.y )
532  return false;
533 
534  return true;
535 }
536 
537 
538 const wxPoint WS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
539 {
540  DPOINT pos = GetCornerPosition( aIdx, aRepeat );
542  return wxPoint( int(pos.x), int(pos.y) );
543 }
544 
545 
546 WS_DATA_ITEM_TEXT::WS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
547  WS_DATA_ITEM( WS_TEXT )
548 {
549  m_TextBase = aTextBase;
550  m_IncrementLabel = 1;
553  m_Italic = false;
554  m_Bold = false;
555  m_Orient = 0.0;
556  m_LineWidth = 0.0; // 0 means use default value
557 }
558 
559 
561 {
562  int pensize = GetPenSizeUi();
563  bool multilines = false;
564 
565  if( WS_DATA_MODEL::GetTheInstance().m_EditMode )
567  else
568  {
569  m_FullText = aCollector ? aCollector->BuildFullText( m_TextBase ) : wxString();
570  multilines = ReplaceAntiSlashSequence();
571  }
572 
573  if( pensize == 0 )
574  pensize = aCollector ? aCollector->GetDefaultPenSize() : 1;
575 
577  wxSize textsize;
578 
581 
582  if( m_Bold )
583  pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
584 
585  std::map<int, STATUS_FLAGS> itemFlags;
586  WS_DRAW_ITEM_TEXT* text = nullptr;
587 
588  for( size_t i = 0; i < m_drawItems.size(); ++i )
589  {
590  text = (WS_DRAW_ITEM_TEXT*) m_drawItems[ i ];
591  itemFlags[ i ] = text->GetFlags();
592 
593  if( aCollector )
594  aCollector->Remove( text );
595 
596  if( aView )
597  aView->Remove( text );
598 
599  delete text;
600  }
601 
602  m_drawItems.clear();
603 
604  for( int j = 0; j < m_RepeatCount; ++j )
605  {
606  if( j > 0 && !IsInsidePage( j ) )
607  continue;
608 
609  text = new WS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
610  m_Italic, m_Bold );
611  text->SetFlags( itemFlags[ j ] );
612  m_drawItems.push_back( text );
613 
614  if( aCollector )
615  aCollector->Append( text );
616 
617  if( aView )
618  aView->Add( text );
619 
620  text->SetHorizJustify( m_Hjustify ) ;
621  text->SetVertJustify( m_Vjustify );
622  text->SetTextAngle( m_Orient * 10 ); // graphic text orient unit = 0.1 degree
623  text->SetMultilineAllowed( multilines );
624 
625  // Increment label for the next text (has no meaning for multiline texts)
626  if( m_RepeatCount > 1 && !multilines )
627  IncrementLabel(( j + 1 ) * m_IncrementLabel );
628  }
629 }
630 
631 
633 {
635 
636  if( m_LineWidth != 0 )
637  return KiROUND( m_LineWidth * model.m_WSunits2Iu );
638  else
639  return KiROUND( model.m_DefaultTextThickness * model.m_WSunits2Iu );
640 }
641 
642 
644 {
645  int last = m_TextBase.Len() -1;
646 
647  wxChar lbchar = m_TextBase[last];
649  m_FullText.RemoveLast();
650 
651  if( lbchar >= '0' && lbchar <= '9' )
652  // A number is expected:
653  m_FullText << (int)( aIncr + lbchar - '0' );
654  else
655  m_FullText << (wxChar) ( aIncr + lbchar );
656 }
657 
658 
659 // Replace the '\''n' sequence by EOL
660 // and the sequence '\''\' by only one '\' in m_FullText
661 // if m_FullText is a multiline text (i.e.contains '\n') return true
663 {
664  bool multiline = false;
665 
666  for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
667  {
668  if( m_FullText[ii] == '\n' )
669  multiline = true;
670 
671  else if( m_FullText[ii] == '\\' )
672  {
673  if( ++ii >= m_FullText.Len() )
674  break;
675 
676  if( m_FullText[ii] == '\\' )
677  {
678  // a double \\ sequence is replaced by a single \ char
679  m_FullText.Remove(ii, 1);
680  ii--;
681  }
682  else if( m_FullText[ii] == 'n' )
683  {
684  // Replace the "\n" sequence by a EOL char
685  multiline = true;
686  m_FullText[ii] = '\n';
687  m_FullText.Remove(ii-1, 1);
688  ii--;
689  }
690  }
691  }
692 
693  return multiline;
694 }
695 
696 
698 {
700 
701  if( m_ConstrainedTextSize.x == 0 )
703 
704  if( m_ConstrainedTextSize.y == 0 )
706 
708  {
709  // to know the X and Y size of the line, we should use
710  // EDA_TEXT::GetTextBox()
711  // but this function uses integers
712  // So, to avoid truncations with our unit in mm, use microns.
713  wxSize size_micron;
714  #define FSCALE 1000.0
715  int linewidth = 0;
716  size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
717  size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
718  WS_DRAW_ITEM_TEXT dummy( WS_DRAW_ITEM_TEXT( this, 0, this->m_FullText, wxPoint( 0, 0 ),
719  size_micron, linewidth, m_Italic, m_Bold ) );
720  dummy.SetMultilineAllowed( true );
721  dummy.SetHorizJustify( m_Hjustify ) ;
722  dummy.SetVertJustify( m_Vjustify );
723  dummy.SetTextAngle( m_Orient * 10 );
724 
725  EDA_RECT rect = dummy.GetTextBox();
726  DSIZE size;
727  size.x = rect.GetWidth() / FSCALE;
728  size.y = rect.GetHeight() / FSCALE;
729 
730  if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
732 
733  if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y )
735  }
736 }
737 
738 
740 {
741  std::map<int, STATUS_FLAGS> itemFlags;
742  WS_DRAW_ITEM_BASE* item = nullptr;
743 
744  for( size_t i = 0; i < m_drawItems.size(); ++i )
745  {
746  item = m_drawItems[ i ];
747  itemFlags[ i ] = item->GetFlags();
748 
749  if( aCollector )
750  aCollector->Remove( item );
751 
752  if( aView )
753  aView->Remove( item );
754 
755  delete item;
756  }
757 
758  m_drawItems.clear();
759 
760  for( int j = 0; j < m_RepeatCount; j++ )
761  {
762  if( j && !IsInsidePage( j ) )
763  continue;
764 
765  auto bitmap = new WS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
766  bitmap->SetFlags( itemFlags[ j ] );
767  m_drawItems.push_back( bitmap );
768 
769  if( aCollector )
770  aCollector->Append( bitmap );
771 
772  if( aView )
773  aView->Add( bitmap );
774  }
775 }
776 
777 
779 {
780  if( m_ImageBitmap )
782 
783  return 300;
784 }
785 
786 
787 void WS_DATA_ITEM_BITMAP::SetPPI( int aBitmapPPI )
788 {
789  if( m_ImageBitmap )
790  m_ImageBitmap->SetScale( (double) m_ImageBitmap->GetPPI() / aBitmapPPI );
791 }
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:38
DPOINT m_RB_Corner
Definition: ws_data_model.h:52
void SyncDrawItems(WS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
void Remove(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:472
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:97
virtual bool IsInsidePage(int ii) const
std::vector< DPOINT > m_Corners
Definition: ws_data_item.h:223
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:48
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:357
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:370
POINT_COORD m_End
Definition: ws_data_item.h:120
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:264
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
DSIZE m_DefaultTextSize
Definition: ws_data_model.h:55
unsigned GetPolyIndexEnd(unsigned aContour) const
Definition: ws_data_item.h:276
void Append(WS_DRAW_ITEM_BASE *aItem)
Definition: ws_draw_item.h:467
DPOINT m_LT_Corner
Definition: ws_data_model.h:53
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ws_data_item.h:308
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
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ws_draw_item.h:357
WS_DATA_ITEM(WS_ITEM_TYPE aType)
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:220
WS_ITEM_TYPE m_type
Definition: ws_data_item.h:109
SHAPE_POLY_SET.
DPOINT m_Pos
Definition: ws_data_item.h:75
WS_DATA_ITEM_TEXT(const wxString &aTextBase)
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:204
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ws_data_item.h:309
std::vector< WS_DRAW_ITEM_BASE * > m_drawItems
Definition: ws_data_item.h:112
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:123
void SetMultilineAllowed(bool aAllow)
Definition: eda_text.h:197
int GetHeight() const
Definition: eda_rect.h:120
WS_ITEM_TYPE GetType() const
Definition: ws_data_item.h:151
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:121
const wxPoint GetEndPosUi(int ii=0) const
int GetPolyCount() const
Definition: ws_data_item.h:258
virtual ~WS_DATA_ITEM()
const char * name
Definition: DXF_plotter.cpp:59
double m_DefaultLineWidth
Definition: ws_data_model.h:54
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:50
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:203
wxString BuildFullText(const wxString &aTextbase)
Return the full text corresponding to the aTextbase, after replacing format symbols by the correspond...
Definition: ws_painter.cpp:116
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:318
double m_DefaultTextThickness
Definition: ws_data_model.h:56
const DPOINT GetCornerPosition(unsigned aIdx, int aRepeat=0) const
Helper classes to handle basic graphic items used to draw/plot title blocks and frame references segm...
Definition: ws_draw_item.h:54
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:125
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:327
void SetPPI(int aBitmapPPI)
PAGE_OPTION m_pageOption
Definition: ws_data_item.h:110
VIEW.
Definition: view.h:63
#define FSCALE
POINT_COORD m_Pos
Definition: ws_data_item.h:119
STATUS_FLAGS GetFlags() const
Definition: eda_item.h:222
int GetDefaultPenSize() const
Definition: ws_draw_item.h:436
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:100