I want to implement zoom to area feature by drawing rectangle in QT local offline app.
Could you please suggest right way to do it....
which methods to call ...
Essentially you need to draw a rectangle on the screen and convert the corners from screen coordinates to map coordinates. Once you do that, you can get an Envelope representing the extent, and then create a ViewpointExtent from the envelope, and setViewpoint on the MapView.
We have an example similar to what you are looking for, where the sample draws a rectangle and converts it to an Envelope so that this area can be taken offline. You can based your example off this only instead of exporting tiles, you'd zoom to the Envelope
arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Layers/ExportTiles at master · Esri/arcgis-runtime-samples-qt · …
I am trying to use CPP + QML...I am handling mouse click event but panning is not allowing me to draw Reactangle How disable it.
There are some examples of this here - arcgis-runtime-qt-projects-100/OverrideMapSignals at master · ldanzinger/arcgis-runtime-qt-projects-100 · GitHub
For example, you could do:
<SPAN class="token function">connect</SPAN><SPAN class="punctuation token">(</SPAN>m_mapView<SPAN class="punctuation token">,</SPAN> <SPAN class="operator token">&</SPAN>MapQuickView<SPAN class="operator token">::</SPAN>mousePressed<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">(</SPAN>QMouseEvent<SPAN class="operator token">&</SPAN> event<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// accept the event - this will prevent the default panning from happening</SPAN> event<SPAN class="punctuation token">.</SPAN><SPAN class="token function">accept</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks it's working what to do in case on second button click I want to release this connect and connect with new one .
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.