python-awips/dynamicserialize/adapters/CoordAdapter.py

29 lines
714 B
Python
Raw Normal View History

2018-09-05 15:52:38 -06:00
#
# Adapter for com.vividsolutions.jts.geom.Coordinate
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 01/20/11 dgilling Initial Creation.
#
from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Coordinate
ClassAdapter = 'com.vividsolutions.jts.geom.Coordinate'
2018-10-14 17:37:08 -06:00
2018-09-05 15:52:38 -06:00
def serialize(context, coordinate):
context.writeDouble(coordinate.getX())
context.writeDouble(coordinate.getY())
2018-10-14 17:37:08 -06:00
2018-09-05 15:52:38 -06:00
def deserialize(context):
x = context.readDouble()
y = context.readDouble()
coord = Coordinate()
coord.setX(x)
coord.setY(y)
return coord