Fixed #6 (RVE DB reader and edges)

This solution will not only fix this issue but also turn
pairs of edges into "edge pair" objects. These objects
provide a somewhat better visualization for DRC violations
by connecting the edges with a filled region.

Single edges and clusters of more than two edges are
represented as individual edges.
This commit is contained in:
Matthias Koefferlein 2017-03-14 00:09:51 +01:00
parent fea965a321
commit 2953184b15
1 changed files with 13 additions and 5 deletions

View File

@ -30,6 +30,7 @@
#include "dbTrans.h"
#include "dbPolygon.h"
#include "dbEdge.h"
#include "dbEdgePair.h"
#include <cctype>
#include <cstring>
@ -80,6 +81,7 @@ public:
db::DCplxTrans trans;
db::DCplxTrans shape_trans;
std::vector <db::DPoint> points;
std::vector <db::DEdge> edges;
ex = tl::Extractor (m_input_stream.get_line ().c_str ());
ex.read (s, " ");
@ -360,10 +362,7 @@ public:
} else if (shape_type == 'e') {
Item *item = db.create_item (cell->id (), cath->id ());
if (waived) {
db.add_item_tag (item, waived_tag_id);
}
edges.clear ();
for (size_t point = 0; point < npoints; ++point) {
@ -387,10 +386,19 @@ public:
ex.expect_end ();
values.add (new Value<db::DEdge> (db::DEdge (db::DPoint (x1 * dbu, y1 * dbu), db::DPoint (x2 * dbu, y2 * dbu)).transformed (shape_trans)));
edges.push_back (db::DEdge (db::DPoint (x1 * dbu, y1 * dbu), db::DPoint (x2 * dbu, y2 * dbu)).transformed (shape_trans));
}
if (edges.size () == 2) {
// produce an edge pair from two edges
values.add (new Value<db::DEdgePair> (db::DEdgePair (edges [0], edges [1])));
} else {
for (std::vector <db::DEdge>::const_iterator e = edges.begin (); e != edges.end (); ++e) {
values.add (new Value<db::DEdge> (*e));
}
}
} else {
error (tl::sprintf (tl::to_string (QObject::tr ("Invalid shape type: %c")), shape_type));
}