KiCad PCB EDA Suite
Loading...
Searching...
No Matches
BOARD_OUTLINE Class Reference

IDFv3 BOARD OUTLINE data and is the basis of other IDFv3 outline objects. More...

#include <idf_outlines.h>

Inheritance diagram for BOARD_OUTLINE:
GROUP_OUTLINE IDF3_COMP_OUTLINE OTHER_OUTLINE PLACE_OUTLINE ROUTE_OUTLINE VIA_KO_OUTLINE PLACE_KO_OUTLINE ROUTE_KO_OUTLINE

Public Member Functions

 BOARD_OUTLINE ()
 
virtual ~BOARD_OUTLINE ()
 
virtual bool SetUnit (IDF3::IDF_UNIT aUnit)
 Function SetUnit sets the native unit of the outline; except for component outlines this must be the same as the native unit of the parent IDF_BOARD object.
 
virtual IDF3::IDF_UNIT GetUnit (void)
 Return the native unit type of the outline.
 
virtual bool SetThickness (double aThickness)
 Set the thickness or height of the outline (mm).
 
virtual double GetThickness (void)
 
virtual bool Clear (void)
 Free memory and reinitializes all internal data except for the parent pointer.
 
IDF3::OUTLINE_TYPE GetOutlineType (void)
 
IDF3_BOARD * GetParent (void)
 
bool AddOutline (IDF_OUTLINE *aOutline)
 Add the specified outline to this object.
 
bool DelOutline (IDF_OUTLINE *aOutline)
 Remove the given outline, subject to IDF ownership rules, if it is owned by this object.
 
bool DelOutline (size_t aIndex)
 Delete the outline specified by the given index, subject to IDF ownership rules.
 
const std::list< IDF_OUTLINE * > * GetOutlines (void)
 Return outlines list.
 
size_t OutlinesSize (void)
 
IDF_OUTLINE * GetOutline (size_t aIndex)
 Return a pointer to the outline as specified by aIndex.
 
IDF3::KEY_OWNER GetOwner (void)
 
bool SetOwner (IDF3::KEY_OWNER aOwner)
 Set the ownership status of the outline subject to IDF ownership rules.
 
bool IsSingle (void)
 
void ClearOutlines (void)
 Clear internal data except for the parent pointer.
 
void AddComment (const std::string &aComment)
 Add a comment to the outline data.
 
size_t CommentsSize (void)
 
std::list< std::string > * GetComments (void)
 
const std::string * GetComment (size_t aIndex)
 
bool DeleteComment (size_t aIndex)
 Deletes a comment based on the given index.
 
void ClearComments (void)
 Deletes all comments.
 
const std::string & GetError (void)
 

Protected Member Functions

void readOutlines (std::istream &aBoardFile, IDF3::IDF_VERSION aIdfVersion)
 
bool writeComments (std::ostream &aBoardFile)
 
bool writeOwner (std::ostream &aBoardFile)
 
void writeOutline (std::ostream &aBoardFile, IDF_OUTLINE *aOutline, size_t aIndex)
 
void writeOutlines (std::ostream &aBoardFile)
 
void clearOutlines (void)
 
void setParent (IDF3_BOARD *aParent)
 Set the parent IDF_BOARD object.
 
bool addOutline (IDF_OUTLINE *aOutline)
 
virtual bool setThickness (double aThickness)
 
virtual void clear (void)
 
virtual void readData (std::istream &aBoardFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion)
 Read data from a .BOARD_OUTLINE section.
 
virtual void writeData (std::ostream &aBoardFile)
 Write the comments and .BOARD_OUTLINE section to an IDFv3 file.
 

Protected Attributes

std::string errormsg
 
std::list< IDF_OUTLINE * > outlines
 
IDF3::KEY_OWNER owner
 
IDF3::OUTLINE_TYPE outlineType
 
bool single
 
std::list< std::string > comments
 
IDF3::IDF_UNIT unit
 
IDF3_BOARD * parent
 
double thickness
 

Friends

class IDF3_BOARD
 

Detailed Description

IDFv3 BOARD OUTLINE data and is the basis of other IDFv3 outline objects.

Definition at line 86 of file idf_outlines.h.

