KiCad PCB EDA Suite
DRAWING_SHEET_READER_PARSER Class Reference

DRAWING_SHEET_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a DS_DATA_MODEL. More...

Inheritance diagram for DRAWING_SHEET_READER_PARSER:

Public Member Functions

 DRAWING_SHEET_READER_PARSER (const char *aLine, const wxString &aSource)
 
void Parse (DS_DATA_MODEL *aLayout)
 

Private Member Functions

int parseInt (int aMin, int aMax)
 Function parseInt parses an integer and constrains it between two values. More...
 
double parseDouble ()
 Function parseDouble parses a double. More...
 
void parseSetup (DS_DATA_MODEL *aLayout)
 
void parseGraphic (DS_DATA_ITEM *aItem)
 parse a graphic item starting by "(line" or "(rect" and read parameters. More...
 
void parseText (DS_DATA_ITEM_TEXT *aItem)
 parse a text item starting by "(tbtext" and read parameters. More...
 
void parsePolygon (DS_DATA_ITEM_POLYGONS *aItem)
 parse a polygon item starting by "( polygon" and read parameters. More...
 
void parsePolyOutline (DS_DATA_ITEM_POLYGONS *aItem)
 parse a list of corners starting by "( pts" and read coordinates. More...
 
void parseBitmap (DS_DATA_ITEM_BITMAP *aItem)
 parse a bitmap item starting by "( bitmap" and read parameters. More...
 
void parseCoordinate (POINT_COORD &aCoord)
 
void readOption (DS_DATA_ITEM *aItem)
 
void readPngdata (DS_DATA_ITEM_BITMAP *aItem)
 

Detailed Description

DRAWING_SHEET_READER_PARSER holds data and functions pertinent to parsing a S-expression file for a DS_DATA_MODEL.

Definition at line 46 of file drawing_sheet_reader.cpp.

Constructor & Destructor Documentation

◆ DRAWING_SHEET_READER_PARSER()

DRAWING_SHEET_READER_PARSER::DRAWING_SHEET_READER_PARSER ( const char *  aLine,
const wxString &  aSource 
)

Definition at line 106 of file drawing_sheet_reader.cpp.

107  :
108  DRAWING_SHEET_READER_LEXER( aLine, aSource )
109 {
110 }

Member Function Documentation

◆ Parse()

void DRAWING_SHEET_READER_PARSER::Parse ( DS_DATA_MODEL aLayout)

Definition at line 187 of file drawing_sheet_reader.cpp.

188 {
189  DS_DATA_ITEM* item;
190  LOCALE_IO toggle;
191 
192  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
193  {
194  if( token == T_LEFT )
195  token = NextTok();
196 
197  if( token == T_page_layout || token == T_drawing_sheet )
198  continue;
199 
200  switch( token )
201  {
202  case T_setup: // Defines default values for graphic items
203  parseSetup( aLayout );
204  break;
205 
206  case T_line:
208  parseGraphic( item );
209  aLayout->Append( item );
210  break;
211 
212  case T_rect:
213  item = new DS_DATA_ITEM( DS_DATA_ITEM::DS_RECT );
214  parseGraphic( item );
215  aLayout->Append( item );
216  break;
217 
218  case T_polygon:
219  item = new DS_DATA_ITEM_POLYGONS();
221  aLayout->Append( item );
222  break;
223 
224  case T_bitmap:
225  item = new DS_DATA_ITEM_BITMAP( NULL );
226  parseBitmap( (DS_DATA_ITEM_BITMAP*) item );
227  aLayout->Append( item );
228  break;
229 
230  case T_tbtext:
231  NeedSYMBOLorNUMBER();
232  item = new DS_DATA_ITEM_TEXT( convertLegacyVariableRefs( FromUTF8() ) );
233  parseText( (DS_DATA_ITEM_TEXT*) item );
234  aLayout->Append( item );
235  break;
236 
237  default:
238  Unexpected( CurText() );
239  break;
240  }
241  }
242 }
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
void parsePolygon(DS_DATA_ITEM_POLYGONS *aItem)
parse a polygon item starting by "( polygon" and read parameters.
void parseText(DS_DATA_ITEM_TEXT *aItem)
parse a text item starting by "(tbtext" and read parameters.
void parseBitmap(DS_DATA_ITEM_BITMAP *aItem)
parse a bitmap item starting by "( bitmap" and read parameters.
#define NULL
void parseGraphic(DS_DATA_ITEM *aItem)
parse a graphic item starting by "(line" or "(rect" and read parameters.
wxString convertLegacyVariableRefs(const wxString &aTextbase)
void parseSetup(DS_DATA_MODEL *aLayout)
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
void Append(DS_DATA_ITEM *aItem)

