KiCad PCB EDA Suite
WS_DRAW_ITEM_LIST Class Reference

#include <worksheet_shape_builder.h>

Public Member Functions

 WS_DRAW_ITEM_LIST ()
 
 ~WS_DRAW_ITEM_LIST ()
 
void SetFileName (const wxString &aFileName)
 Set the filename to draw/plot. More...
 
void SetSheetName (const wxString &aSheetName)
 Set the sheet name to draw/plot. More...
 
void SetSheetLayer (const wxString &aSheetLayer)
 Set the sheet layer to draw/plot. More...
 
void SetPenSize (int aPenSize)
 Function SetPenSize Set the default pen size to draw/plot lines and texts. More...
 
void SetMilsToIUfactor (double aScale)
 Function SetMilsToIUfactor Set the scalar to convert pages units ( mils) to draw/plot units. More...
 
void SetPageSize (const wxSize &aPageSize)
 Function SetPageSize Set the size of the page layout. More...
 
void SetSheetNumber (int aSheetNumber)
 Function SetSheetNumber Set the value of the sheet number, for basic inscriptions. More...
 
void SetSheetCount (int aSheetCount)
 Function SetSheetCount Set the value of the count of sheets, for basic inscriptions. More...
 
void SetMargins (const wxPoint &aLTmargin, const wxPoint &aRBmargin)
 Function SetMargins Set the left top margin and the right bottom margin of the page layout. More...
 
void Append (WS_DRAW_ITEM_BASE *aItem)
 
WS_DRAW_ITEM_BASEGetFirst ()
 
WS_DRAW_ITEM_BASEGetNext ()
 
void GetAllItems (std::vector< WS_DRAW_ITEM_BASE * > *aList)
 
void Draw (EDA_RECT *aClipBox, wxDC *aDC)
 Draws the item list created by BuildWorkSheetGraphicList. More...
 
void BuildWorkSheetGraphicList (const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock, COLOR4D aColor, COLOR4D aAltColor)
 Function BuildWorkSheetGraphicList is a core function for drawing or plotting the page layout with the frame and the basic inscriptions. More...
 
wxString BuildFullText (const wxString &aTextbase)
 Function BuildFullText returns the full text corresponding to the aTextbase, after replacing format symbols by the corresponding value. More...
 
void Locate (wxDC *aDC, std::vector< WS_DRAW_ITEM_BASE * > &aList, const wxPoint &aPosition)
 Locate graphic items in m_graphicList at location aPosition. More...
 

Protected Attributes

std::vector< WS_DRAW_ITEM_BASE * > m_graphicList
 
unsigned m_idx
 
wxPoint m_LTmargin
 
wxPoint m_RBmargin
 
wxSize m_pageSize
 
double m_milsToIu
 
int m_penSize
 
int m_sheetNumber
 
int m_sheetCount
 
const TITLE_BLOCKm_titleBlock
 
const wxString * m_paperFormat
 
wxString m_fileName
 
wxString m_sheetFullName
 
const wxString * m_sheetLayer
 

Detailed Description

Definition at line 373 of file worksheet_shape_builder.h.

Constructor & Destructor Documentation

◆ WS_DRAW_ITEM_LIST()

WS_DRAW_ITEM_LIST::WS_DRAW_ITEM_LIST ( )
inline

Definition at line 396 of file worksheet_shape_builder.h.

397  {
398  m_idx = 0;
399  m_milsToIu = 1.0;
400  m_penSize = 1;
401  m_sheetNumber = 1;
402  m_sheetCount = 1;
403  m_sheetLayer = nullptr;
404  m_titleBlock = nullptr;
405  m_paperFormat = nullptr;
406  }
const wxString * m_paperFormat
const TITLE_BLOCK * m_titleBlock
const wxString * m_sheetLayer

References m_idx, m_milsToIu, m_paperFormat, m_penSize, m_sheetCount, m_sheetLayer, m_sheetNumber, and m_titleBlock.

◆ ~WS_DRAW_ITEM_LIST()

WS_DRAW_ITEM_LIST::~WS_DRAW_ITEM_LIST ( )
inline

Definition at line 408 of file worksheet_shape_builder.h.

