mercredi 1 avril 2009

QGIS python console-Note-before beginning...

When coding QGIS plugins, you'll have to deal with objects such as the interface (iface object), the canvas, the layers of course. Each object has a certain number of attributes and methods. For example, layers have the attribute "source", or "name". They also are assigned methods like the "getSelectedFeatures" method. Notice that when applying the function "getSelectedFeatures", you get some feature objects. Like interface, canvas and layer, features are another type of object with attributes and methods. Of course, I won't list all the objects, attributes and methods avalaible through the QGIS API.

Another aspect is the notion of inheritance: the classes QgsVectorLayer and QgsRasterLayer are like brother objects, who have a common parent: the QgsMapLayer Class. They are both specific and contain different methods but what they have in common are the attributes and methods of their parent class: QgsMapLayer.

This API reflects a contemporary vision in programming called object oriented programming. All the programming books deal with this subject.

What I recommend you while reading the examples posts is having the API doc opened in your web navigator, so that you check the function, object properties I'm calling.

Let's remind you the QGIS API address:
http://doc.qgis.org/
On the website, choose your version. Most of the times, it is the kore version...