<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">I use the statement:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">facility_placement_tool = FacilityPlacementTool(iface.mapCanvas(), vlayer_crs)<o:p></o:p></p>
<p class="MsoNormal">iface.mapCanvas().setMapTool(facility_placement_tool)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">to set a custom tool on the map canvas. It allows me to move a feature layer around the map canvas using the translateFeature method of the layer using the canvasMoveEvent of FacilityPlacementTool until I click on the left mouse button.
Once the user clicks the left mouse, I detect that event and I run a method, rotateFeature, below that allows me to use the native QGIS rotate method. I can then rotate the feature. Expecting this to happen, it then seems that the rotate tool takes over
the map canvas events from my FacilityPlacementTool so when I right click to end the rotate on the feature that’s all that happens. But I want the right click to end editing which have in the canvasPressEvent method in FacilityPlacementTool. Is there a
way after the code below runs and the user ends the rotate tool by right clicking that right click even can then be passed onto the FacilityPlacementTool tool or I can just run some other method that closes out the edit session.<o:p></o:p></p>
<p class="MsoNormal"> Also wondering why I have to get to the rotate feature tool with the code below, but there is a iface.actionMoveFeature().trigger() statement I can call to move a feature Why isn’t there a iface.actionRotateFeature().trigger() method.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">def rotateFeature(self):<o:p></o:p></p>
<p class="MsoNormal"> # Get all actions<o:p></o:p></p>
<p class="MsoNormal"> actions = iface.mainWindow().findChildren(QAction)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> # Check the action <o:p></o:p></p>
<p class="MsoNormal"> action = [x for x in actions if x.objectName()=='mActionRotateFeature'][0]<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> # Run the action<o:p></o:p></p>
<p class="MsoNormal"> action.trigger()<o:p></o:p></p>
</div>
</body>
</html>