Bug report #6476

data defined ellipse symbols on polygon centroid fill

Added by Raymond Nijssen about 12 years ago. Updated almost 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:master Regression?:No
Operating System:linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15706

Description

In the new symbology you can draw ellipses as point symbols. This works fine on both point layers and polygon layers (using centroid fill). There's also an advanced option where you can set the width and height of the ellipses defined by data values. This works on point layers, but not on polygon layers.

On polygon layers you can choose the fields for width and height, but ellipses are rendered in the fixed (4*3) size anyway.

32.png - screenshot (142 KB) Raymond Nijssen, 2012-10-10 02:28 PM

centroid-fill-databased-color.png (28.5 KB) Raymond Nijssen, 2013-11-22 05:55 AM

History

#1 Updated by Julien Lamarche about 12 years ago

Can you specify what version you are running and steps to reproduce the problem? When you say you are drawing elipses is that with the “Rectangles ovals digitizing” plugin by Pavol Kapusta?

#2 Updated by Raymond Nijssen about 12 years ago

Actually I reinstalled my laptop so I'm on ubuntu 12.04 now. QGIS is version 1.8.0-lisboa. But I expect the problem to be inside qgis since the functionality works on a point layer and does not work on a polygon layer.

I do not use any plugin for this.

Step by step:
- open a polygon shapefile as a layer
- open the layer properties
- change the symbology
- add a symbol layer
- set the symbol layer type to "centroid fill"
- change the marker
- set the marker type to "ellipse marker"
now if i apply i see black (4x3 size) ellipse markers on all my polygons, so the rendering works
- in the the data defined properties tab, select fields for width and height (i use integer fields)
now i apply, the ellipses are still drawn in the 4x3 size.

if i repeat these same steps at a point shapefile, the ellipse sizes do change after the last step.

I hope this helps you reproducing the problem. I use the dutch translation so i had to guess the english captions in my description. I also added a screenshot.

Thanks so far,
Raymond

#3 Updated by Julien Lamarche about 12 years ago

Yes, I have reproduced the problem using the field "id".

#4 Updated by Julien Lamarche about 12 years ago

  • Assignee set to Larry Shaffer

Notes to devs:

In release-1_8, line 191 to 202 of src/core/symbology-ng/qgsellipsesymbollayerv2.cpp has:

  const QgsVectorLayer* vlayer = context.layer();
  if ( vlayer )
  {
      QgsDebugMsg("Julien: Resolving data defined attribute indices");
      mWidthIndex = vlayer->fieldNameIndex( mWidthField );
    mHeightIndex = vlayer->fieldNameIndex( mHeightField );
    mRotationIndex = vlayer->fieldNameIndex( mRotationField );
    mOutlineWidthIndex = vlayer->fieldNameIndex( mOutlineWidthField );
    mFillColorIndex = vlayer->fieldNameIndex( mFillColorField );
    mOutlineColorIndex = vlayer->fieldNameIndex( mOutlineColorField );
    mSymbolNameIndex = vlayer->fieldNameIndex( mSymbolNameField );
  }

One thing I noticed is that with a point layer, the code will enter the if condition starting at line 192. On a polygon layer it will not.

So next I have to look at the function of QgsSymbolV2RenderContext.layer and figure out why it is returning a false value in the case of a polygon layer.

#5 Updated by Julien Lamarche about 12 years ago

  • Assignee deleted (Larry Shaffer)

Undoing bug assign. Sorry Larry.

#6 Updated by Julien Lamarche almost 12 years ago

Did a bit more reasearch on this.

On line 177-178 of src/core/symbology-ng/qgssymbolv2.h, which is where the class definition of QgsSymbolV2RenderContext is located:

    void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; }
    const QgsVectorLayer* layer() const { return mLayer; }

So the function layer returns the value of mLayer, which is evaluated to false in qgsellipsesymbollayerv2.cpp on line 192.

Next steps for this bug resolution would be to:

  1. Double check that behavior can be reproduced in a latter beta version of qgis
  2. If so, check with active developpers if this is being addressed in a different bug.
  3. If not, proceed with bug fix, putting in some debug feedback in setLayer

#7 Updated by Julien Lamarche over 11 years ago

Posted email to dev mailing list to see if anyone else was working on simillar bugs:
http://lists.osgeo.org/pipermail/qgis-developer/2013-June/026686.html

#8 Updated by Matthias Kuhn almost 11 years ago

  • Status changed from Open to Feedback

Works for me on a recent master build. Is this issue solved or am I testing the wrong thing?

#9 Updated by Raymond Nijssen almost 11 years ago

Works for me too now! And I could even fill the ellipse colour using a text field containing values like #54f7b8.

I'm using todays testing/master version on Ubuntu 13.10.

Can more people test? I hope we can close this!

#10 Updated by Matthias Kuhn almost 11 years ago

  • Status changed from Feedback to Closed

This issue seems to be fixed.

Also available in: Atom PDF