Exemplo n.º 1
0
        /// <summary>
        /// Locates animals from the selected category.
        /// </summary>
        private void loadGoogleMapPerCategory()
        {
            gMapControl.Overlays.Clear();
            Models.Category selectedCategory = (Models.Category) this.category_comboBox.Items[category_comboBox.SelectedIndex];
            int             categoryId       = selectedCategory.categoryId;

            try
            {
                List <TrackingInfo> trackingInfo = TrackingInfoDelegate.GetLatestPositionOfAllAnimalPerCategory(categoryId);
                GMarkerGoogle       marker;
                GMapOverlay         markersOverlay = new GMapOverlay("markers");
                foreach (TrackingInfo point in trackingInfo)
                {
                    GMarkerGoogleType MarkerColor = (GMarkerGoogleType)Enum.Parse(typeof(GMarkerGoogleType), Constants.GREEN_COLOR, true);
                    marker             = new GMarkerGoogle(new PointLatLng(point.latitude, point.longitude), MarkerColor);
                    marker.ToolTipText = point.gpsDeviceId + Constants.COLON_CONSTANTS + point.categoryName;
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    markersOverlay.Markers.Add(marker);
                }
                gMapControl.Overlays.Add(markersOverlay);
                configureZoomingOfMap();
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Error map view {0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
        }
 public MyGMarkerGoogle(PointLatLng point, GMarkerGoogleType type, String text, Color foreColor) : base(point, type)
 {
     this.Size      = new Size(24, 24);
     this.foreColor = foreColor;
     this.text      = text;
     font           = new System.Drawing.Font("Sansation", 5.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
 }
Exemplo n.º 3
0
        public void paintGMap_filter2(List <InvestigationGroup> ig_list, GMarkerGoogleType gmarker_type)
        {
            Random r = new Random();
            List <InvestigationGroup> ig_municipalities = new List <InvestigationGroup>();

            for (int i = 0; i < ig_list.Count(); i++)
            {
                Municipality s = program.Locat.MunicipalityList.Find(b => b.Name.Equals(ig_list.ElementAt(i).Municipality));

                if (s == null)
                {
                    MessageBox.Show(ig_list.ElementAt(i).Municipality);
                }
                else
                {
                    double x = r.NextDouble() * (s.x1 - s.x2) + s.x2;
                    double y = r.NextDouble() * (s.y1 - s.y2) + s.y2;



                    GMapMarker marker = new GMarkerGoogle(new PointLatLng(y, x), gmarker_type);
                    markers.Markers.Add(marker);
                }
            }
        }
Exemplo n.º 4
0
 public GmapMarkerWithLabel2(PointLatLng p, string caption, GMarkerGoogleType type)
     : base(p)
 {
     font = new Font("Arial", 14);
     innerMarker = new GMarkerGoogle(p, type);
     Caption = caption;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Locates total animals from all categoreies in Gmap.
        /// </summary>
        private void loadGoogleMapForAllCategory()
        {
            gMapControl.Overlays.Clear();
            try
            {
                List <TrackingInfo> trackingInfo    = TrackingInfoDelegate.GetLatestPositionOfAllAnimal();
                var           allAnimalsPerCategory = trackingInfo.GroupBy(category => category.categoryId);
                GMarkerGoogle marker;
                GMapOverlay   markersOverlay = new GMapOverlay("markers");

                int colorIndex = 0;
                foreach (var allAnimal in allAnimalsPerCategory)
                {
                    foreach (TrackingInfo point in allAnimal)
                    {
                        GMarkerGoogleType MarkerColor = (GMarkerGoogleType)Enum.Parse(typeof(GMarkerGoogleType), Constants.CategoryMapLocatorColor[colorIndex], true);
                        marker             = new GMarkerGoogle(new PointLatLng(point.latitude, point.longitude), MarkerColor);
                        marker.ToolTipText = point.gpsDeviceId + Constants.COLON_CONSTANTS + point.categoryName;
                        marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                        markersOverlay.Markers.Add(marker);
                    }
                    colorIndex += 1;
                }
                gMapControl.Overlays.Add(markersOverlay);
                configureZoomingOfMap();
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Error in viewing the map {0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// Método que cria uma camada de marcadores, identifiando marcador inicial, intermédio e final assim como informações sobre os mesmos.
        /// </summary>
        /// <param name="markers"></param>
        /// <returns>Uma camada de marcadores</returns>
        public virtual GMapOverlay PlaceMarkers(List <Marker> markers)
        {
            GMapOverlay markersOverlay = new GMapOverlay("markers");

            for (int i = 0; i < markers.Count; i++)
            {
                Marker      marker = markers[i];
                PointLatLng point  = new PointLatLng(marker.Latitude, marker.Longitude);

                GMarkerGoogleType markerType = GMarkerGoogleType.blue_pushpin;
                if (i == 0)
                {
                    markerType = GMarkerGoogleType.green_pushpin;
                }
                if (i == markers.Count - 1)
                {
                    markerType = GMarkerGoogleType.red_pushpin;
                }

                GMapMarker mapMarker = new GMarkerGoogle(point, markerType)
                {
                    Tag         = marker,
                    ToolTipMode = MarkerTooltipMode.OnMouseOver,
                    ToolTipText = marker.Description
                };

                markersOverlay.Markers.Add(mapMarker);
            }
            return(markersOverlay);
        }
Exemplo n.º 7
0
 private void AddSafeAreaMarker(PointLatLng pointtoadd, GMarkerGoogleType markertype = GMarkerGoogleType.blue_dot)
 {
     // var markers = new GMapOverlay("markers");
     markersafelocation = new GMarkerGoogle(pointtoadd, markertype);
     safelocationoverlay.Markers.Add(markersafelocation);
     map.Overlays.Add(safelocationoverlay);
 }
Exemplo n.º 8
0
        void AddMarker(PointLatLng pointToAdd, GMarkerGoogleType markerType = GMarkerGoogleType.arrow)
        {
            var markers = new GMapOverlay("markers");
            var marker  = new GMarkerGoogle(pointToAdd, markerType);

            var tooltip = new GMap.NET.WindowsForms.ToolTips.GMapBaloonToolTip(marker)
            {
                Stroke     = new Pen(new SolidBrush(Color.Black)),
                Font       = new Font("Arial", 9, FontStyle.Bold | FontStyle.Underline),
                Fill       = new SolidBrush(Color.Black),
                Foreground = new SolidBrush(Color.White)
            };

            marker.ToolTip                  = tooltip;
            marker.ToolTip.TextPadding      = new Size(0, 0);
            marker.ToolTip.Format.Alignment = StringAlignment.Far;

            marker.ToolTipText = $"Latitude: {Math.Round(map.Position.Lat, 3)}, \nLongitude: {Math.Round(map.Position.Lng, 3)}";


            markers.Markers.Add(marker);
            map.Overlays.Add(markers);
            //map.RefreshMap();
            map.UpdateMarkerLocalPosition(marker);
        }
Exemplo n.º 9
0
 //adding marker
 private void AddMarker(PointLatLng pointtoadd, GMarkerGoogleType markertype = GMarkerGoogleType.blue_dot)
 {
     // var markers = new GMapOverlay("markers");
     marker = new GMarkerGoogle(pointtoadd, markertype);
     markers.Markers.Add(marker);
     map.Overlays.Add(markers);
 }
Exemplo n.º 10
0
        private void Waypoint(PointLatLng pointToAdd, GMarkerGoogleType markerType = GMarkerGoogleType.yellow_pushpin)
        {
            var marker = new GMarkerGoogle(pointToAdd, markerType);

            markers.Markers.Add(marker);
            gMapControl1.Overlays.Add(markers);
        }
Exemplo n.º 11
0
 public GMarkerGoogleExt(PointLatLng p, GMarkerGoogleType MarkerType, Color b, int r, bool isCircle) : base(p, MarkerType)
 {
     this.IsHitTestVisible = true;
     InRouteIndex          = -1;
     this.isCircle         = isCircle;
     InitialCircleParas(b, r);
 }
Exemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            RadioButton button = groupBox1.Controls.OfType <RadioButton>().FirstOrDefault(n => n.Checked);

            marker = (GMarkerGoogleType)button.Tag;
            this.Close();
        }
Exemplo n.º 13
0
 public GMarkerGoogleExt(PointLatLng p, GMarkerGoogleType MarkerType) : base(p, MarkerType)
 {
     this.IsHitTestVisible = true;
     InRouteIndex          = -1;
     this.isCircle         = false;
     InitialCircleParas(Color.Red);
 }
Exemplo n.º 14
0
        void GerarMarkers()
        {
            markersOverlay.Clear();
            for (int i = 0; i < pontos.Count; i++)
            {
                //Dependendo da intensidade mudar a cor do marker
                GMarkerGoogleType markerColor = GMarkerGoogleType.red;

                if (pontos[i].intensidade >= -70)
                {
                    markerColor = GMarkerGoogleType.green;
                }
                if (pontos[i].intensidade < -70 && pontos[i].intensidade >= -110)
                {
                    markerColor = GMarkerGoogleType.yellow;
                }
                if (pontos[i].intensidade < -110)
                {
                    markerColor = GMarkerGoogleType.red;
                }

                //Inserir um label para cada ponto com a intensidade
                marker[i]             = new GMarkerGoogle(new PointLatLng(pontos[i].lat, pontos[i].lng), markerColor);
                marker[i].ToolTip     = new GMapToolTip(marker[i]);
                marker[i].ToolTipText = String.Format("Int: {0}\nDist: {1}\nLat: {2}\nLng: {3}", pontos[i].intensidade,
                                                      distance(pontos[i].lat, pontos[i].lng, -21.7270, -55.4018, 'K').ToString("n3"),
                                                      pontos[i].lat, pontos[i].lng);
                markersOverlay.Markers.Add(marker[i]);
            }

            gmap.Overlays.Add(markersOverlay);
        }
Exemplo n.º 15
0
        void AddMarker(GMapOverlay markersOverlay, GpsPoint point, GMarkerGoogleType mark)
        {
            GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(point.Latitude.Value, point.Longitude.Value),
                                                     mark);

            markersOverlay.Markers.Add(marker);
        }
Exemplo n.º 16
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            List <Earthquake> earthquakes = manager.GetEarthquakes(Int32.Parse(yearTrack.Value.ToString()));

            gMap.Overlays.Clear();

            GMapOverlay markers = new GMapOverlay("markers");

            foreach (Earthquake eq in earthquakes)
            {
                GMarkerGoogleType pin = GMarkerGoogleType.red_small;

                switch (eq.Type)
                {
                case Earthquake.EarthquakeType.EXPLOSION:
                    pin = GMarkerGoogleType.blue_small;
                    break;

                case Earthquake.EarthquakeType.NUCLEAR_EXPLOSION:
                    pin = GMarkerGoogleType.green_small;
                    break;

                case Earthquake.EarthquakeType.ROCK_BURST:
                    pin = GMarkerGoogleType.yellow_small;
                    break;
                }
                GMapMarker marker = new GMarkerGoogle(new PointLatLng(eq.Latitude, eq.Longitude), pin);
                marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                marker.ToolTipText = string.Format("\n{0}\nID: {1}\nCOORDINATES: {2},{3}\nDATE: {4}\nDEPTH: {5}\nMAGNITUDE: {6} {7}", eq.Type.ToString(), eq.Id, eq.Latitude, eq.Longitude, eq.Date.ToString(), eq.Depth, eq.Magnitude, eq.MagnitudeType.ToString());
                markers.Markers.Add(marker);
            }

            gMap.Overlays.Add(markers);
        }
Exemplo n.º 17
0
        public void InitMapAndLocations(List <string> i_Locations, GMarkerGoogleType i_MakrerType)
        {
            MapControl.MapProvider = GoogleMapProvider.Instance;
            MapControl.DragButton  = MouseButtons.Left;

            if (i_Locations != null)
            {
                GMapOverlay markersOverlay = new GMapOverlay("markers");
                foreach (string location in i_Locations)
                {
                    GeoCoderStatusCode status;

                    PointLatLng?point = GoogleMapProvider.Instance.GetPoint(location, out status);
                    if (point.HasValue)
                    {
                        GMarkerGoogle marker = new GMarkerGoogle(point.Value, i_MakrerType);
                        markersOverlay.Markers.Add(marker);
                    }
                }

                MapControl.Overlays.Add(markersOverlay);
            }

            MapControl.Zoom = 1;
        }
Exemplo n.º 18
0
        private GMarkerGoogle CreateMarker(PointLatLng pt, GMarkerGoogleType type, String tooltip)
        {
            GMarkerGoogle marker = new GMarkerGoogle(pt, type);

            marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker.ToolTipText = tooltip;
            return(marker);
        }
        public GmapMarkerWithLabel(PointLatLng p, string caption, GMarkerGoogleType type)
            : base(p, type)
        {
            _font        = new Font("Arial", 14, FontStyle.Bold);
            _innerMarker = new GMarkerGoogle(p, type);

            _caption = caption;
        }
Exemplo n.º 20
0
        private void AddMarker(PointLatLng pointToAdd, GMarkerGoogleType markerType = GMarkerGoogleType.arrow)
        {
            var markers = new GMapOverlay("markers");
            var marker  = new GMarkerGoogle(pointToAdd, markerType);

            markers.Markers.Add(marker);
            map.Overlays.Add(markers);
        }
Exemplo n.º 21
0
        public GMapMarker placeMarkerOnMap(PointLatLng location, GMarkerGoogleType markerType)
        {
            GMapMarker tmpMarker = new GMarkerGoogle(location, markerType);

            map.Overlays.Add(markersOverlay);
            markersOverlay.Markers.Add(tmpMarker);
            return(tmpMarker);
        }
Exemplo n.º 22
0
        private void MarkBarInRadius(GMapControl map, Bar bar, string markerString, GMarkerGoogleType markerType = GMarkerGoogleType.black_small)
        {
            var distanceTo = GetDistance(homeAddress, bar.barLocation);

            if (distanceTo <= prefDistance)
            {
                ShowMapByAddress(map, bar.barLocation, markerString + $"\n {distanceTo}", markerType);
            }
        }
Exemplo n.º 23
0
        public GMarkerGoogle(PointLatLng p, GMarkerGoogleType type)
            : base(p)
        {
            this.Type = type;

            if (type != GMarkerGoogleType.none)
            {
                LoadBitmap();
            }
        }
Exemplo n.º 24
0
        internal void add(PointLatLng position, string str, GMarkerGoogleType color)
        {
            GMarkerGoogle marker;

            marker             = new GMarkerGoogle(position, color);
            marker.ToolTipMode = MarkerTooltipMode.Always;
            marker.ToolTipText = string.Format(str);

            mapOverlay.Markers.Add(marker);
        }
Exemplo n.º 25
0
        private void DrawMarker(PointLatLng point, string message, GMarkerGoogleType gMarker)
        {
            GMapOverlay markersOverlay = new GMapOverlay("marker");
            GMapMarker  marker         = new GMarkerGoogle(point, gMarker);

            marker.ToolTip     = new GMapRoundedToolTip(marker);
            marker.ToolTipText = message;
            markersOverlay.Markers.Add(marker);
            gMapControl1.Overlays.Add(markersOverlay);
        }
Exemplo n.º 26
0
      public GMarkerGoogle(PointLatLng p, GMarkerGoogleType type)
         : base(p)
      {
         this.Type = type;

         if(type != GMarkerGoogleType.none)
         {
            LoadBitmap();
         }
      }
Exemplo n.º 27
0
        public MarcadorGoogle(PointLatLng p, string usuario, GMarkerGoogleType type) : base(p)
        {
            Font = new Font("Arial", 14);

            this.Usuario = usuario;

            this.type = type;

            //this.innerMarker = new GMarkerGoogle(p, type);
        }
        private void Waypoint(PointLatLng pointToAdd, GMarkerGoogleType markerType = GMarkerGoogleType.yellow)
        {
            var marker = new GMarkerGoogle(pointToAdd, markerType);

            markers.Markers.Add(marker);
            marker.ToolTipText = "WP-" + urut;
            marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

            gMapControl1.Overlays.Add(markers);
            urut++;
        }
Exemplo n.º 29
0
        public static GMarkerGoogle PlotPoint(PointLatLng point, GMarkerGoogleType type, GMapOverlay overlay, string toolTipText = null)
        {
            GMarkerGoogle marker = new GMarkerGoogle(point, type);

            if (toolTipText != null)
            {
                marker.ToolTipText = toolTipText;
            }
            overlay.Markers.Add(marker);
            return(marker);
        }
Exemplo n.º 30
0
        public static void PlotArrayAsPoints(Coord[] dataArray, GMarkerGoogleType type, GMapOverlay overlay)
        {
            int numberOfPoints = dataArray.GetLength(0);

            for (int i = 0; i < numberOfPoints; i++)
            {
                PointLatLng   point  = new PointLatLng(dataArray[i].Latitude, dataArray[i].Longitude);
                GMarkerGoogle marker = new GMarkerGoogle(point, type);
                overlay.Markers.Add(marker);
            }
        }
Exemplo n.º 31
0
        public static void PlotPoints(IEnumerable <Coord> coordinates, GMarkerGoogleType type, GMapOverlay overlay)
        {
            var coords = coordinates.ToArray();

            for (int i = 0; i < coords.Count(); i++)
            {
                PointLatLng   point  = new PointLatLng(coords[i].Latitude, coords[i].Longitude);
                GMarkerGoogle marker = new GMarkerGoogle(point, type);
                overlay.Markers.Add(marker);
            }
        }
Exemplo n.º 32
0
       public GMarkerGoogle(PointLatLng p, GMarkerGoogleType type, bool showShadow = true)
         : base(p)
      {
         this.Type = type;
         this.ShowShadow = showShadow;

         if(type != GMarkerGoogleType.none)
         {
            LoadBitmap();
         }
      }
        public static void AddDefaultGoogleMarker(this Collection<GMapMarker> source, PointLatLng? point, GMarkerGoogleType style, object tag = null)
        {
            if (point != null)
            {
                GMarkerGoogle m = new GMarkerGoogle((PointLatLng)point, style);
                m.ToolTip = new GMapRoundedToolTip(m);
                m.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                m.Tag = tag;

                source.Add(m);
            }
        }
            public Polygon(FlightPlanner host, string name, GMarkerGoogleType markerType, Color color, Brush brush, string tag = "")
            {
                this.markerType = markerType;
                this.color = color;
                this.brush = brush;

                //setup drawnpolygon
                List<PointLatLng> list = new List<PointLatLng>();
                polygon = new GMapPolygon(list, name + "poly");
                polygon.Stroke = new Pen(color, 2);
                polygon.Fill = brush;

                overlay = new GMapOverlay(name + "polygonoverlay");
                this.host = host;
                host.MainMap.Overlays.Add(this.overlay);
                this.tag = tag;
            }
Exemplo n.º 35
0
 protected GMarkerGoogle(SerializationInfo info, StreamingContext context)
    : base(info, context)
 {
    this.Type = Extensions.GetStruct<GMarkerGoogleType>(info, "type", GMarkerGoogleType.none);
    this.Bearing = Extensions.GetStruct<float>(info, "Bearing", null);
 }