References DS_DATA_MODEL::Append(), convertLegacyVariableRefs(), DS_DATA_ITEM::DS_RECT, DS_DATA_ITEM::DS_SEGMENT, NULL, parseBitmap(), parseGraphic(), parsePolygon(), parseSetup(), and parseText().

Referenced by DS_DATA_MODEL::LoadDrawingSheet(), and DS_DATA_MODEL::SetPageLayout().

◆ parseBitmap()

void DRAWING_SHEET_READER_PARSER::parseBitmap ( DS_DATA_ITEM_BITMAP aItem)
private

parse a bitmap item starting by "( bitmap" and read parameters.

Definition at line 396 of file drawing_sheet_reader.cpp.

397 {
399  aItem->m_ImageBitmap = image;
400 
401  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
402  {
403  if( token == T_LEFT )
404  token = NextTok();
405 
406  switch( token )
407  {
408  case T_name:
409  NeedSYMBOLorNUMBER();
410  aItem->m_Name = FromUTF8();
411  NeedRIGHT();
412  break;
413 
414  case T_pos:
415  parseCoordinate( aItem->m_Pos );
416  break;
417 
418  case T_repeat:
419  aItem->m_RepeatCount = parseInt( -1, 100 );
420  NeedRIGHT();
421  break;
422 
423  case T_incrx:
424  aItem->m_IncrementVector.x = parseDouble();
425  NeedRIGHT();
426  break;
427 
428  case T_incry:
429  aItem->m_IncrementVector.y = parseDouble();
430  NeedRIGHT();
431  break;
432 
433  case T_linewidth:
434  aItem->m_LineWidth = parseDouble();
435  NeedRIGHT();
436  break;
437 
438  case T_scale:
439  aItem->m_ImageBitmap->SetScale( parseDouble() );
440  NeedRIGHT();
441  break;
442 
443  case T_pngdata:
444  readPngdata( aItem );
445  break;
446 
447  case T_option:
448  readOption( aItem );
449  break;
450 
451  default:
452  Unexpected( CurText() );
453  break;
454  }
455  }
456 }
void SetScale(double aScale)
Definition: bitmap_base.h:80
void readOption(DS_DATA_ITEM *aItem)
void readPngdata(DS_DATA_ITEM_BITMAP *aItem)
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:51
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
double m_LineWidth
Definition: ds_data_item.h:211
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:373
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
void parseCoordinate(POINT_COORD &aCoord)
POINT_COORD m_Pos
Definition: ds_data_item.h:209
double parseDouble()
Function parseDouble parses a double.
wxString m_Name
Definition: ds_data_item.h:206

References image, DS_DATA_ITEM_BITMAP::m_ImageBitmap, DS_DATA_ITEM::m_IncrementVector, DS_DATA_ITEM::m_LineWidth, DS_DATA_ITEM::m_Name, DS_DATA_ITEM::m_Pos, DS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), readOption(), readPngdata(), BITMAP_BASE::SetScale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseCoordinate()

void DRAWING_SHEET_READER_PARSER::parseCoordinate ( POINT_COORD aCoord)
private

Definition at line 715 of file drawing_sheet_reader.cpp.

716 {
717  aCoord.m_Pos.x = parseDouble();
718  aCoord.m_Pos.y = parseDouble();
719 
720  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
721  {
722  switch( token )
723  {
724  case T_ltcorner: aCoord.m_Anchor = LT_CORNER; break;
725  case T_lbcorner: aCoord.m_Anchor = LB_CORNER; break;
726  case T_rbcorner: aCoord.m_Anchor = RB_CORNER; break;
727  case T_rtcorner: aCoord.m_Anchor = RT_CORNER; break;
728  default: Unexpected( CurText() ); break;
729  }
730  }
731 }
DPOINT m_Pos
Definition: ds_data_item.h:80
double parseDouble()
Function parseDouble parses a double.

References LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, POINT_COORD::m_Pos, parseDouble(), RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ parseDouble()

double DRAWING_SHEET_READER_PARSER::parseDouble ( )
private

Function parseDouble parses a double.

Returns
double - the parsed double.

