Skip to content

Commit d0fc0e3

Browse files
committed
Merge branch 'feature/mesh_code_alt' of github.com:Synesthesias/libplateau into feature/add_standard_map_grid
2 parents e6da444 + 5ad9adb commit d0fc0e3

40 files changed

Lines changed: 644 additions & 251 deletions
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<core:CityModel xmlns:brid="http://www.opengis.net/citygml/bridge/2.0" xmlns:wtr="http://www.opengis.net/citygml/waterbody/2.0" xmlns:tran="http://www.opengis.net/citygml/transportation/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:frn="http://www.opengis.net/citygml/cityfurniture/2.0" xmlns:veg="http://www.opengis.net/citygml/vegetation/2.0" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:tun="http://www.opengis.net/citygml/tunnel/2.0" xmlns:tex="http://www.opengis.net/citygml/texturedsurface/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:luse="http://www.opengis.net/citygml/landuse/2.0" xmlns:uro="https://www.geospatial.jp/iur/uro/3.1" xmlns:xAL="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:smil20="http://www.w3.org/2001/SMIL20/" xmlns:pbase="http://www.opengis.net/citygml/profiles/base/2.0" xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:grp="http://www.opengis.net/citygml/cityobjectgroup/2.0" xsi:schemaLocation="https://www.geospatial.jp/iur/urf/3.1 ../../schemas/iur/urf/3.1/urbanFunction.xsd https://www.geospatial.jp/iur/uro/3.1 ../../schemas/iur/uro/3.1/urbanObject.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/landuse/2.0 http://schemas.opengis.net/citygml/landuse/2.0/landUse.xsd http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/transportation/2.0 http://schemas.opengis.net/citygml/transportation/2.0/transportation.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/cityobjectgroup/2.0 http://schemas.opengis.net/citygml/cityobjectgroup/2.0/cityObjectGroup.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd">
3+
<gml:boundedBy>
4+
<gml:Envelope srsName="http://www.opengis.net/def/crs/EPSG/0/10169" srsDimension="3">
5+
<gml:lowerCorner>156561.10929971817 21007.437699998685 0</gml:lowerCorner>
6+
<gml:upperCorner>157517.0072997175 22010.374800001056 225.3813</gml:upperCorner>
7+
</gml:Envelope>
8+
</gml:boundedBy>
9+
10+
<core:cityObjectMember>
11+
<uro:Manhole gml:id="unf_f15bce0a-e6b5-41c2-a4ea-140f966686c3">
12+
<gml:name>雨水マンホール</gml:name>
13+
<core:creationDate>2025-03-21</core:creationDate>
14+
<frn:lod2Geometry>
15+
<gml:Solid srsName="http://www.opengis.net/def/crs/EPSG/0/10169" srsDimension="3">
16+
<gml:exterior>
17+
<gml:CompositeSurface>
18+
<gml:surfaceMember>
19+
<gml:Polygon gml:id="poly-7a90fd2f-c13c-4824-ab37-9cc81d19ad51">
20+
<gml:exterior>
21+
<gml:LinearRing>
22+
<gml:posList>157110.9434 21547.8443 136.489 157111.4651 21547.5479 136.489 157111.4651 21547.5479 135.139 157110.9434 21547.8443 135.139 157110.9434 21547.8443 136.489</gml:posList>
23+
</gml:LinearRing>
24+
</gml:exterior>
25+
</gml:Polygon>
26+
</gml:surfaceMember>
27+
<gml:surfaceMember>
28+
<gml:Polygon gml:id="poly-47a82d4d-d696-4dd1-b7b3-5cbe9336f141">
29+
<gml:exterior>
30+
<gml:LinearRing>
31+
<gml:posList>157111.7615 21548.0695 135.139 157111.4651 21547.5479 135.139 157111.4651 21547.5479 136.489 157111.7615 21548.0695 136.489 157111.7615 21548.0695 135.139</gml:posList>
32+
</gml:LinearRing>
33+
</gml:exterior>
34+
</gml:Polygon>
35+
</gml:surfaceMember>
36+
<gml:surfaceMember>
37+
<gml:Polygon gml:id="poly-6f56700e-61de-439a-aefa-c04c1eb4aaeb">
38+
<gml:exterior>
39+
<gml:LinearRing>
40+
<gml:posList>157111.7615 21548.0695 136.489 157111.4651 21547.5479 136.489 157110.9434 21547.8443 136.489 157111.2398 21548.366 136.489 157111.7615 21548.0695 136.489</gml:posList>
41+
</gml:LinearRing>
42+
</gml:exterior>
43+
</gml:Polygon>
44+
</gml:surfaceMember>
45+
<gml:surfaceMember>
46+
<gml:Polygon gml:id="poly-4f0fbdad-b948-4122-95c2-b8f2656630c3">
47+
<gml:exterior>
48+
<gml:LinearRing>
49+
<gml:posList>157110.9434 21547.8443 135.139 157111.4651 21547.5479 135.139 157111.7615 21548.0695 135.139 157111.2398 21548.366 135.139 157110.9434 21547.8443 135.139</gml:posList>
50+
</gml:LinearRing>
51+
</gml:exterior>
52+
</gml:Polygon>
53+
</gml:surfaceMember>
54+
<gml:surfaceMember>
55+
<gml:Polygon gml:id="poly-f2f88f9b-3671-4722-a933-bd81c52b94fa">
56+
<gml:exterior>
57+
<gml:LinearRing>
58+
<gml:posList>157111.2398 21548.366 135.139 157111.7615 21548.0695 135.139 157111.7615 21548.0695 136.489 157111.2398 21548.366 136.489 157111.2398 21548.366 135.139</gml:posList>
59+
</gml:LinearRing>
60+
</gml:exterior>
61+
</gml:Polygon>
62+
</gml:surfaceMember>
63+
<gml:surfaceMember>
64+
<gml:Polygon gml:id="poly-e378d104-8bd1-41b0-aa2f-b62e9f63cf1e">
65+
<gml:exterior>
66+
<gml:LinearRing>
67+
<gml:posList>157110.9434 21547.8443 135.139 157111.2398 21548.366 135.139 157111.2398 21548.366 136.489 157110.9434 21547.8443 136.489 157110.9434 21547.8443 135.139</gml:posList>
68+
</gml:LinearRing>
69+
</gml:exterior>
70+
</gml:Polygon>
71+
</gml:surfaceMember>
72+
</gml:CompositeSurface>
73+
</gml:exterior>
74+
</gml:Solid>
75+
</frn:lod2Geometry>
76+
<uro:frnDataQualityAttribute>
77+
<uro:DataQualityAttribute>
78+
<uro:geometrySrcDescLod0 codeSpace="../../codelists/DataQualityAttribute_geometrySrcDesc.xml">500</uro:geometrySrcDescLod0>
79+
<uro:geometrySrcDescLod1 codeSpace="../../codelists/DataQualityAttribute_geometrySrcDesc.xml">999</uro:geometrySrcDescLod1>
80+
<uro:geometrySrcDescLod2 codeSpace="../../codelists/DataQualityAttribute_geometrySrcDesc.xml">500</uro:geometrySrcDescLod2>
81+
<uro:geometrySrcDescLod3 codeSpace="../../codelists/DataQualityAttribute_geometrySrcDesc.xml">999</uro:geometrySrcDescLod3>
82+
<uro:thematicSrcDesc codeSpace="../../codelists/DataQualityAttribute_thematicSrcDesc.xml">500</uro:thematicSrcDesc>
83+
</uro:DataQualityAttribute>
84+
</uro:frnDataQualityAttribute>
85+
<uro:year>2008</uro:year>
86+
</uro:Manhole>
87+
</core:cityObjectMember>
88+
</core:CityModel>

