Skip to content

Conversation

@sevendev
Copy link
Contributor

@sevendev sevendev commented Apr 8, 2025

関連リンク

実装内容

epsgによる判定でmesh_extractorのproject処理をスキップ

レビュー前確認項目

  • 自動ビルド・テストが通っていること

マージ前確認項目

  • 自動ビルド・テストが通っていること
  • Squash and Mergeが選択されていること
  • (libcitygmlの変更がある場合)libcitygmlがmasterの最新版になっていること

動作確認

現状はユニットテストでの動作確認のみ
全実装完了後に長岡市の地下施設の読み込み確認

その他

Summary by CodeRabbit

  • 新機能

    • 詳細な3D都市モデルに、雨水マンホールを含む新たなインフラ情報を追加しました。
    • 幅広い地理座標範囲に対応する柔軟な座標変換が実現し、メッシュ生成の位置精度が向上しました。
  • テスト

    • GeoReferenceクラスの機能検証を強化するテストケースを追加しました。
    • GmlFileクラスのEPSGコード取得と極座標ステータスを検証するテストケースを追加しました。
    • メッシュ抽出の際の座標変換を確認するテストケースを追加し、信頼性を向上しました。
    • DatasetAccessorTestクラスのテストメソッドの期待値を更新し、地下施設パッケージを含めました。

@coderabbitai
Copy link

coderabbitai bot commented Apr 8, 2025

Walkthrough

このプルリクエストでは、CityGML標準に基づく新たなCityModel XMLファイルが追加され、Manholeオブジェクトを含む詳細な都市モデルが定義されました。また、GmlFileクラスにEPSGコード取得および極座標判定のメソッドが導入され、GeoReferenceクラスは新たなconvertメソッドで座標変換処理が強化されています。さらに、これらの変更に合わせ、ポリゴンメッシュ生成ロジックやテストケース(GeoReference、GmlFile、MeshExtractor)が更新・追加されています。

Changes

File(s) Change Summary
data/日本語パステスト/.../08EE763_unf_10169_sewer_op.gml CityGML準拠の新XMLファイル追加。CityModel内でManholeオブジェクト、バウンディングボックス、ジオメトリ、品質属性を定義。
include/plateau/dataset/gml_file.h
src/dataset/gml_file.cpp
test/test_gml_file.cpp
GmlFileクラスにgetEpsg()およびisPolarCoordinateSystem()メソッドを追加し、EPSGコードの抽出と極座標判定機能を実装。
include/plateau/geometry/geo_coordinate.h Extent::all()メソッドの最小/最大座標値を(-9999999, -9999999, -9999)と(9999999, 9999999, 9999)に更新。
include/plateau/geometry/geo_reference.h
src/geometry/geo_reference.cpp
test/test_geo_reference.cpp
GeoReferenceクラスに新たなconvert()メソッドを追加し、軸変換と投影処理の選択を可能に。
src/polygon_mesh/mesh_factory.cpp
src/polygon_mesh/polygon_mesh_utils.cpp
test/test_mesh_extractor.cpp
ポリゴンメッシュ生成ロジックを更新。新機能であるGmlFileとGeoReferenceのメソッドを利用し、極座標判定に基づく座標変換処理を実装。
test/CMakeLists.txt plateau_test対象のソースファイルリストを整理し、test_geo_reference.cppを新規追加。

Sequence Diagram(s)

sequenceDiagram
    participant MF as MeshFactory
    participant GF as GmlFile
    participant GR as GeoReference
    MF->>GF: applyPath(gml_path) // EPSG情報の設定
    GF-->>MF: EPSGコードを返却
    MF->>GF: isPolarCoordinateSystem()
    GF-->>MF: 極座標判定結果を返却
    MF->>GR: convert(city_center, true, isPolar)
    GR-->>MF: 変換後の座標を返却
    MF->>MF: メッシュ生成処理を実施
Loading

Poem

ぴょんぴょん跳ねる小さなウサギでございます
コードの森に新たな命が芽吹く
EPSGと座標の謎もぱっと解け
メッシュが踊り出す輝く瞬間
わたしもワクワク、にっこり🐰!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 758c6c4 and 721f421.

📒 Files selected for processing (1)
  • src/dataset/gml_file.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/dataset/gml_file.cpp
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-and-test (ubuntu-20.04, x86_64)
  • GitHub Check: build-and-test (macos-14, arm64)
  • GitHub Check: check-submodule-license
  • GitHub Check: build-and-test (windows-2022, x86_64)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
