80 static wxRegEx automatic( wxS(
"^[Nn][0-9]+(![^!]*!)?$" ), wxRE_ADVANCED );
82 return !automatic.Matches( aName );
88 std::set<wxString> names;
90 for(
const std::unique_ptr<OBJECT>& obj : aDoc.
Objects )
97 names.insert( net->
Name.Upper() );
101 for(
const wxString&
name : names )
123 int64_t x =
static_cast<int64_t
>( aLocal.
X ) - aSym.
OriginX;
124 int64_t y =
static_cast<int64_t
>( aLocal.
Y ) - aSym.
OriginY;
132 if( std::hypot(
static_cast<double>( x ),
static_cast<double>( y ) ) > INT32_MAX )
133 THROW_IO_ERROR( wxString::Format(
_(
"Easy-PC symbol %s has a point too far from its origin" ), aSym.
Name ) );
135 PointRotate(
static_cast<double>( x ),
static_cast<double>( y ), aInst.
Angle, 0.0, 0.0, rx, ry );
137 int64_t px =
static_cast<int64_t
>( aInst.
Position.
X ) + rx;
138 int64_t py =
static_cast<int64_t
>( aInst.
Position.
Y ) + ry;
140 if( px < INT32_MIN || px > INT32_MAX || py < INT32_MIN || py > INT32_MAX )
141 THROW_IO_ERROR( wxString::Format(
_(
"Easy-PC symbol %s has a point outside the design" ), aSym.
Name ) );
143 return POINT32{
static_cast<int32_t
>( px ),
static_cast<int32_t
>( py ) };
180 std::vector<const SOURCE_ATTRIBUTE*> out;
185 auto over = std::find_if( own.begin(), own.end(),
188 return aMine->AttributeName && attr->AttributeName
189 && aMine->AttributeName->Name.CmpNoCase( attr->AttributeName->Name ) == 0;
192 out.push_back( over != own.end() ? *over : attr );
197 if( std::find( out.begin(), out.end(), mine ) == out.end() )
198 out.push_back( mine );
207 const wxString& aName )
211 if( attr->AttributeName && attr->AttributeName->Name.CmpNoCase( aName ) == 0 )
215 return wxEmptyString;
231 std::vector<VALUE_LINE> lines;
235 auto add = [&](
FIELD_T aField,
const wxString& aName,
const wxString& aText )
237 if( !aText.IsEmpty() )
238 lines.push_back( { aField, aName, aText } );
259 if( !( aVp.
Types & kind ) )
264 if( !attr->AttributeName
266 : attr->AttributeName->Name.CmpNoCase( aVp.
Attribute ) != 0 ) )
271 bool isValue = attr->AttributeName->Name.CmpNoCase( wxS(
"Value" ) ) == 0;
280static wxString
joinLines(
const std::vector<VALUE_LINE>& aLines )
285 whole += ( whole.IsEmpty() ? wxString() : wxString( wxS(
"\n" ) ) ) + line.Text;
324static int32_t
floorTo( int64_t aValue, int32_t aGrid )
326 int64_t q = aValue / aGrid;
328 if( aValue % aGrid < 0 )
331 return static_cast<int32_t
>( q * aGrid );
338 int64_t minX = INT64_MAX, minY = INT64_MAX, maxX = INT64_MIN, maxY = INT64_MIN;
340 auto add = [&]( int64_t aX, int64_t aY )
342 minX = std::min( minX, aX );
343 minY = std::min( minY, aY );
344 maxX = std::max( maxX, aX );
345 maxY = std::max( maxY, aY );
348 auto addShape = [&](
const OBJECT* aShape )
353 add( seg->X, seg->Y );
377 add( node->Position.X, node->Position.Y );
380 addText( *
name, net->Name );
384 addShape( conn->Track );
398 add( inst->Position.X, inst->Position.Y );
430 add(
text->Position.X,
text->Position.Y );
435 addShape( copper->Shape );
439 addShape( bus->Shape );
443 add( term->Position.X, term->Position.Y );
444 add( term->BusEndPosition.X, term->BusEndPosition.Y );
449 minX = maxX = minY = maxY = 0;
477 m_screen->SetTitleBlock( titleBlock );
493 m_screen->Append( shape.release() );
502 int c = angle == 180000 ? -1 : ( angle == 90000 || angle == 270000 ? 0 : 1 );
503 int s = angle == 90000 ? 1 : ( angle == 270000 ? -1 : 0 );
520 if( !
pin->PcbSymbolPin.IsEmpty() &&
pin->PcbSymbolPin != wxS(
"-1" ) )
524 for( int32_t
pad : map->PcbSymbolPins )
538 std::map<wxString, const SOURCE_COMPONENT*> libNames;
539 std::map<wxString, const SOURCE_SYMBOL*> designSymbols;
543 designSymbols.emplace( sym->Name, sym );
550 THROW_IO_ERROR( wxString::Format(
_(
"Component instance %s has no schematic component" ),
comp->Name ) );
559 source.Gates.assign( gates.size(),
nullptr );
566 if( inst->Gate >= 0 && inst->Gate <
static_cast<int>( gates.size() ) )
571 for(
size_t g = 0; g < gates.size(); ++g )
576 if(
auto it = designSymbols.find( gates[g]->Symbol ); it != designSymbols.end() )
577 source.Gates[g] = it->second;
579 source.Gates[g] = pit->second;
599 bool power = scmOnly && gates.size() == 1 && pinCount < 2 && signalNet &&
IsNamedNet( signalNet->
Name );
601 wxString netName = power ?
m_names.Name( signalNet->
Name ) : wxString();
603 wxString base = libName;
606 for(
int n = 2; libNames.count( libName ) && libNames[libName] != part; ++n )
607 libName = wxString::Format( wxS(
"%s_%d" ), base, n );
609 libNames[libName] = part;
616 libSymbol->SetGlobalPower();
630 libSymbol->GetValueField().SetText(
ToKiCadMarkup( netName ) );
633 for(
SCH_PIN*
pin : libSymbol->GetGraphicalPins( 0, 0 ) )
648 m_reporter->Report( wxString::Format(
_(
"Unplaced gate %d of %s has connected pins and is placed "
649 "at its stored position" ),
650 inst->Gate + 1,
comp->Name ),
654 int unit = inst->Gate >= 0 ? inst->Gate + 1 : 1;
656 wxString ref = power ? wxString::Format( wxS(
"#PWR%04d" ), ++
m_powerCount ) :
comp->Name;
662 symbol->
SetRef( &aSheetPath, ref );
699 aInst.
Gate >= 0 && aInst.
Gate <
static_cast<int>( gates.size() ) ? gates[aInst.
Gate] :
nullptr;
703 if( aText.IsEmpty() )
718 int terminal = freePad->
Number - 1;
723 if( gate && terminal >= 0 && terminal <
static_cast<int>( gate->
PinNames.size() ) )
736 addText( pinName, *vp );
738 addText( resolved.
Display, *vp );
750 addText( pinName,
placedText( aInst, *sym, *def ) );
753 if( sym && number && number->
Visible )
766 std::set<SCH_FIELD*> placed;
769 field.SetVisible(
false );
778 std::vector<VALUE_LINE> lines =
valueLines( *vp, aComp, *part, aInst );
783 double angle = drawnAngle *
M_PI / 180000.0;
784 bool hasOther = std::any_of( lines.begin(), lines.end(),
787 return aLine.Field != FIELD_T::REFERENCE;
790 for(
size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex )
803 if( !field || placed.count( field ) )
812 VECTOR2D down( std::sin( angle ) * pitch * lineIndex, -std::cos( angle ) * pitch * lineIndex );
825 placed.insert( field );
834 if( aA.
A == aA.
B || aB.
A == aB.
B )
839 auto cross = [&](
const VECTOR2I& aPoint )
842 return d.
x * r.
y - d.
y * r.
x;
845 auto param = [&](
const VECTOR2I& aPoint )
848 return d.
x * r.
x + d.
y * r.
y;
851 if( cross( aB.
A ) != 0 || cross( aB.
B ) != 0 )
854 int64_t lo = std::max<int64_t>( 0, std::min( param( aB.
A ), param( aB.
B ) ) );
855 int64_t hi = std::min<int64_t>( d.
x * d.
x + d.
y * d.
y, std::max( param( aB.
A ), param( aB.
B ) ) );
864 std::vector<std::pair<VECTOR2I, const SOURCE_NET*>> points;
865 std::map<VECTOR2I, std::set<const SOURCE_NET*>> netsAt;
866 std::map<int, std::vector<size_t>> pointsByX;
867 std::map<int, std::vector<size_t>> pointsByY;
872 points.emplace_back(
toSheet( node->Position ), net );
885 freePad && !
pad->Node )
886 points.emplace_back(
toSheet(
placePoint( *inst, *sym, freePad->Position ) ),
nullptr );
891 for(
size_t i = 0; i < points.size(); ++i )
893 netsAt[points[i].first].insert( points[i].second );
894 pointsByX[points[i].first.x].push_back( i );
895 pointsByY[points[i].first.y].push_back( i );
900 for(
const auto& [pt, nets] : netsAt )
902 if( nets.size() > 1 )
909 std::vector<size_t> out;
910 const std::map<int, std::vector<size_t>>*
index = aSeg.A.x == aSeg.B.x ? &pointsByX
911 : aSeg.A.y == aSeg.B.y ? &pointsByY
913 int line =
index == &pointsByX ? aSeg.A.x : aSeg.A.y;
917 out.resize( points.size() );
918 std::iota( out.begin(), out.end(), 0 );
922 for(
int c = line - 1; c <= line + 1; ++c )
924 if(
auto it =
index->find( c ); it !=
index->end() )
925 out.insert( out.end(), it->second.begin(), it->second.end() );
928 std::sort( out.begin(), out.end() );
933 using SPANS = std::vector<std::pair<SEG, int>>;
935 std::map<const SOURCE_NET*, int> netIndex;
936 std::map<std::pair<int, int>, SPANS> spansOnLine;
938 std::set<VECTOR2I> bareEnds;
942 int index =
static_cast<int>( netIndex.size() );
943 netIndex[net] =
index;
950 if( junction && !junction->
Style )
951 bareEnds.insert(
toSheet( node->Position ) );
957 std::vector<const SOURCE_SEGMENT*> verts =
958 track ?
ShapeVertices( *track ) : std::vector<const SOURCE_SEGMENT*>();
960 for(
size_t i = 0; i + 1 < verts.size(); ++i )
962 SEG seg(
toSheet( verts[i]->
X, verts[i]->Y ),
toSheet( verts[i + 1]->
X, verts[i + 1]->Y ) );
964 allSpans.emplace_back( seg,
index );
966 if( seg.
A.
x == seg.
B.
x )
967 spansOnLine[{ 0, seg.
A.
x }].emplace_back( seg,
index );
968 else if( seg.
A.
y == seg.
B.
y )
969 spansOnLine[{ 1, seg.
A.
y }].emplace_back( seg,
index );
974 auto overlapsEarlierNet = [&](
const SEG& aSeg,
int aNet )
976 static const SPANS none;
977 const SPANS* spans = &allSpans;
980 if( aSeg.
A.
x == aSeg.
B.
x || aSeg.
A.
y == aSeg.
B.
y )
982 auto it = spansOnLine.find( aSeg.
A.
x == aSeg.
B.
x ? std::make_pair( 0, aSeg.
A.
x )
983 : std::make_pair( 1, aSeg.
A.
y ) );
984 spans = it == spansOnLine.end() ? &none : &it->second;
987 return std::any_of( spans->begin(), spans->end(),
988 [&](
const std::pair<SEG, int>& aSpan )
990 return aSpan.second < aNet && collinearOverlap( aSeg, aSpan.first );
999 std::vector<const SOURCE_SEGMENT*> verts =
1000 track ?
ShapeVertices( *track ) : std::vector<const SOURCE_SEGMENT*>();
1002 for(
size_t i = 0; i + 1 < verts.size(); ++i )
1013 auto retract = [&](
VECTOR2I& aPt,
const VECTOR2I& aInward,
bool aIsTrackEnd )
1015 const std::set<const SOURCE_NET*>& nets = netsAt[aPt];
1017 if( !aIsTrackEnd || !bareEnds.count( aPt ) || nets.empty()
1018 || ( nets.size() == 1 && *nets.begin() == net ) )
1023 wxString msg =
_(
"A wire of net %s ends on a connection of another net at "
1024 "(%.4f, %.4f) mm; it stops %d nm short" );
1027 wxString::Format( msg, net->Name, aPt.
x / 10000.0, aPt.
y / 10000.0,
DETOUR * 100 ),
1032 retract( start, along, i == 0 );
1033 retract(
end, -along, i + 2 == verts.size() );
1035 std::vector<VECTOR2I>
path = { start };
1036 bool overlaps = overlapsEarlierNet(
SEG( start,
end ), netIndex.at( net ) );
1041 m_reporter->Report( wxString::Format(
_(
"A wire of net %s is drawn over a wire of another "
1042 "net; it is offset by %d nm" ),
1043 net->Name,
DETOUR * 100 ),
1045 path.push_back( start + across );
1046 path.push_back(
end + across );
1050 std::vector<VECTOR2I> crossings;
1052 for(
size_t k : overlaps ? std::vector<size_t>() :
candidates(
SEG( start,
end ) ) )
1054 const auto& [pt, other] = points[k];
1056 if( other != net && pt != start && pt !=
end &&
SEG( start,
end ).Contains( pt ) )
1057 crossings.push_back( pt );
1060 std::sort( crossings.begin(), crossings.end(),
1063 return ( l - start ).SquaredEuclideanNorm() < ( r - start ).SquaredEuclideanNorm();
1066 for(
const VECTOR2I& pt : crossings )
1068 path.insert(
path.end(), { pt - along, pt - along + across, pt + along + across, pt + along } );
1070 wxString msg =
_(
"A wire of net %s passes over a connection of another net at "
1071 "(%.4f, %.4f) mm; it detours by %d nm to stay unconnected" );
1074 wxString::Format( msg, net->Name, pt.x / 10000.0, pt.y / 10000.0,
DETOUR * 100 ),
1080 for(
size_t k = 0; k + 1 <
path.size(); ++k )
1100 if( junction && junction->
Style )
1131 bool vertical = ( rot >= 45000 && rot < 135000 ) || ( rot >= 225000 && rot < 315000 );
1132 int reading = rot >= 135000 && rot < 315000 ? -1 : 1;
1135 double halfWidth = style ? style->
Height * 0.6 * aText.length() / 2.0 : 0.0;
1169 std::map<const SOURCE_NODE*, const SOURCE_NODE*> root;
1176 while( root[r] != r )
1180 n = std::exchange( root[n], r );
1193 if( a && b && conn->Track && root.count( a ) && root.count( b ) )
1197 std::set<const SOURCE_NODE*> named;
1198 std::map<const SOURCE_NODE*, const SOURCE_NODE*> hiddenLabelOf;
1199 std::vector<const SOURCE_NODE*> pieces;
1207 if( std::find( pieces.begin(), pieces.end(), piece ) == pieces.end() )
1208 pieces.push_back( piece );
1211 named.insert( piece );
1216 place(
name, *node, label );
1217 named.insert( piece );
1219 else if( label && free && !hiddenLabelOf.count( piece ) )
1221 hiddenLabelOf[piece] = node;
1239 auto hidden = hiddenLabelOf.find( piece );
1240 const SOURCE_NODE* at = hidden != hiddenLabelOf.end() ? hidden->second :
nullptr;
1242 if( named.count( piece ) )
1248 && ( !at || rank( node ) < rank( at ) ) )
1267 if( !part || !part->
Board )
1272 std::map<wxString, const SOURCE_NET*> netOfPin;
1281 if( freePad && net )
1285 netOfPin.emplace(
pin.Number, net );
1299 if( !freePad ||
pad->Node )
1303 auto it =
pin.Mapped ? netOfPin.find(
pin.Number ) : netOfPin.end();
1305 if( it == netOfPin.end() )
1323 std::vector<const SOURCE_SEGMENT*> verts =
1324 shape ?
ShapeVertices( *shape ) : std::vector<const SOURCE_SEGMENT*>();
1326 for(
size_t i = 0; i + 1 < verts.size(); ++i )
1353 std::vector<wxString> members;
1364 std::vector<const SOURCE_SEGMENT*> verts =
ShapeVertices( aShape );
1366 if( members.empty() || verts.empty() )
1371 for( wxUniChar ch : aBus.
Name )
1372 base += wxIsalnum( ch ) ? ch : wxUniChar(
'_' );
1374 if( base.IsEmpty() )
1375 base = wxS(
"BUS" );
1377 wxString aliasName = base;
1379 for(
int i = 2;
m_schematic->GetBusAlias( aliasName ); ++i )
1380 aliasName = wxString::Format( wxS(
"%s_%d" ), base, i );
1382 std::shared_ptr<BUS_ALIAS> alias = std::make_shared<BUS_ALIAS>();
1383 alias->SetName( aliasName );
1384 alias->SetMembers( members );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr coord_type GetLeft() const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
void buildBuses(const SOURCE_DESIGN &aDesign)
void placePinItems(const SOURCE_COMPONENT &aPart, const SOURCE_SYMBOL_INSTANCE &aInst, const SCH_FRAME &aFrame)
std::map< wxString, const SOURCE_SYMBOL * > m_projectSymbols
by name, first sheet wins
void placeFields(SCH_SYMBOL &aSymbol, const SOURCE_COMPONENT_INSTANCE &aComp, const SOURCE_SYMBOL_INSTANCE &aInst, bool aPower, const SCH_FRAME &aFrame)
void addBusAlias(const SOURCE_BUS &aBus, const SOURCE_SHAPE &aShape)
std::set< const SOURCE_NODE * > m_powerNodes
const SOURCE_DESIGN * m_design
void buildWires(const SOURCE_DESIGN &aDesign)
std::set< wxString > m_labelledNets
upper-cased nets a label names
SCH_BUILDER(SCHEMATIC *aSchematic, const SCH_NET_NAMES &aNames, REPORTER *aReporter)
void buildSymbols(const SOURCE_DESIGN &aDesign, const SCH_SHEET_PATH &aSheetPath)
void BuildSheet(const DESIGN_DOCUMENT &aDoc, SCH_SHEET *aSheet, const SCH_SHEET_PATH &aSheetPath)
SCH_LABEL_BASE * addLabel(const wxString &aName, const VECTOR2I &aAt)
A local label, global when the name crosses sheets or a global power symbol names it.
VECTOR2I toSheet(int32_t aX, int32_t aY) const
void SetProjectSymbols(const std::vector< const DESIGN_DOCUMENT * > &aDocs)
Symbols of every sheet, for gates placed on a sheet other than the one being built.
std::set< VECTOR2I > m_sharedPoints
points where connections of different nets meet
void buildLabels(const SOURCE_DESIGN &aDesign)
void computeOffset(const SOURCE_DESIGN &aDesign)
int32_t m_originX
design point at the sheet's top left corner
void buildCommonPinCopies(const SOURCE_DESIGN &aDesign)
std::set< wxString > m_powerNets
upper-cased nets a power symbol names
const SCH_NET_NAMES & m_names
Project-wide net naming: a user name takes the spelling of its first occurrence.
void AddSheet(const DESIGN_DOCUMENT &aDoc)
bool Shared(const wxString &aName) const
A user name used on more than one sheet, which is one net across the project.
wxString Name(const wxString &aStoredName) const
std::map< wxString, int > m_sheetCount
std::map< wxString, wxString > m_canonical
upper-cased name to first spelling
bool CanMeasure() const
False for a TrueType style; the measuring calls throw IO_ERROR for one.
BOX2I TextBox(const wxString &aText, const VECTOR2I &aAnchor, int32_t aAngle, bool aMirrored, int aHAlign, int aVAlign=TEXT_V_BASELINE) const
Every line's cell, inflated by half the pen width, mirrored about the anchor and bounded after rotati...
bool IsHorizontal() const
virtual VECTOR2I GetTextPos() const
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
virtual EDA_ANGLE GetTextAngle() const
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
A logical library item identifier and consists of various portions much like a URI.
Define a library symbol object.
A pure virtual class used to derive REPORTER objects from.
void SetSize(const VECTOR2I &aSize)
Class for a wire to bus entry.
void SetEffectiveHorizJustify(GR_TEXT_H_ALIGN_T)
void SetEffectiveVertJustify(GR_TEXT_V_ALIGN_T)
void SetPosition(const VECTOR2I &aPosition) override
void SetText(const wxString &aText) override
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetLineWidth(const int aSize)
void SetEndPoint(const VECTOR2I &aPosition)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_SCREEN * GetScreen() const
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetExcludedFromBOM(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
void SetExcludedFromBoard(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Spin style for labels of all kinds on schematics.
void SetTransform(const TRANSFORM &aTransform)
const TRANSFORM & GetTransform() const
Hold the information shown in the lower right corner of a plot, printout, or editing view.
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Placed instances and connectivity: component, symbol and pad instances, nets, nodes,...
Shapes, vertices and the free-standing drawn items.
Free pads, apart because they derive from a connectivity class.
Symbols, components and gates, embedded in designs or the single object of a library item stream.
The design document and the design parameter tables the importers use.
Design items, attributes, styles, layers, net classes and spacings.
Title block and page size, shared by the board and schematic builders.
Loading designs, library items and projects.
Builds KiCad sheets from Easy-PC / DesignSpark schematic designs.
Schematic graphics, texts and symbols shared by the sheet builder and the symbol libraries,...
Easy-PC's text measurement, so text lands where Easy-PC draws it.
Design units of 100 nm and angles of thousandths of a degree, anticlockwise from +X with Y up.
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
bool TextStaysUpright(const SOURCE_DESIGN &aDesign, bool aSchematic)
Whether aDesign's text is drawn upright: the design's flag, which old schematics imply,...
static int32_t floorTo(int64_t aValue, int32_t aGrid)
GATE_TERMINAL ResolveTerminal(const SOURCE_PCB_COMPONENT *aPcb, int aGate, int aTerminal)
Terminal aTerminal (0-based) of gate aGate; formats before 9000 map a bare pad number,...
bool IsNamedNet(const wxString &aName)
True unless aName is an automatic net name (N or n and digits, an optional !sheet!...
std::unique_ptr< SCH_TEXT > ConvertFreeText(const SOURCE_FREE_TEXT &aText, const SCH_FRAME &aFrame, SCH_LAYER_ID aLayer, int aUnit, bool aKeepUpright)
int32_t UprightRotation(int32_t aAngle, bool aKeepUpright)
With text kept upright, an angle above 135 and up to 305 degrees turns by 180.
static POINT32 placePoint(const SOURCE_SYMBOL_INSTANCE &aInst, const SOURCE_SYMBOL &aSym, const POINT32 &aLocal)
Symbol point to design point: subtract the symbol origin, mirror in X, rotate anticlockwise,...
static wxString attributeValue(const SOURCE_COMPONENT_INSTANCE &aComp, const SOURCE_COMPONENT &aPart, const wxString &aName)
The value of the part's first attribute named aName, or empty.
PAGE_INFO PageForExtents(const BOX2L &aExtentsNm)
Easy-PC stores no page size, so the first of A4 to A0 then A to E, landscape before portrait,...
std::unique_ptr< LIB_SYMBOL > ConvertComponentSymbol(const SCH_COMPONENT_SOURCE &aSrc, const LIB_ID &aId)
One unit per gate in symbol-local coordinates, zero-length passive pins at the pads,...
static bool isDrawn(const SOURCE_SYMBOL_INSTANCE &aInst)
Gates the import draws: placed ones, and unplaced ones whose pins are still on nets.
@ SUPPRESS_SCM_PCB_TRANSLATION
bool DrawsUpright(const SOURCE_TEXT_POSITION &aPos, bool aKeepUpright)
True when a design that keeps text upright turns aPos about the far end of its first line.
void PointRotate(double aPx, double aPy, int32_t aAngle, double aCx, double aCy, int32_t &aOutX, int32_t &aOutY)
Rotate aPx, aPy anticlockwise by aAngle about aCx, aCy as Easy-PC places points: in double with exact...
constexpr double PAGE_MARGIN_MM
Margin added on every side of the drawn extents before choosing a page, in millimetres.
static SOURCE_TEXT_POSITION placedText(const SOURCE_SYMBOL_INSTANCE &aInst, const SOURCE_SYMBOL &aSym, const SOURCE_TEXT_POSITION &aLocal)
A symbol-local text position placed on the sheet with the instance transform.
static constexpr int32_t SHEET_ORIGIN_GRID
The sheet origin snaps to 0.1 inch, keeping items on Easy-PC grids on KiCad's 50 mil grid.
std::vector< std::unique_ptr< SCH_SHAPE > > ConvertShapeItem(const SOURCE_SHAPE_ITEM &aItem, const SCH_FRAME &aFrame, SCH_LAYER_ID aLayer, int aUnit)
A shape item with its own line style and fill.
static const SOURCE_NET * netOf(const OBJECT *aNode)
static constexpr int32_t DETOUR
Offset that keeps a wire off another net's connection point, far below drawing resolution.
static std::vector< VALUE_LINE > valueLines(const SOURCE_VALUE_POSITION &aVp, const SOURCE_COMPONENT_INSTANCE &aComp, const SOURCE_COMPONENT &aPart, const SOURCE_SYMBOL_INSTANCE &aInst)
@ SCH_SYMBOL
one item stream of a Schematic Symbol Library
std::vector< T * > TypedItems(const OBJECT *aList)
The items of ListItems that are a T, in order.
static bool collinearOverlap(const SEG &aA, const SEG &aB)
Two segments on one line sharing more than a point.
static constexpr int32_t PAGE_MARGIN
static bool isScmOnly(const SOURCE_COMPONENT &aPart)
Schematic-only part: no package, an empty package name, or no gate pin mapped to a pad.
constexpr int32_t NormalizeAngle(int32_t aAngle)
Wrap an angle into [0, ANGLE_FULL_TURN)
wxString ToKiCadMarkup(const wxString &aText)
A displayed string in KiCad's markup.
static SPIN_STYLE labelSpin(const SOURCE_NET_NAME &aName, const SOURCE_NODE &aNode, const wxString &aText)
Label orientation from the stored text rotation and alignment, judged by the middle of the text.
VECTOR2I TextSize(const SOURCE_TEXT_STYLE &aStyle)
KiCad text size for a source text style: its height as the width, its capital height as the height.
@ VALUE_ATTRIBUTE
the attribute the value position names
void ApplyTextPosition(EDA_TEXT &aText, const SOURCE_TEXT_POSITION &aPos, const SCH_FRAME &aFrame, bool aKeepUpright, const wxString &aMeasured)
Place any KiCad text as the source position says: anchor, angle, mirror, justification and style.
static const SOURCE_TEXT_STYLE * defaultTextStyle(const SOURCE_DESIGN &aDesign)
static wxString joinLines(const std::vector< VALUE_LINE > &aLines)
static TRANSFORM placementTransform(int32_t aAngle, bool aMirrored)
KiCad transform for a stored placement: mirror in X, then rotate anticlockwise (Y up)
std::vector< const SOURCE_SEGMENT * > ShapeVertices(const SOURCE_SHAPE &aShape)
A shape's vertices in drawing order, following next references for formats 1 and 2.
static std::vector< const SOURCE_ATTRIBUTE * > partAttributes(const SOURCE_COMPONENT_INSTANCE &aComp, const SOURCE_COMPONENT &aPart)
Package attributes then the instance's own, an instance attribute overriding the package's of the sam...
void FillTitleBlock(const DESIGN_DOCUMENT &aDoc, TITLE_BLOCK &aTitleBlock)
Fill a title block from the design's SummaryInformation property set: title from Title,...
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
std::unique_ptr< OBJECT > Design
design root, not in the load array
std::vector< std::unique_ptr< OBJECT > > Objects
What a package's gate map says about one gate terminal.
wxString Display
the number shown beside the pin, the part before '=' when there is one
Root of every deserialized object.
A point read as two int32 values.
Everything one component LIB_SYMBOL is made from.
Design to KiCad mapping: X shifted, Y negated about the origin.
VECTOR2I Map(int64_t aX, int64_t aY) const
std::vector< OBJECT * > Nets
wxString Name
reference designator
SOURCE_SCM_COMPONENT * Schematic
SOURCE_PCB_COMPONENT * Board
OBJECT * Attributes
attribute array
OBJECT * Parent
null is the document in a design, nothing in a library item
The document: OLE items, then the design.
SOURCE_DEFAULTS * Defaults
OBJECT * ComponentInstances
Every drawn shape, pour and dimension part.
A pad of a symbol definition.
One gate's terminals to footprint pads.
A schematic symbol and its pin names.
std::vector< wxString > PinNames
terminal t is the symbol pad numbered t + 1
A schematic net label owned by a node.
OBJECT * GateMaps
one per schematic gate in order
wxString Symbol
footprint name
Placed pin names and numbers.
OBJECT * Definition
the pin name or number instantiated
A placed footprint (gate -1) or a placed schematic gate.
OBJECT * ValuePositions
below 10003 built from the stored symbol name
bool Mirrored
PCB bottom side.
Footprints and schematic symbols alike.
OBJECT * Shapes
free copper list
OBJECT * Texts
free text list
OBJECT * Pads
free pad list
int32_t Height
the accessor is GetWidth but it is the text height
int32_t InterlineHeightPercent
OBJECT * Style
track style of the span leaving this vertex
One line of the text a value position shows.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
static std::vector< int > candidates(const SEGMENT_INDEX &aIndex, const SEG &aQuery, int aPadding)
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
VECTOR2< int64_t > VECTOR2L