Skip to content

Commit 71ecdeb

Browse files
authored
主要地物と最小地物で主要地物IDがずれる問題を修正 (Synesthesias#181)
1 parent 1d6f2ef commit 71ecdeb

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

include/plateau/polygon_mesh/mesh_factory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ namespace plateau::polygonMesh {
6060
const std::list<const citygml::CityObject*>& city_objects,
6161
unsigned lod, const std::string& gml_path);
6262

63+
void incrementPrimaryIndex();
64+
6365
/**
6466
* city_obj に含まれるポリゴンをすべて検索し、リストで返します。
6567
* 子の CityObject は検索しません。

src/polygon_mesh/area_mesh_factory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ namespace plateau::polygonMesh {
132132
auto atomic_objects = PolygonMeshUtils::getChildCityObjectsRecursive(*primary_object);
133133
mesh_factory.addPolygonsInAtomicCityObjects(*primary_object, atomic_objects, lod, city_model.getGmlPath());
134134
}
135+
mesh_factory.incrementPrimaryIndex();
135136
}
136137
merged_meshes.emplace(group_id, mesh_factory.releaseMesh());
137138
}

src/polygon_mesh/mesh_extractor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace {
7171

7272
// 主要地物ごとのノードを追加します。
7373
lod_node.addChildNode(Node(primary_object->getId(), mesh_factory.releaseMesh()));
74+
mesh_factory.incrementPrimaryIndex();
7475
}
7576
}
7677
break;
@@ -87,8 +88,8 @@ namespace {
8788

8889
// 主要地物のノードを作成します。
8990
std::unique_ptr<Mesh> primary_mesh;
91+
MeshFactory primary_mesh_factory(nullptr, options, geo_reference);
9092
if (MeshExtractor::shouldContainPrimaryMesh(lod, *primary_city_object)) {
91-
MeshFactory primary_mesh_factory(nullptr, options, geo_reference);
9293
primary_mesh_factory.addPolygonsInPrimaryCityObject(*primary_city_object, lod, city_model.getGmlPath());
9394
primary_mesh = primary_mesh_factory.releaseMesh();
9495
}
@@ -105,6 +106,7 @@ namespace {
105106
primary_node.addChildNode(std::move(atomic_node));
106107
}
107108
lod_node.addChildNode(std::move(primary_node));
109+
primary_mesh_factory.incrementPrimaryIndex();
108110
}
109111

110112
}

src/polygon_mesh/mesh_factory.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ namespace plateau::polygonMesh {
227227
const auto primary_index = available_primary_index_.getPrimary();
228228
mesh_->addUV4WithSameVal(primary_index.toUV(), vertex_count);
229229
mesh_->city_object_list_.add(primary_index, gml_id);
230-
++available_primary_index_.primary_index;
231230
}
232231

233232
long long MeshFactory::countVertices(
@@ -314,6 +313,9 @@ namespace plateau::polygonMesh {
314313
}
315314
}
316315

316+
void MeshFactory::incrementPrimaryIndex() {
317+
++available_primary_index_.primary_index;
318+
}
317319

318320
void MeshFactory::findAllPolygons(
319321
const CityObject& city_obj, const unsigned lod,
@@ -339,7 +341,6 @@ namespace plateau::polygonMesh {
339341
// 登録されて無ければ新規にインデックスを追加
340342
available_city_object_index = available_primary_index_;
341343
available_city_object_index.atomic_index = 0;
342-
++available_primary_index_.primary_index;
343344
}
344345
return available_city_object_index;
345346
}

0 commit comments

Comments
 (0)