Skip to content

Commit 7e25b6b

Browse files
author
Matthias Koefferlein
committed
Fixed LStream writer under the presence of iterated arrays
1 parent 25d3960 commit 7e25b6b

File tree

7 files changed

+22
-16
lines changed

7 files changed

+22
-16
lines changed

src/plugins/streamers/lstream/db_plugin/lstrCompressed.cc

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ Compressed::make_rep_id (const RegularArray &array, const std::vector<db::Vector
6969

7070
template <class Obj>
7171
void
72-
Compressed::write_shape (const db::Shape &shape, const db::Vector &disp, RegularArray &regular, std::vector<db::Vector> &irregular_array)
72+
Compressed::write_shape (const db::Shape &shape, RegularArray &regular, std::vector<db::Vector> &irregular_array)
7373
{
7474
Obj sh;
7575
shape.instantiate (sh);
7676
if (! object_is_empty (sh)) {
77-
sh.move (disp);
7877
if (shape.prop_id () != 0) {
7978
write (db::object_with_properties<Obj> (sh, shape.prop_id ()), regular, irregular_array);
8079
} else {
@@ -115,27 +114,26 @@ Compressed::compress_shapes (const db::Shapes &shapes, unsigned int level, bool
115114
std::vector<db::Vector> irregular_array;
116115

117116
bool transfer_array = (shape.in_array () && level > 0);
118-
db::Vector disp;
119117
if (transfer_array) {
120-
disp = create_repetition (shape.array (), array, irregular_array);
118+
create_repetition (shape.array (), array, irregular_array);
121119
}
122120

123121
if (shape->is_simple_polygon ()) {
124-
write_shape<db::SimplePolygon> (*shape, disp, array, irregular_array);
122+
write_shape<db::SimplePolygon> (*shape, array, irregular_array);
125123
} else if (shape->is_polygon ()) {
126-
write_shape<db::Polygon> (*shape, disp, array, irregular_array);
124+
write_shape<db::Polygon> (*shape, array, irregular_array);
127125
} else if (shape->is_path ()) {
128-
write_shape<db::Path> (*shape, disp, array, irregular_array);
126+
write_shape<db::Path> (*shape, array, irregular_array);
129127
} else if (shape->is_text ()) {
130-
write_shape<db::Text> (*shape, disp, array, irregular_array);
128+
write_shape<db::Text> (*shape, array, irregular_array);
131129
} else if (shape->is_edge ()) {
132-
write_shape<db::Edge> (*shape, disp, array, irregular_array);
130+
write_shape<db::Edge> (*shape, array, irregular_array);
133131
} else if (shape->is_edge_pair ()) {
134-
write_shape<db::EdgePair> (*shape, disp, array, irregular_array);
132+
write_shape<db::EdgePair> (*shape, array, irregular_array);
135133
} else if (shape->is_box ()) {
136-
write_shape<db::Box> (*shape, disp, array, irregular_array);
134+
write_shape<db::Box> (*shape, array, irregular_array);
137135
} else if (shape->is_point ()) {
138-
write_shape<db::Point> (*shape, disp, array, irregular_array);
136+
write_shape<db::Point> (*shape, array, irregular_array);
139137
} else if (shape->is_user_object ()) {
140138
// ignore
141139
} else {
@@ -486,9 +484,9 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances,
486484

487485
db::CellInstArray single_inst;
488486
if (! inst_array.is_complex ()) {
489-
single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ());
487+
single_inst = db::CellInstArray (inst_array.object (), db::Trans (disp) * inst_array.front ());
490488
} else {
491-
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ()));
489+
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (disp) * inst_array.front ()));
492490
}
493491

494492
// no compression -> just keep as is

src/plugins/streamers/lstream/db_plugin/lstrCompressed.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ class Compressed
275275
db::Vector create_repetition (const db::Shape &array, RegularArray &regular, std::vector<db::Vector> &irregular_array);
276276
template <class Obj>
277277
void write_shape(const db::Shape &shape, RegularArray &regular, std::vector<db::Vector> &irregular_array);
278-
template <class Obj>
279-
void write_shape(const db::Shape &shape, const db::Vector &disp, RegularArray &regular, std::vector<db::Vector> &irregular_array);
280278
};
281279

282280
template <> inline Compressed::compressed_container<db::Point> &Compressed::get_container () { return m_points; }

src/plugins/streamers/lstream/unit_tests/dbLStreamWriterTests.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,13 @@ TEST(variants)
151151
run_test (_this, tl::testdata (), "variants.lstr", "variants_au.oas");
152152
}
153153

154+
TEST(sample1)
155+
{
156+
run_test (_this, tl::testdata (), "sample1.lstr", "sample1_au.oas");
157+
}
158+
159+
TEST(sample2)
160+
{
161+
run_test (_this, tl::testdata (), "sample2.lstr", "sample2_au.oas");
162+
}
163+

testdata/lstream/sample1.lstr

3.25 KB
Binary file not shown.

testdata/lstream/sample1_au.oas

797 Bytes
Binary file not shown.

testdata/lstream/sample2.lstr

90.4 KB
Binary file not shown.

testdata/lstream/sample2_au.oas

26.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)