mirror of https://github.com/KLayout/klayout.git
Fixed LStream writer under the presence of iterated arrays
This commit is contained in:
parent
25d396023a
commit
7e25b6b986
|
|
@ -69,12 +69,11 @@ Compressed::make_rep_id (const RegularArray &array, const std::vector<db::Vector
|
||||||
|
|
||||||
template <class Obj>
|
template <class Obj>
|
||||||
void
|
void
|
||||||
Compressed::write_shape (const db::Shape &shape, const db::Vector &disp, RegularArray ®ular, std::vector<db::Vector> &irregular_array)
|
Compressed::write_shape (const db::Shape &shape, RegularArray ®ular, std::vector<db::Vector> &irregular_array)
|
||||||
{
|
{
|
||||||
Obj sh;
|
Obj sh;
|
||||||
shape.instantiate (sh);
|
shape.instantiate (sh);
|
||||||
if (! object_is_empty (sh)) {
|
if (! object_is_empty (sh)) {
|
||||||
sh.move (disp);
|
|
||||||
if (shape.prop_id () != 0) {
|
if (shape.prop_id () != 0) {
|
||||||
write (db::object_with_properties<Obj> (sh, shape.prop_id ()), regular, irregular_array);
|
write (db::object_with_properties<Obj> (sh, shape.prop_id ()), regular, irregular_array);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -115,27 +114,26 @@ Compressed::compress_shapes (const db::Shapes &shapes, unsigned int level, bool
|
||||||
std::vector<db::Vector> irregular_array;
|
std::vector<db::Vector> irregular_array;
|
||||||
|
|
||||||
bool transfer_array = (shape.in_array () && level > 0);
|
bool transfer_array = (shape.in_array () && level > 0);
|
||||||
db::Vector disp;
|
|
||||||
if (transfer_array) {
|
if (transfer_array) {
|
||||||
disp = create_repetition (shape.array (), array, irregular_array);
|
create_repetition (shape.array (), array, irregular_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shape->is_simple_polygon ()) {
|
if (shape->is_simple_polygon ()) {
|
||||||
write_shape<db::SimplePolygon> (*shape, disp, array, irregular_array);
|
write_shape<db::SimplePolygon> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_polygon ()) {
|
} else if (shape->is_polygon ()) {
|
||||||
write_shape<db::Polygon> (*shape, disp, array, irregular_array);
|
write_shape<db::Polygon> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_path ()) {
|
} else if (shape->is_path ()) {
|
||||||
write_shape<db::Path> (*shape, disp, array, irregular_array);
|
write_shape<db::Path> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_text ()) {
|
} else if (shape->is_text ()) {
|
||||||
write_shape<db::Text> (*shape, disp, array, irregular_array);
|
write_shape<db::Text> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_edge ()) {
|
} else if (shape->is_edge ()) {
|
||||||
write_shape<db::Edge> (*shape, disp, array, irregular_array);
|
write_shape<db::Edge> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_edge_pair ()) {
|
} else if (shape->is_edge_pair ()) {
|
||||||
write_shape<db::EdgePair> (*shape, disp, array, irregular_array);
|
write_shape<db::EdgePair> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_box ()) {
|
} else if (shape->is_box ()) {
|
||||||
write_shape<db::Box> (*shape, disp, array, irregular_array);
|
write_shape<db::Box> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_point ()) {
|
} else if (shape->is_point ()) {
|
||||||
write_shape<db::Point> (*shape, disp, array, irregular_array);
|
write_shape<db::Point> (*shape, array, irregular_array);
|
||||||
} else if (shape->is_user_object ()) {
|
} else if (shape->is_user_object ()) {
|
||||||
// ignore
|
// ignore
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -486,9 +484,9 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances,
|
||||||
|
|
||||||
db::CellInstArray single_inst;
|
db::CellInstArray single_inst;
|
||||||
if (! inst_array.is_complex ()) {
|
if (! inst_array.is_complex ()) {
|
||||||
single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ());
|
single_inst = db::CellInstArray (inst_array.object (), db::Trans (disp) * inst_array.front ());
|
||||||
} else {
|
} else {
|
||||||
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ()));
|
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (disp) * inst_array.front ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// no compression -> just keep as is
|
// no compression -> just keep as is
|
||||||
|
|
|
||||||
|
|
@ -275,8 +275,6 @@ private:
|
||||||
db::Vector create_repetition (const db::Shape &array, RegularArray ®ular, std::vector<db::Vector> &irregular_array);
|
db::Vector create_repetition (const db::Shape &array, RegularArray ®ular, std::vector<db::Vector> &irregular_array);
|
||||||
template <class Obj>
|
template <class Obj>
|
||||||
void write_shape(const db::Shape &shape, RegularArray ®ular, std::vector<db::Vector> &irregular_array);
|
void write_shape(const db::Shape &shape, RegularArray ®ular, std::vector<db::Vector> &irregular_array);
|
||||||
template <class Obj>
|
|
||||||
void write_shape(const db::Shape &shape, const db::Vector &disp, RegularArray ®ular, std::vector<db::Vector> &irregular_array);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> inline Compressed::compressed_container<db::Point> &Compressed::get_container () { return m_points; }
|
template <> inline Compressed::compressed_container<db::Point> &Compressed::get_container () { return m_points; }
|
||||||
|
|
|
||||||
|
|
@ -151,3 +151,13 @@ TEST(variants)
|
||||||
run_test (_this, tl::testdata (), "variants.lstr", "variants_au.oas");
|
run_test (_this, tl::testdata (), "variants.lstr", "variants_au.oas");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(sample1)
|
||||||
|
{
|
||||||
|
run_test (_this, tl::testdata (), "sample1.lstr", "sample1_au.oas");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(sample2)
|
||||||
|
{
|
||||||
|
run_test (_this, tl::testdata (), "sample2.lstr", "sample2_au.oas");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue