python-awips/dynamicserialize/adapters/CoordAdapter.py

34 lines
725 B
Python
Raw Normal View History

2015-06-18 10:25:33 -06:00
##
##
#
# Adapter for com.vividsolutions.jts.geom.Coordinate
2016-03-16 16:32:17 -05:00
#
#
2015-06-18 10:25:33 -06:00
# SOFTWARE HISTORY
2016-03-16 16:32:17 -05:00
#
2015-06-18 10:25:33 -06:00
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 01/20/11 dgilling Initial Creation.
2016-03-16 16:32:17 -05:00
#
#
2015-06-18 10:25:33 -06:00
#
from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Coordinate
ClassAdapter = 'com.vividsolutions.jts.geom.Coordinate'
def serialize(context, coordinate):
context.writeDouble(coordinate.getX())
context.writeDouble(coordinate.getY())
def deserialize(context):
x = context.readDouble()
y = context.readDouble()
coord = Coordinate()
coord.setX(x)
coord.setY(y)
return coord