Feature request #1502

Allow vector symbol classification to affect outline color

Added by John Tull almost 16 years ago. Updated over 6 years ago.

Status:Open
Priority:Low
Assignee:-
Category:Symbology
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:11562

Description

It would be useful to have the ability to randomize outline color (or have outline color match random fill color) when classifying symbology. Currently, outlines remain black and fill color is changed.

Screenshot.png (161 KB) Giovanni Manghi, 2009-08-01 10:57 AM

History

#1 Updated by Giovanni Manghi over 15 years ago

I like also the gvsig way, that uses for outlines a darker color of the same tone used for fill the polygon. This gives better results than using the black outlines. See attached image.

#2 Updated by John Tull over 13 years ago

A workaround that meets my original desire of matching color is to eliminate the border before classifying the items. By editing the symbol and setting the border style to no pen prior to classifying will achieve this result. This does not do what lutra described.

#3 Updated by Giovanni Manghi almost 13 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#4 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

#5 Updated by Alister Hood over 12 years ago

  • Pull Request or Patch supplied set to No
  • Assignee deleted (nobody -)

Maybe QGIS could beat ArcGIS in this :)
It seems to be a very popular feature request at
http://esri.force.com/ideaList?c=09a300000004xET&sort=popular

Much as the "+1" practice annoys me...:

Giovanni Manghi wrote:

I like also the gvsig way, that uses for outlines a darker color of the same tone used for fill the polygon. This gives better results than using the black outlines. See attached image.

+1
I think that would make a better default, not just when using a classifier. And I seem to remember we have another discussion about this somewhere else.
I guess it would be easy to implement for new layers when they are added. But it would be nice to be able to actually link the two settings together somehow, so the user can change the colour of the outline, and the fill colour will update automatically. This might not be simple to handle this in the gui...

#6 Updated by Pirmin Kalberer about 12 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#7 Updated by Médéric RIBREUX almost 9 years ago

  • Estimated time set to 2.00
  • Status changed from Open to Feedback

Hello,

I've started to work on this feature (but not made a PR before user feedback). For the moment, I have implemented the modification of the outline color for the default polygon symbol (which is used on a simple fill renderer whenever you open a new layer). The color of the outline is darker than the random polygon fill color.

For the moment, this feature is used only when you open a new polygon layer and when you have no default style (or no default project style). Once the layer is loaded, you can change the renderer (categories or graduated) but when you use a color ramp, only the fill color will change, not the outline color (which will be the initial random color for the simple fill renderer but darker, not black anymore).

Should I go further and try to implement automatic outline color ramps or something like that (probably much more difficult) or should the above behavior be considered sufficient to close this feature request ?

#8 Updated by Nyall Dawson almost 9 years ago

@Médéric

Before you spend too much time coding this, can you please file a QEP over at https://github.com/qgis/QGIS-Enhancement-Proposals/issues describing your proposed approach? There's some usability issues which may result from this which I think warrant further discussion (eg, I think before implementing this we would need a way of "locking" the outline color, for cases where users do NOT want the outline colour modified. Currently there's a method for locking the fill colour for symbol layers, but not additional colours such as the outline colour. I think this needs to be addressed as a prerequisite/companion to this work).

#9 Updated by Alister Hood almost 9 years ago

In answer to the question though:

Médéric RIBREUX wrote:

For the moment, this feature is used only when you open a new polygon layer and when you have no default style (or no default project style). Once the layer is loaded, you can change the renderer (categories or graduated) but when you use a color ramp, only the fill color will change, not the outline color (which will be the initial random color for the simple fill renderer but darker, not black anymore).

Should I go further and try to implement automatic outline color ramps or something like that (probably much more difficult) or should the above behavior be considered sufficient to close this feature request ?

No, that wouldn't address the feature request at all.

#10 Updated by Médéric RIBREUX almost 9 years ago

Nyall Dawson wrote:

@Médéric

Before you spend too much time coding this, can you please file a QEP over at https://github.com/qgis/QGIS-Enhancement-Proposals/issues describing your proposed approach? There's some usability issues which may result from this which I think warrant further discussion (eg, I think before implementing this we would need a way of "locking" the outline color, for cases where users do NOT want the outline colour modified. Currently there's a method for locking the fill colour for symbol layers, but not additional colours such as the outline colour. I think this needs to be addressed as a prerequisite/companion to this work).

Hello,

I am sorry but I don't have the strength to make a QEP for this (and not enough knowledge in QGIS base code and "administrative procedure"). But I can share what I've found so far...

In file src/core/symbology-ng/qgssymbolv2.cpp:

  • The default random style is in method QgsSymbolV2::defaultSymbol.
  • Random color is chosen like this: QColor::fromHsv( qrand() % 360, 64 + qrand() % 192, 128 + qrand() % 128 ).
  • This random color is not too bright (64 min of saturation) and not too dark (128 minimum of value).
  • For polygons layers, the color is set on a QgsFillSymbolV2 which means that the color is set at the upper level of the symbol. It only affects the FillColor, not the outline one.
  • To define a darker outline color, I've found that you need to add a little bit of saturation (about 50 on a scale of 0 to 254) in order to have a brighter color and to remove a greater amount of value (about 77 on a scale of 0 to 254) in order to have something darker. This is a very simple method to define the outline color but perhaps something better exists (perhaps more complex).
  • The defined above Outline color needs to be applied on the first layer of the QgsFillSymbolV2 with the setOutlineColor method.

#11 Updated by Médéric RIBREUX almost 9 years ago

  • Status changed from Feedback to Open

#12 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No

Also available in: Atom PDF