KiCad PCB EDA Suite
Loading...
Searching...
No Matches
idf_parser.h
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) 2014-2017 Cirilo Bernardo
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21/*
22 * NOTE:
23 *
24 * Rules to ensure friendly use within a DLL:
25 *
26 * 1. all functions which throw exceptions must not be publicly available;
27 * they must become FRIEND functions instead.
28 *
29 * 2. All objects with PRIVATE functions which throw exceptions when
30 * invoked by a PUBLIC function must indicate success or failure
31 * and make the exception information available via a GetError()
32 * routine.
33 *
34 * General notes:
35 *
36 * 1. Due to the complexity of objects and the risk of accumulated
37 * position errors, CAD packages should only delete or add complete
38 * components. If a component being added already exists, it is
39 * replaced by the new component IF and only if the CAD type is
40 * permitted to make such changes.
41 *
42 * 2. Internally all units shall be in mm and by default we shall
43 * write files with mm units. The internal flags mm/thou shall only
44 * be used to translate data being read from or written to files.
45 * This avoids the painful management of a mixture of mm and thou.
46 * The API shall require all dimensions in mm; for people using any
47 * other unit, it is their responsibility to perform the conversion
48 * to mm. Conversion back to thou may incur small rounding errors.
49 */
50
51
52#ifndef IDF_PARSER_H
53#define IDF_PARSER_H
54
55#include <io/idf/idf_common.h>
56#include <io/idf/idf_outlines.h>
57
58class IDF3_COMPONENT;
59class REPORTER;
60
62{
63public:
68
76
88 double aXoff, double aYoff, double aZoff, double aAngleOff );
89
91
102 bool SetOffsets( double aXoff, double aYoff, double aZoff, double aAngleOff );
103
112 void GetOffsets( double& aXoff, double& aYoff, double& aZoff, double& aAngleOff );
113
119 void SetParent( IDF3_COMPONENT* aParent );
120
127 bool SetOutline( IDF3_COMP_OUTLINE* aOutline );
128
135 {
136 return outline;
137 }
138
139 const std::string& GetError( void )
140 {
141 return errormsg;
142 }
143
144private:
145
146#ifndef DISABLE_IDF_OWNERSHIP
147 bool checkOwnership( int aSourceLine, const char* aSourceFunc );
148#endif
149
163 bool readPlaceData( std::istream &aBoardFile, IDF3::FILE_STATE& aBoardState,
164 IDF3_BOARD *aBoard, IDF3::IDF_VERSION aIdfVersion,
165 bool aNoSubstituteOutlines );
166
179 void writePlaceData( std::ostream& aBoardFile, double aXpos, double aYpos, double aAngle,
180 const std::string& aRefDes, IDF3::IDF_PLACEMENT aPlacement,
181 IDF3::IDF_LAYER aSide );
182
183 friend class IDF3_BOARD;
184 friend class IDF3_COMPONENT;
185
186 double xoff; // X offset from KiCad or X placement from IDF file
187 double yoff; // Y offset from KiCad or Y placement from IDF file
188 double zoff; // height offset (specified in IDFv3 spec, corresponds to KiCad Z offset)
189 double aoff; // angular offset from KiCad or Rotation Angle from IDF file
190 std::string errormsg;
191
192 IDF3_COMP_OUTLINE* outline; // component outline to use
193 IDF3_COMPONENT* parent; // associated component
194};
195
196
198{
199public:
205 IDF3_COMPONENT( IDF3_BOARD* aParent );
206
208
214 void SetParent( IDF3_BOARD* aParent );
215
220
225 IDF3::IDF_UNIT GetUnit( void );
226
235 bool SetRefDes( const std::string& aRefDes );
236
242 const std::string& GetRefDes( void );
243
255 IDF_DRILL_DATA* AddDrill( double aDia, double aXpos, double aYpos,
256 IDF3::KEY_PLATING aPlating,
257 const std::string& aHoleType,
258 IDF3::KEY_OWNER aOwner );
259
269 IDF_DRILL_DATA* AddDrill( IDF_DRILL_DATA* aDrilledHole );
270
282 bool DelDrill( double aDia, double aXpos, double aYpos );
283
293 bool DelDrill( IDF_DRILL_DATA* aDrill );
294
300 const std::list<IDF_DRILL_DATA*>* GetDrills( void );
301
308 bool AddOutlineData( IDF3_COMP_OUTLINE_DATA* aComponentOutline );
309
316 bool DeleteOutlineData( IDF3_COMP_OUTLINE_DATA* aComponentOutline );
317
324 bool DeleteOutlineData( size_t aIndex );
325
329 size_t GetOutlinesSize( void );
330
331
335 const std::list< IDF3_COMP_OUTLINE_DATA* >* GetOutlinesData( void );
336
341 bool GetPosition( double& aXpos, double& aYpos, double& aAngle, IDF3::IDF_LAYER& aLayer );
342
343 // NOTE: it may be possible to extend this so that internal drills and outlines
344 // are moved when the component is moved. However there is always a danger of
345 // position creep due to the relative position updates.
359 bool SetPosition( double aXpos, double aYpos, double aAngle, IDF3::IDF_LAYER aLayer );
360
365
374 bool SetPlacement( IDF3::IDF_PLACEMENT aPlacementValue );
375
376 const std::string& GetError( void )
377 {
378 return errormsg;
379 }
380
381private:
382 friend class IDF3_BOARD;
383
390 bool writeDrillData( std::ostream& aBoardFile );
391
398 bool writePlaceData( std::ostream& aBoardFile );
399
400#ifndef DISABLE_IDF_OWNERSHIP
401 bool checkOwnership( int aSourceLine, const char* aSourceFunc );
402#endif
403
404 std::list< IDF3_COMP_OUTLINE_DATA* > components;
405 std::list< IDF_DRILL_DATA* > drills;
406
407 double xpos;
408 double ypos;
409 double angle;
411 IDF3::IDF_LAYER layer; // [TOP/BOTTOM ONLY as per IDF spec]
413 std::string refdes;
415 std::string errormsg;
416};
417
418
420{
421public:
422 IDF3_BOARD( IDF3::CAD_TYPE aCadType );
423 virtual ~IDF3_BOARD();
424
426
427 // retrieve the nominal unit used in reading/writing
428 // data. This is primarily for use by owned objects
429 // and is only of informational use for the end user.
430 // Internally all data is represented in mm and the
431 // end user must use only mm in the API.
432 IDF3::IDF_UNIT GetUnit( void ) const { return m_unit; }
433
434 const std::string& GetNewRefDes( void );
435
436 void SetBoardName( const std::string& aBoardName ) { m_boardName = aBoardName; }
437 const std::string& GetBoardName( void ) const { return m_boardName; }
438
439 bool SetBoardThickness( double aBoardThickness );
440 double GetBoardThickness( void );
441
442 bool ReadFile( const wxString& aFullFileName, bool aNoSubstituteOutlines = false );
443 bool WriteFile( const wxString& aFullFileName, IDF3::IDF_UNIT aUnits, REPORTER* aReporter = nullptr );
444
445 const std::string& GetIDFSource( void ) const { return m_idfSource; }
446 void SetIDFSource( const std::string& aIDFSource) { m_idfSource = aIDFSource; }
447
448 const std::string& GetBoardSource( void ) const { return m_brdSource; }
449 const std::string& GetLibrarySource( void ) const { return m_libSource; }
450 const std::string& GetBoardDate( void ) const { return m_brdDate; }
451 const std::string& GetLibraryDate( void ) const { return m_libDate; }
452
453 int GetBoardVersion( void ) const { return m_brdFileVersion; }
454 bool SetBoardVersion( int aVersion );
455 int GetLibraryVersion( void ) const { return m_libFileVersion; }
456 bool SetLibraryVersion( int aVersion );
457
458 double GetUserScale( void ) const { return m_userScale; }
459 bool SetUserScale( double aScaleFactor );
460
461 int GetUserPrecision( void ) const { return m_userPrec; }
462 bool SetUserPrecision( int aPrecision );
463
464 void GetUserOffset( double& aXoff, double& aYoff );
465 void SetUserOffset( double aXoff, double aYoff );
466
467 bool AddBoardOutline( IDF_OUTLINE* aOutline );
468 bool DelBoardOutline( IDF_OUTLINE* aOutline );
469 bool DelBoardOutline( size_t aIndex );
470 size_t GetBoardOutlinesSize( void );
472
473 // Operations for OTHER OUTLINES
474 const std::map<std::string, OTHER_OUTLINE*>* GetOtherOutlines( void ) const { return &m_otherOutlines; }
475
477 //
478 // SetBoardOutlineOwner()
479 //
480 // AddDrillComment
481 // AddPlacementComment
482 // GetDrillComments()
483 // GetPlacementComments()
484 // ClearDrillComments()
485 // ClearPlacementComments()
486 // AddNoteComment
487 // GetNoteComments
488 // AddNote
489 //
490 // [IMPLEMENTED] const std::map<std::string, OTHER_OUTLINE*>*const GetOtherOutlines( void )
491 // size_t GetOtherOutlinesSize()
492 // OTHER_OUTLINE* AddOtherOutline( OTHER_OUTLINE* aOtherOutline )
493 // bool DelOtherOutline( int aIndex )
494 // bool DelOtherOutline( OTHER_OUTLINE* aOtherOutline )
495 //
496 // const std::list<ROUTE_OUTLINE*>*const GetRouteOutlines()
497 // size_t GetRouteOutlinesSize()
498 // ROUTE_OUTLINE* AddRouteOutline( ROUTE_OUTLINE* aRouteOutline )
499 // bool DelRouteOutline( int aIndex )
500 // bool DelRouteOutline( ROUTE_OUTLINE* aRouteOutline )
501 //
502 // const std::list<PLACE_OUTLINE*>*const GetPlacementOutlines()
503 // size_t GetPlacementOutlinesSize()
504 // PLACE_OUTLINE* AddPlacementOutline( PLACE_OUTLINE* aPlaceOutline )
505 // bool DelPlacementOutline( int aIndex )
506 // bool DelPlacementOutline( PLACE_OUTLINE* aPlaceOutline )
507 //
508 // const std::list<ROUTE_KO_OUTLINE*>*const GetRouteKeepOutOutlines()
509 // size_t GetRouteKeepOutOutlinesSize()
510 // ROUTE_KO_OUTLINE* AddRouteKeepoutOutline( ROUTE_KO_OUTLINE* aRouteKeepOut )
511 // bool DelRouteKeepOutOutline( int aIndex )
512 // bool DelRouteKeepOutOutline( ROUTE_KO_OUTLINE* aRouteKeepOut )
513 //
514 // const std::list<VIA_KO_OUTLINE*>*const GetViaKeepOutOutlines()
515 // size_t GetViaKeepOutOutlinesSize()
516 // VIA_KO_OUTLINE* AddViaKeepoutOutline( VIA_KO_OUTLINE* aViaKeepOut )
517 // bool DelViaKeepOutOutline( int aIndex )
518 // bool DelViaKeepOutOutline( VIA_KO_OUTLINE* aViaKeepOut )
519 //
520 // const std::list<PLACE_KO_OUTLINE*>*const GetPlacementKeepOutOutlines()
521 // size_t GetPlacementKeepOutOutlinesSize()
522 // PLACE_KO_OUTLINE* AddPlacementKeepoutOutline( PLACE_KO_OUTLINE* aPlaceKeepOut )
523 // bool DelPlacementKeepOutOutline( int aIndex )
524 // bool DelPlacementKeepOutOutline( PLACE_KO_OUTLINE* aPlaceKeepOut )
525 //
526 // const std::multimap<std::string, GROUP_OUTLINE*>*const GetGroupOutlines()
527 // size_t GetGroupOutlinesSize()
528 // GROUP_OUTLINE* AddGroupOutline( GROUP_OUTLINE* aGroupOutline )
529 // bool DelGroupOutline( int aIndex )
530 // bool DelGroupOutline( GROUP_OUTLINE* aGroupOutline )
531
532 std::list<IDF_DRILL_DATA*>& GetBoardDrills( void )
533 {
534 return m_drills;
535 }
536
537 IDF_DRILL_DATA* AddBoardDrill( double aDia, double aXpos, double aYpos,
538 IDF3::KEY_PLATING aPlating,
539 const std::string& aHoleType,
540 IDF3::KEY_OWNER aOwner );
541
542 IDF_DRILL_DATA* AddDrill( IDF_DRILL_DATA* aDrilledHole );
543
544 bool DelBoardDrill( double aDia, double aXpos, double aYpos );
545
546 // a slot is a deficient representation of a kicad slotted hole;
547 // it is usually associated with a component but IDFv3 does not
548 // provide for such an association.
549 bool AddSlot( double aWidth, double aLength, double aOrientation, double aX, double aY );
550
551 bool AddComponent( IDF3_COMPONENT* aComponent );
552 bool DelComponent( IDF3_COMPONENT* aComponent );
553 bool DelComponent( size_t aIndex );
554 size_t GetComponentsSize( void );
555 std::map< std::string, IDF3_COMPONENT* >* GetComponents( void );
556 IDF3_COMPONENT* FindComponent( const std::string& aRefDes );
557
558 // Return a pointer to a component outline object or NULL if the object doesn't exist.
559 IDF3_COMP_OUTLINE* GetComponentOutline( const wxString& aFullFileName );
560
561 // returns a pointer to the component outline object with the
562 // unique ID aComponentID
563 IDF3_COMP_OUTLINE* GetComponentOutline( const std::string& aComponentID );
564 // Return a pointer to a component outline registered under the unique ID
565 // GEOM_PART; if no such outline exists, create one, register it, and
566 // return it. The component class, unit, and height must be set by the
567 // caller; the outline has no file backing.
568 IDF3_COMP_OUTLINE* GetComponentOutline( const std::string& aGeomName,
569 const std::string& aPartName );
570
571 // returns a pointer to the outline "NOGEOM NOPART" which is substituted
572 // whenever a true outline cannot be found or is defective
573 IDF3_COMP_OUTLINE* GetInvalidOutline( const std::string& aGeomName,
574 const std::string& aPartName );
575
576 // clears all data
577 void Clear( void );
578
579 // return error string
580 const std::string& GetError( void )
581 {
582 return m_errormsg;
583 }
584
585private:
586 // Set the unit; this can only be done internally upon reading a file or saving.
587 bool setUnit( IDF3::IDF_UNIT aUnit, bool convert = false );
588
589 IDF_DRILL_DATA* addCompDrill( double aDia, double aXpos, double aYpos,
590 IDF3::KEY_PLATING aPlating,
591 const std::string& aHoleType,
592 IDF3::KEY_OWNER aOwner,
593 const std::string& aRefDes );
594
596
597 bool delCompDrill( double aDia, double aXpos, double aYpos, const std::string& aRefDes );
598
599 // read the DRILLED HOLES section
600 void readBrdDrills( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState );
601
602 // read the NOTES section
603 void readBrdNotes( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState );
604
605 // read the component placement section
606 void readBrdPlacement( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState,
607 bool aNoSubstituteOutlines );
608
609 // read the board HEADER
610 void readBrdHeader( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState );
611
612 // read individual board sections; pay attention to IDFv3 section specifications
613 // exception thrown on unrecoverable errors. state flag set to FILE_PLACEMENT
614 // upon reading the PLACEMENT file; according to IDFv3 this is the final section
615 void readBrdSection( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState,
616 bool aNoSubstituteOutlines );
617 // read the board file data
618 void readBoardFile( const std::string& aFileName, bool aNoSubstituteOutlines );
619
620 // write the board file data
621 void writeBoardFile( const std::string& aFileName );
622
623 // read the library sections (outlines)
624 void readLibSection( std::istream& aLibFile, IDF3::FILE_STATE& aLibState, IDF3_BOARD* aBoard );
625
626 // read the library HEADER
627 void readLibHeader( std::istream& aLibFile, IDF3::FILE_STATE& aLibState );
628
629 // read the library file data
630 void readLibFile( const std::string& aFileName );
631
632 // write the library file data
633 bool writeLibFile( const std::string& aFileName );
634
635#ifndef DISABLE_IDF_OWNERSHIP
636 bool checkComponentOwnership( int aSourceLine, const char* aSourceFunc, IDF3_COMPONENT* aComponent );
637#endif
638
639 std::map<std::string, std::string> m_uidFileList; // map of files opened and UIDs
640 std::list<std::string> m_uidLibList; // list of UIDs read from a library file
641
642 // string for passing error messages to user
643 std::string m_errormsg;
644 std::list< IDF_NOTE*> m_notes; // IDF notes
645 std::list<std::string> m_noteComments; // comment list for NOTES section
646 std::list<std::string> m_drillComments; // comment list for DRILL section
647 std::list<std::string> m_placeComments; // comment list for PLACEMENT section
648 std::list<IDF_DRILL_DATA*> m_drills;
649 std::map<std::string, IDF3_COMPONENT*> m_components; // drill and placement data for components
650 std::map<std::string, IDF3_COMP_OUTLINE*> m_componentOutlines; // component outlines (data for library file).
651
652 std::string m_boardName;
655 IDF3::IDF_VERSION m_idfVer; // IDF version of Board or Library
656
657 int m_refDesCounter; // counter for automatically numbered NOREFDES items
658 std::string m_refDesString;
659
660 std::string m_idfSource; // SOURCE string to use when writing BOARD and LIBRARY headers
661 std::string m_brdSource; // SOURCE string as retrieved from a BOARD file
662 std::string m_libSource; // SOURCE string as retrieved from a LIBRARY file
663 std::string m_brdDate; // DATE string from BOARD file
664 std::string m_libDate; // DATE string from LIBRARY file
665 int m_brdFileVersion; // File Version from BOARD file
666 int m_libFileVersion; // File Version from LIBRARY file
667
668 int m_userPrec; // user may store any integer here
669 double m_userScale; // user may store a scale for translating to arbitrary units
670 double m_userXoff; // user may specify an arbitrary X/Y offset
672
673 BOARD_OUTLINE m_boardOutline; // main board outline and cutouts
674 std::map<std::string, OTHER_OUTLINE*> m_otherOutlines; // OTHER outlines
675 std::list<ROUTE_OUTLINE*> m_routeOutlines; // ROUTE outlines
676 std::list<PLACE_OUTLINE*> m_placeOutlines; // PLACEMENT outlines
677 std::multimap<std::string, GROUP_OUTLINE*> m_groupOutlines; // PLACEMENT GROUP outlines
678
679 std::list<ROUTE_KO_OUTLINE*> m_routeKeepoutOutlines; // ROUTE KEEPOUT outlines
680 std::list<VIA_KO_OUTLINE*> m_viaKeepoutOutlines; // VIA KEEPOUT outlines
681 std::list<PLACE_KO_OUTLINE*> m_placeKeepoutOutlines; // PLACE KEEPOUT outlines
682};
683
684#endif // IDF_PARSER_H
IDFv3 BOARD OUTLINE data and is the basis of other IDFv3 outline objects.
void GetUserOffset(double &aXoff, double &aYoff)
bool WriteFile(const wxString &aFullFileName, IDF3::IDF_UNIT aUnits, REPORTER *aReporter=nullptr)
std::list< std::string > m_uidLibList
Definition idf_parser.h:640
std::list< IDF_DRILL_DATA * > m_drills
Definition idf_parser.h:648
void readLibFile(const std::string &aFileName)
void readLibSection(std::istream &aLibFile, IDF3::FILE_STATE &aLibState, IDF3_BOARD *aBoard)
std::list< VIA_KO_OUTLINE * > m_viaKeepoutOutlines
Definition idf_parser.h:680
bool SetBoardThickness(double aBoardThickness)
IDF3::CAD_TYPE m_cadType
Definition idf_parser.h:653
int m_brdFileVersion
Definition idf_parser.h:665
bool SetLibraryVersion(int aVersion)
std::map< std::string, OTHER_OUTLINE * > m_otherOutlines
Definition idf_parser.h:674
bool setUnit(IDF3::IDF_UNIT aUnit, bool convert=false)
std::list< std::string > m_placeComments
Definition idf_parser.h:647
IDF3_COMP_OUTLINE * GetComponentOutline(const wxString &aFullFileName)
const std::string & GetNewRefDes(void)
std::string m_brdSource
Definition idf_parser.h:661
std::map< std::string, IDF3_COMP_OUTLINE * > m_componentOutlines
Definition idf_parser.h:650
const std::string & GetBoardDate(void) const
Definition idf_parser.h:450
std::list< IDF_NOTE * > m_notes
Definition idf_parser.h:644
double GetUserScale(void) const
Definition idf_parser.h:458
int GetBoardVersion(void) const
Definition idf_parser.h:453
bool writeLibFile(const std::string &aFileName)
const std::string & GetLibrarySource(void) const
Definition idf_parser.h:449
int GetLibraryVersion(void) const
Definition idf_parser.h:455
void SetUserOffset(double aXoff, double aYoff)
int m_libFileVersion
Definition idf_parser.h:666
const std::string & GetLibraryDate(void) const
Definition idf_parser.h:451
void readBrdNotes(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
double m_userXoff
Definition idf_parser.h:670
std::map< std::string, std::string > m_uidFileList
Definition idf_parser.h:639
std::list< PLACE_OUTLINE * > m_placeOutlines
Definition idf_parser.h:676
double m_userYoff
Definition idf_parser.h:671
std::string m_brdDate
Definition idf_parser.h:663
const std::string & GetIDFSource(void) const
Definition idf_parser.h:445
const std::string & GetError(void)
Definition idf_parser.h:580
std::list< ROUTE_KO_OUTLINE * > m_routeKeepoutOutlines
Definition idf_parser.h:679
IDF3::CAD_TYPE GetCadType(void)
Definition idf_parser.h:425
int m_refDesCounter
Definition idf_parser.h:657
std::string m_refDesString
Definition idf_parser.h:658
IDF3::IDF_UNIT m_unit
Definition idf_parser.h:654
std::multimap< std::string, GROUP_OUTLINE * > m_groupOutlines
Definition idf_parser.h:677
bool DelBoardOutline(IDF_OUTLINE *aOutline)
IDF_DRILL_DATA * AddBoardDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner)
IDF3::IDF_VERSION m_idfVer
Definition idf_parser.h:655
std::string m_libSource
Definition idf_parser.h:662
bool ReadFile(const wxString &aFullFileName, bool aNoSubstituteOutlines=false)
void SetIDFSource(const std::string &aIDFSource)
Definition idf_parser.h:446
bool delCompDrill(double aDia, double aXpos, double aYpos, const std::string &aRefDes)
void writeBoardFile(const std::string &aFileName)
std::map< std::string, IDF3_COMPONENT * > * GetComponents(void)
IDF3_COMPONENT * FindComponent(const std::string &aRefDes)
std::string m_boardName
Definition idf_parser.h:652
std::list< IDF_DRILL_DATA * > & GetBoardDrills(void)
XXX - TO BE IMPLEMENTED.
Definition idf_parser.h:532
std::string m_errormsg
Definition idf_parser.h:643
IDF_DRILL_DATA * AddDrill(IDF_DRILL_DATA *aDrilledHole)
void readBrdHeader(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
size_t GetComponentsSize(void)
double GetBoardThickness(void)
const std::string & GetBoardSource(void) const
Definition idf_parser.h:448
void readLibHeader(std::istream &aLibFile, IDF3::FILE_STATE &aLibState)
const std::map< std::string, OTHER_OUTLINE * > * GetOtherOutlines(void) const
Definition idf_parser.h:474
int GetUserPrecision(void) const
Definition idf_parser.h:461
virtual ~IDF3_BOARD()
std::string m_libDate
Definition idf_parser.h:664
bool AddComponent(IDF3_COMPONENT *aComponent)
void readBrdDrills(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
size_t GetBoardOutlinesSize(void)
bool SetUserScale(double aScaleFactor)
std::list< ROUTE_OUTLINE * > m_routeOutlines
Definition idf_parser.h:675
bool checkComponentOwnership(int aSourceLine, const char *aSourceFunc, IDF3_COMPONENT *aComponent)
void readBoardFile(const std::string &aFileName, bool aNoSubstituteOutlines)
const std::string & GetBoardName(void) const
Definition idf_parser.h:437
void readBrdPlacement(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, bool aNoSubstituteOutlines)
double m_userScale
Definition idf_parser.h:669
void readBrdSection(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, bool aNoSubstituteOutlines)
IDF3::IDF_UNIT GetUnit(void) const
Definition idf_parser.h:432
void SetBoardName(const std::string &aBoardName)
Definition idf_parser.h:436
bool SetUserPrecision(int aPrecision)
std::list< PLACE_KO_OUTLINE * > m_placeKeepoutOutlines
Definition idf_parser.h:681
void Clear(void)
std::string m_idfSource
Definition idf_parser.h:660
bool DelBoardDrill(double aDia, double aXpos, double aYpos)
BOARD_OUTLINE m_boardOutline
Definition idf_parser.h:673
IDF3_BOARD(IDF3::CAD_TYPE aCadType)
IDF3_COMP_OUTLINE * GetInvalidOutline(const std::string &aGeomName, const std::string &aPartName)
std::list< std::string > m_drillComments
Definition idf_parser.h:646
bool DelComponent(IDF3_COMPONENT *aComponent)
bool AddSlot(double aWidth, double aLength, double aOrientation, double aX, double aY)
bool SetBoardVersion(int aVersion)
bool AddBoardOutline(IDF_OUTLINE *aOutline)
std::map< std::string, IDF3_COMPONENT * > m_components
Definition idf_parser.h:649
BOARD_OUTLINE * GetBoardOutline(void)
Definition idf_parser.h:471
IDF_DRILL_DATA * addCompDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner, const std::string &aRefDes)
std::list< std::string > m_noteComments
Definition idf_parser.h:645
const std::list< IDF3_COMP_OUTLINE_DATA * > * GetOutlinesData(void)
friend class IDF3_BOARD
Definition idf_parser.h:382
IDF3::IDF_PLACEMENT placement
Definition idf_parser.h:410
const std::string & GetRefDes(void)
Retrieve the Reference Designator (RefDes) of this component.
bool SetPlacement(IDF3::IDF_PLACEMENT aPlacementValue)
Set the placement value of the component subject to ownership rules.
IDF3_BOARD * parent
Definition idf_parser.h:414
bool writeDrillData(std::ostream &aBoardFile)
Write the internal drill data to an IDFv3 .DRILLED_HOLES section.
const std::string & GetError(void)
Definition idf_parser.h:376
IDF3::IDF_LAYER layer
Definition idf_parser.h:411
bool DeleteOutlineData(IDF3_COMP_OUTLINE_DATA *aComponentOutline)
Remove outline data based on the pointer provided.
std::list< IDF_DRILL_DATA * > drills
Definition idf_parser.h:405
IDF3_COMPONENT(IDF3_BOARD *aParent)
Set the parent object and initializes other internal parameters to default values.
bool SetPosition(double aXpos, double aYpos, double aAngle, IDF3::IDF_LAYER aLayer)
Set the internal position parameters and returns true if the position was set, false if the position ...
std::list< IDF3_COMP_OUTLINE_DATA * > components
Definition idf_parser.h:404
const std::list< IDF_DRILL_DATA * > * GetDrills(void)
Return the internal list of drills.
bool SetRefDes(const std::string &aRefDes)
Set the Reference Designator (RefDes) of this component.
void SetParent(IDF3_BOARD *aParent)
Set the parent object.
IDF3::IDF_UNIT GetUnit(void)
IDF3::CAD_TYPE GetCadType(void)
bool hasPosition
True after SetPosition is called once.
Definition idf_parser.h:412
std::string errormsg
Definition idf_parser.h:415
bool checkOwnership(int aSourceLine, const char *aSourceFunc)
bool writePlaceData(std::ostream &aBoardFile)
Write the component placement data to an IDFv3 .PLACEMENT section.
IDF_DRILL_DATA * AddDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner)
Add a drill entry to the component and returns its pointer.
std::string refdes
Reference Description (MUST BE UNIQUE)
Definition idf_parser.h:413
size_t GetOutlinesSize(void)
bool GetPosition(double &aXpos, double &aYpos, double &aAngle, IDF3::IDF_LAYER &aLayer)
Retrieve the internal position parameters and returns true if the position was previously set,...
bool DelDrill(double aDia, double aXpos, double aYpos)
Delete a drill entry based on its size and location.
IDF3::IDF_PLACEMENT GetPlacement(void)
bool AddOutlineData(IDF3_COMP_OUTLINE_DATA *aComponentOutline)
Add the given component outline data to this component.
bool checkOwnership(int aSourceLine, const char *aSourceFunc)
bool readPlaceData(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, IDF3_BOARD *aBoard, IDF3::IDF_VERSION aIdfVersion, bool aNoSubstituteOutlines)
Read placement data from an open IDFv3 file.
friend class IDF3_BOARD
Definition idf_parser.h:183
void GetOffsets(double &aXoff, double &aYoff, double &aZoff, double &aAngleOff)
Retrieve the position and orientation of this outline item in relation to its parent.
IDF3_COMP_OUTLINE * outline
Definition idf_parser.h:192
void writePlaceData(std::ostream &aBoardFile, double aXpos, double aYpos, double aAngle, const std::string &aRefDes, IDF3::IDF_PLACEMENT aPlacement, IDF3::IDF_LAYER aSide)
Write RECORD 2 and RECORD 3 of a PLACEMENT section as per IDFv3 specification.
IDF3_COMP_OUTLINE_DATA()
Create an object with default settings and no parent or associated outline.
void SetParent(IDF3_COMPONENT *aParent)
Set the parent object.
const std::string & GetError(void)
Definition idf_parser.h:139
bool SetOutline(IDF3_COMP_OUTLINE *aOutline)
Set the outline whose position is managed by this object.
IDF3_COMPONENT * parent
Definition idf_parser.h:193
IDF3_COMP_OUTLINE * GetOutline(void)
Retrieve the outline whose position is managed by this object.
Definition idf_parser.h:134
bool SetOffsets(double aXoff, double aYoff, double aZoff, double aAngleOff)
Set the position and orientation of this outline item in relation to its parent.
friend class IDF3_COMPONENT
Definition idf_parser.h:184
A component's outline as stored in an IDF library file.
A drilled hole.
Definition idf_common.h:312
A segment and winding information for an IDF outline.
Definition idf_common.h:551
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
FILE_STATE
State values for the IDF parser's input.
Definition idf_common.h:63
KEY_PLATING
The plating condition of a hole.
Definition idf_common.h:107
IDF_PLACEMENT
The placement status of a component.
Definition idf_common.h:188
CAD_TYPE
The class of CAD program which is opening or modifying a file.
Definition idf_common.h:127
IDF_VERSION
The supported IDF versions (3.0 and 2.0 ONLY).
Definition idf_common.h:76
IDF_UNIT
The native unit of the board and of component outlines.
Definition idf_common.h:177
IDF_LAYER
The various IDF layer classes and groupings.
Definition idf_common.h:137
KEY_OWNER
The type of CAD which has ownership an object.
Definition idf_common.h:85