Skip to content

Commit 625bfc9

Browse files
committed
nitpick対応
1 parent dd4e68b commit 625bfc9

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

test/test_tile_extractor.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "gtest/gtest.h"
22
#include "citygml/citymodel.h"
33
#include "citygml/citygml.h"
4-
#include "plateau/dataset/grid_code.h"
54
#include <plateau/polygon_mesh/tile_extractor.h>
6-
#include <plateau/dataset/gml_file.h>
75

86
using namespace citygml;
97
using namespace plateau::geometry;
@@ -23,6 +21,7 @@ namespace plateau::polygonMesh {
2321

2422
const std::string gml_path = u8"../data/日本語パステスト/tile_test/tran/52353549_tran_6697_op.gml";
2523
const std::shared_ptr<const CityModel> city_model = load(gml_path, params_);
24+
ASSERT_TRUE(city_model);
2625

2726
// zoomLevel 11の場合のグリッド分割
2827
MeshExtractOptions mesh_extract_options = MeshExtractOptions();
@@ -35,25 +34,33 @@ namespace plateau::polygonMesh {
3534
const auto min = city_model->getEnvelope().getLowerBound();
3635
const auto max = city_model->getEnvelope().getUpperBound();
3736

38-
std::vector extents = {
37+
std::vector<Extent> extents = {
3938
Extent(GeoCoordinate(min.x, min.y, min.z), GeoCoordinate(max.x, max.y, max.z))
4039
};
4140

4241
const auto model = TileExtractor::extractWithGrid(*city_model, mesh_extract_options, extents);
4342

44-
ASSERT_EQ(model->getRootNodeCount(), 4); // 2x2のグリッドなので最大4つのGRIDノードがあるはず(オブジェクトがなければ少なくなる)
43+
ASSERT_EQ(model->getRootNodeCount(), 4); // 2x2のグリッドなので最大4つのGRIDノードがあるはず(オブジェクトがなければ少なくなる)Test用の読込GMLは4分割される
4544

4645
// グリッドノードの名前を確認
4746
const auto& grid_node = model->getRootNodeAt(0);
4847
const auto& grid_name = grid_node.getName();
4948
ASSERT_EQ(grid_name.substr(0, 4), "GRID");
5049

50+
for (size_t i = 0; i < model->getRootNodeCount(); ++i) {
51+
const auto& node = model->getRootNodeAt(i);
52+
const auto& name = node.getName();
53+
ASSERT_EQ(name.substr(0, 4), "GRID");
54+
}
55+
5156
// LODノードの名前を確認
57+
ASSERT_GT(grid_node.getChildCount(), 0);
5258
const auto& lod_node = grid_node.getChildAt(0);
5359
const auto& lod_name = lod_node.getName();
5460
ASSERT_EQ(lod_name.substr(0, 3), "LOD");
5561

5662
// グリッドノードの子ノードの名前を確認
63+
ASSERT_GT(lod_node.getChildCount(), 0);
5764
const auto& first_model_node = lod_node.getChildAt(0);
5865
const auto& first_model_node_name = first_model_node.getName();
5966
ASSERT_EQ(first_model_node_name.substr(0, 5), "group");
@@ -73,13 +80,15 @@ namespace plateau::polygonMesh {
7380
const std::string gml_path2 = u8"../data/日本語パステスト/tile_test/tran/52353549_tran_6697_op.gml";
7481
const std::shared_ptr<const CityModel> city_model1 = load(gml_path1, params_);
7582
const std::shared_ptr<const CityModel> city_model2 = load(gml_path2, params_);
83+
ASSERT_TRUE(city_model1);
84+
ASSERT_TRUE(city_model2);
7685

7786
const auto min1 = city_model1->getEnvelope().getLowerBound();
7887
const auto max1 = city_model1->getEnvelope().getUpperBound();
7988
const auto min2 = city_model2->getEnvelope().getLowerBound();
8089
const auto max2 = city_model2->getEnvelope().getUpperBound();
8190

82-
std::vector extents = {
91+
std::vector<Extent> extents = {
8392
Extent(GeoCoordinate(min1.x, min1.y, min1.z), GeoCoordinate(max1.x, max1.y, max1.z)),
8493
Extent(GeoCoordinate(min2.x, min2.y, min2.z), GeoCoordinate(max2.x, max2.y, max2.z)),
8594
};
@@ -92,11 +101,12 @@ namespace plateau::polygonMesh {
92101
auto model = TileExtractor::extractWithCombine(city_models, mesh_extract_options, extents);
93102

94103
// LODノードの名前を確認
104+
ASSERT_GT(model->getRootNodeCount(), 0);
95105
const auto& lod_node = model->getRootNodeAt(0);
96106
const auto& lod_name = lod_node.getName();
97107
ASSERT_EQ(lod_name.substr(0, 3), "LOD");
98108

99-
ASSERT_EQ(lod_node.getChildCount(), 1); // 結合なので1つの子ノードがあるはず
109+
ASSERT_EQ(lod_node.getChildCount(), 1); // 結合されるので子ノードは1つ
100110

101111
// 子ノードの名前を確認
102112
const auto& first_model_node = lod_node.getChildAt(0);

wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU/PolygonMesh/MeshExtractOptions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public float UnitScale
155155
{
156156
if (Math.Abs(value) < 0.00000001)
157157
{
158-
throw new ArgumentException($"Validate failed : {nameof(this.UnitScale)} is too small.");
158+
throw new ArgumentOutOfRangeException(nameof(value), "UnitScale is too small.");
159159
}
160160
this.unitScale = value;
161161
}
@@ -228,6 +228,11 @@ public string MapTileURL
228228

229229
public int EpsgCode;
230230

231+
/// <summary>
232+
/// 最高LODのみを抽出するかどうかを指定します。
233+
/// true の場合、minLOD..maxLOD のうち最大LODに相当するポリゴンのみを抽出します。
234+
/// false の場合、minLOD から maxLOD までの範囲のポリゴンを抽出します。
235+
/// </summary>
231236
[MarshalAs(UnmanagedType.U1)]
232237
public bool HighestLodOnly;
233238

wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU/PolygonMesh/TileExtractor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public static class TileExtractor
1717

1818
/// <summary>
1919
/// <see cref="CityModel"/> からタイル分割された <see cref="Model"/> を抽出します。
20+
/// Grid分割する場合は、<paramref name="options"/> の <see cref="MeshExtractOptions.GridCountOfSide"/> を2以上に
21+
/// <see cref="MeshExtractOptions.HighestLodOnly"/> をtrueに設定してください。
2022
/// 結果は <paramref name="outModel"/> に格納されます。
2123
/// 通常、<paramref name="outModel"/> には new したばかりの Model を渡してください。
2224
/// </summary>

0 commit comments

Comments
 (0)