[Qgis-developer] Re: show grid on map canvas (similiar to grid used in composer) - strategy?

Etienne Tourigny etourigny.dev at gmail.com
Mon May 14 09:49:44 PDT 2012

On Mon, May 14, 2012 at 8:43 AM, John Donovan <mersey.viking at gmail.com> wrote:
> On 13 May 2012 22:49, Etienne Tourigny <etourigny.dev at gmail.com> wrote:
>> Hi folks,
>> there have been a number of interesting suggestions, I will try to
>> summarize them this week.
>> Basically I think there could be 2 concurrent and complementary ways
>> to implement grids:
>> 1) basic grid in core, similar to what is already in the composer map
>> (and in my branch)
>> 2) more refined grid(s) as plugin/vector layers, whose rendering order
>> can be fine-tuned
> Nice work Etienne! Over the weekend, I've knocked up a little plugin
> of the second type - a plugin layer that uses the new symbology
> system.
> It's marked as experimental, and there are a few things on the TODO
> list, but it can be found in my plugin repo:

I got this error when executing your "Grid Overlay" plugin

An error has occured while executing Python code:

Traceback (most recent call last):
  File "/home/tourigny/.qgis/python/plugins/grid_overlay/gridpluginlayer.py",
line 63, in draw
    self.symbol.renderPolyline(polyline, renderContext)
TypeError: QgsLineSymbolV2.renderPolyline(QPolygonF, QgsFeature,
QgsRenderContext, int layer=-1, bool selected=False): argument 2 has
unexpected type 'QgsRenderContext'

> One of the todo's is saving the styling information - I can't find
> where I can get the XML of the symbol for my writeXml() function. Any
> ideas?

I was looking for that also, found it here
QgsSymbolV2 * QgsSymbolLayerV2Utils::loadSymbol 	( 	QDomElement &  	element 	 )

Seems to me most of the symbologyv2 stuff is not well documented yet.

I have implemented this in my branch for both line symbology and new
marker symbology. It creates an xml doc, then saves the content to a
string item in the .qgs project file.
When you load the project the symbology is loaded with the other options.

> Regards,
> John
> --
> One of the advantages of being disorderly is that one is constantly
> making exciting discoveries. - AA Milne

More information about the Qgis-developer mailing list