diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 3f548db1dc..22096fd07e 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -203,3 +203,22 @@ BITMAP_DEF SCH_JUNCTION::GetMenuImage() const { return add_junction_xpm; } + + +bool SCH_JUNCTION::operator <( const SCH_ITEM& aItem ) const +{ + if( Type() != aItem.Type() ) + return Type() < aItem.Type(); + + if( GetLayer() != aItem.GetLayer() ) + return GetLayer() < aItem.GetLayer(); + + auto junction = static_cast( &aItem ); + + if( GetPosition().x != junction->GetPosition().x ) + return GetPosition().x < junction->GetPosition().x; + + return GetPosition().y < junction->GetPosition().y; + +} + diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 2fc5b09ae7..56aad21ce9 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -104,6 +104,8 @@ public: EDA_ITEM* Clone() const override; + virtual bool operator <( const SCH_ITEM& aItem ) const override; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override; #endif