Select to view content in your preferred language

Drawing Polyline points using Geometry Editor with restricted Options

302
3
Jump to solution
4 weeks ago
Labels (3)
SWE
by
New Contributor II

A little background i am drawing polyline Points using geometry editor now what i am doing is when i click on the map it is drawing the connected points on map and i am  saving the coordinates to a vector along with some other settings it works fine but when i click on the existing point it still add the Lat-longs of the clicked area but no other point is drawn on map what i want to do is instead of changing logic on my side because it will be complex i just want the functionality of clicking previous points disabled like you can only draw from current point i don't wanna allow user to click previous point while in drawing state is there any possibility but keep the undo functionality enabled??

Another workaround to this if there's any better way to do it like i just want the waypoints saved in my vector along with its number below is the code of what i am currently trying to do.

Another small question how to change color of polylines being drawn

if(!m_geometryEditor->isStarted())
{

m_geometryEditor->start(GeometryType::Polyline);
connect(mapConfigs::getInstance(),&mapConfigs::signalDepthChanged,this,&class::editHeightandVelocity);

if(m_geometryEditor->isStarted())
{
connect(m_mapView, &MapGraphicsView::mouseClicked, this, &class::onMouseClicked);
}


void class::onMouseClicked(const QMouseEvent& event)
{

Point mapPoint = m_mapView->screenToLocation(event.position().x(),event.position().y());
Point mapPointConverted = convertMercator_Coordinates(mapPoint);
addMapDataToVector(mapPointConverted);
qDebug() << "Converted MapPoint: Latitude:" << mapPointConverted.y() << "Longitude:" << mapPointConverted.x();
}

2 Solutions

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Will setting some combination of the InteractionConfiguration properties get you what you need? From what you describe, I think setting vertex selection to false would get you what you need - https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-interactionconfiguration.html#... 

View solution in original post

0 Kudos
LucasDanzinger
Esri Frequent Contributor

something like the following should do the trick

// setup interaction configuration
auto conf = new Esri::ArcGISRuntime::InteractionConfiguration(m_mapView);
conf->setAllowSelection(false);

// set the config on the tool
auto vertexTool = new Esri::ArcGISRuntime::VertexTool(this);
vertexTool->setConfiguration(conf);

// set the tool on the editor
geometryEditor->setTool(vertexTool);

 

As for the second issue - that sounds like some logic you will need to switch up. I'm not sure of your full workflow or why you want to store the lat/long in a vector, but maybe you don't need to? The GeometryEditor has a geometryChanged signal. Maybe you only want to add the last click when that emits? Or maybe you can just get the geometry property when the signal emits, and then access the geometry's list of points/access the json/etc?

View solution in original post

0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

Will setting some combination of the InteractionConfiguration properties get you what you need? From what you describe, I think setting vertex selection to false would get you what you need - https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-interactionconfiguration.html#... 

0 Kudos
SWE
by
New Contributor II

yes it could be done sure but can you provide a snippet of how would i do this i cant seem to get it i've tried but it didnt work. 
m_mapView = new MapGraphicsView(this);

conf = new Esri::ArcGISRuntime::InteractionConfiguration(m_mapView);

conf->setAllowSelection(false);
and another question is i am currenlty inserting vertex data to a vector when mouse is clicked on the map but its causing issues as when i click some other vertex it still add the point as insertion was based on mouse click on the map instead what i want to do is as soon as some waypoint is added on the map get that waypoint and extract its lat longs and then add it to a vector 

 

0 Kudos
LucasDanzinger
Esri Frequent Contributor

something like the following should do the trick

// setup interaction configuration
auto conf = new Esri::ArcGISRuntime::InteractionConfiguration(m_mapView);
conf->setAllowSelection(false);

// set the config on the tool
auto vertexTool = new Esri::ArcGISRuntime::VertexTool(this);
vertexTool->setConfiguration(conf);

// set the tool on the editor
geometryEditor->setTool(vertexTool);

 

As for the second issue - that sounds like some logic you will need to switch up. I'm not sure of your full workflow or why you want to store the lat/long in a vector, but maybe you don't need to? The GeometryEditor has a geometryChanged signal. Maybe you only want to add the last click when that emits? Or maybe you can just get the geometry property when the signal emits, and then access the geometry's list of points/access the json/etc?

0 Kudos