include/plateau/dataset/gml_file.h (1)

19-21: コメントの更新が必要かもしれません

19-21行目のTODOコメントでは「EPSGコードの判別と、それによって処理を変える機能は未実装です」と記載されていますが、今回の変更でその機能の一部が実装されたようです。このTODOコメントを更新または削除することを検討してください。

include/plateau/geometry/geo_coordinate.h (1)

16-18: 記載されたEPSGコードの例について

コメントには「EPSGコードが 6697 のとき」という具体例が記載されていますが、今回の変更で新たに対応した平面直角座標系のEPSGコード(例:10169)についても言及するとさらに明確になるでしょう。

include/plateau/geometry/geo_reference.h (1)

23-23: コメントの書式を修正

コメント閉じタグの前の余分なスペースが削除されました。これはコードスタイルの一貫性を保つための良い変更です。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfee250 and 81a3c63.

📒 Files selected for processing (12)
  • data/日本語パステスト/udx/unf/08EE763_unf_10169_sewer_op.gml (1 hunks)
  • include/plateau/dataset/gml_file.h (2 hunks)
  • include/plateau/geometry/geo_coordinate.h (1 hunks)
  • include/plateau/geometry/geo_reference.h (1 hunks)
  • src/dataset/gml_file.cpp (2 hunks)
  • src/geometry/geo_reference.cpp (1 hunks)
  • src/polygon_mesh/mesh_factory.cpp (3 hunks)
  • src/polygon_mesh/polygon_mesh_utils.cpp (2 hunks)
  • test/CMakeLists.txt (1 hunks)
  • test/test_geo_reference.cpp (1 hunks)
  • test/test_gml_file.cpp (1 hunks)
  • test/test_mesh_extractor.cpp (2 hunks)
🧰 Additional context used
🧬 Code Definitions (5)
src/geometry/geo_reference.cpp (4)
include/plateau/geometry/geo_reference.h (4)
  • convert (29-29)
  • project (24-24)
  • project (25-25)
  • convertAxisFromENUTo (30-30)
src/geometry/polar_to_plane_cartesian.h (1)
  • lat_lon (10-10)
src/geometry/polar_to_plane_cartesian.cpp (4)
  • project (5-14)
  • project (5-5)
  • project (23-78)
  • project (23-23)
src/polygon_mesh/mesh.cpp (2)
  • convertAxisFromENUTo (290-294)
  • convertAxisFromENUTo (290-290)
test/test_geo_reference.cpp (1)
src/geometry/polar_to_plane_cartesian.h (1)
  • position (9-9)
src/polygon_mesh/mesh_factory.cpp (2)
include/plateau/dataset/gml_file.h (3)
  • GmlFile (15-77)
  • GmlFile (17-17)
  • GmlFile (18-18)
src/dataset/gml_file.cpp (2)
  • GmlFile (28-32)
  • GmlFile (35-39)
src/dataset/gml_file.cpp (1)
include/plateau/dataset/gml_file.h (2)
  • getEpsg (24-24)
  • isPolarCoordinate (25-25)
test/test_mesh_extractor.cpp (5)
include/plateau/polygon_mesh/mesh_extract_options.h (1)
  • MeshExtractOptions (24-41)
src/dataset/gml_file.cpp (2)
  • GmlFile (28-32)
  • GmlFile (35-39)
wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU/Dataset/GmlFile.cs (4)
  • GmlFile (16-245)
  • GmlFile (20-23)
  • GmlFile (29-35)
  • GmlFile (127-142)
src/polygon_mesh/mesh_extractor.cpp (4)
  • extract (182-187)
  • extract (182-183)
  • extract (189-192)
  • extract (189-190)
include/plateau/polygon_mesh/mesh_extractor.h (2)
  • extract (27-27)
  • extract (35-35)
🪛 Cppcheck (2.10-2)
test/test_geo_reference.cpp

[error] 23-23: syntax error

(syntaxError)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: upload-dlls (ubuntu-20.04, x86_64)
  • GitHub Check: build-and-test (ubuntu-20.04, x86_64)
  • GitHub Check: upload-dlls (windows-2022, x86_64)
  • GitHub Check: upload_mobile_dlls (macos-14, 33, 30.0.3, 23.1.7779620)
  • GitHub Check: build-and-test (windows-2022, x86_64)
🔇 Additional comments (22)
test/test_gml_file.cpp (1)

16-24: EPSGコードとpolarCoordinate判定のテストが追加されました

このテストケースは、GmlFileクラスの新しいメソッドgetEpsg()isPolarCoordinate()の機能を検証しています。2つの異なるファイルパスでGmlFileインスタンスを作成し、それぞれのEPSGコードと座標系タイプを確認しています。適切なテストケースの追加です。

test/CMakeLists.txt (1)

51-53: 新しいテストファイルが追加されました

test_geo_reference.cppが追加され、GeoReferenceクラスのテストが追加されました。これは、平面直角座標系のサポートに関連する変更に対するテストカバレッジを向上させるものです。

include/plateau/dataset/gml_file.h (2)

24-25: 新しいEPSG取得とpolar座標判定メソッドの追加

GmlFileクラスに、EPSGコードを取得するgetEpsg()メソッドとその座標系が極座標かどうかを判定するisPolarCoordinate()メソッドが追加されました。これらのメソッドは平面直角座標系の対応に必要な機能です。


68-68: EPSGコードを保存するための新しいメンバ変数

ファイル名から抽出したEPSGコードを保存するためのepsg_メンバ変数が追加されました。この変数はgetEpsg()およびisPolarCoordinate()メソッドで使用されます。

include/plateau/geometry/geo_coordinate.h (1)

98-99: Extent::all()メソッドの座標範囲拡大

Extent::all()メソッドの返す座標範囲が大幅に拡大されました。これは平面直角座標系のデータを扱う際に、従来の緯度経度範囲(-90〜90, -180〜180)では不十分なため、より広い範囲(-9999999〜9999999)をサポートするための変更です。この変更により、平面直角座標系で表現されたGMLファイルを正しく処理できるようになります。

include/plateau/geometry/geo_reference.h (1)

29-29: 新しいconvertメソッドを追加

座標変換のための柔軟な新メソッドconvertが追加されました。このメソッドは座標軸変換と平面直角座標への投影を個別に制御できるフラグを持っており、GMLファイルのEPSGコードに基づいて適切な変換処理を選択できるようになります。

これにより、平面直角座標で記されたGMLファイルの読み込み時に不要な座標変換を回避できます。

src/polygon_mesh/mesh_factory.cpp (3)

12-12: 新しい依存関係の追加

GmlFileクラスを使用するために必要なinclude文が追加されました。


37-38: GmlFileオブジェクトの生成

GmlFileインスタンスをローカル変数として生成しています。このインスタンスは座標系の種類を判断するために使用されます。

参考までに、GmlFileはコンストラクタでapplyPath()を呼び出し、ファイルのメタデータを読み込んでいます。


59-59: 座標変換ロジックの改善

以前のprojectWithoutAxisConvertメソッドの代わりに、新しいconvertメソッドを使用するように変更されました。