include/plateau/dataset/gml_file.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <libplateau_api.h>
4-
#include <plateau/dataset/mesh_code.h>
54
#include <set>
65
#include <optional>
76
#include "plateau/network/client.h"
@@ -22,6 +21,8 @@ namespace plateau::dataset {
2221
void setPath(const std::string& path);
2322
std::shared_ptr<GridCode> getGridCode() const;
2423
GridCode* getGridCodeRaw() const; // 寿命管理をDLL利用者に任せる用です
24+
double getEpsg() const;
25+
bool isPolarCoordinateSystem() const;
2526
const std::string& getFeatureType() const;
2627
PredefinedCityModelPackage getPackage() const;
2728
std::string getAppearanceDirectoryPath() const;
@@ -64,6 +65,7 @@ namespace plateau::dataset {
6465
std::string path_;
6566
std::shared_ptr<GridCode> grid_code_;
6667
std::string feature_type_;
68+
std::string epsg_;
6769
bool is_valid_;
6870
bool is_local_;
6971
int max_lod_;

include/plateau/dataset/grid_code.h

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include "plateau/geometry/geo_coordinate.h"
77

88
namespace plateau::dataset {
9+
class StandardMapGrid;
10+
class MeshCode;
11+
912
/**
1013
* \brief 地図の区画を表すコードの基底クラスです。
1114
*
@@ -25,11 +28,6 @@ namespace plateau::dataset {
2528
*/
2629
virtual geometry::Extent getExtent() const = 0;
2730

28-
/**
29-
* \brief このコードが他のコードに内包されるかどうかを計算します。
30-
*/
31-
virtual bool isWithin(const GridCode& other) const = 0;
32-
3331
/**
3432
* \brief コードが適切な値かどうかを返します。
3533
*/
@@ -38,19 +36,34 @@ namespace plateau::dataset {
3836
/**
3937
* \brief 1段階上のレベルのグリッドコードに変換します。
4038
*/
41-
virtual std::shared_ptr<GridCode> upper() = 0;
39+
virtual std::shared_ptr<GridCode> upper() const = 0;
40+
41+
/**
42+
* \brief upper()のP/Invokeから呼び出す版です。newして返すので、利用者が適切に廃棄する必要があります。
43+
*/
44+
virtual GridCode* upperRaw() const = 0;
4245

4346
/**
4447
* \brief コードのレベル(詳細度)を取得します。
4548
*/
4649
virtual int getLevel() const = 0;
4750

4851
/**
49-
* \brief コードのレベル(詳細度)が、PLATEAUの仕様上考えられる中でもっとも大きいものであるときにtrueを返します。
50-
* @return
52+
* \brief コードのレベル(詳細度)が、PLATEAUの仕様上考えられる中でもっとも広域であるときにtrueを返します。
5153
*/
5254
virtual bool isLargestLevel() const = 0;
5355

56+
/**
57+
* \brief コードのレベル(詳細度)が、PLATEAUの典型的な建物のGMLファイルのレベルよりも詳細である場合にtrueを返します。
58+
*/
59+
virtual bool isSmallerThanNormalGml() const = 0;
60+
61+
/**
62+
* \brief コードのレベル(詳細度)が、PLATEAUの典型的な建物のGMLファイルのレベルである場合にtrueを返します。
63+
*/
64+
virtual bool isNormalGmlLevel() const = 0;
65+
66+
5467
/**
5568
* \brief 与えられたコードから適切なGridCodeの派生クラスのインスタンスを作成します。
5669
* \param code コード文字列
@@ -71,7 +84,9 @@ namespace plateau::dataset {
7184

7285
struct GridCodeComparator {
7386
bool operator()(const std::shared_ptr<GridCode>& lhs, const std::shared_ptr<GridCode>& rhs) const {
74-
if(lhs == nullptr || rhs == nullptr) return false;
87+
if(lhs == nullptr && rhs == nullptr) return false;
88+
if(lhs != nullptr && rhs == nullptr) return false;
89+
if(lhs == nullptr) return true;
7590
return lhs->get() < rhs->get();
7691
}
7792
};

include/plateau/dataset/i_dataset_accessor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace plateau::dataset {
1616
*/
1717
class LIBPLATEAU_EXPORT UdxSubFolder {
1818
public:
19-
UdxSubFolder(std::string name)
19+
explicit UdxSubFolder(std::string name)
2020
: name_(std::move(name)) {
2121
}
2222

@@ -27,11 +27,11 @@ namespace plateau::dataset {
2727
return name_;
2828
}
2929

30-
operator std::string& () {
30+
explicit operator std::string& () {
3131
return name_;
3232
}
3333

34-
operator std::string() const {
34+
explicit operator std::string() const {
3535
return name_;
3636
}
3737

@@ -95,9 +95,9 @@ namespace plateau::dataset {
9595
* \brief GMLファイル群のうち、範囲が extent の内部であり、パッケージ種が package であるものを vector で返します。
9696
* なお、 package はフラグの集合と見なされるので、複数のビットを立てることで複数の指定が可能です。
9797
*/
98-
virtual std::shared_ptr<std::vector<GmlFile>> getGmlFiles(const PredefinedCityModelPackage package) = 0;
98+
virtual std::shared_ptr<std::vector<GmlFile>> getGmlFiles(PredefinedCityModelPackage package) = 0;
9999

100-
virtual void getGmlFiles(const PredefinedCityModelPackage package,
100+
virtual void getGmlFiles(PredefinedCityModelPackage package,
101101
std::vector<GmlFile>& out_vector) = 0;
102102

103103
/**

include/plateau/dataset/invalid_grid_code.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,12 @@ namespace plateau::dataset {
2626
* \return 原点(0,0,0)を中心とする無効な範囲を返します。
2727
*/
2828
geometry::Extent getExtent() const override {
29-
return geometry::Extent(
29+
return {
3030
geometry::GeoCoordinate(0, 0, 0),
3131
geometry::GeoCoordinate(0, 0, 0)
32-
);
32+
};
3333
}
3434

35-
/**
36-
* \brief このコードが他のコードに内包されるかどうかを計算します。
37-
* \return 常にfalseを返します。
38-
*/
39-
bool isWithin(const GridCode& other) const override { return false; }
40-
4135
/**
4236
* \brief コードが適切な値かどうかを返します。
4337
* \return 常にfalseを返します。
@@ -48,11 +42,17 @@ namespace plateau::dataset {
4842
* \brief 1段階上のレベルのグリッドコードに変換します。
4943
* \return 無効なグリッドコードを返します。
5044
*/
51-
std::shared_ptr<GridCode> upper() override {
45+
std::shared_ptr<GridCode> upper() const override {
5246
return std::make_shared<InvalidGridCode>();
5347
}
5448

49+
GridCode* upperRaw() const override {
50+
return new InvalidGridCode();
51+
}
52+
5553
int getLevel() const override { return -1; }
5654
bool isLargestLevel() const override { return true; }
55+
bool isSmallerThanNormalGml() const override { return false; }
56+
bool isNormalGmlLevel() const override { return true; }
5757
};
5858
}

include/plateau/dataset/mesh_code.h

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace plateau::dataset {
1313
*
1414
* 2~5次メッシュの緯度経度範囲の取得、緯度経度範囲を内包する3次メッシュの取得を行う機能を提供しています。
1515
*/
16-
class LIBPLATEAU_EXPORT MeshCode : public GridCode {
16+
class LIBPLATEAU_EXPORT MeshCode : public plateau::dataset::GridCode {
1717
public:
1818
explicit MeshCode(const std::string& code);
1919
MeshCode() = default;
@@ -26,7 +26,7 @@ namespace plateau::dataset {
2626
/**
2727
* \brief メッシュコードの次数を取得します。
2828
*/
29-
int getLevel() const;
29+
int getLevel() const override;
3030

3131
/**
3232
* \brief メッシュコードの緯度経度範囲を取得します。
@@ -48,11 +48,6 @@ namespace plateau::dataset {
4848
*/
4949
static std::shared_ptr<std::vector<MeshCode>> getThirdMeshes(const geometry::Extent& extent);
5050

51-
/**
52-
* \brief 地域メッシュが内包されるかどうかを計算します。
53-
*/
54-
bool isWithin(const GridCode& other) const override;
55-
5651
/**
5752
* \brief 地域メッシュを2次メッシュとして取得します。
5853
*/
@@ -61,7 +56,8 @@ namespace plateau::dataset {
6156
/**
6257
* \brief レベル2以上の範囲で1段階上のレベルの地域メッシュに変換します。
6358
*/
64-
std::shared_ptr<GridCode> upper() override;
59+
std::shared_ptr<GridCode> upper() const override;
60+
GridCode* upperRaw() const override;
6561

6662
/**
6763
* \brief メッシュコードが適切な値かどうかを返します。
@@ -72,24 +68,26 @@ namespace plateau::dataset {
7268
* \brief コードのレベル(詳細度)が、PLATEAUの仕様上考えられる中でもっとも大きいものであるときにtrueを返します。
7369
*/
7470
bool isLargestLevel() const override;
71+
bool isSmallerThanNormalGml() const override;
72+
bool isNormalGmlLevel() const override;
7573

7674
bool operator==(const MeshCode& other) const;
7775

7876

7977

8078
private:
81-
int first_row_;
82-
int first_col_;
83-
int second_row_;
84-
int second_col_;
85-
int third_row_;
86-
int third_col_;
87-
int fourth_row_;
88-
int fourth_col_;
89-
int fifth_row_;
90-
int fifth_col_;
91-
int level_;
92-
bool is_valid_;
79+
int first_row_ = 0;
80+
int first_col_ = 0;
81+
int second_row_ = 0;
82+
int second_col_ = 0;
83+
int third_row_ = 0;
84+
int third_col_ = 0;
85+
int fourth_row_ = 0;
86+
int fourth_col_ = 0;
87+
int fifth_row_ = 0;
88+
int fifth_col_ = 0;
89+
int level_ = 0;
90+
bool is_valid_ = false;
9391

9492
static void nextRow(MeshCode& mesh_code);
9593
static void nextCol(MeshCode& mesh_code);

include/plateau/dataset/standard_map_grid.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <string>
4-
#include <tuple>
54

65
#include <libplateau_api.h>
76
#include "plateau/geometry/geo_coordinate.h"
@@ -16,7 +15,7 @@ namespace plateau::dataset {
1615
*/
1716
class LIBPLATEAU_EXPORT StandardMapGrid : public GridCode {
1817
public:
19-
explicit StandardMapGrid(const std::string& code);
18+
explicit StandardMapGrid(std::string code);
2019
StandardMapGrid() = default;
2120

2221
/**
@@ -29,11 +28,6 @@ namespace plateau::dataset {
2928
*/
3029
geometry::Extent getExtent() const override;
3130

32-
/**
33-
* \brief 図郭が他の図郭に内包されるかどうかを計算します。
34-
*/
35-
bool isWithin(const GridCode& other) const override;
36-
3731
/**
3832
* \brief 図郭コードが適切な値かどうかを返します。
3933
*/
@@ -42,7 +36,8 @@ namespace plateau::dataset {
4236
/**
4337
* \brief 1段階上のレベルのグリッドコードに変換します。
4438
*/
45-
std::shared_ptr<GridCode> upper() override;
39+
std::shared_ptr<GridCode> upper() const override;
40+
GridCode* upperRaw() const override;
4641

4742
/**
4843
* \brief コードのレベル(詳細度)を取得します。
@@ -53,14 +48,15 @@ namespace plateau::dataset {
5348
* \brief コードのレベル(詳細度)が、PLATEAUの仕様上考えられる中でもっとも大きいものであるときにtrueを返します。
5449
*/
5550
bool isLargestLevel() const override;
51+
bool isSmallerThanNormalGml() const override;
52+
bool isNormalGmlLevel() const override;
5653

5754
bool operator==(const StandardMapGrid& other) const;
58-
bool operator<(StandardMapGrid& other) const;
5955
bool operator<(const StandardMapGrid& other) const;
6056

6157
private:
6258
std::string code_; // 図郭コード
63-
bool is_valid_; // コードが有効かどうか
59+
bool is_valid_ = false; // コードが有効かどうか
6460
StandardMapGridLevel level_;
6561

6662
int coordinate_origin_; // 原点

0 commit comments

Comments
 (0)