def addshape(self, x, y, fields=None, z=None, m=None): type = 'point' if self.shapetype == ShapeTypes.Polyline: type = 'line' elif self.shapetype == ShapeTypes.Polygon: type = 'polygon' shapes = geoutil.makeshapes(x, y, type, z, m) if len(shapes) == 1: self.layer.editAddShape(shapes[0], fields) else: for shape, field in zip(shapes, fields): self.layer.editAddShape(shape, field)
def addshape(self, x, y, fields=None, z=None, m=None): ''' Add a shape. :param x: (*array_like*) X coordinates of the shape points. :param y: (*array_like*) Y coordinates of the shape points. :param fields: (*array_like*) Field values of the shape. :param z: (*array_like*) Optional, Z coordinates of the shape points. :param m: (*array_like*) Optional, M coordinates of the shape points. ''' type = 'point' if self.shapetype == ShapeTypes.Polyline: type = 'line' elif self.shapetype == ShapeTypes.Polygon: type = 'polygon' shapes = geoutil.makeshapes(x, y, type, z, m) if len(shapes) == 1: self.layer.editAddShape(shapes[0], fields) else: for shape, field in zip(shapes, fields): self.layer.editAddShape(shape, field)