From f65064e71cbc59db69c7dacdb4b5ef86186d2bb2 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Mon, 11 Sep 2023 13:27:33 +0900 Subject: [PATCH] minor text changes --- .../algorithms/create_grid_square.py | 6 +++--- japanese_grids/algorithms/utils/generator.py | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/japanese_grids/algorithms/create_grid_square.py b/japanese_grids/algorithms/create_grid_square.py index e9774d9..c15bb56 100644 --- a/japanese_grids/algorithms/create_grid_square.py +++ b/japanese_grids/algorithms/create_grid_square.py @@ -1,4 +1,4 @@ -"""Processing algorithm for generating Japan's Mesh""" +"""Processing algorithm to create the "Grid Square Code" of Japan (JIS X 0410) as vector layers""" # Copyright (C) 2023 MIERUNE Inc. # @@ -48,10 +48,10 @@ 作成したい種類のメッシュの出力先を「一時レイヤ」や「ファイル」に設定して、アルゴリズムを実行してください。 -デフォルトでは日本全域のメッシュを作成しますが、「メッシュの作成範囲」オプションで作成する範囲を制限できます。 +デフォルトでは日本全域のメッシュを作成しますが、「メッシュの作成範囲」オプションでメッシュの作成範囲を制限できます。 なお、1/2地域メッシュより小さいメッシュについては、大量の地物生成を防ぐため、生成範囲を制限しないとアルゴリズムを実行できません。 -""" # noqa: RUF001 +""" def _tr(string: str): diff --git a/japanese_grids/algorithms/utils/generator.py b/japanese_grids/algorithms/utils/generator.py index a84ddaf..f857baf 100644 --- a/japanese_grids/algorithms/utils/generator.py +++ b/japanese_grids/algorithms/utils/generator.py @@ -244,15 +244,17 @@ def iter_standard_mesh_patch( yield (prefix + str(x), bbox) -def iter_subdivision_mesh_patch(standard_mesh_patch: tuple[str, LngLatBox]): +def iter_subdivided_mesh_patch(standard_mesh_patch: tuple[str, LngLatBox]): parent_code, parent_bbox = standard_mesh_patch lng0, lat0, lng1, lat1 = parent_bbox lath = (lat0 + lat1) / 2 lngh = (lng0 + lng1) / 2 - yield (parent_code + "1", (lng0, lat0, lngh, lath)) - yield (parent_code + "2", (lngh, lat0, lng1, lath)) - yield (parent_code + "3", (lng0, lath, lngh, lat1)) - yield (parent_code + "4", (lngh, lath, lng1, lat1)) + return [ + (parent_code + "1", (lng0, lat0, lngh, lath)), + (parent_code + "2", (lngh, lat0, lng1, lath)), + (parent_code + "3", (lng0, lath, lngh, lat1)), + (parent_code + "4", (lngh, lath, lng1, lat1)), + ] def iter_patch( # noqa: C901 @@ -284,15 +286,15 @@ def iter_patch( # noqa: C901 if standard: yield ("standard", *standard_mesh_patch) if half or quarter or eighth: - for patch2 in iter_subdivision_mesh_patch(standard_mesh_patch): + for patch2 in iter_subdivided_mesh_patch(standard_mesh_patch): if half: yield ("half", *patch2) if quarter or eighth: - for patch4 in iter_subdivision_mesh_patch(patch2): + for patch4 in iter_subdivided_mesh_patch(patch2): if quarter: yield ("quarter", *patch4) if eighth: - for patch8 in iter_subdivision_mesh_patch(patch4): + for patch8 in iter_subdivided_mesh_patch(patch4): yield ("eighth", *patch8) @@ -305,7 +307,7 @@ def estimate_total_count( quarter: bool = False, eighth: bool = False, ): - """生成されるパッチ数を推定する""" + """生成されるパッチ数の概数を返す""" num_primary = len(list(iter_primary_mesh_patch(extent=extent))) c = 0