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 (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
 
const 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 ( )
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 = 0;
404  m_titleBlock = NULL;
405  m_paperFormat = NULL;
406  m_sheetFullName = NULL;
407  }
const wxString * m_paperFormat
const TITLE_BLOCK * m_titleBlock
const wxString * m_sheetLayer
const wxString * m_sheetFullName
WS_DRAW_ITEM_LIST::~WS_DRAW_ITEM_LIST ( )
inline

Definition at line 409 of file worksheet_shape_builder.h.

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

Member Function Documentation

void WS_DRAW_ITEM_LIST::Append ( WS_DRAW_ITEM_BASE aItem)
inline

Definition at line 501 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

502  {
503  m_graphicList.push_back( aItem );
504  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList
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 129 of file worksheet.cpp.

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().

130 {
131  wxString msg;
132 
133  /* Known formats
134  * %% = replaced by %
135  * %K = Kicad version
136  * %Z = paper format name (A4, USLetter)
137  * %Y = company name
138  * %D = date
139  * %R = revision
140  * %S = sheet number
141  * %N = number of sheets
142  * %L = layer name
143  * %Cx = comment (x = 0 to 9 to identify the comment)
144  * %F = filename
145  * %P = sheet path (sheet full name)
146  * %T = title
147  */
148 
149  for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
150  {
151  if( aTextbase[ii] != '%' )
152  {
153  msg << aTextbase[ii];
154  continue;
155  }
156 
157  if( ++ii >= aTextbase.Len() )
158  break;
159 
160  wxChar format = aTextbase[ii];
161  switch( format )
162  {
163  case '%':
164  msg += '%';
165  break;
166 
167  case 'D':
168  msg += m_titleBlock->GetDate();
169  break;
170 
171  case 'R':
172  msg += m_titleBlock->GetRevision();
173  break;
174 
175  case 'K':
176  msg += productName + Pgm().App().GetAppName();
177  msg += wxT( " " ) + GetBuildVersion();
178  break;
179 
180  case 'Z':
181  msg += *m_paperFormat;
182  break;
183 
184  case 'S':
185  msg << m_sheetNumber;
186  break;
187 
188  case 'N':
189  msg << m_sheetCount;
190  break;
191 
192  case 'F':
193  {
194  wxFileName fn( m_fileName );
195  msg += fn.GetFullName();
196  }
197  break;
198 
199  case 'L':
200  msg += *m_sheetLayer;
201  break;
202 
203  case 'P':
204  msg += *m_sheetFullName;
205  break;
206 
207  case 'Y':
208  msg += m_titleBlock->GetCompany();
209  break;
210 
211  case 'T':
212  msg += m_titleBlock->GetTitle();
213  break;
214 
215  case 'C':
216  format = aTextbase[++ii];
217  switch( format )
218  {
219  case '0':
220  case '1':
221  case '2':
222  case '3':
223  case '4':
224  case '5':
225  case '6':
226  case '7':
227  case '8':
228  case '9':
229  msg += m_titleBlock->GetComment( format - '0');
230  break;
231 
232  default:
233  break;
234  }
235 
236  default:
237  break;
238  }
239  }
240 
241  return msg;
242 }
const wxString * m_paperFormat
const wxString & GetCompany() const
const wxString & GetComment(int aIdx) const
VTBL_ENTRY wxApp & App()
Function App returns a bare naked wxApp, which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition: pgm_base.cpp:323
const TITLE_BLOCK * m_titleBlock
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
const wxString & GetDate() const
const wxString * m_sheetLayer
const wxString & GetTitle() const
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
const wxString & GetRevision() const
const wxString * m_sheetFullName
static const wxString productName
Definition: worksheet.cpp:47
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.

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().

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:41
void TransfertSetupToGraphicText(WS_DRAW_ITEM_TEXT *aGText)
transfert the text justification and orientation to aGText
const wxString * m_paperFormat
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
const TITLE_BLOCK * m_titleBlock
virtual bool IsInsidePage(int ii) const
const wxPoint GetStartPosUi(int ii=0) const
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 ...
const wxSize & GetSizeMils() const
void SetPageSize(const wxSize &aPageSize)
Function SetPageSize Set the size of the page layout.
WORKSHEET_DATAITEM * GetItem(unsigned aIdx) const
unsigned GetPolyIndexStart(unsigned aContour) const
const wxPoint GetEndPosUi(int ii=0) const
std::vector< wxPoint > m_Corners
void SetMultilineAllowed(bool aAllow)
Function SetMultiLineAllowed.
Definition: eda_text.h:187
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
#define milsTomm
unsigned GetCount() const
const wxPoint GetCornerPositionUi(unsigned aIdx, int aRepeat=0) const
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: drawtxt.cpp:49
wxString BuildFullText(const wxString &aTextbase)
Function BuildFullText returns the full text corresponding to the aTextbase, after replacing format s...
Definition: worksheet.cpp:129
void SetConstrainedTextSize()
Calculates m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text s...
WS_ItemType GetType() const
unsigned GetPolyIndexEnd(unsigned aContour) const
void SetMargins(const wxPoint &aLTmargin, const wxPoint &aRBmargin)
Function SetMargins Set the left top margin and the right bottom margin of the page layout...
const wxString & GetType() const
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
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 92 of file page_layout_graphic_items.cpp.

References drawMarker(), WS_DRAW_ITEM_LINE::GetEnd(), GetFirst(), WORKSHEET_DATAITEM::GetMarkerSizeUi(), GetNext(), WS_DRAW_ITEM_POLYGON::GetPosition(), WS_DRAW_ITEM_BITMAP::GetPosition(), 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().

93 {
94  // The not selected items are drawn first (most of items)
95  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
96  {
97  if( item->GetParent() && item->GetParent()->IsSelected() )
98  continue;
99 
100  item->DrawWsItem( aClipBox, aDC );
101  }
102 
103  // The selected items are drawn after (usually 0 or 1)
104  int markerSize = WORKSHEET_DATAITEM::GetMarkerSizeUi();
105 
106  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
107  {
108  if( !item->GetParent() || !item->GetParent()->IsSelected() )
109  continue;
110 
111  item->DrawWsItem( aClipBox, aDC );
112 
113  switch( item->GetType() )
114  {
116  {
117  WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
118 
119  if( markerSize )
120  {
121  drawMarker( aClipBox, aDC, line->GetStart(), markerSize );
122  drawMarker( aClipBox, aDC, line->GetEnd(), markerSize, true );
123  }
124  }
125  break;
126 
128  {
129  WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
130 
131  if( markerSize )
132  {
133  drawMarker( aClipBox, aDC, rect->GetStart(), markerSize );
134  drawMarker( aClipBox, aDC, rect->GetEnd(), markerSize, true );
135  }
136  }
137  break;
138 
140  {
141  WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
142 
143  if( markerSize )
144  drawMarker( aClipBox, aDC, text->GetTextPos(),
145  markerSize );
146  }
147  break;
148 
150  {
152 
153  if( markerSize )
154  {
155  drawMarker( aClipBox, aDC, poly->GetPosition(),
156  markerSize );
157  }
158  }
159  break;
160 
162  {
163  WS_DRAW_ITEM_BITMAP* bitmap = (WS_DRAW_ITEM_BITMAP*) item;
164 
165  if( markerSize )
166  {
167  drawMarker( aClipBox, aDC, bitmap->GetPosition(),
168  markerSize );
169  }
170  }
171  break;
172  }
173  }
174 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
WS_DRAW_ITEM_BASE * GetNext()
WS_DRAW_ITEM_BASE * GetFirst()
const wxPoint & GetEnd() const
const wxPoint & GetPosition()
const wxPoint & GetPosition() const
void drawMarker(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, int aSize, bool aEndPointShape=false)
const wxPoint & GetStart() const
void WS_DRAW_ITEM_LIST::GetAllItems ( std::vector< WS_DRAW_ITEM_BASE * > *  aList)
inline

Definition at line 526 of file worksheet_shape_builder.h.

References m_graphicList.

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

527  {
528  *aList = m_graphicList;
529  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList
WS_DRAW_ITEM_BASE* WS_DRAW_ITEM_LIST::GetFirst ( )
inline

Definition at line 506 of file worksheet_shape_builder.h.

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

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

Definition at line 516 of file worksheet_shape_builder.h.

References m_idx.

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

517  {
518  m_idx++;
519 
520  if( m_graphicList.size() > m_idx )
521  return m_graphicList[m_idx];
522  else
523  return NULL;
524  }
std::vector< WS_DRAW_ITEM_BASE * > m_graphicList
void WS_DRAW_ITEM_LIST::Locate ( 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 443 of file page_layout_graphic_items.cpp.

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

Referenced by PL_EDITOR_FRAME::Locate().

445 {
446  for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
447  {
448  item->m_Flags &= ~(LOCATE_STARTPOINT|LOCATE_ENDPOINT);
449  bool found = false;
450 
451  if( item->HitTestStartPoint ( aPosition ) )
452  {
453  item->m_Flags |= LOCATE_STARTPOINT;
454  found = true;
455  }
456 
457  if( item->HitTestEndPoint ( aPosition ) )
458  {
459  item->m_Flags |= LOCATE_ENDPOINT;
460  found = true;
461  }
462 
463  if( found || item->HitTest( aPosition ) )
464  {
465  aList.push_back( item );
466  }
467  }
468 }
WS_DRAW_ITEM_BASE * GetNext()
WS_DRAW_ITEM_BASE * GetFirst()
#define LOCATE_STARTPOINT
#define LOCATE_ENDPOINT
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 419 of file worksheet_shape_builder.h.

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

420  {
421  m_fileName = aFileName;
422  }
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 495 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

496  {
497  m_LTmargin = aLTmargin;
498  m_RBmargin = aRBmargin;
499  }
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 455 of file worksheet_shape_builder.h.

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

456  {
457  m_milsToIu = aScale;
458  }
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 464 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

465  {
466  m_pageSize = aPageSize;
467  }
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 446 of file worksheet_shape_builder.h.

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

447  {
448  m_penSize = aPenSize;
449  }
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 484 of file worksheet_shape_builder.h.

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

485  {
486  m_sheetCount = aSheetCount;
487  }
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 437 of file worksheet_shape_builder.h.

Referenced by DrawPageLayout().

438  {
439  m_sheetLayer = &aSheetLayer;
440  }
const wxString * m_sheetLayer
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 428 of file worksheet_shape_builder.h.

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

429  {
430  m_sheetFullName = &aSheetName;
431  }
const wxString * m_sheetFullName
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 474 of file worksheet_shape_builder.h.

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

475  {
476  m_sheetNumber = aSheetNumber;
477  }

Member Data Documentation

wxString WS_DRAW_ITEM_LIST::m_fileName
protected

Definition at line 390 of file worksheet_shape_builder.h.

Referenced by BuildFullText().

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 GetAllItems().

unsigned WS_DRAW_ITEM_LIST::m_idx
protected

Definition at line 377 of file worksheet_shape_builder.h.

Referenced by GetNext().

wxPoint WS_DRAW_ITEM_LIST::m_LTmargin
protected

Definition at line 378 of file worksheet_shape_builder.h.

double WS_DRAW_ITEM_LIST::m_milsToIu
protected

Definition at line 381 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

wxSize WS_DRAW_ITEM_LIST::m_pageSize
protected

Definition at line 380 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

const wxString* WS_DRAW_ITEM_LIST::m_paperFormat
protected

Definition at line 389 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), and BuildWorkSheetGraphicList().

int WS_DRAW_ITEM_LIST::m_penSize
protected

Definition at line 383 of file worksheet_shape_builder.h.

Referenced by BuildWorkSheetGraphicList().

wxPoint WS_DRAW_ITEM_LIST::m_RBmargin
protected

Definition at line 379 of file worksheet_shape_builder.h.

int WS_DRAW_ITEM_LIST::m_sheetCount
protected

Definition at line 386 of file worksheet_shape_builder.h.

Referenced by BuildFullText().

const wxString* WS_DRAW_ITEM_LIST::m_sheetFullName
protected

Definition at line 391 of file worksheet_shape_builder.h.

Referenced by BuildFullText().

const wxString* WS_DRAW_ITEM_LIST::m_sheetLayer
protected

Definition at line 392 of file worksheet_shape_builder.h.

Referenced by BuildFullText().

int WS_DRAW_ITEM_LIST::m_sheetNumber
protected

Definition at line 385 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), and BuildWorkSheetGraphicList().

const TITLE_BLOCK* WS_DRAW_ITEM_LIST::m_titleBlock
protected

Definition at line 388 of file worksheet_shape_builder.h.

Referenced by BuildFullText(), and BuildWorkSheetGraphicList().


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