54#include <compoundfilereader.h>
59#include <wx/mstream.h>
61#include <wx/zstream.h>
62#include <wx/wfstream.h>
67#define HARNESS_PORT_COLOR_DEFAULT_BACKGROUND COLOR4D( 0.92941176470588238, \
68 0.94901960784313721, \
69 0.98431372549019602, 1.0 )
71#define HARNESS_PORT_COLOR_DEFAULT_OUTLINE COLOR4D( 0.56078431372549020, \
72 0.61960784313725492, \
73 0.78823529411764703, 1.0 )
86 int green = (
color & 0x00FF00 ) >> 8;
87 int blue = (
color & 0xFF0000 ) >> 16;
225 wxCHECK( !aFileName.IsEmpty() && aSchematic,
nullptr );
227 wxFileName fileName( aFileName );
232 std::unique_ptr<SCH_SHEET> deleter( aAppendToMe ?
nullptr :
m_rootSheet );
236 wxCHECK_MSG( aSchematic->
IsValid(),
nullptr,
"Can't append to a schematic with no root!" );
263 wxCHECK_MSG( libTable,
nullptr,
"Could not load symbol lib table." );
265 m_pi.
set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
273 wxString libTableUri =
"${KIPRJMOD}/" +
getLibFileName().GetFullName();
277 wxString(
"KiCad" ) ) );
286 libTable->
Format( &formatter, 0 );
297 wxCHECK( rootScreen,
nullptr );
335 wxFileName parentFileName = aFileName;
345 catch(
const CFB::CFBException& exception )
349 catch(
const std::exception& exc )
351 wxLogDebug( wxT(
"Unhandled exception in Altium schematic parsers: %s." ), exc.what() );
356 wxCHECK( currentScreen, );
364 wxCHECK2( sheet,
continue );
368 wxFileName loadAltiumFileName( parentFileName.GetPath(), sheet->
GetFileName() );
370 if( loadAltiumFileName.GetFullName().IsEmpty() || !loadAltiumFileName.IsFileReadable() )
374 msg.Printf(
_(
"The file name for sheet %s is undefined, this is probably an"
375 " Altium signal harness that got converted to a sheet." ),
393 sheet->
SetName( loadAltiumFileName.GetName() );
394 wxCHECK2( screen,
continue );
400 wxFileName projectFileName = loadAltiumFileName;
403 sheet->
SetFileName( projectFileName.GetFullName() );
404 screen->
SetFileName( projectFileName.GetFullPath() );
414 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( {
"Storage" } );
416 if( file ==
nullptr )
421 std::map<wxString, wxString> properties = reader.
ReadProperties();
428 for(
int i = 0; i < weight; i++ )
441 "(%d bytes remaining)." ),
450 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( {
"Additional" } );
452 if( file ==
nullptr )
464 std::map<wxString, wxString> properties = reader.
ReadProperties();
475 std::map<wxString, wxString> properties = reader.
ReadProperties();
505 "inside \"Additional\" section." ),
526 const CFB::COMPOUND_FILE_ENTRY* file = aAltiumSchFile.
FindStream( {
"FileHeader" } );
528 if( file ==
nullptr )
539 std::map<wxString, wxString> properties = reader.
ReadProperties();
557 std::map<wxString, wxString> properties = reader.
ReadProperties();
729 "inside \"FileHeader\" section." ),
745 for( std::pair<const int, SCH_SYMBOL*>& symbol :
m_symbols )
755 symbol.second->SetLibSymbol( libSymbolIt->second );
790 return component->second.displaymode == aOwnerpartdisplaymode;
800 if( file.filename.IsSameAs( aFilename ) )
803 if( file.filename.EndsWith( aFilename ) )
804 nonExactMatch = &file;
807 return nonExactMatch;
812 const std::map<wxString, wxString>& aProperties )
815 wxCHECK( currentSheet, );
817 wxString sheetName = currentSheet->
GetName();
819 if( sheetName.IsEmpty() )
820 sheetName = wxT(
"root" );
829 "replaced with symbol \"%s\"." ),
893 libSymbolIt->second->AddDrawItem(
pin );
902 pin->SetNumberTextSize( 0 );
905 pin->SetNameTextSize( 0 );
1038 int vjustify, hjustify;
1041 switch( justification )
1064 switch( justification )
1087 switch( orientation )
1122 std::map<wxString, wxString> variableMap = {
1123 {
"APPLICATION_BUILDNUMBER",
"KICAD_VERSION" },
1124 {
"SHEETNUMBER",
"#" },
1125 {
"SHEETTOTAL",
"##" },
1126 {
"TITLE",
"TITLE" },
1127 {
"REVISION",
"REVISION" },
1128 {
"DATE",
"ISSUE_DATE" },
1129 {
"CURRENTDATE",
"CURRENT_DATE" },
1130 {
"COMPANYNAME",
"COMPANY" },
1131 {
"DOCUMENTNAME",
"FILENAME" },
1132 {
"PROJECTNAME",
"PROJECTNAME" },
1140 size_t fontId =
static_cast<int>( elem.
fontId );
1155 screen->
Append( textItem );
1172 libSymbolIt->second->AddDrawItem( textItem );
1180 size_t fontId =
static_cast<int>( elem.
fontId );
1215 textBox->
SetStart( sheetTopRight );
1216 textBox->
SetEnd( sheetBottomLeft );
1250 size_t fontId =
static_cast<int>( aElem->
FontID );
1266 screen->
Append( textBox );
1274 if( elem.
points.size() < 2 )
1278 static_cast<int>( elem.
points.size() ) ),
1288 for(
size_t i = 0; i + 1 < elem.
points.size(); i += 3 )
1290 if( i + 2 == elem.
points.size() )
1306 std::vector<VECTOR2I> bezierPoints;
1307 std::vector<VECTOR2I> polyPoints;
1309 for(
size_t j = i; j < elem.
points.size() && j < i + 4; j++ )
1310 bezierPoints.push_back( elem.
points.at( j ) );
1313 converter.
GetPoly( polyPoints );
1315 for(
size_t k = 0; k + 1 < polyPoints.size(); k++ )
1347 for(
size_t i = 0; i + 1 < elem.
points.size(); i += 3 )
1349 if( i + 2 == elem.
points.size() )
1353 libSymbolIt->second->AddDrawItem( line );
1357 for(
size_t j = i; j < elem.
points.size() && j < i + 2; j++ )
1365 else if( i + 3 == elem.
points.size() )
1372 libSymbolIt->second->AddDrawItem( line );
1376 for(
size_t j = i; j < elem.
points.size() && j < i + 2; j++ )
1388 libSymbolIt->second->AddDrawItem( bezier );
1392 for(
size_t j = i; j < elem.
points.size() && j < i + 4; j++ )
1399 case 0: bezier->
SetStart( pos );
break;
1402 case 3: bezier->
SetEnd( pos );
break;
1452 libSymbolIt->second->AddDrawItem( line );
1503 libSymbolIt->second->AddDrawItem( line );
1532 rect->
SetEnd( sheetBottomLeft );
1558 libSymbolIt->second->AddDrawItem( rect );
1597 screen->
Append( circle );
1637 libSymbolIt->second->AddDrawItem( circle );
1648 libSymbolIt->second->AddDrawItem( arc );
1653 VECTOR2I arcStart( arc_radius, 0 );
1680 "(X = %d; Y = %d)." ),
1702 screen->
Append( circle );
1720 libSymbolIt->second->AddDrawItem( circle );
1773 libSymbolIt->second->AddDrawItem( line );
1808 m_reporter->
Report( wxT(
"Signal harness, belonging to the part is not currently "
1815 wxString>& aProperties )
1820 wxCHECK( currentScreen, );
1831 currentScreen->
Append( sheet );
1844 m_reporter->
Report( wxT(
"Harness connector, belonging to the part is not currently "
1866 sheetIt->second->AddPin( sheetPin );
1871 VECTOR2I pos = sheetIt->second->GetPosition();
1872 VECTOR2I size = sheetIt->second->GetSize();
1930 wxString fullPath = fn.GetFullPath();
1932 fullPath.Replace( wxT(
"\\" ), wxT(
"/" ) );
1934 SCH_SCREEN* screen = sheetIt->second->GetScreen();
1940 "hierarchical sheet. Please review the imported "
1962 rect->
SetEnd( sheetBottomLeft );
1986 libSymbolIt->second->AddDrawItem( rect );
1998 const std::map<wxString, wxString>& aProperties )
2013 wxCHECK( currentScreen, );
2014 currentScreen->
Append( sheet );
2023 wxCHECK( rootScreen, );
2031 m_sheets.insert( { aIndex, sheet } );
2050 sheetIt->second->AddPin( sheetPin );
2057 VECTOR2I pos = sheetIt->second->GetPosition();
2058 VECTOR2I size = sheetIt->second->GetSize();
2295 aReporter->
Report(
_(
"Power Port with unknown style imported as 'Bar' type." ),
2326 libSymbol = powerSymbolIt->second;
2337 "label with name '%s'" ), elem.
text ) );
2346 pin->SetPosition( { 0, 0 } );
2347 pin->SetLength( 0 );
2409 screen->
Append( symbol );
2420 int height = aElem.
Height;
2451 size_t fontId =
static_cast<int>( aElem.
FontID );
2467 screen->
Append( textBox );
2470 "a text box. Please review the imported "
2489 switch( aElem.
Style )
2519 bool connectionFound = startIsWireTerminal
2520 || startIsBusTerminal
2521 || endIsWireTerminal
2522 || endIsBusTerminal;
2524 if( !connectionFound )
2531 VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end;
2563 switch( aElem.
Style )
2570 if( ( startIsWireTerminal || startIsBusTerminal ) )
2580 if( ( startIsWireTerminal || startIsBusTerminal ) )
2591 label->
GetFields()[0].SetVisible(
false );
2598 if( ( startIsWireTerminal && endIsWireTerminal ) )
2606 else if( startIsBusTerminal && endIsBusTerminal )
2629 screen->
Append( noConnect );
2677 for(
size_t i = 0; i + 1 < elem.
points.size(); i++ )
2697 for(
size_t i = 0; i + 1 < elem.
points.size(); i++ )
2720 screen->
Append( junction );
2732 && component->second.currentpartid != elem.
ownerpartid )
2736 std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>( center );
2753 wxString storagePath = wxFileName::CreateTempFileName(
"kicad_import_" );
2756 wxMemoryInputStream fileStream( storageFile->
data.data(), storageFile->
data.size() );
2757 wxZlibInputStream zlibInputStream( fileStream );
2758 wxFFileOutputStream outputStream( storagePath );
2759 outputStream.Write( zlibInputStream );
2760 outputStream.Close();
2762 if( !bitmap->ReadImageFile( storagePath ) )
2770 wxRemoveFile( storagePath );
2774 if( !wxFileExists( elem.
filename ) )
2781 if( !bitmap->ReadImageFile( elem.
filename ) )
2790 VECTOR2I currentImageSize = bitmap->GetSize();
2792 double scaleX =
std::abs(
static_cast<double>( expectedImageSize.
x ) / currentImageSize.
x );
2793 double scaleY =
std::abs(
static_cast<double>( expectedImageSize.
y ) / currentImageSize.
y );
2794 bitmap->SetImageScale( std::min( scaleX, scaleY ) );
2796 bitmap->SetFlags(
IS_NEW );
2797 screen->
Append( bitmap.release() );
2803 m_altiumSheet = std::make_unique<ASCH_SHEET>( aProperties );
2912 bool emptyRef = elem.
text.IsEmpty();
2917 bool visible = !emptyRef;
2938 busWireEntry->
SetSize( { vector.
x, vector.
y } );
2941 screen->
Append( busWireEntry );
2953 std::map<wxString, wxString> variableMap = {
2954 {
"COMMENT",
"VALUE" },
2955 {
"VALUE",
"ALTIUM_VALUE" },
2961 if( elem.
text ==
"*" )
2964 wxString paramName = elem.
name.Upper();
2966 if( paramName ==
"SHEETNUMBER" )
2970 else if( paramName ==
"TITLE" )
2974 else if( paramName ==
"REVISION" )
2978 else if( paramName ==
"DATE" )
2982 else if( paramName ==
"COMPANYNAME" )
3003 wxString upperName = elem.
name.Upper();
3005 if( upperName ==
"COMMENT" )
3012 wxString fieldName = elem.
name.Upper();
3014 if( fieldName.IsEmpty() )
3016 int disambiguate = 1;
3021 }
while( !symbol->
GetFieldText( fieldName ).IsEmpty() );
3023 else if( fieldName ==
"VALUE" )
3025 fieldName =
"ALTIUM_VALUE";
3041 const std::map<wxString, wxString>& aProperties )
3066 const auto& libSymbolIt =
m_libSymbols.find( implementationOwnerIt->second );
3071 implementationOwnerIt->second ),
3077 wxArrayString fpFilters;
3078 fpFilters.Add( fpLibId.
Format() );
3080 libSymbolIt->second->SetFPFilters( fpFilters );
const int ALTIUM_COMPONENT_NONE
LIB_ID AltiumToKiCadLibID(const wxString &aLibName, const wxString &aLibReference)
wxString AltiumSpecialStringsToKiCadVariables(const wxString &aString, const std::map< wxString, wxString > &aOverrides)
constexpr EDA_IU_SCALE schIUScale
const CFB::COMPOUND_FILE_ENTRY * FindStream(const std::vector< std::string > &aStreamPath) const
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
size_t GetRemainingBytes() const
std::map< wxString, wxString > ReadProperties()
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
Bezier curves to polygon converter.
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMinSegLen=0, int aMaxSegCount=32)
Convert a Bezier curve to a polygon.
void SetFlags(EDA_ITEM_FLAGS aMask)
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
void SetFilled(bool aFlag)
void SetFillColor(const COLOR4D &aColor)
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
void SetBezierC1(const VECTOR2I &aPt)
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void SetTextColor(const COLOR4D &aColor)
virtual void SetVisible(bool aVisible)
void SetTextSize(const VECTOR2I &aNewSize)
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EE_TYPE OfType(KICAD_T aType) const
A color representation with 4 components: red, green, blue, alpha.
COLOR4D & FromCSSRGBA(int aRed, int aGreen, int aBlue, double aAlpha=1.0)
Initialize the color from a RGBA value with 0-255 red/green/blue and 0-1 alpha.
VECTOR2I GetPosition() const override
A logical library item identifier and consists of various portions much like a URI.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
void SetPosition(const VECTOR2I &aPosition) override
void SetStroke(const STROKE_PARAMS &aStroke)
void AddPoint(const VECTOR2I &aPosition)
void SetPosition(const VECTOR2I &aPosition) override
VECTOR2I GetCenter() const
VECTOR2I GetPosition() const override
Define a library symbol object.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetDescription(const wxString &aDescription)
void SetKeyWords(const wxString &aKeyWords)
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
LIB_FIELD & GetValueField()
Return reference to the value field.
void SetLibId(const LIB_ID &aLibId)
virtual void SetName(const wxString &aName)
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
Define a symbol library graphical text item.
Describe the page size and margins of a paper page on which to eventually print or plot.
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
virtual std::map< wxString, wxString > & GetTextVars() const
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
Holds all the data relating to one schematic.
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
std::unique_ptr< ASCH_SHEET > m_altiumSheet
void ParseImplementationList(int aIndex, const std::map< wxString, wxString > &aProperties)
std::vector< ASCH_PORT > m_altiumHarnessPortsCurrentSheet
void ParseStorage(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
std::map< int, int > m_altiumImplementationList
void AddTextBox(const ASCH_TEXT_FRAME *aElem)
void ParseSheetEntry(const std::map< wxString, wxString > &aProperties)
const wxString GetName() const override
Return a brief hard coded name for this SCH_PLUGIN.
int GetModifyHash() const override
Return the modification hash from the library cache.
void ParseComponent(int aIndex, const std::map< wxString, wxString > &aProperties)
void ParsePin(const std::map< wxString, wxString > &aProperties)
std::map< wxString, LIB_SYMBOL * > m_powerSymbols
void ParseImplementation(const std::map< wxString, wxString > &aProperties)
wxFileName getLibFileName()
void ParseImage(const std::map< wxString, wxString > &aProperties)
void ParseNetLabel(const std::map< wxString, wxString > &aProperties)
void ParseBezier(const std::map< wxString, wxString > &aProperties)
void ParseBusEntry(const std::map< wxString, wxString > &aProperties)
void ParseSheetName(const std::map< wxString, wxString > &aProperties)
void ParseBus(const std::map< wxString, wxString > &aProperties)
void ParseAdditional(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
void ParseDesignator(const std::map< wxString, wxString > &aProperties)
void ParseSheetSymbol(int aIndex, const std::map< wxString, wxString > &aProperties)
bool IsComponentPartVisible(int aOwnerindex, int aOwnerpartdisplaymode) const
void ParseAltiumSch(const wxString &aFileName)
void ParsePort(const ASCH_PORT &aElem)
void ParsePowerPort(const std::map< wxString, wxString > &aProperties)
void ParseRoundRectangle(const std::map< wxString, wxString > &aProperties)
std::unique_ptr< STRING_UTF8_MAP > m_properties
void ParseWire(const std::map< wxString, wxString > &aProperties)
SCH_SCREEN * getCurrentScreen()
std::vector< ASCH_STORAGE_FILE > m_altiumStorage
std::map< int, LIB_SYMBOL * > m_libSymbols
void ParseSignalHarness(const std::map< wxString, wxString > &aProperties)
void ParseArc(const std::map< wxString, wxString > &aProperties)
std::unique_ptr< TITLE_BLOCK > m_currentTitleBlock
SCH_SHEET_PATH m_sheetPath
void ParseHarnessType(const std::map< wxString, wxString > &aProperties)
const ASCH_STORAGE_FILE * GetFileFromStorage(const wxString &aFilename) const
const wxString GetFileExtension() const override
Return the file extension for the SCH_PLUGIN.
void ParseRectangle(const std::map< wxString, wxString > &aProperties)
SCH_SHEET * getCurrentSheet()
void ParsePolyline(const std::map< wxString, wxString > &aProperties)
void ParseParameter(const std::map< wxString, wxString > &aProperties)
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi
void ParseLabel(const std::map< wxString, wxString > &aProperties)
void ParseHarnessConnector(int aIndex, const std::map< wxString, wxString > &aProperties)
std::vector< ASCH_PORT > m_altiumPortsCurrentSheet
void ParseSheet(const std::map< wxString, wxString > &aProperties)
int m_harnessOwnerIndexOffset
SCH_SHEET * Load(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr) override
Load information from some input file format that this SCH_PLUGIN implementation knows about,...
void ParseTextFrame(const std::map< wxString, wxString > &aProperties)
void ParseJunction(const std::map< wxString, wxString > &aProperties)
void ParseFileHeader(const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
void ParseNoERC(const std::map< wxString, wxString > &aProperties)
void ParseLine(const std::map< wxString, wxString > &aProperties)
const wxString GetLibraryFileExtension() const override
Return the library file extension for the SCH_PLUGIN object.
void ParsePolygon(const std::map< wxString, wxString > &aProperties)
std::map< int, ASCH_SYMBOL > m_altiumComponents
void ParseNote(const std::map< wxString, wxString > &aProperties)
bool CheckHeader(const wxString &aFileName) override
Return true if the first line in aFileName begins with the expected header.
std::map< int, SCH_SYMBOL * > m_symbols
void ParseHarnessPort(const ASCH_PORT &aElem)
void ParseFileName(const std::map< wxString, wxString > &aProperties)
void ParseEllipse(const std::map< wxString, wxString > &aProperties)
std::map< int, SCH_SHEET * > m_sheets
void ParseHarnessEntry(const std::map< wxString, wxString > &aProperties)
void SetSize(const VECTOR2I &aSize)
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void SetPosition(const VECTOR2I &aPosition) override
void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetShape(LABEL_FLAG_SHAPE aShape) override
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
std::vector< SCH_FIELD > & GetFields()
Segment description base class to describe items which have 2 end points (track, wire,...
void SetLineWidth(const int aSize)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
void set(SCH_PLUGIN *aPlugin)
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
virtual void SaveLibrary(const wxString &aFileName, const STRING_UTF8_MAP *aProperties=nullptr)
virtual void CreateSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty symbol library at aLibraryPath.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
std::vector< SCH_SHEET_INSTANCE > m_sheetInstances
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetPageSettings(const PAGE_INFO &aPageSettings)
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
const KIID & GetUuid() const
bool IsTerminalPoint(const VECTOR2I &aPosition, int aLayer) const
Test if aPosition is a connection point on aLayer.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
void SetPosition(const VECTOR2I &aPos) override
void SetStroke(const STROKE_PARAMS &aStroke) override
void AddPoint(const VECTOR2I &aPosition)
VECTOR2I GetPosition() const override
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SCREEN * LastScreen()
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void pop_back()
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
void SetPosition(const VECTOR2I &aPosition) override
void SetSide(SHEET_SIDE aEdge)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetBorderColor(KIGFX::COLOR4D aColor)
void SetFileName(const wxString &aFilename)
wxString GetFileName() const
Return the filename corresponding to this sheet.
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
void SetBackgroundColor(KIGFX::COLOR4D aColor)
void SetName(const wxString &aName)
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
void SetLibId(const LIB_ID &aName)
void SetPosition(const VECTOR2I &aPosition) override
int GetFieldCount() const
Return the number of fields in this symbol.
void SetValueFieldText(const wxString &aValue)
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SetFootprintFieldText(const wxString &aFootprint)
VECTOR2I GetPosition() const override
TRANSFORM & GetTransform()
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetUnit(int aUnit)
Change the unit number to aUnit.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
wxString GetFieldText(const wxString &aFieldName) const
Search for a field named aFieldName and returns text associated with this field.
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
A name/value tuple with unique names and optional values.
Simple container to manage line stroke parameters.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
static const wxString & GetSymbolLibTableFileName()
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
Generate the table in s-expression format to aOutput with an indentation level of aIndentLevel.
static REPORTER & GetInstance()
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
#define IS_NEW
New item, just created.
@ FILLED_WITH_BG_BODYCOLOR
const std::string KiCadSymbolLibFileExtension
const std::string KiCadSchematicFileExtension
#define THROW_IO_ERROR(msg)
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PT_INPUT
usual pin input: must be connected
@ PT_TRISTATE
tris state bus pin
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static COLOR4D GetColorFromInt(int color)
#define HARNESS_PORT_COLOR_DEFAULT_OUTLINE
static PLOT_DASH_TYPE GetPlotDashType(const ASCH_POLYLINE_LINESTYLE linestyle)
static void SetLibShapeFillAndColor(const ASCH_SHAPE_INTERFACE &elem, LIB_SHAPE *shape)
VECTOR2I HelperGeneratePowerPortGraphics(LIB_SYMBOL *aKsymbol, ASCH_POWER_PORT_STYLE aStyle, REPORTER *aReporter)
static const VECTOR2I GetRelativePosition(const VECTOR2I &aPosition, const SCH_SYMBOL *aSymbol)
#define HARNESS_PORT_COLOR_DEFAULT_BACKGROUND
static void SetSchShapeFillAndColor(const ASCH_SHAPE_INTERFACE &elem, SCH_SHAPE *shape)
void SetTextPositioning(EDA_TEXT *text, ASCH_LABEL_JUSTIFICATION justification, ASCH_RECORD_ORIENTATION orientation)
PLOT_DASH_TYPE
Dashed line types.
std::vector< VECTOR2I > points
std::vector< VECTOR2I > points
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_ENTRY_SIDE Side
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_ELECTRICAL electrical
ASCH_RECORD_ORIENTATION orientation
std::vector< VECTOR2I > points
ASCH_POLYLINE_LINESTYLE LineStyle
std::vector< VECTOR2I > Points
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_POWER_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_ENTRY_SIDE side
ASCH_RECORD_ORIENTATION orientation
std::vector< VECTOR2I > Points
wxString componentdescription
ASCH_TEXT_FRAME_ALIGNMENT Alignment
std::vector< VECTOR2I > points
constexpr int MilsToIU(int mils) const
A simple container for sheet instance information.
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition of file extensions used in Kicad.