Definition at line 751 of file drawing_sheet_reader.cpp.

752 {
753  T token = NextTok();
754 
755  if( token != T_NUMBER )
756  Expecting( T_NUMBER );
757 
758  double val = strtod( CurText(), NULL );
759 
760  return val;
761 }
#define NULL

References NULL.

Referenced by parseBitmap(), parseCoordinate(), parseGraphic(), parsePolygon(), parsePolyOutline(), parseSetup(), and parseText().

◆ parseGraphic()

void DRAWING_SHEET_READER_PARSER::parseGraphic ( DS_DATA_ITEM aItem)
private

parse a graphic item starting by "(line" or "(rect" and read parameters.

Definition at line 506 of file drawing_sheet_reader.cpp.

507 {
508  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
509  {
510  if( token == T_LEFT )
511  token = NextTok();
512  else
513  {
514  // If another token than T_LEFT is read here, this is an error
515  // however, due to a old bug in kicad, the token T_end can be found
516  // without T_LEFT in a very few .wks files (perhaps only one in a demo).
517  // So this ugly hack disables the error detection.
518  if( token != T_end )
519  Unexpected( CurText() );
520  }
521 
522  switch( token )
523  {
524  case T_comment:
525  NeedSYMBOLorNUMBER();
526  aItem->m_Info = FromUTF8();
527  NeedRIGHT();
528  break;
529 
530  case T_option:
531  readOption( aItem );
532  break;
533 
534  case T_name:
535  NeedSYMBOLorNUMBER();
536  aItem->m_Name = FromUTF8();
537  NeedRIGHT();
538  break;
539 
540  case T_start:
541  parseCoordinate( aItem->m_Pos );
542  break;
543 
544  case T_end:
545  parseCoordinate( aItem->m_End );
546  break;
547 
548  case T_repeat:
549  aItem->m_RepeatCount = parseInt( -1, 100 );
550  NeedRIGHT();
551  break;
552 
553  case T_incrx:
554  aItem->m_IncrementVector.x = parseDouble();
555  NeedRIGHT();
556  break;
557 
558  case T_incry:
559  aItem->m_IncrementVector.y = parseDouble();
560  NeedRIGHT();
561  break;
562 
563  case T_linewidth:
564  aItem->m_LineWidth = parseDouble();
565  NeedRIGHT();
566  break;
567 
568  default:
569  Unexpected( CurText() );
570  break;
571  }
572  }
573 }
wxString m_Info
Definition: ds_data_item.h:208
void readOption(DS_DATA_ITEM *aItem)
POINT_COORD m_End
Definition: ds_data_item.h:210
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
double m_LineWidth
Definition: ds_data_item.h:211
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
void parseCoordinate(POINT_COORD &aCoord)
POINT_COORD m_Pos
Definition: ds_data_item.h:209
double parseDouble()
Function parseDouble parses a double.
wxString m_Name
Definition: ds_data_item.h:206

