Beispiel #1
0
 public Text(string text, Font Font, GeoPoint BeginPoint)
 {
     this.Title = text;
     this.Font = Font;
     this.BeginPoint = BeginPoint;
     Priority = 1;
 }
Beispiel #2
0
 public GeoPoint FindMaxCoord()
 {
     if (MapObjects.Count != 0)
     {
         double MaxX;
         double MaxY;
         GeoPoint MaxCoords = new GeoPoint();
         GeoPoint gp = new GeoPoint();
         MaxX = MapObjects[0].FindMaxCoord().X;
         MaxY = MapObjects[0].FindMaxCoord().Y;
         foreach (var MapObject in MapObjects)
         {
             MaxCoords = MapObject.FindMaxCoord();
             if (MaxCoords.X > MaxX)
                 MaxX = MaxCoords.X;
             if (MaxCoords.Y > MaxY)
                 MaxY = MaxCoords.Y;
             gp.X = MaxX;
             gp.Y = MaxY;
         }
         return gp;
     }
     return null;
 }
Beispiel #3
0
 public abstract bool IsCross(GeoPoint gp, double delta);
Beispiel #4
0
 public override GeoPoint FindMinCoord()
 {
     GeoPoint gp = new GeoPoint();
     if (GeoPointBegin.X < GeoPointEnd.X)
         gp.X = GeoPointBegin.X;
     else
         gp.X = GeoPointEnd.X;
     if (GeoPointBegin.Y < GeoPointEnd.Y)
         gp.Y = GeoPointBegin.Y;
     else
         gp.Y = GeoPointEnd.Y;
     return gp;
 }
Beispiel #5
0
 public Line(double XBegin, double YBegin, double XEnd, double YEnd)
 {
     GeoPointBegin = new GeoPoint(XBegin, YBegin);
     GeoPointEnd = new GeoPoint(XEnd, YEnd);
     Priority = 2;
 }
Beispiel #6
0
 public Line(GeoPoint GeoPointBegin, GeoPoint GeoPointEnd)
 {
     this.GeoPointBegin = GeoPointBegin;
     this.GeoPointEnd = GeoPointEnd;
     Priority = 2;
 }
Beispiel #7
0
        public override bool IsCross(GeoPoint gp, double delta)
        {
            double result = Math.Abs(((GeoPointBegin.Y - GeoPointEnd.Y) * gp.X + (GeoPointEnd.X - GeoPointBegin.X) * gp.Y + GeoPointBegin.X * GeoPointEnd.Y - GeoPointEnd.X * GeoPointBegin.Y) / Math.Sqrt((GeoPointEnd.X - GeoPointBegin.X) * (GeoPointEnd.X - GeoPointBegin.X) + (GeoPointEnd.Y - GeoPointBegin.Y) * (GeoPointEnd.Y - GeoPointBegin.Y)));
            double MinY;
            double MinX;
            double MaxX = FindMaxCoord().X;
            double MaxY = FindMaxCoord().Y;

            if (GeoPointBegin.X < GeoPointEnd.X)
                MinX = GeoPointBegin.X;
            else
                MinX = GeoPointEnd.X;
            if (GeoPointBegin.Y < GeoPointEnd.Y)
                MinY = GeoPointBegin.Y;
            else
                MinY = GeoPointEnd.Y;
            if (result <= (Pen.Width / (2 * this.CurrentLayer.CurrentMap.MapScale)) + delta && gp.X <= MaxX + delta && gp.X >= MinX - delta && gp.Y <= MaxY + delta && gp.Y >= MinY - delta)
                return true;
            else
                return false;
        }
Beispiel #8
0
 public override bool IsCross(GeoPoint gp, double delta)
 {
     if (Check())
     {
         double MaxX = FindMaxCoord().X;
         double MaxY = FindMaxCoord().Y;
         double MinX = BeginPoint.X;
         double MinY = BeginPoint.Y - TextRenderer.MeasureText(Title, Font).Height / (float)CurrentLayer.CurrentMap.MapScale;
         if (gp.X <= MaxX + delta && gp.X >= MinX - delta && gp.Y <= MaxY + delta && gp.Y >= MinY - delta)
             return true;
         else
             return false;
     }
     return false;
 }
