[Qgis-developer] Extending QgsMapToolIdentify and QgsIdentifyResults

Peter Ersts ersts at amnh.org
Fri Jan 26 16:40:46 EST 2007


Martin,

For the most part the results that are displayed now are sufficient but 
here is a list of things that could be useful

All Results to include:
Map coordinate (projected)
Map coordinate (geographic)
Display coordinates, i.e., X,Y within the display (lower priority)
Layer type

Vector Specific:
Feature ID + all associated attributes (table values)
length or area of feature if not already in table (lower priority)

Raster Specific:
Pixel Coordinate
Pixel values (all bands)
Pixel count (for classified/categorical data)

WMS Specific:
???

For simplicity the result set could include more meta-data type 
information about the layer, but that is not necessarily needed as that 
information is readily available using QgsInterface::getActiveLayer(). 
For the actual storage of the results an xml document would be robust, 
but could add a little overhead.  Or, for everything but the vector 
feature attributes and the pixel values, a simple struct could be used. 
Vector feature and Pixel values could be a QList of another struct that 
is just an attribute name and value, so for raster it would be 
attribute=Band1 value=50 etc.

Anyway, thanks for thinking about this. I know there are a lot of other 
things to do but I think this would be a useful modification that would, 
for example, allow a plugin to respond differently to points based on a 
particular attribute i.e., loading an external file (path/url in 
attribute) with the correct application (depending the file type stored 
in another attribute). 

cheers,
-pete

Martin Dobias wrote:
> Hi Peter,
>
> your idea sounds good for me. But could you explain how should
> QgsIdentifyResult object look like? I mean what will be its contents
> for vector/raster layers - e.g. only feature ID (for vector layers)
> and cell coordinate (for raster layers) or whether it will contain
> also more information etc.
>
> Martin
>
>
> On 1/26/07, Peter Ersts <ersts at amnh.org> wrote:
>> Dear Developers,
>>
>> I was wonder if it would be possible to disassociate the
>> QgsIdentifyResults from a QWidget? My suggestions is to make
>> QgsIdentifyResults a more generic object. This would allow for any class
>> (or plugin) to implement QgsMapToolIdentify. The QgsMapToolIdentify
>> mouse event would simply return a QgsIdentifyResult object that could
>> then be displayed by the user or used to obtain attributes for the
>> feature or pixel at the screen/map coordinates.
>>
>> For example, I have been working on some modifications to the
>> QgsRasterLayer and QgsRasterLayerProperties classes (and gui) to allow
>> for basic stretching and multiple user defined transparency values.  One
>> of the feature that was suggested was to have a "Identify Features" like
>> tool to populate the transparency tables. In this example, the user
>> would press a button "Add Values From Display" which I would like to
>> launch a QgsMapToolIdentify like feature, but return the results as a
>> simple object to QgsRasterLayerProperties.  QgsRasterLayerProperties
>> would then use the results to populate a table in gui rather than simply
>> display the pixel values in another dialog.
>>
>> This would also allow users to inherit and extend the functionality of
>> QgsMapToolIdentify. It seems like it should not be to difficult, but I
>> may be missing something here.
>>
>> cheers,
>> -pete
>>


-- 
====================================
Peter J. Ersts, Project Specialist
American Museum of Natural History
Center for Biodiversity and Conservation
Central Park West at 79th Street
New York, New York 10024
Tel: (212)-496-3488 or (212)-769-5742
Fax: (212)-313-7295 or (212)-769-5292
Web: http://cbc.amnh.org

Visit the Indo-South Atlantic Consortium on Humpback Whales 
Web:  http://www.isach.org




More information about the Qgis-developer mailing list