Curved Segment

642
2
02-24-2021 01:18 AM
francometz
New Contributor

Hi Guys

Qt 5.15, ArcGis 100.9

I'm prototyping a simple flightplan tool to get to know the SDK better. The flightplan is described in NED system with meters and is referenced with a WGS84 point.
I need CurvedSegments but as of right now there are no such thing in the SDK. The closest I've seen is GeodesicSector, but this gives me a closed Polyline. I do not need the straight line (radius).

Currently im doing it like this.

 

QQuaternion rotQ = QQuaternion::fromAxisAndAngle(QVector3D(0,0,1),qRadiansToDegrees(m_angle)/100.0);
QMatrix4x4 rot(rotQ.toRotationMatrix());
QVector3D r = m_startArc;
for(int i = 0; i < 100; i++){
	r = rot.map(r);
	QVector3D point = m_center + r;
	VisualObject::setPoint(i,VisualObject::localToWGS84(point,m_reference));
}

Esri::ArcGISRuntime::Point VisualObject::localToWGS84(QVector3D &point, Esri::ArcGISRuntime::Point &reference){
    qreal azimuth = qAtan2(point.y(),point.x());
    QList<Esri::ArcGISRuntime::Point> movedPoints = Esri::ArcGISRuntime::GeometryEngine::moveGeodetic({reference},point.length(),Esri::ArcGISRuntime::LinearUnit::meters(),azimuth,Esri::ArcGISRuntime::AngularUnit::radians(),Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);
    if(movedPoints.isEmpty()){
        return reference;
    }
    return movedPoints.first();
}

 

 

As you can imagine this is very slow. When I calculate everything in Web Mercator it is faster because i dont need the moveGeodetic command but I lose precisision when I compare it with the above method.

My guess is that I just don't know where to look for a better solution. Do you have an idea to improve the performance?

 

Best regards

 

 

Tags (3)
0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi there.

You're right, true curves would be the best way to solve this, and they don't exist in the platform yet. They are however being actively worked on, so you can expect them soon.

As for solving this right now, the code you posted seems pretty reasonable to me, it's a shame it's not performing to your needs.
To improve performance, we'd need to find a way to avoid calling MoveGeodetic in a loop like that.

I'm not quite sure about your use case, or how you are/want to display these geometries, but I wonder if constructing your geometries directly in an appropriate spatial reference might work, using one of the Builder types?

0 Kudos
francometz
New Contributor

Thanks for your reply.

I've made some more test and even if I create everything in WebMercator without the MoveGeodetic it is still not as performent as when I just use sectorGedotic. I don't know exactly where the inefficiency comes from but my guess is that it has todo with adding points to the builder and then creating the Gemoetry. I guess the sectorGeodotic does this in one step in a more efficient way?

My current workaround is to just caluclate the required end points and do the heavy lifting with QtConcurrent in a separate thread.

0 Kudos