Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
I just thought a version check would be even more efficient than the other methods, so it would be good to try it first. If the user is in fact a wizard, there's always `import antigravity`. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092p5275253.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
Depending on how you build the checks you can even skip the version test. I.e. if somebody manages to put a GeometryGenerator into an older project he has at least earned wizard-status. And you wouldn't want to prevent a wizard from doing his job, would you? Matthias On 07/07/2016 04:36 PM, Tom Chadwin wrote: > Great. I'll do something like that, perhaps preceded by "if QGIS version < > 2.14, it's not 2.5D". > > Thanks > > Tom > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092p5275191.html > Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. > ___ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer > ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
Great. I'll do something like that, perhaps preceded by "if QGIS version < 2.14, it's not 2.5D". Thanks Tom -- View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092p5275191.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
Hi Tom On 07/07/2016 01:35 PM, Tom Chadwin wrote: > Matthias Kuhn-2 wrote >> Or directly the symbols defined on the layer? > > What do you mean? Can you retrieve all symbols used by a layer without > iterating through all the features? In the 2.5D renderer, if height is set > by an expression, and hence all features have different values, how many > symbols does this count as? I thought maybe it would be worth checking layer.rendererV2() and then for categorized iterate renderer.categories() for graduated traverse renderer.rootRule() for simple renderer.symbol() and for the rest fallback to some generic code (or bail out). As long as you are only interested in the definition and not in real, calculated height values that should do I guess. -- Matthias > > Thanks > > Tom > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092p5275136.html > Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. > ___ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer > ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
Matthias Kuhn-2 wrote > Or directly the symbols defined on the layer? What do you mean? Can you retrieve all symbols used by a layer without iterating through all the features? In the 2.5D renderer, if height is set by an expression, and hence all features have different values, how many symbols does this count as? Thanks Tom -- View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092p5275136.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
Hi Tom, On 07/07/2016 10:12 AM, Tom Chadwin wrote: > So you can use a 2.5D renderer, then change to eg categorized or graduated, > and the stack of geometry generators (shadow, walls, roof) remains in place. > I have to detect these latter types of renderers in Python. I do so by > looking for that signature stack of symbol layers. This works. > > However, I loop through every feature in a layer when doing this check, my > vague thought being that some features might have different symbology, but > that others might still be derived from 2.5D. The problem I have is that > this slows things down to a crawl, with multiple layers and many features. > > Therefore: > > 1. Is it overkill to loop through all features - should I just check the > first feature in each layer? Or directly the symbols defined on the layer? You could implemente the logic for graudated and rule based and if this fails fallback to the current approach. > > 2. Does anyone have a more efficient way of detecting these "derived from > 2.5D" renderers? The other thing I can think of is taking the layer variables as hint but that's really brittle. Matthias > > Thanks > > Tom > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092.html > Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. > ___ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer > ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] How to detect a categorized/graduated 2.5D layer in Python
So you can use a 2.5D renderer, then change to eg categorized or graduated, and the stack of geometry generators (shadow, walls, roof) remains in place. I have to detect these latter types of renderers in Python. I do so by looking for that signature stack of symbol layers. This works. However, I loop through every feature in a layer when doing this check, my vague thought being that some features might have different symbology, but that others might still be derived from 2.5D. The problem I have is that this slows things down to a crawl, with multiple layers and many features. Therefore: 1. Is it overkill to loop through all features - should I just check the first feature in each layer? 2. Does anyone have a more efficient way of detecting these "derived from 2.5D" renderers? Thanks Tom -- View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-detect-a-categorized-graduated-2-5D-layer-in-Python-tp5275092.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer