[QGIS-Developer] Activate vertex tool with a specific polygon highligted from Python

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Mon Feb 8 02:47:16 PST 2021


Thanks Jorge for the information :-) .

You're right about my wish: I want to activate the Vertex Tool and lock 
it to a specific object i a specific layer using Python from a plugin 
(Exactly as you surmised)

Med venlig hilsen / Kind regards

Bo Victor Thomsen

Den 08-02-2021 kl. 11:26 skrev Jorge Gustavo Rocha:
> Hi Bo,
>
> I didn't investigate it much. I just tried on the console:
> iface.actionVertexToolActiveLayer().trigger()
> and it works. It open the vertex editor, but no geometry is "locked".
> You have to manually lock your geometry with a right mouse click.
>
> You want to mimic also the right click to selected the geometry to be
> used by the vertex editor, right? I think you want to call
> 'QgsVertexTool::updateVertexEditor( QgsVectorLayer *layer, QgsFeatureId
> fid )' but QgsVertexTool does not have bindings for python.
>
> Maybe there is another way to do it. Let's see if someone knows how to
> lock the selected geometry in Python.
>
> Good luck!
>
> Jorge
>
> Às 16:35 de 07/02/21, Bo Victor Thomsen escreveu:
>> Hi list -
>>
>> Is there any way/method - using python - to activate the Vertex Tool
>> with a specific object from a specific layer ? The position and
>> attribute values for the object is known.
>>
>> The situation is as follows:
>>
>>   1. The user has pushed a button i a plugin dialog.
>>   2. The function to this event automatically generates  a polygon.
>>   3. The geometry is calculated from the position and extend of the
>>      current mapper window.
>>   4. The polygon is inserted in a known layer.
>>   5. This layer is made user editable
>>
>>   6. The vertex tool is activated with the inserted polygon highlighted
>>
>> Point 1-5 is working fine. It's point 6 I'm asking about
>>
>> -- 
>> Med venlig hilsen / Kind regards
>>
>> Bo Victor Thomsen
>>
>>
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
> J. Gustavo


More information about the QGIS-Developer mailing list