Skip to content

Commit 4db4a48

Browse files
committed
AIコメント対応
1 parent 70432d8 commit 4db4a48

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

src/c_wrapper/tile_extractor_c.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ extern "C"{
1616
Model* const out_model) {
1717
API_TRY{
1818

19+
if (out_model == nullptr || extents == nullptr) {
20+
return APIResult::ErrorInvalidArgument;
21+
}
22+
if (city_model_size < 0) {
23+
return APIResult::ErrorInvalidArgument;
24+
}
25+
if (city_model_size > 0 && city_model_handles == nullptr) {
26+
return APIResult::ErrorInvalidArgument;
27+
}
28+
1929
CityModelVector city_models = std::make_shared<std::vector<std::weak_ptr<const citygml::CityModel>>>();
2030
for (int i = 0; i < city_model_size; ++i) {
2131
if (!city_model_handles[i]) {
@@ -26,6 +36,11 @@ extern "C"{
2636
city_models->push_back(weak);
2737
}
2838

39+
if (city_models->empty()) {
40+
// 入力に有効な CityModel が含まれていない
41+
return APIResult::ErrorInvalidArgument;
42+
}
43+
2944
TileExtractor::extractWithCombine(*out_model, city_models, options, *extents);
3045
return APIResult::Success;
3146

@@ -40,6 +55,9 @@ extern "C"{
4055
const std::vector<plateau::geometry::Extent>* extents,
4156
Model* const out_model) {
4257
API_TRY{
58+
if (out_model == nullptr || extents == nullptr || city_model_handle == nullptr) {
59+
return APIResult::ErrorInvalidArgument;
60+
}
4361
TileExtractor::extractWithGrid(*out_model, city_model_handle->getCityModel(), options, *extents);
4462
return APIResult::Success;
4563
}

src/polygon_mesh/tile_extractor.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ namespace {
5858
packer.process(out_model);
5959
}
6060

61-
const auto& gmlPath = (!city_models || city_models->empty() || city_models->front().expired()) ? "" : city_models->front().lock()->getGmlPath();
62-
61+
const auto & gmlPath = (!city_models || city_models->empty() || city_models->front().expired()) ? "" : city_models->front().lock()->getGmlPath();
62+
6363
// 現在の都市モデルが地形であるなら、衛星写真または地図用のUVを付与し、地図タイルをダウンロードします。
64-
auto package = GmlFile(gmlPath).getPackage();
65-
if (package == PredefinedCityModelPackage::Relief && options.attach_map_tile) {
66-
const auto gml_path = fs::u8path(gmlPath);
67-
const auto map_download_dest = gml_path.parent_path() / (gml_path.filename().u8string() + "_map");
68-
MapAttacher().attach(out_model, options.map_tile_url, map_download_dest, options.map_tile_zoom_level,
69-
geo_reference);
64+
if (!gmlPath.empty()) {
65+
auto package = GmlFile(gmlPath).getPackage();
66+
if (package == PredefinedCityModelPackage::Relief && options.attach_map_tile) {
67+
const auto gml_path = fs::u8path(gmlPath);
68+
const auto map_download_dest = gml_path.parent_path() / (gml_path.filename().u8string() + "_map");
69+
MapAttacher().attach(out_model, options.map_tile_url, map_download_dest, options.map_tile_zoom_level, geo_reference);
70+
}
7071
}
7172
}
7273

0 commit comments

Comments
 (0)