Constructor & Destructor Documentation

◆ BOARD_OUTLINE()

BOARD_OUTLINE::BOARD_OUTLINE ( )

◆ ~BOARD_OUTLINE()

BOARD_OUTLINE::~BOARD_OUTLINE ( )
virtual

Definition at line 139 of file idf_outlines.cpp.

References clear().

Member Function Documentation

◆ AddComment()

void BOARD_OUTLINE::AddComment ( const std::string & aComment)

Add a comment to the outline data.

This function is not subject to IDF ownership rules.

Definition at line 1520 of file idf_outlines.cpp.

References comments.

Referenced by IDF3_BOARD::GetComponentOutline(), IDF3_BOARD::readBrdSection(), and IDF3_BOARD::readLibSection().

◆ AddOutline()

bool BOARD_OUTLINE::AddOutline ( IDF_OUTLINE * aOutline)

Add the specified outline to this object.

Parameters
aOutlineis a valid IDF outline.
Returns
true if the outline was added; false if the outline already existed or an ownership violation occurs.

Definition at line 1326 of file idf_outlines.cpp.

References addOutline(), CheckOwnership(), errormsg, outlineType, owner, and parent.

Referenced by IDF_EXPORTER::createOutlineFromExtrudedBody().

◆ addOutline()

bool BOARD_OUTLINE::addOutline ( IDF_OUTLINE * aOutline)
protected

Definition at line 1296 of file idf_outlines.cpp.

References errormsg, and outlines.

Referenced by AddOutline().

◆ Clear()

bool BOARD_OUTLINE::Clear ( void )
virtual

Free memory and reinitializes all internal data except for the parent pointer.

Returns
true if OK, false on ownership violations.

Reimplemented in GROUP_OUTLINE, IDF3_COMP_OUTLINE, OTHER_OUTLINE, PLACE_OUTLINE, and ROUTE_OUTLINE.

Definition at line 1271 of file idf_outlines.cpp.

References CheckOwnership(), clear(), errormsg, outlineType, owner, and parent.

◆ clear()

void BOARD_OUTLINE::clear ( void )
protectedvirtual

◆ ClearComments()

void BOARD_OUTLINE::ClearComments ( void )

Deletes all comments.

Definition at line 1570 of file idf_outlines.cpp.

References comments.

◆ ClearOutlines()

void BOARD_OUTLINE::ClearOutlines ( void )

Clear internal data except for the parent pointer.

◆ clearOutlines()

void BOARD_OUTLINE::clearOutlines ( void )
protected

Definition at line 1505 of file idf_outlines.cpp.

References outlines.

Referenced by clear(), and readOutlines().

◆ CommentsSize()

size_t BOARD_OUTLINE::CommentsSize ( void )
Returns
the number of comments in the internal list.

Definition at line 1529 of file idf_outlines.cpp.

References comments.

◆ DeleteComment()

bool BOARD_OUTLINE::DeleteComment ( size_t aIndex)

Deletes a comment based on the given index.

Returns
true if a comment was deleted, false if the index is out of bounds.

Definition at line 1555 of file idf_outlines.cpp.

References comments.

◆ DelOutline() [1/2]

bool BOARD_OUTLINE::DelOutline ( IDF_OUTLINE * aOutline)

Remove the given outline, subject to IDF ownership rules, if it is owned by this object.

The outline pointer remains valid and it is the user's responsibility to delete the object. The first outline in the list will never be deleted unless it is the sole remaining outline; this is to ensure that a board outline is not removed while the cutouts remain.

Parameters
aOutlineis a pointer to the outline to remove from the list.
Returns
true if the outline was found and removed; false if the outline was not found or an ownership violation occurs.

Definition at line 1337 of file idf_outlines.cpp.

References errormsg, GetOutlineTypeString(), outlines, and outlineType.

◆ DelOutline() [2/2]

bool BOARD_OUTLINE::DelOutline ( size_t aIndex)

Delete the outline specified by the given index, subject to IDF ownership rules.

The outline data is destroyed. The first outline in the list will never be deleted unless it is the sole remaining outline; this is to ensure that a board outline is not removed while the cutouts remain.

Parameters
aIndexis an index to the outline to delete
Returns
true if the outline was found and deleted; false if the outline was not found or an ownership violation or indexation error occurs.

Definition at line 1395 of file idf_outlines.cpp.

References errormsg, GetOutlineTypeString(), outlines, and outlineType.

◆ GetComment()

const std::string * BOARD_OUTLINE::GetComment ( size_t aIndex)
Returns
indexed comment or NULL if the index is out of bounds.

Definition at line 1541 of file idf_outlines.cpp.

References comments.

◆ GetComments()

std::list< std::string > * BOARD_OUTLINE::GetComments ( void )
Returns
the internal list of comments.

Definition at line 1535 of file idf_outlines.cpp.

References comments.

◆ GetError()

const std::string & BOARD_OUTLINE::GetError ( void )
inline

Definition at line 253 of file idf_outlines.h.

References errormsg.

◆ GetOutline()

IDF_OUTLINE * BOARD_OUTLINE::GetOutline ( size_t aIndex)

Return a pointer to the outline as specified by aIndex.

If the index is out of bounds NULL is returned and the error message is set. It is the responsibility of the user to observe IDF ownership rules.

Definition at line 1460 of file idf_outlines.cpp.

References errormsg, and outlines.

Referenced by MatchCompOutline().

◆ GetOutlines()

const std::list< IDF_OUTLINE * > * BOARD_OUTLINE::GetOutlines ( void )

Return outlines list.

It is up to the user to respect the IDFv3 specification and avoid changes to this list which are in violation of the specification.

Definition at line 1448 of file idf_outlines.cpp.

References outlines.

Referenced by addOutline(), makeBoard(), and makeOtherOutlines().

◆ GetOutlineType()

IDF3::OUTLINE_TYPE BOARD_OUTLINE::GetOutlineType ( void )
Returns
the type of outline according to the IDFv3 classification.

Definition at line 145 of file idf_outlines.cpp.

References outlineType.

◆ GetOwner()

IDF3::KEY_OWNER BOARD_OUTLINE::GetOwner ( void )
Returns
the ownership status of the outline (ECAD, MCAD, UNOWNED).

Definition at line 1481 of file idf_outlines.cpp.

References owner.

◆ GetParent()

IDF3_BOARD * BOARD_OUTLINE::GetParent ( void )
Returns
the parent IDF_BOARD object.

Definition at line 1290 of file idf_outlines.cpp.

References IDF3_BOARD, and parent.

◆ GetThickness()

double BOARD_OUTLINE::GetThickness ( void )
virtual
Returns
the thickness or height of an outline (mm).

Definition at line 1040 of file idf_outlines.cpp.

References thickness.

Referenced by addOutline(), and makeOtherOutlines().

◆ GetUnit()

IDF3::IDF_UNIT BOARD_OUTLINE::GetUnit ( void )
virtual

Return the native unit type of the outline.

Returns
IDF_UNIT is the native unit (UNIT_MM or UNIT_THOU).

Definition at line 1005 of file idf_outlines.cpp.

References unit.

◆ IsSingle()

bool BOARD_OUTLINE::IsSingle ( void )
Returns
true if this type of outline only supports a single outline. All outlines except for BOARD_OUTLINE are single.

Definition at line 1499 of file idf_outlines.cpp.

References single.

◆ OutlinesSize()

size_t BOARD_OUTLINE::OutlinesSize ( void )
Returns
the number of items in the internal outline list.

Definition at line 1454 of file idf_outlines.cpp.

References outlines.

Referenced by IDF_EXPORTER::createOutlineFromExtrudedBody(), and MatchCompOutline().

◆ readData()

void BOARD_OUTLINE::readData ( std::istream & aBoardFile,
const std::string & aHeader,
IDF3::IDF_VERSION aIdfVersion )
protectedvirtual

Read data from a .BOARD_OUTLINE section.

In case of an unrecoverable error an exception is thrown. On a successful return the file pointer will be at the line following .END_BOARD_OUTLINE

Parameters
aBoardFileis an IDFv3 file opened for reading.
aHeaderis the ".BOARD_OUTLINE" header line as read by FetchIDFLine.