409  {
410  for( unsigned ii = 0; ii < m_graphicList.size(); ii++ )
411  delete m_graphicList[ii];
412  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList

References m_graphicList.

Member Function Documentation

◆ Append()

void WS_DRAW_ITEM_LIST::Append ( WS_DRAW_ITEM_BASE aItem)
inline

Definition at line 500 of file worksheet_shape_builder.h.

501  {
502  m_graphicList.push_back( aItem );
503  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList

References m_graphicList.

Referenced by BuildWorkSheetGraphicList().

◆ BuildFullText()

wxString WS_DRAW_ITEM_LIST::BuildFullText ( const wxString &  aTextbase)

Function BuildFullText returns the full text corresponding to the aTextbase, after replacing format symbols by the corresponding value.

Basic texts in Ki_WorkSheetData struct use format notation like "Title %T" to identify at run time the full text to display. Currently format identifier is % followed by a letter or 2 letters

%% = replaced by % K = Kicad version Z = paper format name (A4, USLetter) Y = company name D = date R = revision S = sheet number N = number of sheets Cx = comment (x = 0 to 9 to identify the comment) F = filename P = sheet path or sheet full name T = title Other fields like Developer, Verifier, Approver could use Cx and are seen as comments for format

Parameters
aTextbase= the text with format symbols
Returns
the text, after replacing the format symbols by the actual value

Definition at line 50 of file worksheet.cpp.

51 {
52  wxString msg;
53 
54  /* Known formats
55  * %% = replaced by %
56  * %K = Kicad version
57  * %Z = paper format name (A4, USLetter)
58  * %Y = company name
59  * %D = date
60  * %R = revision
61  * %S = sheet number
62  * %N = number of sheets
63  * %L = layer name
64  * %Cx = comment (x = 0 to 9 to identify the comment)
65  * %F = filename
66  * %P = sheet path (sheet full name)
67  * %T = title
68  */
69 
70  for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
71  {
72  if( aTextbase[ii] != '%' )
73  {
74  msg << aTextbase[ii];
75  continue;
76  }
77 
78  if( ++ii >= aTextbase.Len() )
79  break;
80 
81  wxChar format = aTextbase[ii];
82  switch( format )
83  {
84  case '%':
85  msg += '%';
86  break;
87 
88  case 'D':
89  msg += m_titleBlock->GetDate();
90  break;
91 
92  case 'R':
93  msg += m_titleBlock->GetRevision();
94  break;
95 
96  case 'K':
97  msg += productName + Pgm().App().GetAppName();
98  msg += wxT( " " ) + GetBuildVersion();
99  break;
100 
101  case 'Z':
102  if( m_paperFormat )
103  msg += *m_paperFormat;
104  break;
105 
106  case 'S':
107  msg << m_sheetNumber;
108  break;
109 
110  case 'N':
111  msg << m_sheetCount;
112  break;
113 
114  case 'F':
115  {
116  wxFileName fn( m_fileName );
117  msg += fn.GetFullName();
118  }
119  break;
120 
121  case 'L':
122  if( m_sheetLayer )
123  msg += *m_sheetLayer;
124  break;
125 
126  case 'P':
127  msg += m_sheetFullName;
128  break;
129 
130  case 'Y':
131  msg += m_titleBlock->GetCompany();
132  break;
133 
134  case 'T':
135  msg += m_titleBlock->GetTitle();
136  break;
137 
138  case 'C':
139  format = aTextbase[++ii];
140  switch( format )
141  {
142  case '0':
143  case '1':
144  case '2':
145  case '3':
146  case '4':
147  case '5':
148  case '6':
149  case '7':
150  case '8':
151  case '9':
152  msg += m_titleBlock->GetComment( format - '0');
153  break;
154 
155  default:
156  break;
157  }
158 
159  default:
160  break;
161  }
162  }
163 
164  return msg;
165 }
const wxString * m_paperFormat
const wxString & GetComment(int aIdx) const
Definition: title_block.h:110
VTBL_ENTRY wxApp & App()
Function App returns a bare naked wxApp, which may come from wxPython, SINGLE_TOP,...
Definition: pgm_base.cpp:185
const TITLE_BLOCK * m_titleBlock
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
const wxString * m_sheetLayer
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
const wxString & GetRevision() const
Definition: title_block.h:89
const wxString & GetCompany() const
Definition: title_block.h:99
const wxString & GetDate() const
Definition: title_block.h:79
static const wxString productName
Definition: worksheet.cpp:46
const wxString & GetTitle() const
Definition: title_block.h:65

References PGM_BASE::App(), GetBuildVersion(), TITLE_BLOCK::GetComment(), TITLE_BLOCK::GetCompany(), TITLE_BLOCK::GetDate(), TITLE_BLOCK::GetRevision(), TITLE_BLOCK::GetTitle(), m_fileName, m_paperFormat, m_sheetCount, m_sheetFullName, m_sheetLayer, m_sheetNumber, m_titleBlock, Pgm(), and productName.

Referenced by BuildWorkSheetGraphicList().

◆ BuildWorkSheetGraphicList()

void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList ( const PAGE_INFO aPageInfo,
const TITLE_BLOCK aTitleBlock,
COLOR4D  aColor,
COLOR4D  aAltColor 
)

Function BuildWorkSheetGraphicList is a core function for drawing or plotting the page layout with the frame and the basic inscriptions.

It populates the list of basic graphic items to draw or plot. currently lines, rect, polygons and texts before calling this function, some parameters should be initialized: by calling: SetPenSize( aPenWidth ); SetMilsToIUfactor( aScalar ); SetSheetNumber( aSheetNumber ); SetSheetCount( aSheetCount ); SetFileName( aFileName ); SetSheetName( aFullSheetName );

Parameters
aPageInfoThe PAGE_INFO, for page size, margins...
aTitleBlockThe sheet title block, for basic inscriptions.
aColorThe color for drawing.
aAltColorThe color for items which need to be "hightlighted".

Definition at line 66 of file title_block_shapes.cpp.

70 {
72 
73  #define milsTomm (25.4/1000)
74 
75  m_titleBlock = &aTitleBlock;
76  m_paperFormat = &aPageInfo.GetType();
77 
78  wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
79  Mm2mils( pglayout.GetTopMargin() ) );
80  wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
81  Mm2mils( pglayout.GetBottomMargin() ) );
82 
83  SetMargins( LTmargin, RBmargin );
84  SetPageSize( aPageInfo.GetSizeMils() );
85 
86  // Build the basic layout shape, if the layout list is empty
87  if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() )
88  pglayout.SetPageLayout();
89 
91  WORKSHEET_DATAITEM::m_Color = aColor; // the default color to draw items
92  WORKSHEET_DATAITEM::m_AltColor = aAltColor; // an alternate color to draw items
93 
94  // Left top corner position
95  DPOINT lt_corner;
96  lt_corner.x = pglayout.GetLeftMargin();
97  lt_corner.y = pglayout.GetTopMargin();
99 
100  // Right bottom corner position
101  DPOINT rb_corner;
102  rb_corner.x = (m_pageSize.x*milsTomm) - pglayout.GetRightMargin();
103  rb_corner.y = (m_pageSize.y*milsTomm) - pglayout.GetBottomMargin();
105 
106  WS_DRAW_ITEM_TEXT* gtext;
107  int pensize;
108 
109  for( unsigned ii = 0; ; ii++ )
110  {
111  WORKSHEET_DATAITEM* wsItem = pglayout.GetItem( ii );
112 
113  if( wsItem == NULL )
114  break;
115 
116  // Generate it only if the page option allows this
117  if( wsItem->GetPage1Option() < 0 // Not on page 1
118  && m_sheetNumber <= 1 )
119  continue;
120 
121  if( wsItem->GetPage1Option() > 0 // Only on page 1
122  && m_sheetNumber > 1 )
123  continue;
124 
125  COLOR4D color = wsItem->GetItemColor();
126 
127  pensize = wsItem->GetPenSizeUi();
128 
129  switch( wsItem->GetType() )
130  {
132  {
134  bool multilines = false;
135 
136  if( wsText->m_SpecialMode )
137  wsText->m_FullText = wsText->m_TextBase;
138  else
139  {
140  wsText->m_FullText = BuildFullText( wsText->m_TextBase );
141  multilines = wsText->ReplaceAntiSlashSequence();
142  }
143 
144  if( wsText->m_FullText.IsEmpty() )
145  break;
146 
147  if( pensize == 0 )
148  pensize = m_penSize;
149 
150  wsText->SetConstrainedTextSize();
151  wxSize textsize;
152 
153  textsize.x = KiROUND( wsText->m_ConstrainedTextSize.x
155  textsize.y = KiROUND( wsText->m_ConstrainedTextSize.y
157 
158  if( wsText->IsBold())
159  pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
160 
161  for( int jj = 0; jj < wsText->m_RepeatCount; jj++)
162  {
163  if( jj && ! wsText->IsInsidePage( jj ) )
164  continue;
165 
166  gtext = new WS_DRAW_ITEM_TEXT( wsText, wsText->m_FullText,
167  wsText->GetStartPosUi( jj ),
168  textsize, pensize, color,
169  wsText->IsItalic(),
170  wsText->IsBold() );
171  Append( gtext );
172  gtext->SetMultilineAllowed( multilines );
173  wsText->TransfertSetupToGraphicText( gtext );
174 
175  // Increment label for the next text
176  // (has no meaning for multiline texts)
177  if( wsText->m_RepeatCount > 1 && !multilines )
178  wsText->IncrementLabel( (jj+1)*wsText->m_IncrementLabel);
179  }
180  }
181  break;
182 
184  if( pensize == 0 )
185  pensize = m_penSize;
186 
187  for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
188  {
189  if( jj && ! wsItem->IsInsidePage( jj ) )
190  continue;
191  Append( new WS_DRAW_ITEM_LINE( wsItem, wsItem->GetStartPosUi( jj ),
192  wsItem->GetEndPosUi( jj ),
193  pensize, color ) );
194  }
195  break;
196 
198  if( pensize == 0 )
199  pensize = m_penSize;
200 
201  for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
202  {
203  if( jj && ! wsItem->IsInsidePage( jj ) )
204  break;
205 
206  Append( new WS_DRAW_ITEM_RECT( wsItem, wsItem->GetStartPosUi( jj ),
207  wsItem->GetEndPosUi( jj ),
208  pensize, color ) );
209  }
210  break;
211 
213  {
216  for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
217  {
218  if( jj && ! wsItem->IsInsidePage( jj ) )
219  continue;
220 
221  for( int kk = 0; kk < wspoly->GetPolyCount(); kk++ )
222  {
223  const bool fill = true;
224  WS_DRAW_ITEM_POLYGON* poly = new WS_DRAW_ITEM_POLYGON( wspoly,
225  wspoly->GetStartPosUi( jj ),
226  fill, pensize, color );
227  Append( poly );
228 
229  // Create polygon outline
230  unsigned ist = wspoly->GetPolyIndexStart( kk );
231  unsigned iend = wspoly->GetPolyIndexEnd( kk );
232  while( ist <= iend )
233  poly->m_Corners.push_back(
234  wspoly->GetCornerPositionUi( ist++, jj ) );
235 
236  }
237  }
238  }
239  break;
240 
242 
243  ((WORKSHEET_DATAITEM_BITMAP*)wsItem)->SetPixelScaleFactor();
244 
245  for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
246  {
247  if( jj && ! wsItem->IsInsidePage( jj ) )
248  continue;
249 
250  Append( new WS_DRAW_ITEM_BITMAP( wsItem,
251  wsItem->GetStartPosUi( jj ) ) );
252  }
253  break;
254 
255  }
256  }
257 }
int Mm2mils(double x)
Convert mm to mils.
Definition: base_units.h:51
void TransfertSetupToGraphicText(WS_DRAW_ITEM_TEXT *aGText)
transfert the text justification and orientation to aGText
virtual int GetPenSizeUi()
const wxString * m_paperFormat
const wxPoint GetStartPosUi(int ii=0) const
unsigned GetCount() const
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
const wxPoint GetCornerPositionUi(unsigned aIdx, int aRepeat=0) const
WS_ItemType GetType() const
static double m_WSunits2Iu
int color
Definition: DXF_plotter.cpp:62
const TITLE_BLOCK * m_titleBlock
static DPOINT m_LT_Corner
const wxString & GetType() const
Definition: page_info.h:97
void Append(WS_DRAW_ITEM_BASE *aItem)
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...
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application
static COLOR4D m_Color
void SetPageSize(const wxSize &aPageSize)
Function SetPageSize Set the size of the page layout.
static DPOINT m_RB_Corner
WORKSHEET_DATAITEM * GetItem(unsigned aIdx) const
std::vector< wxPoint > m_Corners
const wxSize & GetSizeMils() const
Definition: page_info.h:142
unsigned GetPolyIndexStart(unsigned aContour) const
static COLOR4D m_AltColor
void SetMultilineAllowed(bool aAllow)
Function SetMultiLineAllowed.
Definition: eda_text.h:204
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
#define milsTomm
const wxPoint GetEndPosUi(int ii=0) const
virtual bool IsInsidePage(int ii) const
unsigned GetPolyIndexEnd(unsigned aContour) const
wxString BuildFullText(const wxString &aTextbase)
Function BuildFullText returns the full text corresponding to the aTextbase, after replacing format s...
Definition: worksheet.cpp:50
void SetConstrainedTextSize()
Calculates m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text s...
void SetMargins(const wxPoint &aLTmargin, const wxPoint &aRBmargin)
Function SetMargins Set the left top margin and the right bottom margin of the page layout.
bool ReplaceAntiSlashSequence()
Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References Append(), BuildFullText(), color, WORKSHEET_LAYOUT::GetBottomMargin(), WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi(), WORKSHEET_LAYOUT::GetCount(), WORKSHEET_DATAITEM::GetEndPosUi(), WORKSHEET_LAYOUT::GetItem(), WORKSHEET_DATAITEM::GetItemColor(), WORKSHEET_LAYOUT::GetLeftMargin(), WORKSHEET_DATAITEM::GetPage1Option(), GetPenSizeForBold(), WORKSHEET_DATAITEM::GetPenSizeUi(), WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyCount(), WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyIndexEnd(), WORKSHEET_DATAITEM_POLYPOLYGON::GetPolyIndexStart(), WORKSHEET_LAYOUT::GetRightMargin(), PAGE_INFO::GetSizeMils(), WORKSHEET_DATAITEM::GetStartPosUi(), WORKSHEET_LAYOUT::GetTheInstance(), WORKSHEET_LAYOUT::GetTopMargin(), PAGE_INFO::GetType(), WORKSHEET_DATAITEM::GetType(), WORKSHEET_DATAITEM_TEXT::IncrementLabel(), WORKSHEET_DATAITEM_TEXT::IsBold(), WORKSHEET_DATAITEM::IsInsidePage(), WORKSHEET_DATAITEM_TEXT::IsItalic(), KiROUND(), WORKSHEET_DATAITEM::m_AltColor, WORKSHEET_DATAITEM::m_Color, WORKSHEET_DATAITEM_TEXT::m_ConstrainedTextSize, WS_DRAW_ITEM_POLYGON::m_Corners, WORKSHEET_DATAITEM_TEXT::m_FullText, WORKSHEET_DATAITEM::m_IncrementLabel, WORKSHEET_DATAITEM::m_LT_Corner, m_milsToIu, m_pageSize, m_paperFormat, m_penSize, WORKSHEET_DATAITEM::m_RB_Corner, WORKSHEET_DATAITEM::m_RepeatCount, m_sheetNumber, WORKSHEET_DATAITEM::m_SpecialMode, WORKSHEET_DATAITEM_TEXT::m_TextBase, m_titleBlock, WORKSHEET_DATAITEM::m_WSunits2Iu, milsTomm, min, Mm2mils(), WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), SetMargins(), EDA_TEXT::SetMultilineAllowed(), WORKSHEET_LAYOUT::SetPageLayout(), SetPageSize(), WORKSHEET_DATAITEM_TEXT::TransfertSetupToGraphicText(), WORKSHEET_LAYOUT::VoidListAllowed(), WORKSHEET_DATAITEM::WS_BITMAP, WORKSHEET_DATAITEM::WS_POLYPOLYGON, WORKSHEET_DATAITEM::WS_RECT, WORKSHEET_DATAITEM::WS_SEGMENT, WORKSHEET_DATAITEM::WS_TEXT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

