Avoid passing references in EESchema
This returns the connection list by value. This allows easier Python use Also renames m_End() to GetEnd()
This commit is contained in:
parent
3d5b216d1d
commit
02a5d47de9
|
@ -42,21 +42,28 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnections )
|
||||
std::vector<wxPoint> SCH_EDIT_FRAME::GetSchematicConnections()
|
||||
{
|
||||
std::vector<wxPoint> retval;
|
||||
|
||||
for( auto item : GetScreen()->Items() )
|
||||
{
|
||||
// Avoid items that are changing
|
||||
if( !( item->GetEditFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) )
|
||||
item->GetConnectionPoints( aConnections );
|
||||
{
|
||||
std::vector<wxPoint> pts = item->GetConnectionPoints();
|
||||
retval.insert( retval.end(), pts.begin(), pts.end() );
|
||||
}
|
||||
}
|
||||
|
||||
// We always have some overlapping connection points. Drop duplicates here
|
||||
std::sort( aConnections.begin(), aConnections.end(),
|
||||
std::sort( retval.begin(), retval.end(),
|
||||
[]( const wxPoint& a, const wxPoint& b ) -> bool
|
||||
{ return a.x < b.x || (a.x == b.x && a.y < b.y); } );
|
||||
aConnections.erase(
|
||||
std::unique( aConnections.begin(), aConnections.end() ), aConnections.end() );
|
||||
retval.erase(
|
||||
std::unique( retval.begin(), retval.end() ), retval.end() );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -357,7 +364,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen )
|
|||
{
|
||||
SCH_BUS_WIRE_ENTRY* entry = static_cast<SCH_BUS_WIRE_ENTRY*>( item );
|
||||
point_set.insert( entry->GetPosition() );
|
||||
point_set.insert( entry->m_End() );
|
||||
point_set.insert( entry->GetEnd() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -448,8 +448,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
|
|||
|
||||
for( SCH_ITEM* item : aItemList )
|
||||
{
|
||||
std::vector< wxPoint > points;
|
||||
item->GetConnectionPoints( points );
|
||||
std::vector< wxPoint > points = item->GetConnectionPoints();
|
||||
item->ConnectedItems( aSheet ).clear();
|
||||
|
||||
if( item->Type() == SCH_SHEET_T )
|
||||
|
|
|
@ -80,11 +80,11 @@ EDA_ITEM* SCH_BUS_BUS_ENTRY::Clone() const
|
|||
|
||||
bool SCH_BUS_ENTRY_BASE::doIsConnected( const wxPoint& aPosition ) const
|
||||
{
|
||||
return ( m_pos == aPosition || m_End() == aPosition );
|
||||
return ( m_pos == aPosition || GetEnd() == aPosition );
|
||||
}
|
||||
|
||||
|
||||
wxPoint SCH_BUS_ENTRY_BASE::m_End() const
|
||||
wxPoint SCH_BUS_ENTRY_BASE::GetEnd() const
|
||||
{
|
||||
return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y );
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
|
|||
EDA_RECT box;
|
||||
|
||||
box.SetOrigin( m_pos );
|
||||
box.SetEnd( m_End() );
|
||||
box.SetEnd( GetEnd() );
|
||||
|
||||
box.Normalize();
|
||||
box.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||
|
@ -178,7 +178,7 @@ void SCH_BUS_WIRE_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLi
|
|||
DANGLING_END_ITEM item( WIRE_ENTRY_END, this, m_pos );
|
||||
aItemList.push_back( item );
|
||||
|
||||
DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, m_End() );
|
||||
DANGLING_END_ITEM item1( WIRE_ENTRY_END, this, GetEnd() );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
|
|||
DANGLING_END_ITEM item( BUS_ENTRY_END, this, m_pos );
|
||||
aItemList.push_back( item );
|
||||
|
||||
DANGLING_END_ITEM item1( BUS_ENTRY_END, this, m_End() );
|
||||
DANGLING_END_ITEM item1( BUS_ENTRY_END, this, GetEnd() );
|
||||
aItemList.push_back( item1 );
|
||||
}
|
||||
|
||||
|
@ -200,8 +200,8 @@ void SCH_BUS_ENTRY_BASE::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffs
|
|||
aSettings->GetLayerColor( m_Layer ) : GetStrokeColor();
|
||||
int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
|
||||
|
||||
GRLine( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
|
||||
m_End().y + aOffset.y, penWidth, color,
|
||||
GRLine( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetEnd().x + aOffset.x,
|
||||
GetEnd().y + aOffset.y, penWidth, color,
|
||||
GetwxPenStyle( (PLOT_DASH_TYPE) GetStrokeStyle() ) );
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aI
|
|||
case WIRE_END_END:
|
||||
if( m_pos == each_item.GetPosition() )
|
||||
has_wire[0] = true;
|
||||
else if( m_End() == each_item.GetPosition() )
|
||||
else if( GetEnd() == each_item.GetPosition() )
|
||||
has_wire[1] = true;
|
||||
|
||||
break;
|
||||
|
@ -267,7 +267,7 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aI
|
|||
case BUS_END_END:
|
||||
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
|
||||
has_bus[0] = true;
|
||||
else if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) )
|
||||
else if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
|
||||
has_bus[1] = true;
|
||||
|
||||
break;
|
||||
|
@ -316,7 +316,7 @@ bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aIt
|
|||
case BUS_END_END:
|
||||
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
|
||||
m_isDanglingStart = false;
|
||||
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) )
|
||||
if( IsPointOnSegment( seg_start, each_item.GetPosition(), GetEnd() ) )
|
||||
m_isDanglingEnd = false;
|
||||
break;
|
||||
default:
|
||||
|
@ -334,10 +334,9 @@ bool SCH_BUS_ENTRY_BASE::IsDangling() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
aPoints.push_back( m_End() );
|
||||
return { m_pos, GetEnd() };
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,7 +370,7 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) cons
|
|||
if( aAccuracy == 0 )
|
||||
aAccuracy = ( GetPenWidth() / 2 ) + 4;
|
||||
|
||||
return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy );
|
||||
return TestSegmentHit( aPosition, m_pos, GetEnd(), aAccuracy );
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,7 +399,7 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
|
|||
aPlotter->SetColor( color );
|
||||
aPlotter->SetDash( GetStrokeStyle() );
|
||||
aPlotter->MoveTo( m_pos );
|
||||
aPlotter->FinishTo( m_End() );
|
||||
aPlotter->FinishTo( GetEnd() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,10 +442,10 @@ bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
|
|||
if( GetPosition().y != component->GetPosition().y )
|
||||
return GetPosition().y < component->GetPosition().y;
|
||||
|
||||
if( m_End().x != component->m_End().x )
|
||||
return m_End().x < component->m_End().x;
|
||||
if( GetEnd().x != component->GetEnd().x )
|
||||
return GetEnd().x < component->GetEnd().x;
|
||||
|
||||
return m_End().y < component->m_End().y;
|
||||
return GetEnd().y < component->GetEnd().y;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
*/
|
||||
bool IsMovableFromAnchorPoint() override { return false; }
|
||||
|
||||
wxPoint m_End() const;
|
||||
wxPoint GetEnd() const;
|
||||
|
||||
wxSize GetSize() const { return m_size; }
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
|
||||
|
|
|
@ -1541,8 +1541,10 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_COMPONENT::GetConnectionPoints() const
|
||||
{
|
||||
std::vector<wxPoint> retval;
|
||||
|
||||
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
{
|
||||
// Collect only pins attached to the current unit and convert.
|
||||
|
@ -1556,8 +1558,10 @@ void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
|||
if( pin_convert > 0 && pin_convert != GetConvert() )
|
||||
continue;
|
||||
|
||||
aPoints.push_back( m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_Pos );
|
||||
retval.push_back( m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_Pos );
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -628,7 +628,7 @@ public:
|
|||
*/
|
||||
bool IsInNetlist() const;
|
||||
|
||||
void GetConnectionPoints( std::vector<wxPoint>& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
||||
|
||||
|
|
|
@ -1070,8 +1070,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
|
||||
if( !aItem->IsMoving() && aItem->IsConnectable() )
|
||||
{
|
||||
std::vector< wxPoint > pts;
|
||||
aItem->GetConnectionPoints( pts );
|
||||
std::vector< wxPoint > pts = aItem->GetConnectionPoints();
|
||||
|
||||
for( auto i = pts.begin(); i != pts.end(); i++ )
|
||||
{
|
||||
|
|
|
@ -573,9 +573,9 @@ public:
|
|||
/**
|
||||
* Collects a unique list of all possible connection points in the schematic.
|
||||
*
|
||||
* @param aConnections vector of connections
|
||||
* @return vector of connections
|
||||
*/
|
||||
void GetSchematicConnections( std::vector< wxPoint >& aConnections );
|
||||
std::vector<wxPoint> GetSchematicConnections();
|
||||
|
||||
void OnOpenPcbnew( wxCommandEvent& event );
|
||||
void OnOpenCvpcb( wxCommandEvent& event );
|
||||
|
|
|
@ -383,7 +383,7 @@ public:
|
|||
*
|
||||
* @param aPoints List of connection points to add to.
|
||||
*/
|
||||
virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { }
|
||||
virtual std::vector<wxPoint> GetConnectionPoints() const { return {}; }
|
||||
|
||||
/**
|
||||
* Clears all of the connection items from the list.
|
||||
|
|
|
@ -139,9 +139,9 @@ void SCH_JUNCTION::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_JUNCTION::GetConnectionPoints() const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
return { m_pos };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||
{
|
||||
|
|
|
@ -2263,12 +2263,12 @@ void SCH_LEGACY_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry )
|
|||
m_out->Print( 0, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n",
|
||||
Iu2Mils( aBusEntry->GetPosition().x ),
|
||||
Iu2Mils( aBusEntry->GetPosition().y ),
|
||||
Iu2Mils( aBusEntry->m_End().x ), Iu2Mils( aBusEntry->m_End().y ) );
|
||||
Iu2Mils( aBusEntry->GetEnd().x ), Iu2Mils( aBusEntry->GetEnd().y ) );
|
||||
else
|
||||
m_out->Print( 0, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n",
|
||||
Iu2Mils( aBusEntry->GetPosition().x ),
|
||||
Iu2Mils( aBusEntry->GetPosition().y ),
|
||||
Iu2Mils( aBusEntry->m_End().x ), Iu2Mils( aBusEntry->m_End().y ) );
|
||||
Iu2Mils( aBusEntry->GetEnd().x ), Iu2Mils( aBusEntry->GetEnd().y ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -601,10 +601,9 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_LINE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_LINE::GetConnectionPoints() const
|
||||
{
|
||||
aPoints.push_back( m_start );
|
||||
aPoints.push_back( m_end );
|
||||
return { m_start, m_end };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override;
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
void GetSelectedPoints( std::vector< wxPoint >& aPoints ) const;
|
||||
|
||||
|
|
|
@ -135,9 +135,9 @@ void SCH_NO_CONNECT::Rotate( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_NO_CONNECT::GetConnectionPoints() const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
return { m_pos };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
aItem->Type() == SCH_COMPONENT_T;
|
||||
}
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
{
|
||||
|
|
|
@ -1722,7 +1722,7 @@ void SCH_PAINTER::draw( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
|
|||
line.SetBrightened();
|
||||
|
||||
line.SetStartPoint( aEntry->GetPosition() );
|
||||
line.SetEndPoint( aEntry->m_End() );
|
||||
line.SetEndPoint( aEntry->GetEnd() );
|
||||
line.SetStroke( aEntry->GetStroke() );
|
||||
|
||||
COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows );
|
||||
|
@ -1744,7 +1744,7 @@ void SCH_PAINTER::draw( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
|
|||
aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
|
||||
|
||||
if( aEntry->IsDanglingEnd() )
|
||||
m_gal->DrawCircle( aEntry->m_End(),
|
||||
m_gal->DrawCircle( aEntry->GetEnd(),
|
||||
aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -1113,7 +1113,7 @@ void SCH_SEXPR_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLev
|
|||
{
|
||||
SCH_LINE busEntryLine( aBusEntry->GetPosition(), LAYER_BUS );
|
||||
|
||||
busEntryLine.SetEndPoint( aBusEntry->m_End() );
|
||||
busEntryLine.SetEndPoint( aBusEntry->GetEnd() );
|
||||
saveLine( &busEntryLine, aNestLevel );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -855,10 +855,14 @@ bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_SHEET::GetConnectionPoints() const
|
||||
{
|
||||
std::vector<wxPoint> retval;
|
||||
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
aPoints.push_back( sheetPin->GetPosition() );
|
||||
retval.push_back( sheetPin->GetPosition() );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -550,7 +550,7 @@ public:
|
|||
( aItem->Type() == SCH_NO_CONNECT_T );
|
||||
}
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
||||
|
||||
|
|
|
@ -425,13 +425,13 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|||
}
|
||||
|
||||
|
||||
void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
std::vector<wxPoint> SCH_TEXT::GetConnectionPoints() const
|
||||
{
|
||||
// Normal text labels do not have connection points. All others do.
|
||||
if( Type() == SCH_TEXT_T )
|
||||
return;
|
||||
return {};
|
||||
|
||||
aPoints.push_back( GetTextPos() );
|
||||
return { GetTextPos() };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ public:
|
|||
bool IsDangling() const override { return m_isDangling; }
|
||||
void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
std::vector<wxPoint> GetConnectionPoints() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
||||
|
|
|
@ -1002,11 +1002,15 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
if( !sch_item )
|
||||
continue;
|
||||
|
||||
if( sch_item->IsConnectable() )
|
||||
{
|
||||
std::vector<wxPoint> tmp_pts = sch_item->GetConnectionPoints();
|
||||
pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
|
||||
}
|
||||
|
||||
if( sch_item->Type() == SCH_JUNCTION_T )
|
||||
{
|
||||
sch_item->SetFlags( STRUCT_DELETED );
|
||||
sch_item->GetConnectionPoints( pts );
|
||||
|
||||
// clean up junctions at the end
|
||||
}
|
||||
else
|
||||
|
@ -1015,9 +1019,6 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
|
||||
appendToUndo = true;
|
||||
|
||||
if( sch_item && sch_item->IsConnectable() )
|
||||
sch_item->GetConnectionPoints( pts );
|
||||
|
||||
updateView( sch_item );
|
||||
|
||||
if( sch_item->Type() == SCH_SHEET_PIN_T )
|
||||
|
|
|
@ -364,7 +364,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
|||
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
|
||||
m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() );
|
||||
|
||||
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
|
||||
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->GetEnd(), aNet );
|
||||
m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) );
|
||||
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
|
||||
m_busUnfold.label->SetParent( m_frame->GetScreen() );
|
||||
|
@ -374,9 +374,9 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
|||
m_busUnfold.origin = pos;
|
||||
m_busUnfold.net_name = aNet;
|
||||
|
||||
getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->m_End(), false );
|
||||
getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->GetEnd(), false );
|
||||
|
||||
return startSegments( LAYER_WIRE, m_busUnfold.entry->m_End() );
|
||||
return startSegments( LAYER_WIRE, m_busUnfold.entry->GetEnd() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -638,7 +638,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
m_busUnfold.flipX = flipX;
|
||||
|
||||
m_frame->UpdateItem( entry );
|
||||
m_wires.front()->SetStartPoint( entry->m_End() );
|
||||
m_wires.front()->SetStartPoint( entry->GetEnd() );
|
||||
}
|
||||
|
||||
// Update the label "ghost" position
|
||||
|
@ -803,9 +803,8 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
simplifyWireList();
|
||||
|
||||
// Collect the possible connection points for the new lines
|
||||
std::vector< wxPoint > connections;
|
||||
std::vector< wxPoint > connections = m_frame->GetSchematicConnections();
|
||||
std::vector< wxPoint > new_ends;
|
||||
m_frame->GetSchematicConnections( connections );
|
||||
|
||||
// Check each new segment for possible junctions and add/split if needed
|
||||
for( auto wire : m_wires )
|
||||
|
@ -813,7 +812,9 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
if( wire->HasFlag( SKIP_STRUCT ) )
|
||||
continue;
|
||||
|
||||
wire->GetConnectionPoints( new_ends );
|
||||
std::vector<wxPoint> tmpends = wire->GetConnectionPoints();
|
||||
|
||||
new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() );
|
||||
|
||||
for( auto i : connections )
|
||||
{
|
||||
|
@ -857,8 +858,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
|
||||
for( auto item : m_frame->GetScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
std::vector< wxPoint > pts;
|
||||
item->GetConnectionPoints( pts );
|
||||
std::vector< wxPoint > pts = item->GetConnectionPoints();
|
||||
|
||||
if( pts.size() > 2 )
|
||||
continue;
|
||||
|
@ -891,19 +891,16 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
|
|||
EE_SELECTION* aSelection = aEvent.Parameter<EE_SELECTION*>();
|
||||
|
||||
std::vector<wxPoint> pts;
|
||||
std::vector<wxPoint> connections;
|
||||
|
||||
m_frame->GetSchematicConnections( connections );
|
||||
std::vector<wxPoint> connections = m_frame->GetSchematicConnections();
|
||||
|
||||
for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
|
||||
{
|
||||
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSelection->GetItem( ii ) );
|
||||
std::vector<wxPoint> new_pts;
|
||||
|
||||
if( !item || !item->IsConnectable() )
|
||||
continue;
|
||||
|
||||
item->GetConnectionPoints( new_pts );
|
||||
std::vector<wxPoint> new_pts = item->GetConnectionPoints();
|
||||
pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
|
||||
|
||||
// If the item is a line, we also add any connection points from the rest of the schematic
|
||||
|
|
|
@ -216,7 +216,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( item->Type() == SCH_LINE_T )
|
||||
static_cast<SCH_LINE*>( item )->GetSelectedPoints( connections );
|
||||
else
|
||||
static_cast<SCH_ITEM*>( item )->GetConnectionPoints( connections );
|
||||
connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
|
||||
|
||||
for( wxPoint point : connections )
|
||||
getConnectedDragItems( (SCH_ITEM*) item, point, m_dragAdditions );
|
||||
|
@ -602,8 +602,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
|
|||
// Select labels and bus entries that are connected to a wire being moved.
|
||||
if( aOriginalItem->Type() == SCH_LINE_T )
|
||||
{
|
||||
std::vector<wxPoint> connections;
|
||||
test->GetConnectionPoints( connections );
|
||||
std::vector<wxPoint> connections = test->GetConnectionPoints();
|
||||
|
||||
for( wxPoint& point : connections )
|
||||
{
|
||||
|
@ -615,11 +614,9 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
|
|||
// A bus entry needs its wire & label as well
|
||||
if( testType == SCH_BUS_WIRE_ENTRY_T || testType == SCH_BUS_BUS_ENTRY_T )
|
||||
{
|
||||
std::vector<wxPoint> ends;
|
||||
std::vector<wxPoint> ends = test->GetConnectionPoints();
|
||||
wxPoint otherEnd;
|
||||
|
||||
test->GetConnectionPoints( ends );
|
||||
|
||||
if( ends[0] == point )
|
||||
otherEnd = ends[1];
|
||||
else
|
||||
|
|
|
@ -230,8 +230,7 @@ BOOST_AUTO_TEST_CASE( EndconnectionPoints )
|
|||
expectedConnections.push_back( pin.m_pos );
|
||||
}
|
||||
|
||||
std::vector<wxPoint> connections;
|
||||
m_sheet.GetConnectionPoints( connections );
|
||||
std::vector<wxPoint> connections = m_sheet.GetConnectionPoints();
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( connections.begin(), connections.end(),
|
||||
expectedConnections.begin(), expectedConnections.end() );
|
||||
|
|
Loading…
Reference in New Issue