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 Polygon(self, value): if value is None: self._Polygon = None elif isinstance(value, list): self._Polygon = PolygonType(coordinates=value) elif isinstance(value, PolygonType): self._Polygon = value else: raise TypeError( 'Polygon requires and instance of sarpy.geometry.geometry_elements.Polygon, ' 'got {}'.format(type(value)))