Reimplemented in GROUP_OUTLINE, IDF3_COMP_OUTLINE, OTHER_OUTLINE, PLACE_OUTLINE, and ROUTE_OUTLINE.

Definition at line 1045 of file idf_outlines.cpp.

References IDF3::CompareToken(), ERROR_IDF, IDF3::FetchIDFLine(), IDF3::GetIDFString(), GetOutlineTypeString(), IDF_THOU_TO_MM, IDF_TNM_TO_MM, IDF3::IDF_V2, outlineType, owner, IDF3::ParseOwner(), readOutlines(), thickness, unit, IDF3::UNIT_MM, IDF3::UNIT_THOU, IDF3::UNIT_TNM, and IDF3::UNOWNED.

◆ readOutlines()

◆ SetOwner()

bool BOARD_OUTLINE::SetOwner ( IDF3::KEY_OWNER aOwner)

Set the ownership status of the outline subject to IDF ownership rules.

Returns
true if the ownership was changed and false if a specification violation occurred.

Definition at line 1487 of file idf_outlines.cpp.

References CheckOwnership(), errormsg, outlineType, owner, and parent.

◆ setParent()

void BOARD_OUTLINE::setParent ( IDF3_BOARD * aParent)
protected

◆ SetThickness()

bool BOARD_OUTLINE::SetThickness ( double aThickness)
virtual

Set the thickness or height of the outline (mm).

Parameters
aThicknessis the thickness or height of the outline in mm.

Definition at line 1029 of file idf_outlines.cpp.

References CheckOwnership(), errormsg, outlineType, owner, parent, and setThickness().

Referenced by IDF_EXPORTER::createOutlineFromExtrudedBody().

◆ setThickness()

bool BOARD_OUTLINE::setThickness ( double aThickness)
protectedvirtual

Definition at line 1011 of file idf_outlines.cpp.

References errormsg, GetOutlineTypeString(), outlineType, and thickness.

Referenced by SetThickness().

◆ SetUnit()

bool BOARD_OUTLINE::SetUnit ( IDF3::IDF_UNIT aUnit)
virtual

Function SetUnit sets the native unit of the outline; except for component outlines this must be the same as the native unit of the parent IDF_BOARD object.

Parameters
aUnitis the native unit (UNIT_MM or UNIT_THOU)

Definition at line 985 of file idf_outlines.cpp.

References errormsg, GetOutlineTypeString(), outlineType, unit, IDF3::UNIT_MM, IDF3::UNIT_THOU, and IDF3::UNIT_TNM.

Referenced by IDF_EXPORTER::createOutlineFromExtrudedBody(), and IDF3_BOARD::readBrdSection().

◆ writeComments()

bool BOARD_OUTLINE::writeComments ( std::ostream & aBoardFile)
protected

◆ writeData()

void BOARD_OUTLINE::writeData ( std::ostream & aBoardFile)
protectedvirtual

Write the comments and .BOARD_OUTLINE section to an IDFv3 file.

Throws exceptions.

Parameters
aBoardFileis an IDFv3 file opened for writing.

Reimplemented in GROUP_OUTLINE, IDF3_COMP_OUTLINE, OTHER_OUTLINE, PLACE_OUTLINE, and ROUTE_OUTLINE.

Definition at line 1241 of file idf_outlines.cpp.

References IDF_THOU_TO_MM, thickness, unit, IDF3::UNIT_THOU, writeComments(), writeOutlines(), and writeOwner().

◆ writeOutline()

◆ writeOutlines()

void BOARD_OUTLINE::writeOutlines ( std::ostream & aBoardFile)
protected

◆ writeOwner()

bool BOARD_OUTLINE::writeOwner ( std::ostream & aBoardFile)
protected

Friends And Related Symbol Documentation

◆ IDF3_BOARD

friend class IDF3_BOARD
friend

Definition at line 320 of file idf_outlines.h.

References IDF3_BOARD.

Referenced by GetParent(), IDF3_BOARD, and setParent().

Member Data Documentation

◆ comments

std::list< std::string > BOARD_OUTLINE::comments
protected

◆ errormsg

◆ outlines

◆ outlineType

◆ owner

◆ parent

◆ single

◆ thickness

◆ unit


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