Beispiel #9
0
 public MapObject FindObject(GeoPoint gp, double delta)
 {
     MaxCoords = new GeoPoint(FindMaxCoord().X, FindMaxCoord().Y);
     foreach (MapObject m in MapObjects)
         if (m.IsCross(gp, delta))
             return m;
     return null;
 }
Beispiel #10
0
 public override GeoPoint FindMaxCoord()
 {
     if (Nodes.Count != 0)
     {
         GeoPoint gp = new GeoPoint();
         double MaxX = Nodes[0].X;
         double MaxY = Nodes[0].Y;
         foreach (var Node in Nodes)
         {
             if (Node.X > MaxX)
                 MaxX = Node.X;
             if (Node.Y > MaxY)
                 MaxY = Node.Y;
         }
         gp.X = MaxX;
         gp.Y = MaxY;
         return gp;
     }
     else
         return null;
 }
Beispiel #11
0
 public GeoPoint FindMinCoord()
 {
     if (MapObjects.Count != 0)
     {
         double MinX;
         double MinY;
         GeoPoint MinCoords = new GeoPoint();
         GeoPoint gp = new GeoPoint();
         MinX = MapObjects[0].FindMinCoord().X;
         MinY = MapObjects[0].FindMinCoord().Y;
         foreach (var MapObject in MapObjects)
         {
             MinCoords = MapObject.FindMinCoord();
             if (MinCoords.X < MinX)
                 MinX = MinCoords.X;
             if (MinCoords.Y < MinY)
                 MinY = MinCoords.Y;
             gp.X = MinX;
             gp.Y = MinY;
         }
         return gp;
     }
     return null;
 }
Beispiel #12
0
 public void AddNode(GeoPoint geoPoint)
 {
     Nodes.Add(geoPoint);
 }
Beispiel #13
0
 public override bool IsCross(GeoPoint gp, double delta)
 {
     double result;
     double MinY;
     double MinX;
     double MaxX;
     double MaxY;
     for (int i = 0; i < Nodes.Count - 1; i++)
     {
         result = Math.Abs(((Nodes[i].Y - Nodes[i + 1].Y) * gp.X + (Nodes[i + 1].X - Nodes[i].X) * gp.Y + Nodes[i].X * Nodes[i + 1].Y - Nodes[i + 1].X * Nodes[i].Y) / Math.Sqrt((Nodes[i + 1].X - Nodes[i].X) * (Nodes[i + 1].X - Nodes[i].X) + (Nodes[i + 1].Y - Nodes[i].Y) * (Nodes[i + 1].Y - Nodes[i].Y)));
         if (Nodes[i].X > Nodes[i + 1].X)
         {
             MaxX = Nodes[i].X;
             MinX = Nodes[i + 1].X;
         }
         else
         {
             MaxX = Nodes[i + 1].X;
             MinX = Nodes[i].X;
         }
         if (Nodes[i].Y > Nodes[i + 1].Y)
         {
             MaxY = Nodes[i].Y;
             MinY = Nodes[i + 1].Y;
         }
         else
         {
             MaxY = Nodes[i + 1].Y;
             MinY = Nodes[i].Y;
         }
         if (result <= (Pen.Width / (2 * this.CurrentLayer.CurrentMap.MapScale)) + delta && gp.X >= MinX - delta && gp.Y <= MaxY + delta && gp.Y >= MinY - delta)
             return true;
     }
     return false;
 }
Beispiel #14
0
 public override GeoPoint FindMinCoord()
 {
     if (Nodes.Count != 0)
     {
         GeoPoint gp = new GeoPoint();
         double MinX = Nodes[0].X;
         double MinY = Nodes[0].Y;
         foreach (var Node in Nodes)
         {
             if (Node.X < MinX)
                 MinX = Node.X;
             if (Node.Y < MinY)
                 MinY = Node.Y;
         }
         gp.X = MinX;
         gp.Y = MinY;
         return gp;
     }
     else
         return null;
 }
Beispiel #15
0
 public Line(double XBegin, double YBegin, double XEnd, double YEnd)
 {
     GeoPointBegin = new GeoPoint(XBegin, YBegin);
     GeoPointEnd   = new GeoPoint(XEnd, YEnd);
     Priority      = 2;
 }
Beispiel #16
0
 public Line(GeoPoint GeoPointBegin, GeoPoint GeoPointEnd)
 {
     this.GeoPointBegin = GeoPointBegin;
     this.GeoPointEnd   = GeoPointEnd;
     Priority           = 2;
 }