Formatting sch_eagle_plugin.cpp only
No code changes, just adjusting to match code style
This commit is contained in:
parent
86f9ed1dd9
commit
1e843922cd
|
@ -20,43 +20,42 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <properties.h>
|
||||
#include <kiway.h>
|
||||
#include <properties.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include <sch_junction.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <sch_screen.h>
|
||||
#include <class_library.h>
|
||||
#include <class_libentry.h>
|
||||
#include <lib_item.h>
|
||||
#include <lib_id.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_connection.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include <class_library.h>
|
||||
#include <eagle_parser.h>
|
||||
#include <gr_text.h>
|
||||
#include <lib_arc.h>
|
||||
#include <lib_circle.h>
|
||||
#include <lib_rectangle.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <lib_id.h>
|
||||
#include <lib_item.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <lib_rectangle.h>
|
||||
#include <lib_text.h>
|
||||
#include <sch_text.h>
|
||||
#include <gr_text.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <eagle_parser.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_connection.h>
|
||||
#include <sch_eagle_plugin.h>
|
||||
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include <sch_text.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <ws_draw_item.h>
|
||||
|
||||
|
||||
// Eagle schematic axes are aligned with x increasing left to right and Y increasing bottom to top
|
||||
|
@ -239,8 +238,8 @@ static COMPONENT_ORIENTATION_T kiCadComponentRotation( float eagleDegrees )
|
|||
|
||||
|
||||
// Calculate text alignment based on the given Eagle text alignment parameters.
|
||||
static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment,
|
||||
int aRelDegress, bool aMirror, bool aSpin, int aAbsDegress )
|
||||
static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment, int aRelDegress,
|
||||
bool aMirror, bool aSpin, int aAbsDegress )
|
||||
{
|
||||
int align = aEagleAlignment;
|
||||
|
||||
|
@ -371,8 +370,8 @@ int SCH_EAGLE_PLUGIN::GetModifyHash() const
|
|||
}
|
||||
|
||||
|
||||
SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||
SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway, SCH_SHEET* aAppendToMe,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
wxASSERT( !aFileName || aKiway != NULL );
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||
|
@ -384,8 +383,8 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
|||
m_kiway = aKiway;
|
||||
|
||||
if( !xmlDocument.Load( m_filename.GetFullPath() ) )
|
||||
THROW_IO_ERROR( wxString::Format( _( "Unable to read file \"%s\"" ),
|
||||
m_filename.GetFullPath() ) );
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Unable to read file \"%s\"" ), m_filename.GetFullPath() ) );
|
||||
|
||||
// Delete on exception, if I own m_rootSheet, according to aAppendToMe
|
||||
unique_ptr<SCH_SHEET> deleter( aAppendToMe ? nullptr : m_rootSheet );
|
||||
|
@ -413,7 +412,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
|||
|
||||
m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
m_properties = std::make_unique<PROPERTIES>();
|
||||
(*m_properties)[ SCH_LEGACY_PLUGIN::PropBuffering ] = "";
|
||||
( *m_properties )[SCH_LEGACY_PLUGIN::PropBuffering] = "";
|
||||
|
||||
/// @note No check is being done here to see if the existing symbol library exists so this
|
||||
/// will overwrite the existing one.
|
||||
|
@ -424,12 +423,12 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
|||
wxString libTableUri = "${KIPRJMOD}/" + getLibFileName().GetFullName();
|
||||
|
||||
// Add the new library to the project symbol library table.
|
||||
libTable->InsertRow( new SYMBOL_LIB_TABLE_ROW( getLibName(), libTableUri,
|
||||
wxString( "Legacy" ) ) );
|
||||
libTable->InsertRow(
|
||||
new SYMBOL_LIB_TABLE_ROW( getLibName(), libTableUri, wxString( "Legacy" ) ) );
|
||||
|
||||
// Save project symbol library table.
|
||||
wxFileName fn( m_kiway->Prj().GetProjectPath(),
|
||||
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
wxFileName fn(
|
||||
m_kiway->Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
|
||||
// So output formatter goes out of scope and closes the file before reloading.
|
||||
{
|
||||
|
@ -578,7 +577,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
|||
std::unique_ptr<SCH_SHEET> sheet( new SCH_SHEET( pos ) );
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( m_kiway );
|
||||
|
||||
sheet->SetTimeStamp( GetNewTimeStamp() - i ); // minus the sheet index to make it unique.
|
||||
sheet->SetTimeStamp(
|
||||
GetNewTimeStamp() - i ); // minus the sheet index to make it unique.
|
||||
sheet->SetParent( m_rootSheet->GetScreen() );
|
||||
sheet->SetScreen( screen );
|
||||
sheet->GetScreen()->SetFileName( sheet->GetFileName() );
|
||||
|
@ -638,7 +638,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
|||
std::unique_ptr<SCH_COMPONENT> component( new SCH_COMPONENT( *origCmp ) );
|
||||
component->SetUnitSelection( &sheetpath, unit );
|
||||
component->SetUnit( unit );
|
||||
component->SetTimeStamp( EagleModuleTstamp( reference, origCmp->GetField( VALUE )->GetText(), unit ) );
|
||||
component->SetTimeStamp(
|
||||
EagleModuleTstamp( reference, origCmp->GetField( VALUE )->GetText(), unit ) );
|
||||
component->SetOrientation( 0 );
|
||||
component->AddHierarchicalReference( sheetpath.Path(), reference, unit );
|
||||
|
||||
|
@ -805,7 +806,8 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
if( item->Type() != SCH_COMPONENT_T )
|
||||
continue;
|
||||
|
||||
addImplicitConnections( static_cast<SCH_COMPONENT*>( item ), m_currentSheet->GetScreen(), true );
|
||||
addImplicitConnections(
|
||||
static_cast<SCH_COMPONENT*>( item ), m_currentSheet->GetScreen(), true );
|
||||
}
|
||||
|
||||
m_connPoints.clear();
|
||||
|
@ -819,8 +821,8 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& netName,
|
||||
const wxString& aNetClass )
|
||||
void SCH_EAGLE_PLUGIN::loadSegments(
|
||||
wxXmlNode* aSegmentsNode, const wxString& netName, const wxString& aNetClass )
|
||||
{
|
||||
// Loop through all segments
|
||||
wxXmlNode* currentSegment = aSegmentsNode->GetChildren();
|
||||
|
@ -887,7 +889,8 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n
|
|||
{
|
||||
SCH_TEXT* label = loadLabel( segmentAttribute, netName );
|
||||
screen->Append( label );
|
||||
wxASSERT( segDesc.labels.empty() || segDesc.labels.front()->GetText() == label->GetText() );
|
||||
wxASSERT( segDesc.labels.empty()
|
||||
|| segDesc.labels.front()->GetText() == label->GetText() );
|
||||
segDesc.labels.push_back( label );
|
||||
labelled = true;
|
||||
}
|
||||
|
@ -1002,15 +1005,15 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN
|
|||
|
||||
if( elabel.rot->mirror
|
||||
&& ( label->GetLabelSpinStyle() == 0 || label->GetLabelSpinStyle() == 2 ) )
|
||||
label->SetLabelSpinStyle( (label->GetLabelSpinStyle() + 2 ) % 4 );
|
||||
label->SetLabelSpinStyle( ( label->GetLabelSpinStyle() + 2 ) % 4 );
|
||||
}
|
||||
|
||||
return label.release();
|
||||
}
|
||||
|
||||
|
||||
std::pair<VECTOR2I, const SEG*> SCH_EAGLE_PLUGIN::findNearestLinePoint( const wxPoint& aPoint,
|
||||
const std::vector<SEG>& aLines ) const
|
||||
std::pair<VECTOR2I, const SEG*> SCH_EAGLE_PLUGIN::findNearestLinePoint(
|
||||
const wxPoint& aPoint, const std::vector<SEG>& aLines ) const
|
||||
{
|
||||
VECTOR2I nearestPoint;
|
||||
const SEG* nearestLine = nullptr;
|
||||
|
@ -1021,7 +1024,7 @@ std::pair<VECTOR2I, const SEG*> SCH_EAGLE_PLUGIN::findNearestLinePoint( const wx
|
|||
for( const SEG& line : aLines )
|
||||
{
|
||||
auto testpoint = line.A;
|
||||
d = sqrt( abs( ( (aPoint.x - testpoint.x) ^ 2 ) + ( (aPoint.y - testpoint.y) ^ 2 ) ) );
|
||||
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
|
||||
|
||||
if( d < mindistance )
|
||||
{
|
||||
|
@ -1031,7 +1034,7 @@ std::pair<VECTOR2I, const SEG*> SCH_EAGLE_PLUGIN::findNearestLinePoint( const wx
|
|||
}
|
||||
|
||||
testpoint = line.Center();
|
||||
d = sqrt( abs( ( (aPoint.x - testpoint.x) ^ 2 ) + ( (aPoint.y - testpoint.y) ^ 2 ) ) );
|
||||
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
|
||||
|
||||
if( d < mindistance )
|
||||
{
|
||||
|
@ -1041,7 +1044,7 @@ std::pair<VECTOR2I, const SEG*> SCH_EAGLE_PLUGIN::findNearestLinePoint( const wx
|
|||
}
|
||||
|
||||
testpoint = line.B;
|
||||
d = sqrt( abs( ( (aPoint.x - testpoint.x) ^ 2 ) + ( (aPoint.y - testpoint.y) ^ 2 ) ) );
|
||||
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
|
||||
|
||||
if( d < mindistance )
|
||||
{
|
||||
|
@ -1097,13 +1100,13 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
package = p->second;
|
||||
}
|
||||
|
||||
LIB_PART* part = m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname,
|
||||
m_properties.get() );
|
||||
LIB_PART* part =
|
||||
m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname, m_properties.get() );
|
||||
|
||||
if( !part )
|
||||
{
|
||||
wxLogMessage( wxString::Format( _( "Could not find %s in the imported library" ),
|
||||
kisymbolname ) );
|
||||
wxLogMessage( wxString::Format(
|
||||
_( "Could not find %s in the imported library" ), kisymbolname ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1113,8 +1116,8 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
component->SetUnit( unit );
|
||||
component->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
|
||||
component->GetField( FOOTPRINT )->SetText( package );
|
||||
component->SetTimeStamp( EagleModuleTstamp( einstance.part, epart->value ? *epart->value : "",
|
||||
unit ) );
|
||||
component->SetTimeStamp(
|
||||
EagleModuleTstamp( einstance.part, epart->value ? *epart->value : "", unit ) );
|
||||
|
||||
if( einstance.rot )
|
||||
{
|
||||
|
@ -1132,8 +1135,8 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
for( auto const& field : partFields )
|
||||
{
|
||||
component->GetField( field.GetId() )->ImportValues( field );
|
||||
component->GetField( field.GetId() )->SetTextPos(
|
||||
component->GetPosition() + field.GetTextPos() );
|
||||
component->GetField( field.GetId() )
|
||||
->SetTextPos( component->GetPosition() + field.GetTextPos() );
|
||||
}
|
||||
|
||||
// If there is no footprint assigned, then prepend the reference value
|
||||
|
@ -1209,7 +1212,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
{
|
||||
field = component->FindField( attr.name );
|
||||
|
||||
if(field)
|
||||
if( field )
|
||||
field->SetVisible( false );
|
||||
}
|
||||
|
||||
|
@ -1233,8 +1236,8 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
int reldegrees = ( absdegrees - rotation + 360.0 );
|
||||
reldegrees %= 360;
|
||||
|
||||
eagleToKicadAlignment( (EDA_TEXT*) field, align, reldegrees, mirror, spin,
|
||||
absdegrees );
|
||||
eagleToKicadAlignment(
|
||||
(EDA_TEXT*) field, align, reldegrees, mirror, spin, absdegrees );
|
||||
}
|
||||
}
|
||||
else if( attributeNode->GetName() == "variant" )
|
||||
|
@ -1280,8 +1283,8 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
}
|
||||
|
||||
|
||||
EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
|
||||
EAGLE_LIBRARY* aEagleLibrary )
|
||||
EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary(
|
||||
wxXmlNode* aLibraryNode, EAGLE_LIBRARY* aEagleLibrary )
|
||||
{
|
||||
NODE_MAP libraryChildren = MapChildren( aLibraryNode );
|
||||
|
||||
|
@ -1350,8 +1353,8 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
|
|||
|
||||
aEagleLibrary->GateUnit[edeviceset.name + edevice.name + egate.name] = gateindex;
|
||||
|
||||
ispower = loadSymbol( aEagleLibrary->SymbolNodes[egate.symbol],
|
||||
kpart, &edevice, gateindex, egate.name );
|
||||
ispower = loadSymbol( aEagleLibrary->SymbolNodes[egate.symbol], kpart, &edevice,
|
||||
gateindex, egate.name );
|
||||
|
||||
gateindex++;
|
||||
gateNode = gateNode->GetNext();
|
||||
|
@ -1409,12 +1412,15 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
|
||||
if( ePin.direction )
|
||||
{
|
||||
const std::map<wxString, ELECTRICAL_PINTYPE> pinDirectionsMap =
|
||||
{
|
||||
{ "sup", PIN_POWER_IN }, { "pas", PIN_PASSIVE },
|
||||
{ "out", PIN_OUTPUT }, { "in", PIN_INPUT },
|
||||
{ "nc", PIN_NC }, { "io", PIN_BIDI },
|
||||
{ "oc", PIN_OPENCOLLECTOR }, { "hiz", PIN_TRISTATE },
|
||||
const std::map<wxString, ELECTRICAL_PINTYPE> pinDirectionsMap = {
|
||||
{ "sup", PIN_POWER_IN },
|
||||
{ "pas", PIN_PASSIVE },
|
||||
{ "out", PIN_OUTPUT },
|
||||
{ "in", PIN_INPUT },
|
||||
{ "nc", PIN_NC },
|
||||
{ "io", PIN_BIDI },
|
||||
{ "oc", PIN_OPENCOLLECTOR },
|
||||
{ "hiz", PIN_TRISTATE },
|
||||
{ "pwr", PIN_POWER_IN },
|
||||
};
|
||||
|
||||
|
@ -1439,13 +1445,13 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
{
|
||||
if( connect.gate == aGateName && pin->GetName() == connect.pin )
|
||||
{
|
||||
wxArrayString pads = wxSplit( wxString( connect.pad ), ' ');
|
||||
wxArrayString pads = wxSplit( wxString( connect.pad ), ' ' );
|
||||
|
||||
pin->SetPartNumber( aGateNumber );
|
||||
pin->SetUnit( aGateNumber );
|
||||
pin->SetName( escapeName( pin->GetName() ) );
|
||||
|
||||
if( pads.GetCount() > 1)
|
||||
if( pads.GetCount() > 1 )
|
||||
{
|
||||
pin->SetNumberTextSize( 0 );
|
||||
}
|
||||
|
@ -1453,9 +1459,9 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
// Eagle does not connect multiple NC pins together when they are stacked.
|
||||
// KiCad will do this for pins that are coincident. We opt here for correct
|
||||
// schematic netlist and leave out the multiple NC pins when stacked.
|
||||
for( unsigned i = 0; i < pads.GetCount(); i++)
|
||||
for( unsigned i = 0; i < pads.GetCount(); i++ )
|
||||
{
|
||||
if( pin->GetType() == PIN_NC && i > 0)
|
||||
if( pin->GetType() == PIN_NC && i > 0 )
|
||||
break;
|
||||
|
||||
LIB_PIN* apin = new LIB_PIN( *pin );
|
||||
|
@ -1489,13 +1495,13 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
{
|
||||
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aPart, currentNode, aGateNumber ) );
|
||||
|
||||
if( libtext->GetText().Upper() ==">NAME" )
|
||||
if( libtext->GetText().Upper() == ">NAME" )
|
||||
{
|
||||
LIB_FIELD* field = aPart->GetField( REFERENCE );
|
||||
loadFieldAttributes( field, libtext.get() );
|
||||
foundName = true;
|
||||
}
|
||||
else if( libtext->GetText().Upper() ==">VALUE" )
|
||||
else if( libtext->GetText().Upper() == ">VALUE" )
|
||||
{
|
||||
LIB_FIELD* field = aPart->GetField( VALUE );
|
||||
loadFieldAttributes( field, libtext.get() );
|
||||
|
@ -1536,9 +1542,8 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
}
|
||||
|
||||
|
||||
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aCircleNode,
|
||||
int aGateNumber )
|
||||
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aCircleNode, int aGateNumber )
|
||||
{
|
||||
// Parse the circle properties
|
||||
ECIRCLE c( aCircleNode );
|
||||
|
@ -1554,9 +1559,8 @@ LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle( std::unique_ptr<LIB_PART>& aPart
|
|||
}
|
||||
|
||||
|
||||
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aRectNode,
|
||||
int aGateNumber )
|
||||
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aRectNode, int aGateNumber )
|
||||
{
|
||||
ERECT rect( aRectNode );
|
||||
|
||||
|
@ -1573,9 +1577,8 @@ LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr<LIB_PART>&
|
|||
}
|
||||
|
||||
|
||||
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aWireNode,
|
||||
int aGateNumber )
|
||||
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aWireNode, int aGateNumber )
|
||||
{
|
||||
auto ewire = EWIRE( aWireNode );
|
||||
|
||||
|
@ -1596,7 +1599,8 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_PART>& aPart,
|
|||
wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 );
|
||||
|
||||
double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
|
||||
+ ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) ) * 2;
|
||||
+ ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) )
|
||||
* 2;
|
||||
|
||||
// this emulates the filled semicircles created by a thick arc with flat ends caps.
|
||||
if( ewire.width.ToSchUnits() * 2 > radius )
|
||||
|
@ -1614,7 +1618,8 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_PART>& aPart,
|
|||
end = center + centerEndVector;
|
||||
|
||||
radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
|
||||
+ ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) ) * 2;
|
||||
+ ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) )
|
||||
* 2;
|
||||
|
||||
arc->SetWidth( 1 );
|
||||
arc->SetFillMode( FILLED_SHAPE );
|
||||
|
@ -1656,8 +1661,8 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_PART>& aPart,
|
|||
}
|
||||
|
||||
|
||||
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aPolygonNode, int aGateNumber )
|
||||
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPolygonNode, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart.get() ) );
|
||||
|
||||
|
@ -1686,10 +1691,8 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr<LIB_PART>& a
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aPin,
|
||||
EPIN* aEPin,
|
||||
int aGateNumber )
|
||||
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPin, EPIN* aEPin, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_PIN> pin( new LIB_PIN( aPart.get() ) );
|
||||
pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
|
||||
|
@ -1725,11 +1728,11 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
|||
{
|
||||
wxString length = aEPin->length.Get();
|
||||
|
||||
if( length =="short" )
|
||||
if( length == "short" )
|
||||
{
|
||||
pin->SetLength( 100 );
|
||||
}
|
||||
else if( length =="middle" )
|
||||
else if( length == "middle" )
|
||||
{
|
||||
pin->SetLength( 200 );
|
||||
}
|
||||
|
@ -1791,8 +1794,8 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
|||
}
|
||||
|
||||
|
||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr<LIB_PART>& aPart,
|
||||
wxXmlNode* aLibText, int aGateNumber )
|
||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aLibText, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_TEXT> libtext( new LIB_TEXT( aPart.get() ) );
|
||||
ETEXT etext( aLibText );
|
||||
|
@ -1874,8 +1877,7 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
|
|||
// Sort the intersection points to speed up the search process
|
||||
std::sort( m_wireIntersections.begin(), m_wireIntersections.end() );
|
||||
|
||||
auto onIntersection = [&]( const VECTOR2I& aPos )
|
||||
{
|
||||
auto onIntersection = [&]( const VECTOR2I& aPos ) {
|
||||
return std::binary_search( m_wireIntersections.begin(), m_wireIntersections.end(), aPos );
|
||||
};
|
||||
|
||||
|
@ -1893,7 +1895,8 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
|
|||
// Move the label to the nearest wire
|
||||
if( !segAttached )
|
||||
{
|
||||
std::tie( labelPos, segAttached ) = findNearestLinePoint( label->GetPosition(), segDesc.segs );
|
||||
std::tie( labelPos, segAttached ) =
|
||||
findNearestLinePoint( label->GetPosition(), segDesc.segs );
|
||||
|
||||
if( !segAttached ) // we cannot do anything
|
||||
continue;
|
||||
|
@ -2026,36 +2029,32 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
// |
|
||||
// ---|
|
||||
// |
|
||||
if( TestSegmentHit( linestart + wxPoint( 0, -100 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
linestart + wxPoint( 0, -100 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( -100, 0 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( -100, 0 ) );
|
||||
}
|
||||
else if( TestSegmentHit( linestart + wxPoint( 0, 100 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( -100, 0 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( -100, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( linestart,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2068,37 +2067,33 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
else
|
||||
{
|
||||
// test is bus exists above the wire
|
||||
if( TestSegmentHit( linestart + wxPoint( 0, -100 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
linestart + wxPoint( 0, -100 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
0,
|
||||
-100 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( 0, -100 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart + wxPoint( 100,
|
||||
0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 100, 0 ) );
|
||||
}
|
||||
// test is bus exists below the wire
|
||||
else if( TestSegmentHit( linestart + wxPoint( 0, 100 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
0,
|
||||
100 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( 0, 100 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart + wxPoint( 100,
|
||||
0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 100, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( linestart,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2114,39 +2109,35 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
if( linestart.x < busstart.x )
|
||||
{
|
||||
// Test if bus exists above the wire
|
||||
if( TestSegmentHit( lineend + wxPoint( 0, 100 ), busstart, busend,
|
||||
0 ) )
|
||||
if( TestSegmentHit(
|
||||
lineend + wxPoint( 0, 100 ), busstart, busend, 0 ) )
|
||||
{
|
||||
// |
|
||||
// ___/|
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( -100, 0 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( -100, 0 ) );
|
||||
}
|
||||
// Test if bus exists below the wire
|
||||
else if( TestSegmentHit( lineend + wxPoint( 0, -100 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( -100, 0 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( -100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( -100, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2158,37 +2149,33 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
else
|
||||
{
|
||||
// test if bus existed above the wire
|
||||
if( TestSegmentHit( lineend + wxPoint( 0, -100 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
lineend + wxPoint( 0, -100 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
0,
|
||||
-100 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( 0, -100 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 100, 0 ) );
|
||||
}
|
||||
// test if bus existed below the wire
|
||||
else if( TestSegmentHit( lineend + wxPoint( 0, 100 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
0,
|
||||
100 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( 0, 100 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 100, 0 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 100, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2206,36 +2193,32 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
if( lineend.y < busstart.y )
|
||||
{
|
||||
// Test for bus existance to the left of the wire
|
||||
if( TestSegmentHit( linestart + wxPoint( -100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
linestart + wxPoint( -100, 0 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( -100, 0 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 0, -100 ) );
|
||||
}
|
||||
else if( TestSegmentHit( linestart + wxPoint( 100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
0,
|
||||
100 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( 0, 100 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 0, -100 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( linestart,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2243,36 +2226,32 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
else // wire end is below the bus.
|
||||
{
|
||||
// Test for bus existance to the left of the wire
|
||||
if( TestSegmentHit( linestart + wxPoint( -100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
linestart + wxPoint( -100, 0 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( -100, 0 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart + wxPoint( 0,
|
||||
100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 0, 100 ) );
|
||||
}
|
||||
else if( TestSegmentHit( linestart + wxPoint( 100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart + wxPoint(
|
||||
100,
|
||||
0 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
linestart + wxPoint( 100, 0 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart + wxPoint( 0,
|
||||
100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 0, 100 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( linestart,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2287,36 +2266,32 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
if( linestart.y < busstart.y )
|
||||
{
|
||||
// Test for bus existance to the left of the wire
|
||||
if( TestSegmentHit( lineend + wxPoint( -100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
lineend + wxPoint( -100, 0 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( -100, 0 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 0, -100 ) );
|
||||
}
|
||||
else if( TestSegmentHit( lineend + wxPoint( 100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
0,
|
||||
-100 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( 0, -100 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 0, -100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 0, -100 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2324,36 +2299,32 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
else // wire end is below the bus.
|
||||
{
|
||||
// Test for bus existance to the left of the wire
|
||||
if( TestSegmentHit( lineend + wxPoint( -100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
if( TestSegmentHit(
|
||||
lineend + wxPoint( -100, 0 ), busstart, busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
-100,
|
||||
0 ),
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( -100, 0 ), '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 0, 100 ) );
|
||||
}
|
||||
else if( TestSegmentHit( lineend + wxPoint( 100, 0 ), busstart,
|
||||
busend, 0 ) )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( lineend + wxPoint(
|
||||
0,
|
||||
100 ),
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY(
|
||||
lineend + wxPoint( 0, 100 ), '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, lineend + wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )->SetEndPoint( lineend +
|
||||
wxPoint( 0, 100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetEndPoint( lineend + wxPoint( 0, 100 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend,
|
||||
"Bus Entry needed" );
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
|
@ -2416,41 +2387,43 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
{
|
||||
if( wirevector.y > 0 )
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart,
|
||||
'/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry =
|
||||
new SCH_BUS_WIRE_ENTRY( linestart, '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
|
||||
moveLabels( line, linestart + wxPoint( 100, -100 ) );
|
||||
|
||||
if( linestart + wxPoint( 100, -100 )== lineend ) // wire is overlapped by bus entry symbol
|
||||
if( linestart + wxPoint( 100, -100 )
|
||||
== lineend ) // wire is overlapped by bus entry symbol
|
||||
{
|
||||
m_currentSheet->GetScreen()->DeleteItem( line );
|
||||
line = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( 100, -100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 100, -100 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( linestart,
|
||||
'\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry =
|
||||
new SCH_BUS_WIRE_ENTRY( linestart, '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, linestart + wxPoint( 100, 100 ) );
|
||||
|
||||
if( linestart + wxPoint( 100, 100 )== lineend ) // wire is overlapped by bus entry symbol
|
||||
if( linestart + wxPoint( 100, 100 )
|
||||
== lineend ) // wire is overlapped by bus entry symbol
|
||||
{
|
||||
m_currentSheet->GetScreen()->DeleteItem( line );
|
||||
line = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
( (SCH_LINE*) line )->SetStartPoint( linestart +
|
||||
wxPoint( 100, 100 ) );
|
||||
( (SCH_LINE*) line )
|
||||
->SetStartPoint( linestart + wxPoint( 100, 100 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2491,7 +2464,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
|
||||
moveLabels( line, p );
|
||||
|
||||
if( p== linestart ) // wire is overlapped by bus entry symbol
|
||||
if( p == linestart ) // wire is overlapped by bus entry symbol
|
||||
{
|
||||
m_currentSheet->GetScreen()->DeleteItem( line );
|
||||
}
|
||||
|
@ -2506,8 +2479,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
if( wirevector.y > 0 )
|
||||
{
|
||||
wxPoint p = lineend + wxPoint( -100, 100 );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry =
|
||||
new SCH_BUS_WIRE_ENTRY( p, '/' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, '/' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, p );
|
||||
|
@ -2524,8 +2496,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
else
|
||||
{
|
||||
wxPoint p = lineend + wxPoint( -100, -100 );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry =
|
||||
new SCH_BUS_WIRE_ENTRY( p, '\\' );
|
||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, '\\' );
|
||||
busEntry->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( busEntry );
|
||||
moveLabels( line, p );
|
||||
|
@ -2563,7 +2534,8 @@ const SEG* SCH_EAGLE_PLUGIN::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) c
|
|||
|
||||
|
||||
// TODO could be used to place junctions, instead of IsJunctionNeeded() (see SCH_EDIT_FRAME::importFile())
|
||||
bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const
|
||||
bool SCH_EAGLE_PLUGIN::checkConnections(
|
||||
const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const
|
||||
{
|
||||
wxPoint pinPosition = aComponent->GetPinPhysicalPosition( aPin );
|
||||
auto pointIt = m_connPoints.find( pinPosition );
|
||||
|
@ -2577,8 +2549,8 @@ bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_COMPONENT* aComponent, const
|
|||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_COMPONENT* aComponent,
|
||||
SCH_SCREEN* aScreen, bool aUpdateSet )
|
||||
void SCH_EAGLE_PLUGIN::addImplicitConnections(
|
||||
SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet )
|
||||
{
|
||||
wxCHECK( aComponent->GetPartRef(), /*void*/ );
|
||||
|
||||
|
|
Loading…
Reference in New Issue