예제 #1
0
 public DrawPolyline(PointLatLng p1, PointLatLng p2, int zoom, TOOL_TYPE type)
     : base()
 {
     property = new PropertyLine();
     property.LocalPosition = p1;
     property.DefaultZoom   = zoom;
     property.Type          = type;
     Overlay = Global.control.Overlays.Count - 1;
     PointsArray.Add(p1);
     PointsArray.Add(p2);
 }
예제 #2
0
        public DrawPolygon(int x, int y, int zoom, TOOL_TYPE type)
            : base()
        {
            property               = new PropertyPolygon();
            property.DefaultZoom   = zoom;
            property.LocalPosition = Global.control.FromLocalToLatLng(x, y);
            property.Type          = type;
            Overlay = Global.control.Overlays.Count - 1;

            PointsArray.Add(Global.control.FromLocalToLatLng(x, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + 30, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + 30, y + 30));
            PointsArray.Add(Global.control.FromLocalToLatLng(x, y + 30));
        }
예제 #3
0
        /*
         * public override void ClearLinkSelected()
         * {
         *  List<string> listRemove = new List<string>();
         *  foreach (KeyValuePair<string, LinkObject> o in mapLink)
         *  {
         *      if (o.Value.type == ACTION_TYPE.selected)
         *      {
         *          Global.control.Overlays[Overlay].Routes.Remove(o.Value.route);
         *          o.Value.marker.Clear();
         *          listRemove.Add(o.Key);
         *      }
         *  }
         *  foreach (string o in listRemove)
         *  {
         *      mapLink.Remove(o);
         *  }
         * }
         */

        public override void AddPoint(Point point)
        {
            if (route == null)
            {
                return;
            }
            PointLatLng p = Global.control.FromLocalToLatLng((int)point.X, (int)point.Y);

            PointsArray.Add(p);
            route.Points.Add(p);
            Global.control.UpdateRouteLocalPosition(route);
            property.Distance = route.Distance;
            Global.control.ObjectSelected(property);
        }
예제 #4
0
        public DrawPolyline(int x, int y, int zoom, TOOL_TYPE type)
            : base()
        {
            property = new PropertyLine();
            property.LocalPosition = Global.control.FromLocalToLatLng(x, y);
            property.DefaultZoom   = zoom;
            property.Type          = type;

            Overlay = Global.control.Overlays.Count - 1;

            PointLatLng p;

            p = Global.control.FromLocalToLatLng(x, y);
            PointsArray.Add(p);
            p = Global.control.FromLocalToLatLng(x + 15, y + 15);
            PointsArray.Add(p);
        }
예제 #5
0
        public DrawEllipse(int x, int y,int zoom, TOOL_TYPE type)
            : base()
        {
            property = new PropertyPolygon();
            property.LocalPosition = Global.control.FromLocalToLatLng(x, y);
            property.DefaultZoom = zoom;
            property.Type = type;

            Overlay = Global.control.Overlays.Count - 1;

            Rectangle rect = new Rectangle(x, y, 40, 40);

            PointsArray.Add(Global.control.FromLocalToLatLng(x, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rect.Width, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rect.Width, y + rect.Height));
            PointsArray.Add(Global.control.FromLocalToLatLng(x, y + rect.Height));

            SetRectangle(rect);
        }
예제 #6
0
        public DrawImage(int x, int y, int zoom, TOOL_TYPE type)
            : base()
        {
            property               = new PropertyImage();
            property.DefaultZoom   = zoom;
            property.Type          = type;
            property.LocalPosition = Global.control.FromLocalToLatLng(x, y);

            Overlay = Global.control.Overlays.Count - 1;

            Bitmap    bmp  = new Bitmap(property.ImageFile);
            Rectangle rect = new Rectangle(x, y, (int)bmp.Width * 3 / 4, (int)bmp.Height * 3 / 4);

            PointsArray.Add(Global.control.FromLocalToLatLng(x, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rect.Width, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rect.Width, y + rect.Height));
            PointsArray.Add(Global.control.FromLocalToLatLng(x, y + rect.Height));

            SetRectangle(rect);
        }
