Skip to content

Commit

Permalink
rename from/to coordinate_string -> points
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Apr 25, 2018
1 parent a11f2a6 commit 994c1c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ocrd/model/ocrd_xml_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
)
from ocrd.utils import (
xmllint_format,
xywh_from_coordinate_string,
coordinate_string_from_xywh
xywh_from_points,
points_from_xywh
)

from lxml import etree as ET
Expand All @@ -22,14 +22,14 @@ def get_coords(el):
coords = el.find('page:Coords', NAMESPACES)
if coords is not None:
points = coords.get('points')
return xywh_from_coordinate_string(points)
return xywh_from_points(points)

def set_coords(el, box):
if box is not None:
coords = el.find('page:Coords', NAMESPACES)
if coords is None:
coords = ET.SubElement(el, TAG_PAGE_COORDS)
coords.set("points", coordinate_string_from_xywh(box))
coords.set("points", points_from_xywh(box))

class OcrdXmlDocument(object):

Expand Down
4 changes: 2 additions & 2 deletions ocrd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def getLogger(*args, **kwargs):
return logging.getLogger(*args, **kwargs)

def coordinate_string_from_xywh(box):
def points_from_xywh(box):
"""
Constructs a polygon representation from a rectangle described as a dict with keys x, y, w, h.
"""
Expand All @@ -26,7 +26,7 @@ def coordinate_string_from_xywh(box):
box['y'] + box['h']
)

def xywh_from_coordinate_string(points):
def xywh_from_points(points):
"""
Constructs a numpy-compatible polygon from a page representation.
"""
Expand Down

0 comments on commit 994c1c3

Please sign in to comment.