def from_node(cls, node, xml_ns, ns_key=None, kwargs=None): if xml_ns is None or 'sfa' not in xml_ns: raise ValueError('xml_ns must contain an entry for key "sfa"') coords = cls._deserialize_point(node, xml_ns, 'Point') if coords is not None: return cls(Point=PointType(coordinates=coords)) coords = cls._deserialize_line(node, xml_ns, tag='Line') if coords is not None: return cls(Line=LineStringType(coordinates=coords)) coords = cls._deserialize_line(node, xml_ns, tag='LinearRing') if coords is not None: return cls(LinearRing=LinearRingType(coordinates=coords)) coords = cls._deserialize_polygon(node, xml_ns, tag='Polygon') if coords is not None: return cls(Polygon=PolygonType(coordinates=coords)) coords = cls._deserialize_line(node, xml_ns, tag='MultiPoint') if coords is not None: return cls(MultiPoint=MultiPointType(coordinates=coords)) coords = cls._deserialize_multilinestring(node, xml_ns, tag='MultiLineString') if coords is not None: return cls(MultiLineString=MultiLineStringType(coordinates=coords)) coords = cls._deserialize_multipolygon(node, xml_ns, tag='MultiPolygon') if coords is not None: return cls(MultiPolygon=MultiPolygonType(coordinates=coords)) return cls()
def Point(self, value): if value is None: self._Point = None elif isinstance(value, (numpy.ndarray, list, tuple)): self._Point = PointType(coordinates=value) elif isinstance(value, PointType): self._Point = value else: raise TypeError( 'Point requires and instance of sarpy.geometry.geometry_elements.Point, ' 'got {}'.format(type(value)))