Hi,
I'm trying to move the annotation, but every time I take its geometry, I only see how the line moves (it's the same length as the length of the annotation).
protected override async void OnToolMouseMove(MapViewMouseEventArgs e)
{
lock (_zamek)
{
if (_sledovaniTrasy == TrackingState.NotTracking)
return;
if (_pracovniPlocha.HasValue)
{
_posledniPozice = e.ClientPoint;
return;
}
_posledniPozice = e.ClientPoint;
_pracovniPlocha = e.ClientPoint;
_sledovaniTrasy = TrackingState.Tracking;
}
await QueuedTask.Run(() =>
{
var symbolReference = _symbol.MakeSymbolReference();
const string bodyAnno = "BodyAnno";
var alBodyAnno = AlBodyAnno(bodyAnno);
var insp = Insp();
insp.Load(alBodyAnno, oid);
AnnotationProperties annoVlastnosti = insp.GetAnnotationProperties();
while (true)
{
Point? bod;
Geometry geometrie = null;
IDisposable grafika;
lock (_zamek)
{
bod = _posledniPozice;
_posledniPozice = null;
_pracovniPlocha = bod;
if (bod == null || !bod.HasValue)
{
_pracovniPlocha = null;
break;
}
if (_geometrie == null || _grafika == null)
{
_sledovaniTrasy = TrackingState.NotTracking;
break;
}
grafika = _grafika;
}
var envelope = shape.Extent;
var mapovyBodCentroid = GeometryEngine.Instance.Centroid(envelope);
double souradniceStrduX = mapovyBodCentroid.X;
double souradniceStreduY = mapovyBodCentroid.Y;
if (strana == "horni" || strana == "dolni")
{
if (shape.GeometryType != GeometryType.GeometryBag)
{
var mapovyBod = ActiveMapView.ClientToMap(e.ClientPoint);
var souradniceX = mapovyBod.X;
var x = souradniceX - souradniceStrduX;
var posun = GeometryEngine.Instance.Move(shape, x, 0);
annoVlastnosti.Shape = posun;
UpdateOverlay(grafika,posun, symbolReference);
}
}
else
{
if (shape.GeometryType != GeometryType.GeometryBag)
{
var mapovyBod = ActiveMapView.ClientToMap(e.ClientPoint);
var souradniceY = mapovyBod.Y;
var y = souradniceY - souradniceStreduY;
var posun = GeometryEngine.Instance.Move(shape, 0, y);
annoVlastnosti.Shape = posun;
UpdateOverlay(grafika, posun, symbolReference);
}
}
}
});
}Could it be that the Gemetry annotation is Polyline?
Thanks for the advice and tips.
David