I’m using a custom TrackInteractiveOverlay for a measuring tool which let’s the user click and move the mouse, and as the mouse moves, the line grows so that its last vertex is at the mouse location and an ellipse appears around it, with the center of it being the first vertex of the line and the last vertex of the line being at the edge of the vertex. This works fine in wgs84, but in other projections (like mercator), the ellipse is smaller than the line. This is more noticeable near the poles.
Here’s an example of wgs84 where it is working correctly:
Here is mercator where it is not working:
Here is the related code in mouse move function:
private const string LineFeatureKey = "lineFeature";
private const string EllipseFeatureKey = "ellipseFeature";
private const string FullLineKey = "fullLineFeature";
private LineShape _rulerLineShape;
private LineShape _fullLineShape;
protected override InteractiveResult MouseMoveCore(InteractionArguments interactionArguments)
{
InteractiveResult interactiveResult = new InteractiveResult();
var worldPoint = new PointShape(interactionArguments.WorldX, interactionArguments.WorldY);
_rulerLineShape.Vertices[_rulerLineShape.Vertices.Count - 1] = new Vertex(worldPoint.X, worldPoint.Y);
TrackShapeLayer.InternalFeatures[LineFeatureKey] = new Feature(_rulerLineShape);
var lengthForLabel = _rulerLineShape.GetLength(FromWgs84ToCurrentProjectionConverter.ExternalProjection,
SelectedDistanceUnit, DistanceCalculationMode.Haversine);
var totalLineLength = _clicks == 0 ? lengthForLabel : _fullLineShape.GetLength(FromWgs84ToCurrentProjectionConverter.ExternalProjection, SelectedDistanceUnit, DistanceCalculationMode.Haversine) + lengthForLabel;
// need the vertices in wgs84 for the GetDegreeBearing() below to work
var firstVertex = (PointShape)ToWgs84ProjectionConverter.ConvertToExternalProjection(new PointShape(_rulerLineShape.Vertices[0]));
var lastVertex = (PointShape)ToWgs84ProjectionConverter.ConvertToExternalProjection(new PointShape(_rulerLineShape.Vertices[1]));
var angle = GetDegreeBearing(firstVertex.Y, firstVertex.X, lastVertex.Y, lastVertex.X);
TrackShapeLayer.InternalFeatures[LineFeatureKey].ColumnValues["length"] = string.Format("{0:0.0}", lengthForLabel) + RulerLabel + " " + string.Format("{0:0.0}", angle) + "°";
var lengthForEllipse = lengthForLabel;
var es = new EllipseShape(new PointShape(_rulerLineShape.Vertices[0]), lengthForEllipse, CurrentMapUnit, SelectedDistanceUnit);
ShapeValidationResult res = es.Validate(ShapeValidationMode.Simple);
if (res.IsValid)
{
TrackShapeLayer.InternalFeatures[EllipseFeatureKey] = new Feature(es);
interactiveResult.InteractiveOverlayUpdateMode = InteractiveOverlayUpdateMode.Update;
interactiveResult.ProcessOtherOverlaysMode = ProcessOtherOverlaysMode.DoNotProcessOtherOverlays;
}
return interactiveResult;
}
Is there something I’m missing? I confirmed the worldPoints used for the line are in the same units as the current MapUnit, and the ellipse is being created from those, so I’m not sure why it would appear wrong in certain projections. Or I guess I should say when the mapunit is something other than degrees.

