diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 3312b1b208..d725a375f5 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -223,3 +223,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 8d349e7aee..522be4ca21 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -113,6 +113,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