Esempio n. 1
0
        private void AddLineAsCorridor(Converter c, Line start, Line end, List <Line> lines, LineType lineType)
        {
            Vector MiddleStart = Vector.Middle(getVector(c, start.A), getVector(c, start.B));
            Vector MiddleEnd   = Vector.Middle(getVector(c, end.A), getVector(c, end.B));

            Channel = new ParcourChannelSingle(MiddleStart, MiddleEnd, lineType, lines, c);
        }
Esempio n. 2
0
 public ParcourChannelSingle(ParcourChannelSingle pc)
 {
     this.Start = pc.Start;
     this.End   = pc.End;
     foreach (Vector v in pc.LinearCombinations)
     {
         Vector vec = new Vector(v);
         LinearCombinations.Add(vec);
         if (pc.ImmutablePoints.Contains(v))
         {
             ImmutablePoints.Add(vec);
         }
     }
 }
Esempio n. 3
0
 public ParcourChannelSingle(ParcourChannelSingle pc)
 {
     this.Start = pc.Start;
     this.End = pc.End;
     foreach (Vector v in pc.LinearCombinations)
     {
         Vector vec = new Vector(v);
         LinearCombinations.Add(vec);
         if (pc.ImmutablePoints.Contains(v))
         {
             ImmutablePoints.Add(vec);
         }
     }
 }
Esempio n. 4
0
        private void AddBestModel()
        {
            bestModel.addPolygons();
            lock (parcour)
            {
                bestLegLength      = Converter.MtoNM(bestModel.lenght);
                bestStraightLength = Converter.MtoNM(bestModel.straightLength);

                foreach (Line line in parcour.Line.ToList <Line>().Where(p => p.Type == (int)LineType.Point))
                {
                    parcour.Line.Remove(line);
                }
                ParcourChannelSingle pc = bestModel.getChannel();

                Vector last = null;
                foreach (Vector v in pc.getLinearCombinations())
                {
                    if (last != null)
                    {
                        Line l = new Line();
                        l.Type = (int)LineType.Point;
                        l.A    = Factory.newGPSPoint(c.XtoLongitude(last.X), c.YtoLatitude(last.Y), 0);
                        l.B    = Factory.newGPSPoint(c.XtoLongitude(last.X), c.YtoLatitude(last.Y), 0);
                        if (pc.ImmutablePoints.Contains(last))
                        {
                            //TODO l.A.edited = true;
                            //TODO l.B.edited = true;
                        }
                        l.O = Factory.newGPSPoint(c.XtoLongitude(v.X), c.YtoLatitude(v.Y), 0);
                        if (pc.ImmutablePoints.Contains(v))
                        {
                            //TODO l.O.edited = true;
                        }
                        parcour.Line.Add(l);
                    }
                    last = v;
                }

                foreach (Line line in parcour.Line.ToList <Line>().Where(p => p.Type == (int)LineType.PENALTYZONE))
                {
                    parcour.Line.Remove(line);
                }
                foreach (ParcourPolygon pg in bestModel.getPolygons())
                {
                    Vector mid = new Vector(0, 0, 0);
                    foreach (Vector v in pg.getEdges())
                    {
                        mid = mid + v;
                    }
                    int count = pg.getEdges().Count;
                    mid = mid / count;

                    for (int i = 0; i < count; i++)
                    {
                        Line l = new Line();
                        l.Type = (int)LineType.PENALTYZONE;
                        l.A    = Factory.newGPSPoint(c.XtoLongitude(pg.getEdges()[i].X), c.YtoLatitude(pg.getEdges()[i].Y), 0);
                        l.B    = Factory.newGPSPoint(c.XtoLongitude(pg.getEdges()[(i + 1) % count].X), c.YtoLatitude(pg.getEdges()[(i + 1) % count].Y), 0);
                        l.O    = Factory.newGPSPoint(c.XtoLongitude(mid.X), c.YtoLatitude(mid.Y), 0);
                        parcour.Line.Add(l);
                    }
                }
            }
        }
Esempio n. 5
0
 private void AddCorridor(ParcourChannelSingle c)
 {
     Channel = new ParcourChannelSingle(c);
 }
Esempio n. 6
0
 private void AddLineAsCorridor(Converter c, Line start, Line end, List<Line> lines, LineType lineType)
 {
     Vector MiddleStart = Vector.Middle(getVector(c, start.A), getVector(c, start.B));
     Vector MiddleEnd = Vector.Middle(getVector(c, end.A), getVector(c, end.B));
     Channel = new ParcourChannelSingle(MiddleStart, MiddleEnd, lineType, lines, c);
 }
Esempio n. 7
0
 private void AddCorridor(ParcourChannelSingle c)
 {
     Channel = new ParcourChannelSingle(c);
 }