座標系の種類に応じた適切な変換処理が選択されるようになりました:

  1. 座標軸変換は常にスキップ(false
  2. 平面直角座標変換はisPolarCoordinate()の結果に基づいて適用

これにより、すでに平面直角座標で記されたGMLファイルに対して不要な変換処理が行われなくなります。

src/geometry/geo_reference.cpp (1)

27-42: 新しいconvertメソッドの実装

convertメソッドの実装が追加されました。このメソッドは以下の機能を提供します:

  1. projectフラグに基づいて平面直角座標への変換を条件付きで実行
  2. convert_axisフラグに基づいて座標軸変換を条件付きで実行
  3. スケーリングと基準点に基づくオフセット適用

この実装により、EPSGコードに基づいて適切な座標変換処理を選択できるようになります。特に、平面直角座標で記されたGMLファイルの場合にはprojectをスキップすることで、不要な変換による歪みを防ぐことができます。

コードは明確に構造化されており、各条件分岐の目的がコメントで説明されています。

test/test_mesh_extractor.cpp (2)

11-11: GmlFileクラスのインクルード追加

plateau/dataset/gml_file.hをインクルードすることで、EPSGコードとそれに基づく座標系判定機能を利用できるようになります。


208-250: 平面直角座標系のGMLファイル処理のテストケース追加

EPSGコードが6697以外(10162~10174)の場合に平面直角座標変換を行わないことを確認するテストケースが追加されました。このテストは以下を検証します:

  1. 下水道の地下施設を含むGMLファイル(EPSG: 10169)を読み込み
  2. isPolarCoordinate()falseを返すことを確認
  3. メッシュ抽出処理を実行
  4. 抽出されたメッシュの頂点が元のCityModelの頂点と一致することを確認(座標変換が行われていないことの証明)

このテストは、PRの目的である「平面直角座標で記されたGMLファイルのインポート」機能が正しく動作することを確認する重要な検証です。特に長岡市の地下施設のデータを扱う際に必要となる機能です。

テストの構造は明確で、目的に沿った適切な検証が行われています。

src/polygon_mesh/polygon_mesh_utils.cpp (2)

5-5: GmlFileクラスのインクルードを追加

GmlFileクラスをインクルードすることで、GMLファイルからEPSGコードを取得し、座標系の種類(極座標/平面直角座標)を判定する機能が利用可能になります。これはPR目的と一致しています。


63-65: 平面直角座標系サポートのための変換メソッド改修

getCenterPointメソッドが改善され、GMLファイルのEPSGコードに基づいて座標変換処理が行われるようになりました。以前はprojectメソッドを使用していましたが、より柔軟なconvertメソッドに置き換えられ、isPolarCoordinate()の結果を第三引数として渡しています。

これにより、平面直角座標で記述されたGMLファイルの正確な座標変換が可能になりました。

src/dataset/gml_file.cpp (2)

58-66: 平面直角座標判定メソッドの追加

EPSGコードに基づいて座標系の種類を判定するisPolarCoordinate()メソッドが追加されました。EPSGコードが10162から10174の範囲内であれば平面直角座標系(falseを返す)、それ以外は極座標系(trueを返す)と判定します。

国土交通省のドキュメントを参照したコメントが含まれており、理解を助けています。


130-130: ファイル名からEPSGコードを抽出

applyPath()メソッドでファイル名からEPSGコードを抽出するように変更されました。これによりGMLファイルの座標系情報を取得できるようになりました。

ただし、filename_partsが3つ未満の要素を持つ場合、filename_parts.at(2)で例外が発生する可能性があります。この例外はtry-catchブロックでキャッチされていますが、より明示的なエラーハンドリングの追加も検討すべきです。

test/test_geo_reference.cpp (5)

1-22: GeoReferenceクラスのテスト環境設定

新しいテストファイルでは、GeoReferenceクラスをテストするための適切な環境設定が行われています。ゾーンID、参照点、スケール、座標系など、必要なパラメータが定義されています。

Googleテストフレームワークが適切に使用されており、テストフィクスチャが正しく設定されています。


23-36: 座標軸変換・投影を伴う変換テスト

ConvertAxisProjectテストでは、座標軸変換と平面投影の両方を行うconvertメソッドのテストが実装されています。期待値の計算ロジックと実際の結果を比較することで、メソッドの正確性が検証されています。

また、projectメソッドとconvert(true, true)が同じ結果を返すことを確認しており、これは後方互換性の観点から重要です。

🧰 Tools
🪛 Cppcheck (2.10-2)

[error] 23-23: syntax error

(syntaxError)


38-50: 投影のみを行う変換テスト

ConvertProjectOnlyテストでは、座標軸変換なしで平面投影のみを行うconvertメソッドのテストが実装されています。projectWithoutAxisConvertメソッドとの一貫性も検証されています。


52-61: 座標軸変換のみを行うテスト

ConvertAxisOnlyテストでは、平面投影なしで座標軸変換のみを行う機能をテストしています。これは新しいconvertメソッドの柔軟性を示す重要なテストケースです。


63-71: 変換なしのテストケース

ConvertOnlyテストでは、座標軸変換も平面投影も行わない場合のテストが実装されています。これにより、convertメソッドの全パターンがテストされ、コード網羅率が向上します。

data/日本語パステスト/udx/unf/08EE763_unf_10169_sewer_op.gml (1)

1-89: 平面直角座標系を使用したGMLファイルの追加

このファイルは、平面直角座標系(EPSG:10169)で記述されたマンホールの3次元モデルを定義したCityGMLファイルです。PRの目的である「平面直角座標で記されたgmlファイルをインポート」の機能をテストするための適切なサンプルファイルとなっています。

特に4行目のsrsName="http://www.opengis.net/def/crs/EPSG/0/10169"の部分が重要で、このEPSGコードはisPolarCoordinate()メソッドで検出される平面直角座標系の範囲内(10162-10174)に含まれています。これにより、正しい座標変換処理が適用されることが期待されます。

実際のマンホールオブジェクトのジオメトリデータと属性情報も適切に定義されています。

sevendev added 2 commits April 8, 2025 15:57
build error 修正
例外チェック
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/dataset/gml_file.cpp (1)

54-61: EPSGコード取得メソッドの改善実装

前回のレビューコメントに基づいて、getEpsg()メソッドにエラーハンドリングが追加されました。空文字列の場合やstd::stodで例外が発生した場合に、デフォルト値として6697(日本測地系2011の平面直角座標系IX系)を返すようになっています。

この実装により、不正なEPSG値に対しても安全に処理を継続できるようになりました。

🧹 Nitpick comments (1)
src/dataset/gml_file.cpp (1)

63-71: 極座標判定メソッドの実装

EPSGコードに基づいて座標系のタイプを判定するisPolarCoordinate()メソッドが実装されています。EPSGコードが10162から10174の範囲(平面直角座標系の範囲)にある場合はfalseを返し、それ以外の場合はtrueを返します。

これにより、平面直角座標系のGMLファイルを適切に処理できるようになりました。ただし、メソッド名がisPolarCoordinateであるにもかかわらず、平面直角座標の場合にfalseを返すので、命名がやや直感に反する可能性があります。

メソッド名をisPolarCoordinateからusePolarConversionなど、より処理内容に合った名前に変更することを検討してください。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fbb92c and b699c7e.

📒 Files selected for processing (3)
  • include/plateau/geometry/geo_coordinate.h (2 hunks)
  • src/dataset/gml_file.cpp (2 hunks)
  • src/polygon_mesh/polygon_mesh_utils.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • include/plateau/geometry/geo_coordinate.h
🧰 Additional context used
🧬 Code Definitions (1)
src/dataset/gml_file.cpp (1)
include/plateau/dataset/gml_file.h (2)
  • getEpsg (24-24)
  • isPolarCoordinate (25-25)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-and-test (ubuntu-20.04, x86_64)
  • GitHub Check: build-and-test (macos-14, arm64)
  • GitHub Check: check-submodule-license
  • GitHub Check: build-and-test (windows-2022, x86_64)
🔇 Additional comments (4)
src/polygon_mesh/polygon_mesh_utils.cpp (3)

5-5: GmlFile クラスのインクルードを追加

座標系の変換処理を行うための GmlFile クラスを使用するために必要なインクルードが追加されています。この変更は、平面直角座標系のサポートに必要な機能を有効にします。


63-63: GmlFileオブジェクトの作成

CityModelから取得したGMLパスを使用して、EPSGコードや座標系タイプを判断するためのGmlFileオブジェクトを初期化しています。これにより、座標変換処理に必要な情報を適切に取得できるようになります。


65-65: 座標変換処理の更新

projectメソッドからconvertメソッドへの変更により、座標系の種類(極座標か平面直角座標か)に応じた適切な変換処理が可能になりました。isPolarCoordinate()の結果を第3引数として渡すことで、平面直角座標で記述されたGMLファイルの処理が正しく行われるようになります。

src/dataset/gml_file.cpp (1)

135-135: EPSGコードの抽出処理追加

applyPath()メソッド内でファイル名から抽出した情報の3番目の部分をEPSGコードとして取得しています。これにより、ファイル名から自動的にEPSGコードを取得し、適切な座標変換処理を行うことができるようになりました。

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
include/plateau/dataset/gml_file.h (1)

24-25: メソッド名と戻り値の型が一致していません。

usePolarConversion() メソッドは実際には極座標変換を使用するかどうかのブール値を返すように見えますが、戻り値の型が double になっています。関数名と戻り値の型を一致させるために、以下の修正を検討してください:

-double usePolarConversion() const;
+bool usePolarConversion() const;

これにより、メソッドの目的がより明確になり、誤用を防ぐことができます。

src/dataset/gml_file.cpp (1)

135-135: ファイル名のパース処理の潜在的な問題。

ファイル名から EPSG コードを抽出する際、filename_parts の要素数が3未満の場合、at(2) の呼び出しで例外が発生する可能性があります。この例外は親の try-catch ブロックでキャッチされますが、is_valid_ が false に設定されてしまいます。

EPSG コードの欠如だけで全体の有効性が否定されるべきでない場合は、以下のように分離した処理を検討してください:

    try {
        code_ = filename_parts.empty() ? "" : filename_parts.at(0);
        feature_type_ = filename_parts.size() <= 1 ? "" : filename_parts.at(1);
-       epsg_ = filename_parts.empty() ? "" : filename_parts.at(2);
+       epsg_ = filename_parts.size() <= 2 ? "" : filename_parts.at(2);
        is_valid_ = true;
    }
    catch (...) {
        is_valid_ = false;
    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b699c7e and 2a9d14a.

📒 Files selected for processing (6)
  • include/plateau/dataset/gml_file.h (2 hunks)
  • src/dataset/gml_file.cpp (2 hunks)
  • src/polygon_mesh/mesh_factory.cpp (3 hunks)
  • src/polygon_mesh/polygon_mesh_utils.cpp (2 hunks)
  • test/test_gml_file.cpp (1 hunks)
  • test/test_mesh_extractor.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/polygon_mesh/mesh_factory.cpp
  • src/polygon_mesh/polygon_mesh_utils.cpp
  • test/test_gml_file.cpp
  • test/test_mesh_extractor.cpp
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-and-test (ubuntu-20.04, x86_64)
  • GitHub Check: build-and-test (macos-14, arm64)
  • GitHub Check: check-submodule-license
  • GitHub Check: build-and-test (windows-2022, x86_64)
🔇 Additional comments (2)
include/plateau/dataset/gml_file.h (1)

68-68: EPSG情報を保持するメンバー変数が追加されました。

新しいメンバー変数 epsg_ が追加され、GMLファイルから抽出されたEPSGコードを保持します。これは平面直角座標系のGMLファイルをインポートするために必要な変更で適切です。

src/dataset/gml_file.cpp (1)

54-61: EPSGコード取得メソッドの実装は適切です。

getEpsg() メソッドの実装は、以前のフィードバックに基づいて適切なエラーハンドリングが追加されています。空の文字列や変換エラーの場合、デフォルト値として6697(日本測地系2011)を返すようになっています。

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/dataset/gml_file.cpp (1)

63-71: メソッド名の変更と実装が適切です。ただし、インデントの不一致があります

前回のレビューコメントで提案されたメソッド名の変更(usePolarConversionからisPolarCoordinateSystem)と戻り値の型をboolに変更する実装が適切に行われています。ただし、68-69行目のインデントがタブを使用しているようで、コードベースの残りの部分(4スペース)と一致していません。

インデントをコードベースの他の部分と一致させるため、以下の修正を適用してください:

        if (epsg >= 10162 && epsg <= 10174) {
-			return false;
-		}
+            return false;
+        }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a9d14a and ca0ef48.

📒 Files selected for processing (6)
  • include/plateau/dataset/gml_file.h (2 hunks)
  • src/dataset/gml_file.cpp (2 hunks)
  • src/polygon_mesh/mesh_factory.cpp (3 hunks)
  • src/polygon_mesh/polygon_mesh_utils.cpp (2 hunks)
  • test/test_gml_file.cpp (1 hunks)
  • test/test_mesh_extractor.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/polygon_mesh/mesh_factory.cpp
  • src/polygon_mesh/polygon_mesh_utils.cpp
  • test/test_mesh_extractor.cpp
  • include/plateau/dataset/gml_file.h
  • test/test_gml_file.cpp
🧰 Additional context used
🧬 Code Definitions (1)
src/dataset/gml_file.cpp (1)
include/plateau/dataset/gml_file.h (2)
  • getEpsg (24-24)
  • isPolarCoordinateSystem (25-25)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-and-test (ubuntu-20.04, x86_64)
  • GitHub Check: build-and-test (macos-14, arm64)
  • GitHub Check: build-and-test (windows-2022, x86_64)
🔇 Additional comments (2)
src/dataset/gml_file.cpp (2)

54-61: エラーハンドリングの実装が適切です

前回のレビューコメントで提案されたエラーハンドリングが適切に実装されています。空のepsg_文字列や変換エラーに対して、デフォルト値6697を返す処理は堅牢です。


135-135: EPSGコード設定の実装が適切です

applyPath()メソッドにおいて、ファイル名の第3コンポーネントからepsg_メンバ変数を設定する実装が適切に行われています。filename_partsが空の場合のエラーハンドリングも考慮されています。

@sevendev sevendev merged commit 06f338d into dev/v3 Apr 9, 2025
5 checks passed
@sevendev sevendev deleted the feature/switch_cartesian_coord_by_crs_code branch April 9, 2025 00:03
@coderabbitai coderabbitai bot mentioned this pull request Apr 21, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants