Skip to content

Commit 46601fd

Browse files
committed
epsg double => int に変更
1 parent 34c65ba commit 46601fd

14 files changed

Lines changed: 62 additions & 45 deletions

File tree

include/plateau/geometry/geo_coordinate.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ namespace plateau::geometry {
8282
* 平面直角座標系の判定を含む処理です
8383
* 平面直角座標の場合はunprojectして緯度経度に変換してから判定します。
8484
*/
85-
bool containsInPolar(TVec3d point,const double epsg, bool ignore_height = true) const;
86-
bool containsInPolar(const citygml::CityObject& city_obj,const double epsg, bool ignore_height = true) const;
85+
bool containsInPolar(TVec3d point,const int epsg, bool ignore_height = true) const;
86+
bool containsInPolar(const citygml::CityObject& city_obj,const int epsg, bool ignore_height = true) const;
8787

8888
/**
8989
* other と交わる箇所があるかどうかを返します。
@@ -111,8 +111,11 @@ namespace plateau::geometry {
111111
* 平面直角座標判定、平面直角座標の基準点取得
112112
*/
113113
struct CoordinateReferenceFactory {
114+
115+
static constexpr int default_epsg_ = 6697;
116+
114117
// EPSGごとのzone取得
115-
static int GetZoneId(double epsg) {
118+
static int GetZoneId(int epsg) {
116119
// 日本測地系2011(JGD2011)に基づく平面直角座標系
117120
if (epsg == 10162) {
118121
return 1; // 1系
@@ -157,7 +160,7 @@ namespace plateau::geometry {
157160
}
158161

159162
// EPSGごとの基準点取得
160-
static GeoCoordinate GetReferencePoint(double epsg) {
163+
static GeoCoordinate GetReferencePoint(int epsg) {
161164
const int zone = GetZoneId(epsg);
162165
if (zone != 0)
163166
return GetReferencePointByZone(zone);
@@ -212,7 +215,7 @@ namespace plateau::geometry {
212215
}
213216

214217
// 極座標系・平面直角座標系判定
215-
static bool IsPolarCoordinateSystem(double epsg) {
218+
static bool IsPolarCoordinateSystem(int epsg) {
216219
// 平面直角座標系の区分についてはこちらを参照してください :
217220
// https://www.mlit.go.jp/plateaudocument/toc9/toc9_08/toc9_08_04/
218221
if (epsg >= 10162 && epsg <= 10174) {

include/plateau/geometry/geo_reference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace plateau::geometry {
2626
/// project の座標軸変換をしない版です。座標軸は ENU → ENU であるとします。 reference_point_ は ENUに変換されます。
2727
TVec3d projectWithoutAxisConvert(const TVec3d& lat_lon) const;
2828
TVec3d convertAxisToENU(const TVec3d& vertex) const;
29-
TVec3d convert(const TVec3d& lat_lon, const bool convert_axis = true, const double epsg = 6697) const;
29+
TVec3d convert(const TVec3d& lat_lon, const bool convert_axis = true, const int epsg = CoordinateReferenceFactory::default_epsg_) const;
3030
static TVec3d convertAxisFromENUTo(CoordinateSystem axis, const TVec3d& vertex);
3131
static TVec3d convertAxisToENU(CoordinateSystem axis, const TVec3d& vertex);
3232

include/plateau/polygon_mesh/mesh_extract_options.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace plateau::polygonMesh {
3838
attach_map_tile(true),
3939
map_tile_zoom_level(15),
4040
map_tile_url("https://cyberjapandata.gsi.go.jp/xyz/seamlessphoto/{z}/{x}/{y}.jpg"),
41-
epsg_code(6697)
41+
epsg_code(plateau::geometry::CoordinateReferenceFactory::default_epsg_)
4242
{}
4343

4444
public:
@@ -116,6 +116,6 @@ namespace plateau::polygonMesh {
116116
/**
117117
* 平面直角座標系は、EPSGコードに応じて基準点を取得します。
118118
*/
119-
double epsg_code;
119+
int epsg_code;
120120
};
121121
}

src/c_wrapper/geo_reference_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern "C" {
4949
GeoReference,
5050
TVec3d,
5151
handle->convert(point, convert_axis, epsg),
52-
, TVec3d point, bool convert_axis, double epsg)
52+
, TVec3d point, bool convert_axis, int epsg)
5353

5454
DLL_VALUE_FUNC(plateau_geo_reference_get_reference_point,
5555
GeoReference,

src/c_wrapper/geometry_utils_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DLL_VALUE_FUNC(plateau_geometry_utils_get_center_point,
1515
,int coordinate_zone_id)
1616

1717
LIBPLATEAU_C_EXPORT APIResult LIBPLATEAU_C_API plateau_geometry_utils_is_polar_coordinate_system(
18-
double epsg,
18+
int epsg,
1919
bool* out
2020
) {
2121
API_TRY{

src/c_wrapper/gml_file_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern "C" {
5050

5151
DLL_VALUE_FUNC(plateau_gml_file_get_epsg,
5252
GmlFile,
53-
double,
53+
int,
5454
handle->getEpsg())
5555

5656
LIBPLATEAU_C_EXPORT APIResult LIBPLATEAU_C_API plateau_gml_file_fetch(

src/geometry/geo_coordinate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace plateau::geometry {
6464
}
6565
}
6666

67-
bool Extent::containsInPolar(TVec3d point, const double epsg, bool ignore_height) const {
67+
bool Extent::containsInPolar(TVec3d point, const int epsg, bool ignore_height) const {
6868

6969
if (!CoordinateReferenceFactory::IsPolarCoordinateSystem(epsg)) {
7070
// 平面直角座標系の判定
@@ -74,7 +74,7 @@ namespace plateau::geometry {
7474
return contains(GeoCoordinate(point.x, point.y, point.z), ignore_height);
7575
}
7676

77-
bool Extent::containsInPolar(const CityObject& city_obj, const double epsg, bool ignore_height) const {
77+
bool Extent::containsInPolar(const CityObject& city_obj, const int epsg, bool ignore_height) const {
7878

7979
if (!CoordinateReferenceFactory::IsPolarCoordinateSystem(epsg)) {
8080
// 平面直角座標系の判定

src/geometry/geo_reference.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace plateau::geometry {
2525
}
2626

2727
//平面直角座標判定を含むproject, projectWithoutAxisConvert処理と同様の処理
28-
TVec3d GeoReference::convert(const TVec3d& lat_lon, const bool convert_axis, const double epsg) const {
28+
TVec3d GeoReference::convert(const TVec3d& lat_lon, const bool convert_axis, const int epsg) const {
2929
//平面直角座標変換、座標軸変換をフラグに応じてスキップします。
3030
TVec3d point = lat_lon;
3131

src/polygon_mesh/mesh_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace plateau::polygonMesh {
3232
*/
3333
void cityGmlPolygonToMesh(
3434
const Polygon& polygon, const std::string& gml_path,
35-
const GeoReference& geo_reference, Mesh& out_mesh, double epsg) {
35+
const GeoReference& geo_reference, Mesh& out_mesh, int epsg) {
3636

3737
// マージ対象の情報を取得します。ここでの頂点は極座標です。
3838
const auto& vertices_lat_lon = polygon.getVertices();

wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU.Test/Dataset/GmlFileTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.IO;
33
using Microsoft.VisualStudio.TestTools.UnitTesting;
44
using PLATEAU.Dataset;
5+
using PLATEAU.Geometries;
56
using PLATEAU.Network;
67

78
namespace PLATEAU.Test.Dataset
@@ -42,7 +43,7 @@ public void TestEpsgCode()
4243
string path = "data/udx/bldg/53392642_bldg_6697_op2.gml";
4344
var info = GmlFile.Create(path);
4445
Assert.AreEqual(6697, info.Epsg);
45-
Assert.IsTrue(info.isPolarCoordinateSystem);
46+
Assert.IsTrue(CoordinateReferenceFactory.IsPolarCoordinateSystem(info.Epsg));
4647
info.Dispose();
4748
}
4849

@@ -53,7 +54,7 @@ public void TestEpsgCodePlane()
5354
string path = "data/udx/unf/08EE763_unf_10169_sewer_op.gml";
5455
var info = GmlFile.Create(path);
5556
Assert.AreEqual(10169, info.Epsg);
56-
Assert.IsFalse(info.isPolarCoordinateSystem);
57+
Assert.IsFalse(CoordinateReferenceFactory.IsPolarCoordinateSystem(info.Epsg));
5758
info.Dispose();
5859
}
5960

0 commit comments

Comments
 (0)