References DS_DATA_ITEM::m_End, DS_DATA_ITEM::m_IncrementVector, DS_DATA_ITEM::m_Info, DS_DATA_ITEM::m_LineWidth, DS_DATA_ITEM::m_Name, DS_DATA_ITEM::m_Pos, DS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), readOption(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseInt()

int DRAWING_SHEET_READER_PARSER::parseInt ( int  aMin,
int  aMax 
)
private

Function parseInt parses an integer and constrains it between two values.

Parameters
aMinis the smallest return value.
aMaxis the largest return value.
Returns
int - the parsed integer.

Definition at line 733 of file drawing_sheet_reader.cpp.

734 {
735  T token = NextTok();
736 
737  if( token != T_NUMBER )
738  Expecting( T_NUMBER );
739 
740  int val = atoi( CurText() );
741 
742  if( val < aMin )
743  val = aMin;
744  else if( val > aMax )
745  val = aMax;
746 
747  return val;
748 }

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ parsePolygon()

void DRAWING_SHEET_READER_PARSER::parsePolygon ( DS_DATA_ITEM_POLYGONS aItem)
private

parse a polygon item starting by "( polygon" and read parameters.

the list of corners included in this description is read by parsePolyOutline

Definition at line 302 of file drawing_sheet_reader.cpp.

303 {
304  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
305  {
306  if( token == T_LEFT )
307  token = NextTok();
308 
309  switch( token )
310  {
311  case T_comment:
312  NeedSYMBOLorNUMBER();
313  aItem->m_Info = FromUTF8();
314  NeedRIGHT();
315  break;
316 
317  case T_pos:
318  parseCoordinate( aItem->m_Pos );
319  break;
320 
321  case T_name:
322  NeedSYMBOLorNUMBER();
323  aItem->m_Name = FromUTF8();
324  NeedRIGHT();
325  break;
326 
327  case T_option:
328  readOption( aItem );
329  break;
330 
331  case T_pts:
332  parsePolyOutline( aItem );
333  aItem->CloseContour();
334  break;
335 
336  case T_rotate:
337  aItem->m_Orient = parseDouble();
338  NeedRIGHT();
339  break;
340 
341  case T_repeat:
342  aItem->m_RepeatCount = parseInt( -1, 100 );
343  NeedRIGHT();
344  break;
345 
346  case T_incrx:
347  aItem->m_IncrementVector.x = parseDouble();
348  NeedRIGHT();
349  break;
350 
351  case T_incry:
352  aItem->m_IncrementVector.y = parseDouble();
353  NeedRIGHT();
354  break;
355 
356  case T_linewidth:
357  aItem->m_LineWidth = parseDouble();
358  NeedRIGHT();
359  break;
360 
361  default:
362  Unexpected( CurText() );
363  break;
364  }
365  }
366 
367  aItem->SetBoundingBox();
368 }
wxString m_Info
Definition: ds_data_item.h:208
void SetBoundingBox()
Calculate the bounding box of the set polygons.
void readOption(DS_DATA_ITEM *aItem)
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
double m_LineWidth
Definition: ds_data_item.h:211
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
void CloseContour()
Closes the current contour, by storing the index of the last corner of the current polygon in m_polyI...
Definition: ds_data_item.h:242
void parseCoordinate(POINT_COORD &aCoord)
POINT_COORD m_Pos
Definition: ds_data_item.h:209
void parsePolyOutline(DS_DATA_ITEM_POLYGONS *aItem)
parse a list of corners starting by "( pts" and read coordinates.
double parseDouble()
Function parseDouble parses a double.
wxString m_Name
Definition: ds_data_item.h:206

References DS_DATA_ITEM_POLYGONS::CloseContour(), DS_DATA_ITEM::m_IncrementVector, DS_DATA_ITEM::m_Info, DS_DATA_ITEM::m_LineWidth, DS_DATA_ITEM::m_Name, DS_DATA_ITEM_POLYGONS::m_Orient, DS_DATA_ITEM::m_Pos, DS_DATA_ITEM::m_RepeatCount, parseCoordinate(), parseDouble(), parseInt(), parsePolyOutline(), readOption(), DS_DATA_ITEM_POLYGONS::SetBoundingBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parsePolyOutline()

void DRAWING_SHEET_READER_PARSER::parsePolyOutline ( DS_DATA_ITEM_POLYGONS aItem)
private

parse a list of corners starting by "( pts" and read coordinates.

Definition at line 370 of file drawing_sheet_reader.cpp.

371 {
372  DPOINT corner;
373 
374  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
375  {
376  if( token == T_LEFT )
377  token = NextTok();
378 
379  switch( token )
380  {
381  case T_xy:
382  corner.x = parseDouble();
383  corner.y = parseDouble();
384  aItem->AppendCorner( corner );
385  NeedRIGHT();
386  break;
387 
388  default:
389  Unexpected( CurText() );
390  break;
391  }
392  }
393 }
double parseDouble()
Function parseDouble parses a double.
void AppendCorner(const DPOINT &aCorner)
Add a corner in corner list.
Definition: ds_data_item.h:233

References DS_DATA_ITEM_POLYGONS::AppendCorner(), parseDouble(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by parsePolygon().

◆ parseSetup()

void DRAWING_SHEET_READER_PARSER::parseSetup ( DS_DATA_MODEL aLayout)
private

Definition at line 245 of file drawing_sheet_reader.cpp.

246 {
247  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
248  {
249  switch( token )
250  {
251  case T_LEFT:
252  break;
253 
254  case T_linewidth:
255  aLayout->m_DefaultLineWidth = parseDouble();
256  NeedRIGHT();
257  break;
258 
259  case T_textsize:
260  aLayout->m_DefaultTextSize.x = parseDouble();
261  aLayout->m_DefaultTextSize.y = parseDouble();
262  NeedRIGHT();
263  break;
264 
265  case T_textlinewidth:
266  aLayout->m_DefaultTextThickness = parseDouble();
267  NeedRIGHT();
268  break;
269 
270  case T_left_margin:
271  aLayout->SetLeftMargin( parseDouble() );
272  NeedRIGHT();
273  break;
274 
275  case T_right_margin:
276  aLayout->SetRightMargin( parseDouble() );
277  NeedRIGHT();
278  break;
279 
280  case T_top_margin:
281  aLayout->SetTopMargin( parseDouble() );
282  NeedRIGHT();
283  break;
284 
285  case T_bottom_margin:
286  aLayout->SetBottomMargin( parseDouble() );
287  NeedRIGHT();
288  break;
289 
290  default:
291  Unexpected( CurText() );
292  break;
293  }
294  }
295 
296  // The file is well-formed. If it has no further items, then that's the way the
297  // user wants it.
298  aLayout->AllowVoidList( true );
299 }
void SetBottomMargin(double aMargin)
Definition: ds_data_model.h:70
double m_DefaultLineWidth
void SetLeftMargin(double aMargin)
Definition: ds_data_model.h:61
void SetRightMargin(double aMargin)
Definition: ds_data_model.h:64
double m_DefaultTextThickness
DSIZE m_DefaultTextSize
void AllowVoidList(bool Allow)
In KiCad applications, a page layout description is needed So if the list is empty,...
Definition: ds_data_model.h:81
void SetTopMargin(double aMargin)
Definition: ds_data_model.h:67
double parseDouble()
Function parseDouble parses a double.

References DS_DATA_MODEL::AllowVoidList(), DS_DATA_MODEL::m_DefaultLineWidth, DS_DATA_MODEL::m_DefaultTextSize, DS_DATA_MODEL::m_DefaultTextThickness, parseDouble(), DS_DATA_MODEL::SetBottomMargin(), DS_DATA_MODEL::SetLeftMargin(), DS_DATA_MODEL::SetRightMargin(), DS_DATA_MODEL::SetTopMargin(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ parseText()

void DRAWING_SHEET_READER_PARSER::parseText ( DS_DATA_ITEM_TEXT aItem)
private

parse a text item starting by "(tbtext" and read parameters.

Definition at line 576 of file drawing_sheet_reader.cpp.

577 {
578  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
579  {
580  if( token == T_LEFT )
581  token = NextTok();
582 
583  switch( token )
584  {
585  case T_comment:
586  NeedSYMBOLorNUMBER();
587  aItem->m_Info = FromUTF8();
588  NeedRIGHT();
589  break;
590 
591  case T_option:
592  readOption( aItem );
593  break;
594 
595  case T_name:
596  NeedSYMBOLorNUMBER();
597  aItem->m_Name = FromUTF8();
598  NeedRIGHT();
599  break;
600 
601  case T_pos:
602  parseCoordinate( aItem->m_Pos );
603  break;
604 
605  case T_repeat:
606  aItem->m_RepeatCount = parseInt( -1, 100 );
607  NeedRIGHT();
608  break;
609 
610  case T_incrx:
611  aItem->m_IncrementVector.x = parseDouble();
612  NeedRIGHT();
613  break;
614 
615  case T_incry:
616  aItem->m_IncrementVector.y = parseDouble();
617  NeedRIGHT();
618  break;
619 
620  case T_incrlabel:
621  aItem->m_IncrementLabel = parseInt(INT_MIN, INT_MAX);
622  NeedRIGHT();
623  break;
624 
625  case T_maxlen:
626  aItem->m_BoundingBoxSize.x = parseDouble();
627  NeedRIGHT();
628  break;
629 
630  case T_maxheight:
631  aItem->m_BoundingBoxSize.y = parseDouble();
632  NeedRIGHT();
633  break;
634 
635  case T_font:
636  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
637  {
638  switch( token )
639  {
640  case T_LEFT:
641  break;
642 
643  case T_bold:
644  aItem->m_Bold = true;
645  break;
646 
647  case T_italic:
648  aItem->m_Italic = true;
649  break;
650 
651  case T_size:
652  aItem->m_TextSize.x = parseDouble();
653  aItem->m_TextSize.y = parseDouble();
654  NeedRIGHT();
655  break;
656 
657  case T_linewidth:
658  aItem->m_LineWidth = parseDouble();
659  NeedRIGHT();
660  break;
661 
662  default:
663  Unexpected( CurText() );
664  break;
665  }
666  }
667  break;
668 
669  case T_justify:
670  for( token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
671  {
672  switch( token )
673  {
674  case T_center:
677  break;
678 
679  case T_left:
681  break;
682 
683  case T_right:
685  break;
686 
687  case T_top:
689  break;
690 
691  case T_bottom:
693  break;
694 
695  default:
696  Unexpected( CurText() );
697  break;
698  }
699  }
700  break;
701 
702  case T_rotate:
703  aItem->m_Orient = parseDouble();
704  NeedRIGHT();
705  break;
706 
707  default:
708  Unexpected( CurText() );
709  break;
710  }
711  }
712 }
wxString m_Info
Definition: ds_data_item.h:208
EDA_TEXT_VJUSTIFY_T m_Vjustify
Definition: ds_data_item.h:344
void readOption(DS_DATA_ITEM *aItem)
EDA_TEXT_HJUSTIFY_T m_Hjustify
Definition: ds_data_item.h:343
DPOINT m_IncrementVector
Definition: ds_data_item.h:213
double m_LineWidth
Definition: ds_data_item.h:211
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
int m_IncrementLabel
Definition: ds_data_item.h:215
void parseCoordinate(POINT_COORD &aCoord)
POINT_COORD m_Pos
Definition: ds_data_item.h:209
double parseDouble()
Function parseDouble parses a double.
wxString m_Name
Definition: ds_data_item.h:206

References GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, DS_DATA_ITEM_TEXT::m_Bold, DS_DATA_ITEM_TEXT::m_BoundingBoxSize, DS_DATA_ITEM_TEXT::m_Hjustify, DS_DATA_ITEM::m_IncrementLabel, DS_DATA_ITEM::m_IncrementVector, DS_DATA_ITEM::m_Info, DS_DATA_ITEM_TEXT::m_Italic, DS_DATA_ITEM::m_LineWidth, DS_DATA_ITEM::m_Name, DS_DATA_ITEM_TEXT::m_Orient, DS_DATA_ITEM::m_Pos, DS_DATA_ITEM::m_RepeatCount, DS_DATA_ITEM_TEXT::m_TextSize, DS_DATA_ITEM_TEXT::m_Vjustify, parseCoordinate(), parseDouble(), parseInt(), readOption(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Parse().

◆ readOption()

void DRAWING_SHEET_READER_PARSER::readOption ( DS_DATA_ITEM aItem)
private

Definition at line 492 of file drawing_sheet_reader.cpp.

493 {
494  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
495  {
496  switch( token )
497  {
498  case T_page1only: aItem->SetPage1Option( FIRST_PAGE_ONLY ); break;
499  case T_notonpage1: aItem->SetPage1Option( SUBSEQUENT_PAGES ); break;
500  default: Unexpected( CurText() ); break;
501  }
502  }
503 }
void SetPage1Option(PAGE_OPTION aChoice)
Definition: ds_data_item.h:135

References FIRST_PAGE_ONLY, DS_DATA_ITEM::SetPage1Option(), and SUBSEQUENT_PAGES.

Referenced by parseBitmap(), parseGraphic(), parsePolygon(), and parseText().

◆ readPngdata()

void DRAWING_SHEET_READER_PARSER::readPngdata ( DS_DATA_ITEM_BITMAP aItem)
private

Definition at line 458 of file drawing_sheet_reader.cpp.

459 {
460  std::string tmp;
461 
462  for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
463  {
464  if( token == T_LEFT )
465  token = NextTok();
466 
467  switch( token )
468  {
469  case T_data:
470  NeedSYMBOLorNUMBER();
471  tmp += CurStr();
472  tmp += "\n";
473  NeedRIGHT();
474  break;
475 
476  default:
477  Unexpected( CurText() );
478  break;
479  }
480  }
481 
482  tmp += "EndData";
483 
484  wxString msg;
485  STRING_LINE_READER str_reader( tmp, wxT("Png kicad_wks data") );
486 
487  if( ! aItem->m_ImageBitmap->LoadData( str_reader, msg ) )
488  wxLogMessage(msg);
489 }
BITMAP_BASE * m_ImageBitmap
Definition: ds_data_item.h:373
bool LoadData(LINE_READER &aLine, wxString &aErrorMsg)
Load an image data saved by SaveData.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:237

References BITMAP_BASE::LoadData(), and DS_DATA_ITEM_BITMAP::m_ImageBitmap.

Referenced by parseBitmap().


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