Skip to content

Commit

Permalink
#12 rewrite API document to reST
Browse files Browse the repository at this point in the history
  • Loading branch information
smellman committed Jun 13, 2023
1 parent 123cd15 commit b161d4a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 15 deletions.
15 changes: 10 additions & 5 deletions plateauutils/abc/polygon_to_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PolygonToList(metaclass=abc.ABCMeta):
Parameters
----------
polygon : shapely.geometry.Point
polygon : shapely.geometry.Polygon
対象となるポリゴン
"""

Expand All @@ -16,15 +16,20 @@ def __init__(self, polygon: Polygon):
self.bounds = self.polygon.bounds
self.start_pos = Point(self.bounds[0], self.bounds[1])
self.end_pos = Point(self.bounds[2], self.bounds[3])
self.current_pos = self.start_pos
self.targets = []

@abc.abstractmethod
def split(self):
"""対象となるポリゴンを分割してリストを作成する"""
raise NotImplementedError("split method is not implemented")

@abc.abstractclassmethod
def output(self):
"""リストを出力する"""
@abc.abstractmethod
def output(self) -> list:
"""リストを出力する
Returns
-------
list
リスト
"""
raise NotImplementedError("output method is not implemented")
47 changes: 37 additions & 10 deletions plateauutils/mesh_geocorder/geo_to_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ def _validate_mesh(mesh: str) -> None:
def point_to_meshcode(point: Point, mesh: str = "2") -> str:
"""緯度経度をメッシュコードに変換して返す
:param point: 緯度経度を示すPointオブジェクト
:type point: shapely.geometry.Point
:param mesh: メッシュの種類
:type mesh: str
:return: メッシュコード
:rtype: str"""
Parameters
----------
point : shapely.geometry.Point
緯度経度を示すPointオブジェクト
mesh : str, optional
メッシュの種類, by default "2"
Returns
-------
str
メッシュコード
"""
# メッシュのバリデーション
_validate_mesh(mesh)

Expand Down Expand Up @@ -88,10 +94,15 @@ def meshcode_to_polygon(mesh_code: str) -> Polygon:
"""
メッシュコードをポリゴンに変換して返す
:param mesh_code: メッシュコード
:type mesh_code: str
:return: メッシュコードに対応するポリゴン
:rtype: shapely.geometry.Polygon
Parameters
----------
mesh_code : str
メッシュコード
Returns
-------
shapely.geometry.Polygon
メッシュコードに対応するポリゴン
"""
if len(mesh_code) < 4:
raise MeshCodeException("Mesh code must be 4 or more digits")
Expand Down Expand Up @@ -195,6 +206,22 @@ def _create_polygon(
) -> Polygon:
"""
バウンディングボックスからポリゴンを作成して返す
Parameters
----------
left_x : float
左のx座標
left_y : float
左のy座標
right_x : float
右のx座標
right_y : float
右のy座標
Returns
-------
shapely.geometry.Polygon
ポリゴン
"""
coords = (
(left_x, left_y),
Expand Down

0 comments on commit b161d4a

Please sign in to comment.