@@ -362,7 +362,7 @@ namespace {
362
362
case COLROW: readColrow (); break ;
363
363
case TEXTNODE: readDummy ( false ); break ;
364
364
case NODE: readDummy ( false ); break ;
365
- case TEXTTYPE: readDummy ( false ); break ;
365
+ case TEXTTYPE: readDatatype (); break ;
366
366
case PRESENTATION: readDummy ( false ); break ;
367
367
case SPACING: readDummy ( false ); break ;
368
368
case STRING: readString (); break ;
@@ -674,7 +674,7 @@ namespace {
674
674
bool readNode ();
675
675
bool readBox ();
676
676
bool readText ();
677
- bool readTextbody ( const Layer* );
677
+ bool readTextbody ( uint16_t gdsLayer );
678
678
bool readStrans ();
679
679
bool readProperty ();
680
680
void xyToAbutmentBox ();
@@ -1038,41 +1038,47 @@ namespace {
1038
1038
1039
1039
bool GdsStream::readText ()
1040
1040
{
1041
- const Layer* layer = NULL ;
1041
+ uint16_t gdsLayer = 0 ;
1042
1042
1043
1043
cdebug_log (101 ,1 ) << " GdsStream::readText()" << endl;
1044
1044
if (_record.isELFLAGS ()) { _stream >> _record; }
1045
1045
if (_record.isPLEX ()) { _stream >> _record; }
1046
1046
if (_record.isLAYER ()) {
1047
- layer = gdsToLayer ( (uint16_t )_record.getInt16s ()[0 ], 0 );
1048
- if (not layer) {
1049
- cerr << Error ( " GdsStream::readText(): No BasicLayer id:%d in GDS conversion table (skipped)."
1050
- , _record.getInt16s ()[0 ]
1051
- ) << endl;
1052
- }
1047
+ gdsLayer = (uint16_t )_record.getInt16s ()[0 ];
1053
1048
_stream >> _record;
1054
1049
} else {
1055
1050
_validSyntax = false ;
1056
1051
cdebug_tabw (101 ,-1 );
1057
1052
return _validSyntax;
1058
1053
}
1059
1054
1060
- readTextbody ( layer );
1055
+ readTextbody ( gdsLayer );
1061
1056
1062
1057
// cdebug(101,0) << "GdsStream::readText() - return:" << _validSyntax << endl;
1063
1058
cdebug_tabw (101 ,-1 );
1064
1059
return _validSyntax;
1065
1060
}
1066
1061
1067
1062
1068
- bool GdsStream::readTextbody ( const Layer* layer )
1063
+ bool GdsStream::readTextbody ( uint16_t gdsLayer )
1069
1064
{
1065
+ const Layer* layer = NULL ;
1070
1066
cdebug_log (101 ,1 ) << " GdsStream::readTextbody()" << endl;
1071
1067
1072
1068
DbU::Unit xpos = 0 ;
1073
1069
DbU::Unit ypos = 0 ;
1074
1070
1075
- if (_record.isTEXTTYPE ()) { _stream >> _record; }
1071
+ if (_record.isTEXTTYPE ()) {
1072
+ uint16_t texttype = (uint16_t )_record.getInt16s ()[0 ];
1073
+ layer = gdsToLayer ( gdsLayer, texttype );
1074
+ if (not layer) {
1075
+ cerr << Error ( " GdsStream::readText(): No BasicLayer %d:%d in GDS conversion table (skipped)."
1076
+ , gdsLayer
1077
+ , texttype
1078
+ ) << endl;
1079
+ }
1080
+ _stream >> _record;
1081
+ }
1076
1082
else {
1077
1083
_validSyntax = false ;
1078
1084
cdebug_tabw (101 ,-1 );
@@ -1416,20 +1422,10 @@ namespace {
1416
1422
, m.str ().c_str () ) << endl;
1417
1423
}
1418
1424
}
1419
- dx = (arrayArea[1 ].getX () - arrayArea[0 ].getX ()) / columns;
1420
- dy = (arrayArea[2 ].getY () - arrayArea[0 ].getY ()) / rows;
1421
- if (not dx and (columns > 1 ))
1422
- cerr << Error ( " GdsStream::readAref(): Null dx, but more than one column (%d)."
1423
- , columns ) << endl;
1424
- if (not dy and (rows > 1 ))
1425
- cerr << Error ( " GdsStream::readAref(): Null dy, but more than one row (%d)."
1426
- , rows ) << endl;
1427
1425
cdebug_log (101 ,0 ) << " arrayArea:" << endl;
1428
1426
cdebug_log (101 ,0 ) << " [0] " << arrayArea[0 ] << endl;
1429
1427
cdebug_log (101 ,0 ) << " [1] " << arrayArea[1 ] << endl;
1430
1428
cdebug_log (101 ,0 ) << " [2] " << arrayArea[2 ] << endl;
1431
- cdebug_log (101 ,0 ) << " dx=" << DbU::getValueString (dx) << endl;
1432
- cdebug_log (101 ,0 ) << " dy=" << DbU::getValueString (dy) << endl;
1433
1429
_stream >> _record;
1434
1430
} else {
1435
1431
_validSyntax = false ;
@@ -1441,22 +1437,16 @@ namespace {
1441
1437
Transformation::Orientation orient = Transformation::Orientation::ID;
1442
1438
if (_angle == 90.0 ) {
1443
1439
orient = Transformation::Orientation::R1;
1444
- std::swap ( dx, dy );
1445
- dx = -dx;
1446
1440
} else if (_angle == 180.0 ) {
1447
1441
orient = Transformation::Orientation::R2;
1448
- dy = -dy;
1449
1442
} else if (_angle == 270.0 ) {
1450
1443
orient = Transformation::Orientation::R3;
1451
- std::swap ( dx, dy );
1452
- dy = -dy;
1453
1444
} else if (_angle != 0.0 ) {
1454
1445
cerr << Warning ( " GdsStream::readAref(): Unsupported angle %d.2 for AREF (Instance) of \" %s\" "
1455
1446
, _angle, masterName.c_str () ) << endl;
1456
1447
}
1457
1448
1458
1449
if (_xReflection) {
1459
- dy = -dy;
1460
1450
switch ( orient ) {
1461
1451
case Transformation::Orientation::ID: orient = Transformation::Orientation::MY; break ;
1462
1452
case Transformation::Orientation::R1: orient = Transformation::Orientation::YR; break ;
@@ -1468,6 +1458,18 @@ namespace {
1468
1458
}
1469
1459
}
1470
1460
Transformation arrayTransf ( 0 , 0 , orient );
1461
+ for ( auto &pt: arrayArea)
1462
+ pt = arrayTransf.getPoint (pt);
1463
+ dx = (arrayArea[1 ].getX () - arrayArea[0 ].getX ()) / columns;
1464
+ dy = (arrayArea[2 ].getY () - arrayArea[0 ].getY ()) / rows;
1465
+ cdebug_log (101 ,0 ) << " dx=" << DbU::getValueString (dx) << endl;
1466
+ cdebug_log (101 ,0 ) << " dy=" << DbU::getValueString (dy) << endl;
1467
+ if (not dx and (columns > 1 ))
1468
+ cerr << Error ( " GdsStream::readAref(): Null dx, but more than one column (%d)."
1469
+ , columns ) << endl;
1470
+ if (not dy and (rows > 1 ))
1471
+ cerr << Error ( " GdsStream::readAref(): Null dy, but more than one row (%d)."
1472
+ , rows ) << endl;
1471
1473
for ( uint32_t column=0 ; column < (uint32_t )columns ; ++column ) {
1472
1474
for ( uint32_t row=0 ; row < (uint32_t )rows ; ++row ) {
1473
1475
DbU::Unit xpos = arrayArea[0 ].getX () + column*dx;
0 commit comments