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