예제 #7
0
        public DrawMarker(long pid, int x, int y, int zoom, TOOL_TYPE type, MARKER_TYPE markerType)
            : base()
        {
            PointLatLng latlng = Global.control.FromLocalToLatLng(x, y);

            PointsArray.Add(latlng);

            property               = new PropertyMarker();
            property.DefaultZoom   = zoom;
            property.LocalPosition = latlng;
            property.Type          = type;
            property.MarkerType    = markerType;
            if (type == TOOL_TYPE.camera)
            {
                property.ImageFile = @"image\camera_0.ico";
            }
            else if (type == TOOL_TYPE.model)
            {
                property.ImageFile = @"image\model.ico";
            }
            else if (type == TOOL_TYPE.marker)
            {
                if (markerType == MARKER_TYPE.Green)
                {
                    property.ImageFile = @"image\marker_0.ico";
                }
                else if (markerType == MARKER_TYPE.Yellow)
                {
                    property.ImageFile = @"image\marker_2.ico";
                }
                else if (markerType == MARKER_TYPE.Red)
                {
                    property.ImageFile = @"image\marker_1.ico";
                }
                else if (markerType == MARKER_TYPE.Gray)
                {
                    property.ImageFile = @"image\marker_3.ico";
                }
            }
        }
예제 #8
0
        public DrawText(int x, int y, int zoom, TOOL_TYPE type)
            : base()
        {
            property               = new PropertyText();
            property.DefaultZoom   = zoom;
            property.LocalPosition = Global.control.FromLocalToLatLng(x, y);
            property.Type          = type;

            Overlay = Global.control.Overlays.Count - 1;

            Graphics g    = Graphics.FromImage(new Bitmap(1, 1));
            SizeF    size = g.MeasureString(property.Name, property.Font);

            rectangle = new Rectangle(x, y, (int)(size.Width * 1.5), (int)size.Height);

            PointsArray.Add(Global.control.FromLocalToLatLng(x, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rectangle.Width, y));
            PointsArray.Add(Global.control.FromLocalToLatLng(x + rectangle.Width, y + rectangle.Height));
            PointsArray.Add(Global.control.FromLocalToLatLng(x, y + rectangle.Height));

            //SetRectangle(rectangle);
        }
예제 #9
0
        /// <summary>
        /// Load object from serialization stream
        /// </summary>
        /// <param name="info"></param>
        /// <param name="orderNumber"></param>
        public virtual void LoadFromStream(SerializationInfo info, int orderNumber)
        {
            GetProperty().ID = info.GetInt64(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryID, orderNumber));
            GetProperty().Name = info.GetString(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryName, orderNumber));
            overlay = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryOverlay, orderNumber));
            GetProperty().Type = (TOOL_TYPE)info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryType, orderNumber));
            GetProperty().MaxZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryMaxZoom, orderNumber));
            GetProperty().MinZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryMinZoom, orderNumber));
            GetProperty().DefaultZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryDefaultZoom, orderNumber));

            GetProperty().LocalPosition = (PointLatLng)info.GetValue(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLocalPosition, orderNumber),
                typeof(PointLatLng));

            PointsArray.Clear();
            PointLatLng point;
            int         n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLengthPoint, orderNumber));

            for (int i = 0; i < n; i++)
            {
                point = (PointLatLng)info.GetValue(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}-{2}",
                                  entryPoint, orderNumber, i),
                    typeof(PointLatLng));

                PointsArray.Add(point);
            }

            n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLengthLink, orderNumber));
            linkArray.Clear();
            for (int i = 0; i < n; i++)
            {
                Object link = (Object)info.GetValue(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}-{2}",
                                  entryLink, orderNumber, i),
                    typeof(Object));
                linkArray.Add(link);
            }
        }