2

I actually have a plugin that allows me to draw on a vector layer (I made it based on the FreeHand Editing Plugin). When a mouseMoveEvent is detected, it creates a new point on the vector layer and create a line between it and the last point created. My problem is that I want to show in editing mod only the lines and not the nodes. Does anybody know if this is possible?

EDIT:

This is not what I meant, sorry if you didn't understand well, I'll explain better.

I have a vector layer (and an option in my plugin to create one) In edit mod, I can freely draw lines with the mouse on this vector (the lines will correspond to the drawing, check the screenshot below when it's not in editing mod).

QGIS Lines

The problem is that in editing mod, I don't want to display the nodes cross image (check screenshot below) on the screen like it actually is, I just want to show the lines like how it is in non-editing mod

GIS Lines and Nodes

2
  • Settings - Options - Digitising - Vertex markers allows you to hide vertices of non-selected features. I suppose you do not want to hide them from the feature you are editing or otherwise you can't really edit it. Try to find from the code what this setting does and copy it into your plugin.
    – user30184
    Jun 11, 2015 at 9:48
  • Thanks a lot ! But I didn't find how to use it in the plugin. Doesn't matter it's enough like that Jun 11, 2015 at 14:12

2 Answers 2

4

There is a way to do what you want and not display the nodes in editing mode, or to actually only display the nodes for selected vertices.

Go into Settings/Options/Digitizing and then you will see a section called Vertex markers. This is where you can customize the nodes by selecting to only show them for selected features, change the size, change the shape (from x's to transparent circles or completely off.

You have probably found this solution already by now, but it might help others like me who have been searching for the same thing and stumbled upon it...

1

Well if you can remove vertex (nodes) in the qgis desktop GUI you can do it programmaticly too. So if I understood correctly you create lines from 2 points. Are they created as a new layer? If so you can just create each layer for points and the line. And then you simply remove the points layer with root.removeLayer(someLayer). If your line layer is not in a parent/child relation then deleting the points layer shouldn't effect the line layer.

But if you want to keep your points for later on usage you can "hide" them by setting the layer zoom visibility. They will be still shown as a layer but wont be seen.

Now if the points are a layer you can set the visibility like this:

lyr.toggleScaleBasedVisibility(True) #enables scale based visibility
lyr.setMinimumScale(0.0) #set the scale to something that we cant reach (lets say 0)
lyr.setMaximumScale(0.0) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.