本文整理汇总了Python中viewer.Viewer.remove_feature方法的典型用法代码示例。如果您正苦于以下问题:Python Viewer.remove_feature方法的具体用法?Python Viewer.remove_feature怎么用?Python Viewer.remove_feature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viewer.Viewer
的用法示例。
在下文中一共展示了Viewer.remove_feature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EarthMineQGIS
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import remove_feature [as 别名]
#.........这里部分代码省略.........
continue
yield layer, self.legend.isLayerVisible(layer)
def _layer_feature_added(self, featureid):
layer = self.sender()
if not layer:
return
self.layer_feature_added(layer, featureid)
def layer_feature_added(self, layer, featureid):
if not self.viewer:
return
feature = layer.getFeatures(QgsFeatureRequest(featureid)).next()
renderer = layer.rendererV2()
transform = self.coordinatetransform(layer)
featuredata = to_feature_data(layer.id(), feature, renderer, transform)
geomtype = layer.geometryType()
layerdata = dict(id=layer.id(), geomtype=QGis.vectorGeometryType(geomtype))
self.viewer.load_features(layerdata, featuredata)
def _layer_feature_delete(self, featureid):
layer = self.sender()
if not layer:
return
self.layer_feature_delete(layer, featureid)
def layer_feature_delete(self, layer, featureid):
if not self.viewer:
return
self.viewer.remove_feature(layer.id(), featureid)
def _layer_geometry_changed(self, featureid, geometry):
layer = self.sender()
if not layer:
return
self.layer_geometry_changed(layer, featureid, geometry)
def layer_geometry_changed(self, layer, featureid, geometry):
if not self.viewer:
return
geomtype = layer.geometryType()
if geomtype == QGis.Point:
geom = geometry.asPoint()
transform = self.coordinatetransform(layer)
point = transform.transform(geom, QgsCoordinateTransform.ReverseTransform)
location = dict(lat=point.y(), lng=point.x())
self.viewer.edit_feature(layer.id(), featureid, [location])
elif geomtype == QGis.Line:
self.layer_feature_delete(layer, featureid)
self.layer_feature_added(layer, featureid)
def connect_layer_signals(self, layer):
if not layer.type() == QgsMapLayer.VectorLayer:
return
layer.featureAdded.connect(self._layer_feature_added)
layer.featureDeleted.connect(self._layer_feature_delete)
layer.editingStarted.connect(self.layer_editstate_changed)
layer.editingStopped.connect(self.layer_editstate_changed)
# HACK The new style doesn't work here
# http://hub.qgis.org/issues/6573