本文整理汇总了Python中viewer.Viewer.clear_layer_features方法的典型用法代码示例。如果您正苦于以下问题:Python Viewer.clear_layer_features方法的具体用法?Python Viewer.clear_layer_features怎么用?Python Viewer.clear_layer_features使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viewer.Viewer
的用法示例。
在下文中一共展示了Viewer.clear_layer_features方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EarthMineQGIS
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import clear_layer_features [as 别名]
#.........这里部分代码省略.........
self.center_on_canvas()
self.viewer.activelayercombo.setLayer(self.iface.activeLayer())
def center_on_canvas(self):
point = self.canvas.extent().center()
transform = self.coordinatetransform()
point = transform.transform(point, QgsCoordinateTransform.ReverseTransform)
self.viewer.set_location(point)
self.viewer.infoaction.toggle()
def selection_changed(self, layer):
ids = [feature.id() for feature in layer.selectedFeatures()]
if not ids:
self.viewer.clear_selection(layer.id())
else:
self.viewer.set_selection(layer.id(), ids)
def layers_changed(self):
layerstates = self.layers_with_states()
for layer, visible in layerstates:
layerid = layer.id()
viewerloaded = self.viewer.layer_loaded(layerid)
QgsMessageLog.instance().logMessage(layerid, "Earthmine")
QgsMessageLog.instance().logMessage("Viewer State:" + str(viewerloaded), "Earthmine")
QgsMessageLog.instance().logMessage("QGIS State:" + str(visible), "Earthmine")
if (viewerloaded and visible) or (not viewerloaded and not visible):
QgsMessageLog.instance().logMessage("Ignoring as states match", "Earthmine")
continue
if viewerloaded and not visible:
QgsMessageLog.instance().logMessage(
"Clearing layer because viewer loaded and disabled in QGIS", "Earthmine"
)
self.viewer.clear_layer_features(layerid)
continue
if not viewerloaded and visible:
QgsMessageLog.instance().logMessage("Loading layer", "Earthmine")
self.load_layer_features(layers=[layer])
continue
def layers_removed(self, layers):
for layerid in layers:
self.viewer.clear_layer_features(layerid)
@pyqtSlot(str, float, float)
def viewChanged(self, event, yaw, angle):
self.marker.setAngle(angle)
self.marker.setYaw(yaw)
@pyqtSlot(str, str)
def getInfo(self, layerid, featureid):
featureid = int(featureid)
activelayer = self.iface.activeLayer()
if not activelayer:
return
activetool = self.viewer.active_tool()
if not activetool in ["Info", "Select"]:
return
# Only show information for the active layer
if not layerid == activelayer.id():
return
layer = layer_by_id(layerid)