Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you tell me why it's taking so long to initialize #82

Open
JhonJHUtd opened this issue Aug 8, 2023 · 0 comments
Open

Can you tell me why it's taking so long to initialize #82

JhonJHUtd opened this issue Aug 8, 2023 · 0 comments

Comments

@JhonJHUtd
Copy link

The initialization of the map is too slow, the initialization is successful only about 4s, and before the initialization is successful, the longitude and latitude conversion algorithm will be called abnormally

public static Vector3 GetUnityPosFromLatlon(ArcGISPoint latLon)
{
var cartesianPosition = arcGISMapComponent.View.GeographicToWorld(latLon);
Vector3 result = hPRoot.TransformPoint(cartesianPosition).ToVector3();

// Check for NaN values
if (float.IsNaN(result.x) || float.IsNaN(result.y) || float.IsNaN(result.z))
{
Debug.LogWarning("GetUnityPosFromLatlon returned NaN. Returning default value.");
return Vector3.zero; // Return a default value (0, 0, 0) in case of NaN
}

return result; // Return the calculated result

}

public static ArcGISPoint GetLatLonFromUnityPos(Vector3 vec)
{

var worldPosition = hPRoot.InverseTransformPoint(vec.ToDouble3());
ArcGISPoint result = arcGISMapComponent.View.WorldToGeographic(worldPosition);
if (double.IsNaN(result.X) || double.IsNaN(result.Y) || double.IsNaN(result.Z))
{
Debug.LogWarning("GetLatLonFromUnityPos returned NaN. Returning default value.");
return new ArcGISPoint(0,0,0); // Return a default value (0, 0, 0) in case of NaN
}
return result;

}

Can you tell me why it's taking so long to initialize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant