Issue an early warning for offgrid coordinates in GdsParser.

This commit is contained in:
Jean-Paul Chaput 2021-04-19 14:29:23 +02:00
parent cd4f797831
commit ab908b8c44
1 changed files with 9 additions and 1 deletions

View File

@ -1327,11 +1327,19 @@ namespace {
void GdsStream::xyToComponent ( const Layer* layer ) void GdsStream::xyToComponent ( const Layer* layer )
{ {
DbU::Unit oneGrid = DbU::fromGrid( 1 );
vector<Point> points; vector<Point> points;
vector<int32_t> coordinates = _record.getInt32s(); vector<int32_t> coordinates = _record.getInt32s();
for ( size_t i=0 ; i<coordinates.size() ; i += 2 ) for ( size_t i=0 ; i<coordinates.size() ; i += 2 ) {
points.push_back( Point( coordinates[i ]*_scale points.push_back( Point( coordinates[i ]*_scale
, coordinates[i+1]*_scale ) ); , coordinates[i+1]*_scale ) );
if ( (points.back().getX() % oneGrid) or (points.back().getX() % oneGrid) ) {
cerr << Error( "GdsStream::xyToComponent(): Offgrid %s (foundry grid: %s)."
, getString(points.back()).c_str()
, DbU::getValueString(oneGrid).c_str() ) << endl;
}
}
_stream >> _record; _stream >> _record;