Exemplo n.º 1
0
        public VertexInDateBase(int id, PointCoordinates coordinates, PriorityVertex priorityVertex, ArcInDateBase[] arcs, int numberZone)
        {
            if (coordinates == null ||
               arcs == null)
            {
                throw new ArgumentNullException();
            }
            if (arcs.Length == 0)
            {
                throw new ArgumentException();
            }

        }
Exemplo n.º 2
0
        public List<PointCoordinates> GetWay(PointCoordinates coor1, PointCoordinates coor2)
        {
            int id1 = dataBase.GetNearId(coor1);
            int id2 = dataBase.GetNearId(coor2);
            VertexInDateBase vertexDB1 = dataBase.GetVertex(id1);
            VertexInDateBase vertexDB2 = dataBase.GetVertex(id2);

            if (vertexDB1.NumberZone == vertexDB2.NumberZone)
            {
                return zones[vertexDB1.NumberZone].GetTrack(id1, id2);
            }
            else
            {
                // Запускается алгоритм A*
                throw new Exception("The method or operation is not implemented.");
            }
        }
Exemplo n.º 3
0
        public Vertex(int id, PointCoordinates coordinates, PriorityVertex priority, int zone)
        {
            if (coordinates == null)
            {
                throw new ArgumentNullException();
            }

            if (id == 0)
            {

                throw new ArgumentException();
            }

            this.Id = id;
            this.Coordinates = coordinates;
            this.Priority = priority;
            this.Zone = zone;
            this.Zone0 = null;
        }
Exemplo n.º 4
0
 public abstract double Distance(PointCoordinates point2);
Exemplo n.º 5
0
 public override double Distance(PointCoordinates point2)
 {
     return Math.Sqrt(Math.Pow(X - point2.X, 2) + Math.Pow(Y - point2.Y, 2));
 }
Exemplo n.º 6
0
 public static double Distance(PointCoordinates point1, PointCoordinates point2)
 {
     return Math.Sqrt(Math.Pow(point1.X - point2.X, 2) + Math.Pow(point1.Y - point2.Y, 2));
 }
Exemplo n.º 7
0
        public readonly PointCoordinates[] Track; // Координаты отображения дуги

        public ArcInDateBase(int id, TimeSpan time, int distance, PointCoordinates[] track)
        {
            if (time == null ||
                track == null)
            {
                throw new ArgumentNullException();
            }
            if (track.Length < 2)
            {
                throw new ArgumentException();
            }

            this.Distance = distance;
            this.Id = id;
            this.Time = time;
            this.Track = track;
        }
Exemplo n.º 8
0
 public int GetNearId(PointCoordinates coordinates) // Возвращает номер ближайшей вершины к точке с координатами coordinates.
 {
     throw new Exception("The method or operation is not implemented.");
 }