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