| 131 | } |
| 132 | |
| 133 | std::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 | |
| 157 | void read_testdata (lay::AnnotationShapes &shapes, unsigned int what = 0xff) |
| 158 | { |