◆ Draw()

void WS_DRAW_ITEM_LIST::Draw ( EDA_RECT aClipBox,
wxDC *  aDC 
)

Draws the item list created by BuildWorkSheetGraphicList.

Parameters
aClipBox= the clipping rect, or NULL if no clipping
aDC= the current Device Context

Definition at line 119 of file page_layout_graphic_items.cpp.

120 {
121  // The not selected items are drawn first (most of items)
122  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
123  {
124  if( item->GetParent() && item->GetParent()->IsSelected() )
125  continue;
126 
127  item->DrawWsItem( aClipBox, aDC );
128  }
129 
130  // The selected items are drawn after (usually 0 or 1)
131  int markerSize = WORKSHEET_DATAITEM::GetMarkerSizeUi( getScaleFromZoom( aDC ) );
132 
133  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
134  {
135  if( !item->GetParent() || !item->GetParent()->IsSelected() )
136  continue;
137 
138  item->DrawWsItem( aClipBox, aDC );
139 
140  if( !markerSize )
141  continue;
142 
143  switch( item->GetType() )
144  {
146  {
147  WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
148  drawMarker( aClipBox, aDC, line->GetStart(), markerSize );
149  drawMarker( aClipBox, aDC, line->GetEnd(), markerSize, true );
150  }
151  break;
152 
154  {
155  WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
156  drawMarker( aClipBox, aDC, rect->GetStart(), markerSize );
157  drawMarker( aClipBox, aDC, rect->GetEnd(), markerSize, true );
158  }
159  break;
160 
162  {
163  WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
164  drawMarker( aClipBox, aDC, text->GetTextPos(), markerSize );
165  }
166  break;
167 
169  {
171  drawMarker( aClipBox, aDC, poly->GetPosition(), markerSize );
172  }
173  break;
174 
176  {
177  WS_DRAW_ITEM_BITMAP* bitmap = (WS_DRAW_ITEM_BITMAP*) item;
178  drawMarker( aClipBox, aDC, bitmap->GetPosition(), markerSize );
179  }
180  break;
181  }
182  }
183 }
const wxPoint & GetEnd() const
WS_DRAW_ITEM_BASE * GetNext()
WS_DRAW_ITEM_BASE * GetFirst()
const wxPoint GetPosition() const
const wxPoint & GetStart() const
const wxPoint GetPosition() const
const wxPoint & GetTextPos() const
Definition: eda_text.h:241
void drawMarker(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, int aSize, bool aEndPointShape=false)
static double getScaleFromZoom(wxDC *aDC)
static int GetMarkerSizeUi(double aZoomScale=1.0)

References drawMarker(), WS_DRAW_ITEM_LINE::GetEnd(), GetFirst(), WORKSHEET_DATAITEM::GetMarkerSizeUi(), GetNext(), WS_DRAW_ITEM_POLYGON::GetPosition(), WS_DRAW_ITEM_BITMAP::GetPosition(), getScaleFromZoom(), WS_DRAW_ITEM_LINE::GetStart(), EDA_TEXT::GetTextPos(), WS_DRAW_ITEM_BASE::wsg_bitmap, WS_DRAW_ITEM_BASE::wsg_line, WS_DRAW_ITEM_BASE::wsg_poly, WS_DRAW_ITEM_BASE::wsg_rect, and WS_DRAW_ITEM_BASE::wsg_text.

Referenced by DrawPageLayout().

◆ GetAllItems()

void WS_DRAW_ITEM_LIST::GetAllItems ( std::vector< WS_DRAW_ITEM_BASE * > *  aList)
inline

Definition at line 525 of file worksheet_shape_builder.h.

526  {
527  *aList = m_graphicList;
528  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList

References m_graphicList.

Referenced by PL_EDITOR_FRAME::Block_Move(), and DrawMovingItems().

◆ GetFirst()

WS_DRAW_ITEM_BASE* WS_DRAW_ITEM_LIST::GetFirst ( )
inline

Definition at line 505 of file worksheet_shape_builder.h.

506  {
507  m_idx = 0;
508 
509  if( m_graphicList.size() )
510  return m_graphicList[0];
511  else
512  return NULL;
513  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList

References m_graphicList, and m_idx.

Referenced by Draw(), Locate(), and PlotWorkSheet().

◆ GetNext()

WS_DRAW_ITEM_BASE* WS_DRAW_ITEM_LIST::GetNext ( )
inline

Definition at line 515 of file worksheet_shape_builder.h.

516  {
517  m_idx++;
518 
519  if( m_graphicList.size() > m_idx )
520  return m_graphicList[m_idx];
521  else
522  return NULL;
523  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList

References m_graphicList, and m_idx.

Referenced by Draw(), Locate(), and PlotWorkSheet().

◆ Locate()

void WS_DRAW_ITEM_LIST::Locate ( wxDC *  aDC,
std::vector< WS_DRAW_ITEM_BASE * > &  aList,
const wxPoint &  aPosition 
)

Locate graphic items in m_graphicList at location aPosition.

Parameters
aList= the list of items found
aPositionthe position (in user units) to locate items

Definition at line 458 of file page_layout_graphic_items.cpp.

460 {
461  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
462  {
463  item->m_Flags &= ~(LOCATE_STARTPOINT|LOCATE_ENDPOINT);
464  bool found = false;
465 
466  if( item->HitTestStartPoint ( aDC, aPosition ) )
467  {
468  item->m_Flags |= LOCATE_STARTPOINT;
469  found = true;
470  }
471 
472  if( item->HitTestEndPoint ( aDC, aPosition ) )
473  {
474  item->m_Flags |= LOCATE_ENDPOINT;
475  found = true;
476  }
477 
478  if( found || item->HitTest( aPosition ) )
479  {
480  aList.push_back( item );
481  }
482  }
483 }
WS_DRAW_ITEM_BASE * GetNext()
#define LOCATE_STARTPOINT
WS_DRAW_ITEM_BASE * GetFirst()
#define LOCATE_ENDPOINT

References GetFirst(), GetNext(), LOCATE_ENDPOINT, and LOCATE_STARTPOINT.

Referenced by PL_EDITOR_FRAME::Locate().

◆ SetFileName()

void WS_DRAW_ITEM_LIST::SetFileName ( const wxString &  aFileName)
inline

Set the filename to draw/plot.

Parameters
aFileName= the text to display by the "filename" format

Definition at line 418 of file worksheet_shape_builder.h.

419  {
420  m_fileName = aFileName;
421  }

References m_fileName.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

◆ SetMargins()

void WS_DRAW_ITEM_LIST::SetMargins ( const wxPoint &  aLTmargin,
const wxPoint &  aRBmargin 
)
inline

Function SetMargins Set the left top margin and the right bottom margin of the page layout.

Parameters
aLTmarginThe left top margin of the page layout.
aRBmarginThe right bottom margin of the page layout.

Definition at line 494 of file worksheet_shape_builder.h.

495  {
496  m_LTmargin = aLTmargin;
497  m_RBmargin = aRBmargin;
498  }

References m_LTmargin, and m_RBmargin.

Referenced by BuildWorkSheetGraphicList().

◆ SetMilsToIUfactor()

void WS_DRAW_ITEM_LIST::SetMilsToIUfactor ( double  aScale)
inline

Function SetMilsToIUfactor Set the scalar to convert pages units ( mils) to draw/plot units.

Parameters
aScalethe conversion factor

Definition at line 454 of file worksheet_shape_builder.h.

455  {
456  m_milsToIu = aScale;
457  }

References m_milsToIu.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

◆ SetPageSize()

void WS_DRAW_ITEM_LIST::SetPageSize ( const wxSize &  aPageSize)
inline

Function SetPageSize Set the size of the page layout.

Parameters
aPageSizesize (in mils) of the page layout.

Definition at line 463 of file worksheet_shape_builder.h.

464  {
465  m_pageSize = aPageSize;
466  }

References m_pageSize.

Referenced by BuildWorkSheetGraphicList().

◆ SetPenSize()

void WS_DRAW_ITEM_LIST::SetPenSize ( int  aPenSize)
inline

Function SetPenSize Set the default pen size to draw/plot lines and texts.

Parameters
aPenSizethe thickness of lines

Definition at line 445 of file worksheet_shape_builder.h.

446  {
447  m_penSize = aPenSize;
448  }

References m_penSize.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), PlotWorkSheet(), and KIGFX::WORKSHEET_VIEWITEM::ViewDraw().

◆ SetSheetCount()

void WS_DRAW_ITEM_LIST::SetSheetCount ( int  aSheetCount)
inline

Function SetSheetCount Set the value of the count of sheets, for basic inscriptions.

Parameters
aSheetCountthe number of esheets to display.

Definition at line 483 of file worksheet_shape_builder.h.

484  {
485  m_sheetCount = aSheetCount;
486  }

References m_sheetCount.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

◆ SetSheetLayer()

void WS_DRAW_ITEM_LIST::SetSheetLayer ( const wxString &  aSheetLayer)
inline

Set the sheet layer to draw/plot.

Parameters
aSheetLayer= the text to draw/plot by the "sheetlayer" format

Definition at line 436 of file worksheet_shape_builder.h.

437  {
438  m_sheetLayer = &aSheetLayer;
439  }
const wxString * m_sheetLayer

References m_sheetLayer.

Referenced by DrawPageLayout().

◆ SetSheetName()

void WS_DRAW_ITEM_LIST::SetSheetName ( const wxString &  aSheetName)
inline

Set the sheet name to draw/plot.

Parameters
aSheetName= the text to draw/plot by the "sheetname" format

Definition at line 427 of file worksheet_shape_builder.h.

428  {
429  m_sheetFullName = aSheetName;
430  }

References m_sheetFullName.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

◆ SetSheetNumber()

void WS_DRAW_ITEM_LIST::SetSheetNumber ( int  aSheetNumber)
inline

Function SetSheetNumber Set the value of the sheet number, for basic inscriptions.

Parameters
aSheetNumberthe number to display.

Definition at line 473 of file worksheet_shape_builder.h.

474  {
475  m_sheetNumber = aSheetNumber;
476  }

References m_sheetNumber.

Referenced by ConfigureDrawList(), DrawPageLayout(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

Member Data Documentation

◆ m_fileName

wxString WS_DRAW_ITEM_LIST::m_fileName
protected

Definition at line 390 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), and SetFileName().

◆ m_graphicList

std::vector<WS_DRAW_ITEM_BASE*> WS_DRAW_ITEM_LIST::m_graphicList
protected

Definition at line 376 of file worksheet_shape_builder.h.

Referenced by Append(), GetAllItems(), GetFirst(), GetNext(), and ~WS_DRAW_ITEM_LIST().

◆ m_idx

unsigned WS_DRAW_ITEM_LIST::m_idx
protected

Definition at line 377 of file worksheet_shape_builder.h.

Referenced by GetFirst(), GetNext(), and WS_DRAW_ITEM_LIST().

◆ m_LTmargin

wxPoint WS_DRAW_ITEM_LIST::m_LTmargin
protected

Definition at line 378 of file worksheet_shape_builder.h.

Referenced by SetMargins().

◆ m_milsToIu

double WS_DRAW_ITEM_LIST::m_milsToIu
protected

◆ m_pageSize

wxSize WS_DRAW_ITEM_LIST::m_pageSize
protected

Definition at line 380 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList(), and SetPageSize().

◆ m_paperFormat

const wxString* WS_DRAW_ITEM_LIST::m_paperFormat
protected

◆ m_penSize

int WS_DRAW_ITEM_LIST::m_penSize
protected

◆ m_RBmargin

wxPoint WS_DRAW_ITEM_LIST::m_RBmargin
protected

Definition at line 379 of file worksheet_shape_builder.h.

Referenced by SetMargins().

◆ m_sheetCount

int WS_DRAW_ITEM_LIST::m_sheetCount
protected

Definition at line 386 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), SetSheetCount(), and WS_DRAW_ITEM_LIST().

◆ m_sheetFullName

wxString WS_DRAW_ITEM_LIST::m_sheetFullName
protected

Definition at line 391 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), and SetSheetName().

◆ m_sheetLayer

const wxString* WS_DRAW_ITEM_LIST::m_sheetLayer
protected

Definition at line 392 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), SetSheetLayer(), and WS_DRAW_ITEM_LIST().

◆ m_sheetNumber

int WS_DRAW_ITEM_LIST::m_sheetNumber
protected

◆ m_titleBlock

const TITLE_BLOCK* WS_DRAW_ITEM_LIST::m_titleBlock
protected

The documentation for this class was generated from the following files: