NationalSecurityAgency / qgis-shapetools-plugin

Shape Tools creates geodesic shapes and includes a number of geodesic tools for QGIS including the XY to Line tool, geodesic densify tool, geodesic line break, geodesic measure tool, geodesic measurement layer, geodesic scale, rotate and translate tool, and digitize points at an azimuth & distance tools.
GNU General Public License v2.0
157 stars 66 forks source link

Pie wedge radius according to the zoom level not working properly #55

Closed boombasteek closed 6 months ago

boombasteek commented 6 months ago

When creating a pie wedge & setting the radius to be variable according to the zoom level, it isn't performing the operation accordingly. qgis_zoom_level_config qgis_zoom_level

hamiltoncj commented 6 months ago

@boombasteek Initially I thought you were using an attribute for the radius and that works correctly. The zoom_level variable seems only to be available from a processing algorithm and it seems to get fixed at the time you launch the algorithm. It does not change if you zoom in and out. You have to launch a new processing algorithm instance to get an update in the value. Here is an example of selecting zoom_level variable and then clicking on Edit to see what value is actually displayed.

image

Whatever the zoom_level is when you launch the algorithm is what the variable is set to within the processing algorithm. This seems to be a QGIS bug, but knowing that the processing algorithms are isolated from the QGIS UI, I see why it is working like this. Canvas information like zoom level is passed to the processing algorithm at the time it is launched. From then on it is fixed and the processing algorithm cannot interact with the canvas so it doesn't get updated when you zoom in or out unless you launch a new processing instance.

Assuming I understand your question correctly, I don't think there is anything I can do about this. I have tested some of the core QGIS algorithms and they are working the same way.

boombasteek commented 6 months ago

@hamiltoncj Thanks for your response. Yes, you've understood the question correctly. It's quite inconvenient that the zoom level remains fixed. If I'm using the map of a post-processing soft (e.g. Actix), the cell visibility adapts according to the layer size (please check attached). Also if I'm displaying the pie wedge sector labels in QGIS, their visibility seems to vary according to the zoom level. I believe the same approach could be applied to the polygon feature itself. image

hamiltoncj commented 6 months ago

The Shape Tool shapes are fixed in size. You generate them once and they stay that shape. I think you are trying to create a dynamic size based on the zoom level. I think I have seen some examples of this using symbology for point layers. You might be able to use an SVG icon and have it dynamically scale depending on the zoom. You might have to use geometry generator symbology which is very powerful. I would do some Google searching on using symbology to do this. I don't know if this would help. https://plugins.qgis.org/styles/140/

boombasteek commented 6 months ago

@hamiltoncj Got it, I'll check for the custom symbols. Hopefully will find something suitable for me