GENCAD export: Fixes to footprint hashing

(cherry picked from commit 380b5160d6a5b722a07c8c27cfe0ba3006780253)
This commit is contained in:
Sean Mollet 2025-04-03 17:34:28 +00:00 committed by Wayne Stambaugh
parent 4ba7cff25e
commit d7eea3cf7b
2 changed files with 10 additions and 3 deletions

View File

@ -264,6 +264,16 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
point -= shape->GetPosition();
}
//Basic sort of start/end points to try to always draw the same direction (left to right, down to up)
//The hashes are summed, so it doesn't matter what order the lines are drawn, only that the same points are used
if( points.size() > 1 )
{
if( points[0].x > points[1].x || points[0].y > points[1].y )
{
std::swap( points[0], points[1] );
}
}
for( VECTOR2I& point : points )
hash_combine( ret, point.x, point.y );
}

View File

@ -612,9 +612,6 @@ static size_t hashFootprint( const FOOTPRINT* aFootprint )
constexpr int flags = HASH_FLAGS::HASH_POS | HASH_FLAGS::REL_COORD
| HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER;
for( PCB_FIELD* i : aFootprint->GetFields() )
ret += hash_fp_item( i, flags );
for( BOARD_ITEM* i : aFootprint->GraphicalItems() )
ret += hash_fp_item( i, flags );