Select to view content in your preferred language

Measuring the distance between two clicked points

1953
7
Jump to solution
05-02-2021 06:31 AM
FatmaAkdemir
Frequent Contributor

We want to provide user a ruler that shows the distance between 2 points that are clicked by user? Is there a way to do that?

0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir ,

We do have a sample that adds a polyline on mouse clicks with our Service Area sample.

https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

This code snippet shows the mouseClicked handler and how to get the projected point for the click location

https://github.com/Esri/arcgis-runtime-samples-qt/blob/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

And this code block shows have to add points to a geometry builder and symbolize this on the graphics overlay.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

We are working on the Sketch Editor for Qt and hope to have this ready for the next release. That will be a big improvement in the sketching experience.

We also have a ShowLocationHistory sample that adds points as "breadcrumbs" to a polyline via PolylineBuilder.

https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Maps/Sho... 

View solution in original post

7 Replies
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir .

  That is likely a feature that would be in our toolkit but we don't have any such toolkit component right now. I assume you know how to get the distance with the GeometryEngine, but are looking for a UI element to display on screen representing a ruler, is that correct?

0 Kudos
FatmaAkdemir
Frequent Contributor

Hi @JamesBallard1 ,

Yeah I was looking for a ready to use Ui element for ruler. Can I find an example in github which allows user to draw a line or polygon with mouse?

0 Kudos
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir ,

We do have a sample that adds a polyline on mouse clicks with our Service Area sample.

https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

This code snippet shows the mouseClicked handler and how to get the projected point for the click location

https://github.com/Esri/arcgis-runtime-samples-qt/blob/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

And this code block shows have to add points to a geometry builder and symbolize this on the graphics overlay.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/master/ArcGISRuntimeSDKQt_CppSamples/Routing/...

We are working on the Sketch Editor for Qt and hope to have this ready for the next release. That will be a big improvement in the sketching experience.

We also have a ShowLocationHistory sample that adds points as "breadcrumbs" to a polyline via PolylineBuilder.

https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Maps/Sho... 

LucasDanzinger
Esri Frequent Contributor

@FatmaAkdemir the 100.12 release of ArcGIS Runtime now supports a SketchEditor, which greatly simplifies the workflow for sketching geometries on a map. This might be something worth considering integrating into your app. More details are in the release blog - https://community.esri.com/t5/arcgis-runtime-sdks-blog/sketcheditor-now-available-in-the-arcgis-runt... 

FatmaAkdemir
Frequent Contributor

@LucasDanzingerthanks for the info! It looks great. We are currently using 100.8. If we upgrade to 100.12, I am sure we will add this feature to our project.

0 Kudos
FatmaAkdemir
Frequent Contributor

Hi @LucasDanzinger ,

Hope you're well! One simple question we have : Is there any way to use SketchEditor on 3D SceneGraphicsView instead of MapView?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

No, SketchEditor only works in 2D MapView currently.

0 Kudos