This one from the bottom gets to show what can be seen as in the photo
public static ObjectForRuta CreateGraphic(List<PosicionGis> positionsGis, Patrulla patrulla, int zonaUtm,
ObservableCollection<Terminal> llistaTerminals, bool IsNotSipCat)
{
var objectForGraphics = new ObjectForRuta();
var rutaPoints = new Graphic
{
Symbol = new SimpleLineSymbol
{
Color = new SolidColorBrush(patrulla.Color.ToColor()),
Style = SimpleLineSymbol.LineStyle.Dash,
Width = 2,
},
Geometry = new Polyline { Paths = new ObservableCollection<PointCollection> { new PointCollection()} }
};
var pointCollectionList = new ObservableCollection<PointCollection>();
for (int i = 0; i < (positionsGis.Count * 2); i++)
{
pointCollectionList.Add(new PointCollection());
}
var arrowDirection = new Graphic
{
Symbol = new SimpleLineSymbol
{
Color = new SolidColorBrush(patrulla.Color.ToColor()),
Style = SimpleLineSymbol.LineStyle.Solid,
Width = 2,
},
Geometry = new Polyline { Paths = pointCollectionList }
};
for (int i=0;i<positionsGis.Count;i++)
{
var mapPoint = new MapPoint(positionsGis[I].Y, positionsGis[I].X);
MapPoint mapPointLeftCopy = null;
MapPoint mapPointRightCopy = null;
string codTermi = "";
if (positionsGis != null)
{
var aux1 = llistaTerminals.FirstOrDefault(x => x.Id == positionsGis[I].IdTerminal);
if (aux1 != null) codTermi = aux1.Codi;
}
//if (i < positionsGis.Count - 1 && i != 0)
//{
// mapPointLeftCopy = new MapPoint(mapPoint.X - 0.00001, mapPoint.Y + 0.00001);
// mapPointRightCopy = new MapPoint(mapPoint.X + 0.00001, mapPoint.Y + 0.00001);
//}
if (i < positionsGis.Count - 1 && i != 0)
{
if (positionsGis[I].X > positionsGis[i + 1].X)
{
if (positionsGis[I].Y > positionsGis[i + 1].Y)
{
//mapPointLeftCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y + 0.00002);
//mapPointRightCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y + 0.00002);
}
else
{
mapPointLeftCopy = new MapPoint(mapPoint.X - 0.00001, mapPoint.Y - 0.00001);
mapPointRightCopy = new MapPoint(mapPoint.X + 0.00001, mapPoint.Y - 0.00001);
//mapPointLeftCopy = new MapPoint(mapPoint.X - 0.00002, mapPoint.Y + 0.00002);
//mapPointRightCopy = new MapPoint(mapPoint.X - 0.00002, mapPoint.Y + 0.00002);
}
}
else
{
if (positionsGis[I].Y > positionsGis[i + 1].Y)
{
//mapPointLeftCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y - 0.00002);
//mapPointRightCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y - 0.00002);
}
else
{
mapPointLeftCopy = new MapPoint(mapPoint.X - 0.00001, mapPoint.Y + 0.00001);
mapPointRightCopy = new MapPoint(mapPoint.X + 0.00001, mapPoint.Y + 0.00001);
//mapPointLeftCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y + 0.00002);
//mapPointRightCopy = new MapPoint(mapPoint.X + 0.00002, mapPoint.Y + 0.00002);
}
}
}
if (i != 0)
{
if (i % 2 == 0)
{
(arrowDirection.Geometry as Polyline).Paths[I].Add(mapPoint);
(arrowDirection.Geometry as Polyline).Paths[I].Add(mapPointLeftCopy);
(arrowDirection.Geometry as Polyline).Paths[i + 1].Add(mapPoint);
(arrowDirection.Geometry as Polyline).Paths[i + 1].Add(mapPointRightCopy);
//objectForGraphics.arrowDirectionRight = rutaPoints;
objectForGraphics.arrowDirectionLeft = arrowDirection;
}
else
{
if (i < positionsGis.Count - 1)
{
(arrowDirection.Geometry as Polyline).Paths[pointCollectionList.Count - i].Add(mapPoint);
(arrowDirection.Geometry as Polyline).Paths[pointCollectionList.Count - i].Add(mapPointLeftCopy);
(arrowDirection.Geometry as Polyline).Paths[(pointCollectionList.Count - i) - 1].Add(mapPoint);
(arrowDirection.Geometry as Polyline).Paths[(pointCollectionList.Count - i) - 1].Add(mapPointRightCopy);
//objectForGraphics.arrowDirectionRight = rutaPoints;
objectForGraphics.arrowDirectionLeft = arrowDirection;
}
}
}
(rutaPoints.Geometry as Polyline).Paths[0].Add(mapPoint);
var graphic = new Graphic
{
Geometry = mapPoint,
MapTip = CreateTextBoxMapTip(positionsGis[I], patrulla.Indicatiu, codTermi),
Symbol = SymbolFactory.CircleForUnidadesRutas(patrulla.Color.ToColor())
};
objectForGraphics.graphicPosiciones.Add(graphic);
objectForGraphics.graphicRuta = rutaPoints;
objectForGraphics.graphicRuta.SetZIndex(1);
objectForGraphics.graphicPosiciones.ForEach(x => x.SetZIndex(2));
}
return objectForGraphics;
}