Arrow Point

kiloeras

New member
Joined
Dec 11, 2019
Messages
4
Hello there.
Im doing some software with Silverlight.

Im drawing some Polylines in a Map given some points.

In the first photo there are shown three ponts.
They are connected with some esri polyline function.

But now i need to draw an arrow figure at the end of the line connectid to the various points.
So for me to be able that arrow figure I need to figure the x and y point on which that arrow will be.
(For this I meant what can be seet on the second image x=? and y=?)

The system is coordenate system of the planet.

I will be very glad if u could help me.
The x and y data are not exactly accurate, but I hope u can tell me the way of calculating those points to simulate the arrow.


In the phpuntosCordenadas.png
 
Hello!

I may be missing something terribly, but where are you supposed to draw the arrow? And can I have the polyline function? Thanks!
 
Maybe something at this link will be useful to you:
 
I will take a look to the answers above.
Maybie I can adjust my code to it.

It goes like this

C#:
Spanish=>English=>
                                 Ruta=>Route
                                 Patrulla=>Police patrol
                                 Indicatiu=>Idicative
                                 llistaTerminals=>TerminalList

  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()} }
            };

            for (int i=0;i<positionsGis.Count;i++)
            {
                var mapPoint = new MapPoint(positionsGis[i].Y, positionsGis[i].X);
                string codTermi = "";
                if (positionsGis != null)
                {
                    var aux1 = llistaTerminals.FirstOrDefault(x => x.Id == positionsGis[i].IdTerminal);
                    if (aux1 != null) codTermi = aux1.Codi;
                }

                (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;
        }
        }





C#:
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;
        }

Sorry about the mesy code

--------
 

Attachments

  • 2222222222.png
    2222222222.png
    20.7 KB · Views: 2
Last edited:
Top