[Qgis-developer] Get signal on edited feature ?

dandrigo lcelati at latitude-geosystems.com
Wed Jul 30 04:23:01 PDT 2014


Hello,

Regarding my pyqgis plugin 2.2 , I've implemented signal on a vector layer
event  successfully. For instance, whenever i create a new feature, i can
read a new basic message appeared via QGIS logging system : " feature
added". 

But for some  events, besides this basic message, i would like read the name
of the layer and/or , the id of the feature/ the attribut name / the
geometry type (line,surf,punct). 

How to bring more info details for the events? 

I paste below my piece of code : 
-------------------------------------------------------------------------------------
def logLayerModified(self, onlyGeometry = None ):
		QgsMessageLog.logMessage( "layer modified" )
		QApplication.beep()	
		
def logAttributeAdded(self,QgsFeatureId):
		QgsMessageLog.logMessage( "attribut added" )
 		QApplication.beep()
		
def logAttributeDeleted(self,QgsFeatureId):
		QgsMessageLog.logMessage( "attribut deleted" )
 		QApplication.beep()
		
def logFeatureAdded(self,QgsFeatureId):
		QgsMessageLog.logMessage("feature added, id = " + str(QgsFeatureId))
		QApplication.beep() 
		
def logFeatureDeleted (self,QgsFeatureId):
		QgsMessageLog.logMessage("feature deleted, id = " + str(QgsFeatureId))
		QApplication.beep() 
		
def logGeometryChanged(self,fid)
		QgsMessageLog.logMessage("Geometry changed, id = " + str(fid))
		QApplication.beep() 
		
def logAttributeValueChanged (self, QgsFeatureId fid, int idx, const
QVariant &)
		QgsMessageLog.logMessage("Attribut value changed", id = " +
str(QgsFeatureId))
		QApplication.beep() 
	
	
def logBeforeLayerCommitChange(self):
		QgsMessageLog.logMessage( "commit change" )
 		QApplication.beep()


               layer.layerModified.connect(self.logLayerModified)	
	        layer.attributeAdded.connect(self.logAttributeAdded)
		layer.attributeDeleted.connect(self.logAttributeDeleted)
		layer.featureAdded.connect(self.logFeatureAdded)
		layer.featureDeleted.connect(self.logFeatureDeleted)     
		layer.featureDeleted.connect(self.logGeometryChanged)                                                   
		layer.beforeCommitChanges.connect(self.logBeforeLayerCommitChange)
		layer.AttributeValueChanged.connect(self.logAttributeValueChanged)   
-----------------------------------------------------------------------------------------------------------------



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Get-signal-on-edited-feature-tp5154173.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list