MCPcopy Create free account
hub / github.com/KLayout/klayout / shapes_to_string

Function shapes_to_string

src/laybasic/unit_tests/layAnnotationShapes.cc:133–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133std::string shapes_to_string (const lay::AnnotationShapes &shapes)
134{
135 std::string r;
136 for (lay::AnnotationShapes::iterator shape = shapes.begin (); shape != shapes.end (); ++shape) {
137 if (dynamic_cast<const shape_as_user_object<db::DPolygon> *> (shape->ptr ())) {
138 db::DPolygon p (dynamic_cast<const shape_as_user_object<db::DPolygon> *> (shape->ptr ())->shape ());
139 r += "polygon " + p.to_string ();
140 } else if (dynamic_cast<const shape_as_user_object<db::DPath> *> (shape->ptr ())) {
141 db::DPath p (dynamic_cast<const shape_as_user_object<db::DPath> *> (shape->ptr ())->shape ());
142 r += "path " + p.to_string ();
143 } else if (dynamic_cast<const shape_as_user_object<db::DText> *> (shape->ptr ())) {
144 db::DText p (dynamic_cast<const shape_as_user_object<db::DText> *> (shape->ptr ())->shape ());
145 r += "text " + p.to_string ();
146 } else if (dynamic_cast<const shape_as_user_object<db::DBox> *> (shape->ptr ())) {
147 db::DBox p (dynamic_cast<const shape_as_user_object<db::DBox> *> (shape->ptr ())->shape ());
148 r += "box " + p.to_string ();
149 } else {
150 r += "*unknown type*";
151 }
152 r += "\n";
153 }
154 return r;
155}
156
157void read_testdata (lay::AnnotationShapes &shapes, unsigned int what = 0xff)
158{

Callers 1

Calls 5

beginMethod · 0.45
endMethod · 0.45
ptrMethod · 0.45
shapeMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected