Ejemplo n.º 1
2
 private void areaMap_MouseClick(object sender, MouseEventArgs e)
 {
     finalPoint = areaMap.FromLocalToLatLng(e.X, e.Y);
     label5.Text = finalPoint.Lng.ToString();
     label6.Text = finalPoint.Lat.ToString();
     GMap.NET.WindowsForms.Markers.GMarkerGoogle endpoint = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(finalPoint, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
     overlayMarker.Markers.Clear();
     overlayMarker.Markers.Add(endpoint);
     areaMap.Overlays.Add(overlayMarker);
 }
Ejemplo n.º 2
1
        private void BuildMap()
        {
            GMapOverlay markersOverlay = new GMapOverlay("markers");

            GMap.NET.WindowsForms.Markers.GMarkerGoogle marker;

            if (m_checkins != null)
            {
                foreach (Checkin checkin in m_checkins)
                {
                    if (m_PlacePicker.pickPlace(checkin.Place))
                    {
                        marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                                     checkin.Place.Location.Latitude.Value, checkin.Place.Location.Longitude.Value),
                                                                                 GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_pushpin);
                        marker.ToolTipText = checkin.Name;
                        markersOverlay.Markers.Add(marker);
                    }
                }
            }

            if (m_photosTaggedIn != null)
            {
                foreach (Photo photo in m_photosTaggedIn)
                {
                    if (m_PlacePicker.pickPlace(photo.Place))
                    {
                        marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                                     photo.Place.Location.Latitude.Value, photo.Place.Location.Longitude.Value),
                                                                                 GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
                        marker.ToolTipText = photo.Name;
                        markersOverlay.Markers.Add(marker);
                    }
                }
            }


            if (m_currLocation != null)
            {
                marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                             m_currLocation.Latitude.Value, m_currLocation.Longitude.Value),
                                                                         GMap.NET.WindowsForms.Markers.GMarkerGoogleType.pink_pushpin);
                marker.ToolTipText = "My current location";
                markersOverlay.Markers.Add(marker);
            }

            m_Map.Overlays.Add(markersOverlay);
        }
Ejemplo n.º 3
1
 internal override void AddEvents(FBAdapter i_FBAdapter, IEnumerable<object> i_Events)
 {
     m_GMapControl.Invoke(new Action(() => m_GMapControl.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance));
     m_GMapControl.Invoke(new Action(() => m_GMapControl.SetPositionByKeywords("dubnov, Tel Aviv, Israel")));
     m_MarkersOverlay = new GMapOverlay("markers");
     foreach (object fbEvent in i_Events)
     {
         if (i_FBAdapter.HasLocationEvent(fbEvent))
         {
             //PointLatLng point = GetPosition(i_FBAdapter.GetLatLong(fbEvent));
             PointD eventLocation = i_FBAdapter.GetLatLong(fbEvent);
             PointLatLng point = new PointLatLng(eventLocation.X, eventLocation.Y);
             GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                 point,
                 GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_small);
             marker.ToolTipText = i_FBAdapter.GetEventName(fbEvent);
             m_MarkersOverlay.Markers.Add(marker);
         }
     }
 }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            areaMap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
            areaMap.Position = new PointLatLng(26.5144969, 80.2377076);
            GMap.NET.WindowsForms.Markers.GMarkerGoogle curPos = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(initialPoint, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
            label3.Text = initialPoint.Lat.ToString();
            label4.Text = initialPoint.Lng.ToString();

        }
Ejemplo n.º 5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            GMap.NET.WindowsForms.Markers.GMarkerGoogle curPos = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(initialPoint, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
            path = GMap.NET.MapProviders.GoogleMapProvider.Instance.GetRoute(initialPoint, finalPoint, false, false, 15);
            GMapRoute route = new GMapRoute(path.Points, "My route");
            overlayRoute.Routes.Clear();
            overlayRoute.Routes.Add(route);
            areaMap.Overlays.Add(overlayRoute);
            label10.Text = (path.Distance * 1000).ToString();
            areaMap.Refresh();
            

        }
Ejemplo n.º 6
0
        private void gMapControl1_Load(object sender, EventArgs e)
        {
            GMap.NET.WindowsForms.GMapOverlay markersOverlay = new GMap.NET.WindowsForms.GMapOverlay("markers");

            marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(36.6, 118.6),
                                                                     GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);
            markerTrain = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(36.6, 118.6),
                                                                          GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_small);
            markersOverlay.Markers.Add(marker);
            markersOverlay.Markers.Add(markerTrain);

            marker.IsHitTestVisible = false;

            gMapControl1.Overlays.Add(markersOverlay);
        }
Ejemplo n.º 7
0
        private void MarkerClick(object sender, EventArgs e)
        {
            GMapMarker Marker = (GMapMarker)sender;

            if (lastSelected != -1)
            {
                //create new marker and find old selected marker
                GMapMarker newLastMarker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(Points.Markers.ElementAt(lastSelected).Position, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                GMapMarker lastMarker    = Points.Markers.ElementAt(lastSelected);

                //copy data
                newLastMarker.ToolTipText = lastMarker.ToolTipText;
                newLastMarker.Tag         = lastMarker.Tag;

                //UN-highlight tooltip text
                newLastMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

                //insert new marker and remove the old one
                Points.Markers.Insert((int)lastMarker.Tag, newLastMarker);
                Points.Markers.Remove(lastMarker);
            }

            if ((int)Marker.Tag != lastSelected)
            {
                //use Marker.Tag
                GMapMarker newMarker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(Marker.Position, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_dot);
                //Points.Markers.ElementAt((int)Marker.Tag);
                newMarker.ToolTipText = Marker.ToolTipText;
                newMarker.Tag         = Marker.Tag;

                //highlight tooltip text
                newMarker.ToolTipMode = MarkerTooltipMode.Always;

                //replace marker
                Points.Markers.Insert((int)Marker.Tag, newMarker);
                Points.Markers.Remove(Marker);

                lastSelected = (int)newMarker.Tag;

                //enable the remove point button
                RemovePoint.Enabled = true;
            }
            else
            {
                RemovePoint.Enabled = false;
                lastSelected        = -1;
            }
        }
Ejemplo n.º 8
0
        private void PlaceMarker(MouseEventArgs _e)
        {
            if (_e.Button == MouseButtons.Left && !mymap.IsDragging)
            {
                PointLatLng final = new PointLatLng(
                    mymap.FromLocalToLatLng(_e.X, _e.Y).Lat,
                    mymap.FromLocalToLatLng(_e.X, _e.Y).Lng
                    );
                GMapMarker marker;
                bool       accepted      = false;
                int        retries       = 10;
                int        retries_index = 0;
                do
                {
                    marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(final, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                    GeoCoderStatusCode status;
                    var _tmp = GMapProviders.GoogleSatelliteMap.GetPlacemark(final, out status);
                    if (status == GeoCoderStatusCode.G_GEO_SUCCESS)
                    {
                        marker.Tag         = _tmp.Value.Address;
                        marker.ToolTipText = _tmp.Value.Address;
                        marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                        accepted           = true;
                    }
                    retries_index++;
                    if (retries_index >= retries)
                    {
                        break;
                    }
                } while (!accepted);
                if (!accepted)
                {
                    MessageBox.Show("Could not obtain address of Marker from Google. Please try again", "Unsuccessful request", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                markers_overlay.Markers.Add(marker);

                mymap.UpdateMarkerLocalPosition(marker);
                mymap.Overlays.Clear();
                mymap.Overlays.Add(markers_overlay);

                EditMarkersMenuStripItem();
            }
        }
Ejemplo n.º 9
0
        private void buildMap()
        {
            GMapOverlay markersOverlay = new GMapOverlay("markers");

            GMap.NET.WindowsForms.Markers.GMarkerGoogle marker;

            if (checkBoxcheckins.Checked == true)
            {
                foreach (Checkin checkin in m_FacebookUser.Checkins)
                {
                    marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                                 checkin.Place.Location.Latitude.Value, checkin.Place.Location.Longitude.Value),
                                                                             GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_pushpin);
                    marker.ToolTipText = checkin.Name;
                    markersOverlay.Markers.Add(marker);
                }
            }
            if (checkBoxTagedPlaces.Checked == true)
            {
                foreach (Photo photo in m_FacebookUser.PhotosTaggedIn)
                {
                    if (photo.Place != null)
                    {
                        marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                                     photo.Place.Location.Latitude.Value, photo.Place.Location.Longitude.Value),
                                                                                 GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
                        marker.ToolTipText = photo.Name;
                        markersOverlay.Markers.Add(marker);
                    }
                }
            }
            if (checkBoxCurrentLocation.Checked == true)
            {
                if (m_FacebookUser.Location.Location != null)
                {
                    marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(
                                                                                 m_FacebookUser.Location.Location.Latitude.Value, m_FacebookUser.Location.Location.Longitude.Value),
                                                                             GMap.NET.WindowsForms.Markers.GMarkerGoogleType.pink_pushpin);
                    marker.ToolTipText = "My current location";
                    markersOverlay.Markers.Add(marker);
                }
            }

            map.Overlays.Add(markersOverlay);
        }
Ejemplo n.º 10
0
        public void setGMapMarker(double lat, double log, string filename)
        {
            GMap.NET.WindowsForms.GMapOverlay           markersOverlay = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.Markers.GMarkerGoogle marker         = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                new GMap.NET.PointLatLng(lat, log), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue);


            // Marker Tooltip
            marker.ToolTipText         = filename;
            marker.ToolTip.Fill        = Brushes.White;
            marker.ToolTip.Foreground  = Brushes.Black;
            marker.ToolTip.Stroke      = Pens.Black;
            marker.ToolTip.TextPadding = new Size(20, 10);
            marker.ToolTipMode         = GMap.NET.WindowsForms.MarkerTooltipMode.OnMouseOver;

            markersOverlay.Markers.Add(marker);
            TouristGmap.Overlays.Add(markersOverlay);
        }
Ejemplo n.º 11
0
        private void loadMarkersOntoMap()
        {
            foreach (GridViewRowInfo rowInfo in allVisitedPlacesGrid.Rows)
            {
                try
                {
                    GMap.NET.WindowsForms.GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        new GMap.NET.PointLatLng(double.Parse(rowInfo.Cells["Coordinates(X)"].Value.ToString()),
                                                 double.Parse(rowInfo.Cells["Coordinates(Y)"].Value.ToString())),
                        GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_pushpin);

                    marker.ToolTipText = "Place : " + rowInfo.Cells["Name"].Value + "\n" +
                                         "Type : " + rowInfo.Cells["Type"].Value;
                    markers.Markers.Add(marker);
                }
                catch { }
            }
        }
Ejemplo n.º 12
0
        /**
         * Map button from buyer home
         **/
        private void buttonToMap_Click(object sender, EventArgs e)
        {
            listBoxMapDetails.Items.Clear();
            pictureBoxMap.Image          = Image.FromFile(@"C:\Users\minuf\Documents\Visual Studio 2013\Projects\NeighborhoodInformant\NeighborhoodInformant\bin\Debug\homeforsale.jpg");
            buttonMapMessage.Enabled     = false;
            buttonMapExport.Enabled      = false;
            gMap.MapProvider             = GMap.NET.MapProviders.BingMapProvider.Instance;
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
            gMap.SetPositionByKeywords("Chicago, Illinois");
            gMap.DragButton = MouseButtons.Left;
            GMap.NET.WindowsForms.GMapOverlay markersOverlay = new GMap.NET.WindowsForms.GMapOverlay("markers");
            gMap.Overlays.Add(markersOverlay);
            gMap.Overlays.Remove(markersOverlay);
            gMap.Overlays.Clear();
            IReadOnlyList <LogicTier.Listing> listings = database.allListings();

            foreach (var listing in listings)
            {
                var address = listing.fullAddress();

                var locationService = new GoogleLocationService();
                try
                {
                    var point     = locationService.GetLatLongFromAddress(address);
                    var latitude  = point.Latitude;
                    var longitude = point.Longitude;

                    GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(latitude, longitude), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                    marker.ToolTipText = listing.StAddr;
                    markersOverlay.Markers.Add(marker);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            gMap.Overlays.Add(markersOverlay);

            panelMap.Show();
            panelBuyerHome.Hide();
            prevPage = panelBuyerHome;
        }
Ejemplo n.º 13
0
        private void addMarker(GMap.NET.PointLatLng newPos, int time)
        {
            if (time > 0)
            {
                if (time > resCfg.maxTime)     //found new max value
                {
                    resCfg.maxTime             = time;
                    trackBarUpperBound.Maximum = time;
                    trackBarLowerBound.Maximum = time;
                    if (!checkBoxUseBounds.Checked)
                    {
                        textBoxUpperBound.Text   = time.ToString(); //adjust label
                        trackBarUpperBound.Value = time;            //and value
                    }
                }
                if (time < resCfg.minTime)
                {
                    resCfg.minTime             = time;
                    trackBarUpperBound.Minimum = time;
                    trackBarLowerBound.Minimum = time;
                    if (!checkBoxUseBounds.Checked)
                    {
                        textBoxLowerBound.Text   = time.ToString();
                        trackBarLowerBound.Value = time;
                    }
                }



                GMap.NET.WindowsForms.GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    newPos,
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_small);
                marker.ToolTipText         = time.ToString();
                marker.ToolTipMode         = GMap.NET.WindowsForms.MarkerTooltipMode.OnMouseOver;
                marker.ToolTip.Fill        = Brushes.Black;
                marker.ToolTip.Foreground  = Brushes.White;
                marker.ToolTip.Stroke      = Pens.Black;
                marker.ToolTip.TextPadding = new Size(20, 20);

                markers.Markers.Add(marker);
            }
        }
Ejemplo n.º 14
0
 internal override void AddEvents(FBAdapter i_FBAdapter, IEnumerable <object> i_Events)
 {
     m_GMapControl.Invoke(new Action(() => m_GMapControl.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance));
     m_GMapControl.Invoke(new Action(() => m_GMapControl.SetPositionByKeywords("dubnov, Tel Aviv, Israel")));
     m_MarkersOverlay = new GMapOverlay("markers");
     foreach (object fbEvent in i_Events)
     {
         if (i_FBAdapter.HasLocationEvent(fbEvent))
         {
             //PointLatLng point = GetPosition(i_FBAdapter.GetLatLong(fbEvent));
             PointD      eventLocation = i_FBAdapter.GetLatLong(fbEvent);
             PointLatLng point         = new PointLatLng(eventLocation.X, eventLocation.Y);
             GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                 point,
                 GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_small);
             marker.ToolTipText = i_FBAdapter.GetEventName(fbEvent);
             m_MarkersOverlay.Markers.Add(marker);
         }
     }
 }
Ejemplo n.º 15
0
        private void loadMap()
        {
            gMapControl.Invoke(new Action(() => gMapControl.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance));
            gMapControl.Invoke(new Action(() => gMapControl.SetPositionByKeywords("dubnov, Tel Aviv, Israel")));
            m_MarkersOverlay = new GMapOverlay("markers");
            foreach (object obj in m_FBAdapter.Events)
            {
                if (m_FBAdapter.HasLocationEvent(obj))
                {
                    PointLatLng point = getLatLong(m_FBAdapter.GetLatLong(obj));
                    GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        point,
                        GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_small);
                    marker.ToolTipText = m_FBAdapter.GetEventName(obj);
                    m_MarkersOverlay.Markers.Add(marker);
                }
            }

            gMapControl.Invoke(new Action(() => gMapControl.Overlays.Add(m_MarkersOverlay)));
            gMapControl.Invoke(new Action(() => gMapControl.ZoomAndCenterMarkers(null)));
        }
Ejemplo n.º 16
0
 private void mapexplr_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (rdoZones.Checked)
     {
         var mCoord = mapexplr.FromLocalToLatLng(e.X, e.Y);
         var gmg    = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(mCoord.Lat, mCoord.Lng), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
         mapexplr.Overlays.Add(overlayOne);
         overlayOne.Markers.Add(new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(mCoord.Lat, mCoord.Lng), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green));
         dg1.DataSource = null;
         dg1.DataSource = overlayOne.Markers;
     }
     else
     {
         var mCoord = mapexplr.FromLocalToLatLng(e.X, e.Y);
         var gmg    = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(mCoord.Lat, mCoord.Lng), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
         mapexplr.Overlays.Add(overlayTwo);
         overlayTwo.Markers.Add(new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(mCoord.Lat, mCoord.Lng), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot));
         dg1.DataSource = null;
         dg1.DataSource = overlayTwo.Markers;
     }
 }
Ejemplo n.º 17
0
        public void addPins()
        {
            Debug.Write("Displaying pins");

            for (int i = 0; i < latList.Count; i++)
            {
                double lat = latList[i];
                double lon = longList[i];
                Debug.Write("Pin at: " + lat + ", " + lon);

                GMapOverlay overlay = new GMapOverlay("markers");
                gmap.Overlays.Add(overlay);

                GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new GMap.NET.PointLatLng(lat, lon),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

                marker.ToolTipText = "\nIP: " + ipList[i] + "\n"
                                     + "Threat Level: " + threatList[i];

                overlay.Markers.Add(marker);
            }
        }
        public void SetFrame(int frame)
        {
            if ((frame < 0) || (frame >= dataStream.Positions.Count()))
            {
                toolStripStatus.Text = "Outside of the stream time limits.";
                return;
            }

            if (frame == lastFrame)
            {
                return;
            }

            if (dataStream.Positions.Count() != 0)
            {
                CurrentPosition = dataStream.Positions[frame];

                //if (frameDataLine.Quality == 1)
                //{
                GMap.NET.WindowsForms.GMapMarker marker =
                    new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        //new GMap.NET.PointLatLng(frameDataLine.Lat + 8/3600,  frameDataLine.Lon + 8 / 3600),
                        new GMap.NET.PointLatLng(CurrentPosition.Lat, CurrentPosition.Lon),
                        Properties.Resources.point_marker_selected);

                trajectoryPoints.Markers.Add(marker);

                map.Position = new GMap.NET.PointLatLng(CurrentPosition.Lat, CurrentPosition.Lon);

                /*}
                 * else
                 * {
                 *  toolStripStatus.Text = "No GPS fix!";
                 * }*/
            }
            map.Refresh();
        }
Ejemplo n.º 19
0
        private void button2_Click(object sender, EventArgs e)
        {
            Double lo  = 0;
            Double la  = 0;
            String loc = "";

            GMap.NET.WindowsForms.GMapOverlay markers1 = new GMap.NET.WindowsForms.GMapOverlay("markers1");
            foreach (DataGridViewRow drrow in dataGridView1.SelectedRows)
            {
                Double.TryParse(drrow.Cells["Longitude"].Value.ToString(), out lo);
                Double.TryParse(drrow.Cells["Latitude"].Value.ToString(), out la);
                loc = drrow.Cells["Longitude"].Value.ToString() + " , " + drrow.Cells["Latitude"].Value.ToString();
                GMap.NET.WindowsForms.GMapMarker marker1 =
                    new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        new GMap.NET.PointLatLng(la, lo),
                        GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
                markers1.Markers.Add(marker1);
            }
///            markers.Markers.Add(marker);
            gMap.Overlays.Add(markers1);
            gMap.SetPositionByKeywords(loc);
            gMap.ZoomAndCenterMarkers(loc);
            gMap.Position = new GMap.NET.PointLatLng(la, lo);
        }
Ejemplo n.º 20
0
        private void frmDriver_Load(object sender, EventArgs e)
        {
            panel2.Visible       = false;
            pctSettings2.Visible = false;
            panel3.Visible       = false;
            pctProfile2.Visible  = false;

            timer1.Start();
            GMapProviders.GoogleMap.ApiKey = @"AIzaSyA2yOciCrtfmt8Gt7290nUFBqfptsSuo9I";
            gMap.DragButton  = MouseButtons.Left;
            gMap.MapProvider = GMapProviders.GoogleMap;
            double lat   = 14.526587;
            double longt = 121.056003;

            gMap.Position = new GMap.NET.PointLatLng(lat, longt);
            gMap.MinZoom  = 1;
            gMap.MaxZoom  = 18;
            gMap.Zoom     = 25;

            //new marker
            Bitmap studmarker  = (Bitmap)Image.FromFile("img/stusdiyer.png");
            Bitmap studmarker2 = (Bitmap)Image.FromFile("img/stusdiyer2.png");


            GMap.NET.PointLatLng point = new GMap.NET.PointLatLng(lat, longt);

            GMap.NET.WindowsForms.GMapOverlay markers = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);
            markers.Markers.Add(marker);
            gMap.Overlays.Add(markers);

            //destination
            GMap.NET.PointLatLng pointD = new GMap.NET.PointLatLng(14.555360, 121.043873);

            GMap.NET.WindowsForms.GMapOverlay markersD = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  markerD  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pointD, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);
            markers.Markers.Add(markerD);
            gMap.Overlays.Add(markersD);

            //route
            GMap.NET.PointLatLng pointR = new GMap.NET.PointLatLng(14.555360, 121.043873);
            var route = GoogleMapProvider.Instance.GetRoute(point, pointR, false, false, 10);
            var r     = new GMap.NET.WindowsForms.GMapRoute(route.Points, "My Route")
            {
                Stroke = new Pen(Color.Blue, 5)
            };
            var routes = new GMapOverlay("routes");

            routes.Routes.Add(r);
            gMap.Overlays.Add(routes);

            //student1
            GMap.NET.PointLatLng point1 = new GMap.NET.PointLatLng(14.527394, 121.056395);

            GMap.NET.WindowsForms.GMapOverlay markers1 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker1  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point1, studmarker);
            markers.Markers.Add(marker1);
            gMap.Overlays.Add(markers1);


            //student1.1
            GMap.NET.PointLatLng point11 = new GMap.NET.PointLatLng(14.527005, 121.056209);

            GMap.NET.WindowsForms.GMapOverlay markers11 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker11  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point11, studmarker);
            markers.Markers.Add(marker11);
            gMap.Overlays.Add(markers11);

            //student1.2
            GMap.NET.PointLatLng point12 = new GMap.NET.PointLatLng(14.528199, 121.056666);

            GMap.NET.WindowsForms.GMapOverlay markers12 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker12  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point12, studmarker2);
            markers.Markers.Add(marker12);
            gMap.Overlays.Add(markers12);


            //student2
            GMap.NET.PointLatLng point2 = new GMap.NET.PointLatLng(14.535635, 121.057739);

            GMap.NET.WindowsForms.GMapOverlay markers2 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker2  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point2, studmarker);
            markers.Markers.Add(marker2);
            gMap.Overlays.Add(markers2);

            //student21
            GMap.NET.PointLatLng point21 = new GMap.NET.PointLatLng(14.535594, 121.057733);

            GMap.NET.WindowsForms.GMapOverlay markers21 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker21  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point21, studmarker2);
            markers.Markers.Add(marker21);
            gMap.Overlays.Add(markers21);

            //student21
            GMap.NET.PointLatLng point22 = new GMap.NET.PointLatLng(14.536337, 121.057685);

            GMap.NET.WindowsForms.GMapOverlay markers22 = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMap.NET.WindowsForms.GMapMarker  marker22  = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(point22, studmarker2);
            markers.Markers.Add(marker22);
            gMap.Overlays.Add(markers22);
        }
Ejemplo n.º 21
0
        private void AddPointsToMap()
        {
            //remove old points
            //MainMap.Overlays.Remove(Points);
            ClearMap();

            if (Points == null)
            {
                Points = new GMapOverlay();
            }
            if (Route == null)
            {
                Route = new GMapOverlay();
            }

            //add route
            Route.Routes.Add(new GMapRoute("Route1"));
            GMapRoute r = new GMapRoute("hikeRoute");

            //keep track of where the map needs to show once the points are added
            double highLat = -100, lowLat = 100, highLon = -200, lowLon = 200;

            //double lastLat = 0, lastLon = 0;

            calcDistanceforPoints();

            for (int i = hike.Length - 1; i >= 0; i--)
            {
                double lat = convertGpsToDouble(hike[i].degreeNorthSouth, hike[i].minuteNorthSouth, hike[i].northSouth);
                double lon = convertGpsToDouble(hike[i].degreeEastWest, hike[i].minuteEastWest, hike[i].eastWest);

                //modify high and low values
                if (lat > highLat)
                {
                    highLat = lat;
                }
                if (lat < lowLat)
                {
                    lowLat = lat;
                }

                if (lon > highLon)
                {
                    highLon = lon;
                }
                if (lon < lowLon)
                {
                    lowLon = lon;
                }

                PointLatLng pos = new PointLatLng(lat, lon);
                //Route.Routes.Add()
                r.Points.Add(pos);


                //add "tool tips" and create marker
                GMapMarker Marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pos, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                //Marker.ToolTip = new GMapToolTip(Marker);

                //figure out time hiked
                time hikeTime = calcHikeTime(hike[hike.Length - 1], hike[i]);

                //add tool tip
                Marker.ToolTipText = "Point Number: " + (hike.Length - i)
                                     + "\nTime: " + hike[i].capTime.hours + ":" + hike[i].capTime.minutes + ":" + hike[i].capTime.seconds + " UTC"
                                     + "\nTime Hiked: " + hikeTime.hours + ":" + hikeTime.minutes + ":" + hikeTime.seconds
                                     //+ (hike[i].capTime.hours - hike[0].capTime.hours) + ":" + (hike[i].capTime.minutes - hike[0].capTime.minutes) + ":" + (hike[i].capTime.seconds - hike[0].capTime.seconds)
                                     + "\nDistance Hiked: " + hike[i].distancedHiked.ToString("F") + " Km"
                                     + "\nLatitude: " + hike[i].degreeNorthSouth + "º " + hike[i].minuteNorthSouth + "' " + hike[i].northSouth
                                     + "\nLongitude: " + hike[i].degreeEastWest + "º " + hike[i].minuteEastWest + "' " + hike[i].eastWest;


                //Marker.IsHitTestVisible = false;      //makes marker unclickable and tool tips wont show up
                Marker.Tag = (hike.Length - 1) - i;         //add a tag to identify the marker for later

                Points.Markers.Add(Marker);
            }
            Route.Routes.Add(r);
            MainMap.Overlays.Add(Route);

            MainMap.Overlays.Add(Points);

            //move the map
            MainMap.Position = new PointLatLng((highLat + lowLat) / 2, (highLon + lowLon) / 2);

            populateComboBoxes();
        }
Ejemplo n.º 22
0
        private void gMapControl1_Load(object sender, EventArgs e)
        {
            gmap.MapProvider             = GMap.NET.MapProviders.BingMapProvider.Instance;
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
            GMap.NET.MapProviders.OpenStreetMapProvider.UserAgent = "IE";

            gmap.Position    = new GMap.NET.PointLatLng(45.385, -74.08);
            gmap.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance;
            GMaps.Instance.OptimizeMapDb(null);
            //dev
            //gmap.CacheLocation = @"C:\Users\Inno3\Desktop\";
            //prod
            gmap.CacheLocation = @"C:\Users\VIA RAIL\Desktop\";
            gmap.Zoom          = 14;
            gmap.Size          = new Size(this.Width, this.Height);
            bannerTop.Size     = new Size(this.Width, this.Height / 7);
            bottonbanner.Size  = new Size(this.Width, statusimage.Size.Height);
            //localization
            lanchange.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject("fr");
            lanchange.Tag             = "Français";
            label1.Text  = rm.GetString("welcome");
            button2.Text = rm.GetString("enterbutton");
            label2.Text  = rm.GetString("nextstop") + ": ";
            label3.Text  = rm.GetString("time") + ": ";
            //end of localization
            label1.Location        = new System.Drawing.Point(Convert.ToInt16(2.34 * (this.Height / 7) + 15), this.Height / 7 / 2 - 12); //12 is font size.
            label2.Location        = new System.Drawing.Point(label2.Location.X, this.Height / 7 / 2 / 2);
            label3.Location        = new System.Drawing.Point(label3.Location.X, this.Height / 7 / 2);
            label4.Location        = new System.Drawing.Point((this.Width / 2) - (statusimage.Width / 2) + statusimage.Width + 20, this.Height / 14 * 13);
            label5.Location        = new System.Drawing.Point((this.Width / 2) - (statusimage.Width / 2) + statusimage.Width + 20, this.Height / 14 * 12);
            Nextstation.Location   = new System.Drawing.Point(Nextstation.Location.X, this.Height / 7 / 2 / 2);
            LocalTimecell.Location = new System.Drawing.Point(LocalTimecell.Location.X, this.Height / 7 / 2);
            bottonbanner.Location  = new System.Drawing.Point(0, this.Height - bottonbanner.Size.Height);
            statusimage.Location   = new System.Drawing.Point((this.Width / 2) - (statusimage.Width / 2), this.Height - statusimage.Size.Height);
            logobottom.Location    = new System.Drawing.Point(0, this.Height - 114);
            lanchange.Location     = new System.Drawing.Point(0, this.Height - 114);
            //hide bottom logo for now
            logobottom.Visible   = false;
            upperlogo.Size       = new Size(Convert.ToInt16(2.34 * (this.Height / 7)), this.Height / 7);
            upperlogo.Location   = new System.Drawing.Point(0, 0); //12 is font size.
            pictureBox1.Location = new Point(label2.Location.X, 0);
            pictureBox1.Size     = new Size(this.Width - pictureBox1.Location.X, this.Height / 7);
            button2.Location     = new Point(label2.Location.X - 100, 40);
            Program.GPSTrack();

            gmap.ShowCenter = false;

            GMapOverlay markers = new GMap.NET.WindowsForms.GMapOverlay("markers");


            if (Convert.ToDouble(Program.Latitude) != 0 && Convert.ToDouble(Program.Longitude) != 0)
            {
                marker.Position = new GMap.NET.PointLatLng(Convert.ToDouble(Program.Latitude), Convert.ToDouble(Program.Longitude));;
                gmap.Position   = new GMap.NET.PointLatLng(Convert.ToDouble(Program.Latitude), Convert.ToDouble(Program.Longitude));
            }
            gmap.Overlays.Add(markers);
            markers.Markers.Add(marker);
            foreach (Station tmp in Program.stationlist)
            {
                if (tmp.left != null)
                {
                    GMapMarker station =
                        new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                            new GMap.NET.PointLatLng(Convert.ToDouble(tmp.middle.lat), Convert.ToDouble(tmp.middle.lng)),
                            Properties.Resources.stationlogo);
                    markers.Markers.Add(station);
                }
            }
            InitializeBackgroundWorker();
            backgroundWorker1.RunWorkerAsync();
        }
Ejemplo n.º 23
0
        private void gMapControl1_MouseClick(object sender, MouseEventArgs e)
        {
            double lat = gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat;
            double lng = gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng;

            if (e.Button == MouseButtons.Right)
            {
                OrderForm order = new OrderForm(lng, lat);
                if (order.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    int requestedPersonnelAmount        = 0; //по-хорошему при создании чп указать необходимое количество сотрудников
                    List <Personnel> competentPersonnel = new List <Personnel>();
                    List <Personnel> nearestPersonnel   = new List <Personnel>();

                    foreach (var personnel in MainForm.staff)
                    {
                        if (personnel.Class.ToString() == order.personeTypeComboBox.SelectedItem.ToString())
                        {
                            competentPersonnel.Add(personnel);
                        }
                    }

                    //вдруг компетентнвых сотрудников меньше 5
                    if (competentPersonnel.Count > 5)
                    {
                        requestedPersonnelAmount = 5;
                    }
                    else
                    {
                        requestedPersonnelAmount = competentPersonnel.Count;
                    }

                    for (int i = 0; i < requestedPersonnelAmount; i++) //выбираем requestedPersonnelAmount ближайших сотрудников
                    {
                        Personnel minDistPersonnel = null;
                        double    minDist          = double.MaxValue;

                        foreach (var personnel in competentPersonnel) //проходим по каждому сотруднику - ищем ближайших
                        {
                            GMap.NET.WindowsForms.Markers.GMarkerGoogle coords;

                            coords = personnel.Coord;

                            GeoCoordinate personnelPosition = new GeoCoordinate(coords.Position.Lat, coords.Position.Lng);
                            GeoCoordinate orderPosition     = new GeoCoordinate(lat, lng);

                            double minDistCurrent = orderPosition.GetDistanceTo(personnelPosition);
                            if (minDistCurrent < minDist)
                            {
                                minDist          = minDistCurrent;
                                minDistPersonnel = personnel;
                            }
                        }
                        nearestPersonnel.Add(minDistPersonnel);
                        competentPersonnel.Remove(minDistPersonnel);
                    }

                    //test zone
                    StringBuilder sb = new StringBuilder();

                    foreach (var a in nearestPersonnel)
                    {
                        sb.Append(a.Name + "\n");
                    }

                    MessageBox.Show("Ближайшие компетентные сотрудники: \n\n" + sb.ToString() + "\n (отправляем им уведомления)");
                    //test zone

                    GMap.NET.WindowsForms.GMapMarker marker =
                        new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                            new GMap.NET.PointLatLng(lat, lng),
                            GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
                    markers.Markers.Add(marker);
                    marker.Tag = "warning";
                }
            }
        }
        private void loadMap()
        {
            gMapControl.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
            GMaps.Instance.Mode = AccessMode.ServerOnly;
            gMapControl.SetPositionByKeywords("dubnov, Tel Aviv, Israel");

            m_MarkersOverlay = new GMapOverlay("markers");
            foreach (object obj in m_utils.Events)
            {
                if (m_utils.HasLocationEvent(obj))
                {
                    PointLatLng point = getLatLong(m_utils.GetLatLong(obj));
                    GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        point,
                        GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_small);
                    marker.ToolTipText = m_utils.GetEventName(obj);
                    m_MarkersOverlay.Markers.Add(marker);
                }
            }

            gMapControl.Overlays.Add(m_MarkersOverlay);
            gMapControl.ZoomAndCenterMarkers(null);
        }
Ejemplo n.º 25
0
        private void LoadMarkers()
        {
            if (Controls.Contains(lbx_not_found_targets))
            {
                Controls.Remove(lbx_not_found_targets);
            }
            if (Controls.Contains(lb_listbox))
            {
                Controls.Remove(lb_listbox);
            }

            OpenFileDialog _ofd = new OpenFileDialog();

            _ofd.FileName = "";
            _ofd.Title    = "Open markers file...";
            _ofd.Filter   = "Marker Files(*.mrk)|*.mrk";
            if (_ofd.ShowDialog() == DialogResult.OK)
            {
                _markers = _ofd.FileName;
            }
            else
            {
                return;
            }

            if (_markers.Split('.')[_markers.Split('.').Length - 1] != "mrk")
            {
                MessageBox.Show("You have chosen an incorrect file.\nOnly .mrk files are compatible with this application.", "Incorrect file type", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (mymap.Overlays.Count != 0)
            {
                mymap.Overlays[0].Markers.Clear();
            }
            mymap.Overlays.Clear();

            StreamReader _r;

            if (File.Exists(_markers))
            {
                _r = new StreamReader(_markers);
                do
                {
                    string      _tmp  = _r.ReadLine();
                    PointLatLng final = new PointLatLng(
                        Convert.ToDouble(_tmp.Split('|')[1]),
                        Convert.ToDouble(_tmp.Split('|')[2])
                        );
                    GMapMarker marker   = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(final, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                    string     turnover = _tmp.Split('|').Length > 3 ? ", Turnover: " + _tmp.Split('|')[3] : "";
                    marker.ToolTipText = _tmp.Split('|')[0] + turnover;
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    marker.Tag         = _tmp.Split('|')[0];
                    markers_overlay.Markers.Add(marker);
                    mymap.UpdateMarkerLocalPosition(marker);
                } while (!_r.EndOfStream);
                mymap.Overlays.Add(markers_overlay);
                mymap.SetZoomToFitRect(mymap.GetRectOfAllMarkers(mymap.Overlays[0].Id).Value);
                _r.Close();
            }

            EditMarkersMenuStripItem();
        }
Ejemplo n.º 26
0
        private void MarkerClick(object sender, EventArgs e)
        {
            GMapMarker Marker = (GMapMarker)sender;

            if(lastSelected != -1)
            {
                //create new marker and find old selected marker
                GMapMarker newLastMarker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(Points.Markers.ElementAt(lastSelected).Position, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                GMapMarker lastMarker = Points.Markers.ElementAt(lastSelected);

                //copy data
                newLastMarker.ToolTipText = lastMarker.ToolTipText;
                newLastMarker.Tag = lastMarker.Tag;

                //UN-highlight tooltip text
                newLastMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

                //insert new marker and remove the old one
                Points.Markers.Insert((int)lastMarker.Tag, newLastMarker);
                Points.Markers.Remove(lastMarker);
            }

            if ((int)Marker.Tag != lastSelected)
            {
                //use Marker.Tag
                GMapMarker newMarker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(Marker.Position, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_dot);
                //Points.Markers.ElementAt((int)Marker.Tag);
                newMarker.ToolTipText = Marker.ToolTipText;
                newMarker.Tag = Marker.Tag;

                //highlight tooltip text
                newMarker.ToolTipMode = MarkerTooltipMode.Always;

                //replace marker
                Points.Markers.Insert((int)Marker.Tag, newMarker);
                Points.Markers.Remove(Marker);

                lastSelected = (int)newMarker.Tag;

                //enable the remove point button
                RemovePoint.Enabled = true;
            }
            else
            {
                RemovePoint.Enabled = false;
                lastSelected = -1;
            }
        }
Ejemplo n.º 27
0
        private void AddPointsToMap()
        {
            //remove old points
            //MainMap.Overlays.Remove(Points);
            ClearMap();

            if (Points == null)
            {
                Points = new GMapOverlay();
            }
            if(Route == null)
            {
                Route = new GMapOverlay();
            }

            //add route
            Route.Routes.Add(new GMapRoute("Route1"));
            GMapRoute r = new GMapRoute("hikeRoute");

            //keep track of where the map needs to show once the points are added
            double highLat = -100, lowLat = 100, highLon = -200, lowLon = 200;
            //double lastLat = 0, lastLon = 0;

            calcDistanceforPoints();

            for (int i = hike.Length-1; i >= 0; i--)
            {
                double lat = convertGpsToDouble(hike[i].degreeNorthSouth, hike[i].minuteNorthSouth, hike[i].northSouth);
                double lon = convertGpsToDouble(hike[i].degreeEastWest, hike[i].minuteEastWest, hike[i].eastWest);

                //modify high and low values
                if (lat > highLat)
                {
                    highLat = lat;
                }
                if(lat < lowLat)
                {
                    lowLat = lat;
                }

                if (lon > highLon)
                {
                    highLon = lon;
                }
                if (lon < lowLon)
                {
                    lowLon = lon;
                }

                PointLatLng pos = new PointLatLng(lat, lon);
                //Route.Routes.Add()
                r.Points.Add(pos);

                //add "tool tips" and create marker
                GMapMarker Marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pos, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
                //Marker.ToolTip = new GMapToolTip(Marker);

                //figure out time hiked
                time hikeTime = calcHikeTime(hike[hike.Length - 1], hike[i]);

                //add tool tip
                Marker.ToolTipText = "Point Number: " + (hike.Length - i)
                                        + "\nTime: " + hike[i].capTime.hours + ":" + hike[i].capTime.minutes + ":" + hike[i].capTime.seconds + " UTC"
                                        + "\nTime Hiked: " + hikeTime.hours + ":" + hikeTime.minutes + ":" + hikeTime.seconds
                                        //+ (hike[i].capTime.hours - hike[0].capTime.hours) + ":" + (hike[i].capTime.minutes - hike[0].capTime.minutes) + ":" + (hike[i].capTime.seconds - hike[0].capTime.seconds)
                                        + "\nDistance Hiked: " + hike[i].distancedHiked.ToString("F") + " Km"
                                        + "\nLatitude: " + hike[i].degreeNorthSouth + "º " + hike[i].minuteNorthSouth + "' " + hike[i].northSouth
                                        + "\nLongitude: " + hike[i].degreeEastWest + "º " + hike[i].minuteEastWest + "' " + hike[i].eastWest;

                //Marker.IsHitTestVisible = false;      //makes marker unclickable and tool tips wont show up
                Marker.Tag = (hike.Length - 1) - i;         //add a tag to identify the marker for later

                Points.Markers.Add(Marker);
            }
            Route.Routes.Add(r);
            MainMap.Overlays.Add(Route);

            MainMap.Overlays.Add(Points);

            //move the map
            MainMap.Position = new PointLatLng((highLat + lowLat)/2, (highLon + lowLon)/2);

            populateComboBoxes();
        }
Ejemplo n.º 28
0
        private void PopulateMarkers()
        {
            RemoveAllMarkers();
            int nSamplesShown = 0;

            SqlConnection conn = null;

            try
            {
                conn = DB.OpenConnection();

                string     query = @"
select s.latitude, s.longitude, st.name as 'sample_type_name'
from sample s
    inner join sample_type st on st.id = s.sample_type_id
where number = @id
";
                SqlCommand cmd   = new SqlCommand(query, conn);

                foreach (int id in mSampleList)
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@id", id);
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            reader.Read();

                            if (DB.IsValidField(reader["latitude"]) && DB.IsValidField(reader["longitude"]))
                            {
                                double     lat    = reader.GetDouble("latitude");
                                double     lon    = reader.GetDouble("longitude");
                                string     stype  = reader.GetString("sample_type_name");
                                GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                                    new PointLatLng(lat, lon),
                                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.yellow_pushpin);

                                marker.ToolTipText = "Sample: " + id + Environment.NewLine +
                                                     "Sample type: " + stype + Environment.NewLine +
                                                     "Latitude: " + lat + Environment.NewLine +
                                                     "Longitude: " + lon;
                                overlay.Markers.Add(marker);
                                nSamplesShown++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Common.Log.Error(ex);
                MessageBox.Show(ex.Message);
                return;
            }
            finally
            {
                conn?.Close();
            }

            lblInfo.Text = mSampleList.Count + " samples, showing " + nSamplesShown + " with coordinates";
            gmap.Refresh();
        }
Ejemplo n.º 29
0
 public void UpdateCoord(GMap.NET.WindowsForms.Markers.GMarkerGoogle coord)
 {
     Coord = coord;
 }
Ejemplo n.º 30
0
        public void SetPersonal()
        {
            string[] serverData = File.ReadAllLines(Environment.CurrentDirectory + "\\testCoords.txt");
            foreach (string dataRow in serverData)
            {
                Bitmap    bm  = null;
                Personnel psn = null;
                GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = null;

                int id = int.Parse(dataRow.Split(' ')[0]);
                //string name = dataRow.Split('"')[0];

                string name = dataRow.Remove(0, dataRow.IndexOf('"') + 1);
                name = name.Remove(name.LastIndexOf('"'));


                double x = double.Parse(dataRow.Split(' ')[1].Trim(','));
                double y = double.Parse(dataRow.Split(' ')[2]);

                //Personnel.Type type;

                switch (dataRow.Split(' ')[3])
                {
                case "Engineer":
                    //type = Personnel.Type.Engineer;

                    bm                 = new Bitmap(Properties.Resources.personnelEngineerIcon, new Size(35, 35));
                    marker             = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(x, y), bm);
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    psn                = new Personnel(id, name, Personnel.Type.Engineer, marker);
                    marker.ToolTipText = psn.Name;
                    break;

                case "Assistant":
                    //type = Personnel.Type.Assistant;

                    bm                 = new Bitmap(Properties.Resources.personnelAssistantIcon, new Size(35, 35));
                    marker             = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(x, y), bm);
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    psn                = new Personnel(id, name, Personnel.Type.Assistant, marker);
                    marker.ToolTipText = psn.Name;
                    break;

                case "Carrier":
                    //type = Personnel.Type.Carrier;

                    bm                 = new Bitmap(Properties.Resources.personnelCarrierIcon, new Size(35, 35));
                    marker             = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(x, y), bm);
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    psn                = new Personnel(id, name, Personnel.Type.Carrier, marker);
                    marker.ToolTipText = psn.Name;
                    break;

                case "Police":
                    //type = Personnel.Type.Police;

                    bm                 = new Bitmap(Properties.Resources.personnelPoliceIcon, new Size(35, 35));
                    marker             = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(x, y), bm);
                    marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    psn                = new Personnel(id, name, Personnel.Type.Police, marker);
                    marker.ToolTipText = psn.Name;
                    break;
                }

                staff.Add(psn);
                personnelScreen.mapControl1.markers.Markers.Add(marker);
            }
        }
Ejemplo n.º 31
0
        private void AddMarkersFromCSV()
        {
            string csvDir = "";

            openFileDialog1.FileName = "";
            openFileDialog1.Title    = "Open CSV file...";
            openFileDialog1.Filter   = "CSV Files(*.csv)|*.csv";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                csvDir = openFileDialog1.FileName;
            }
            else
            {
                return;
            }

            if (csvDir.Split('.')[csvDir.Split('.').Length - 1] != "csv")
            {
                MessageBox.Show("You have chosen an incorrect file.\nOnly CSV files are compatible with this application.", "Incorrect file type", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            StreamReader _rdr = new StreamReader(csvDir);

            if (mymap.Overlays.Count != 0)
            {
                mymap.Overlays[0].Markers.Clear();
            }

            if (Controls.Contains(lbx_not_found_targets))
            {
                Controls.Remove(lbx_not_found_targets);
            }
            if (Controls.Contains(lb_listbox))
            {
                Controls.Remove(lb_listbox);
            }


            int _csv_entries = 0;
            int _csv_index   = 0;
            int _retries_index;
            int _retries = 50;

            do
            {
                _rdr.ReadLine();
                _csv_entries++;
            } while (!_rdr.EndOfStream);
            _rdr.Close();
            _csv_entries -= 6;

            StreamReader reader = new StreamReader(csvDir);

            for (int i = 0; i < 6; i++) //skip the "csv headers"
            {
                reader.ReadLine();
            }
            List <string> notFound = new List <string>();

            pb          = new List <ProgressBar>();
            lb_progress = new List <Label>();
            pb.Add(CreateProgressBar(
                       new Point(tb_find_place.Location.X, tb_find_place.Location.Y + tb_find_place.Height + 5),
                       1,
                       _csv_entries,
                       tb_find_place.Width));
            pb.Add(CreateProgressBar(
                       new Point(pb[0].Location.X, pb[0].Location.Y + pb[0].Height + 5),
                       1.5,
                       _retries,
                       tb_find_place.Width / 3));
            Controls.Add(lb_progress[0]);
            Controls.Add(lb_progress[1]);
            Controls.Add(pb[0]);
            Controls.Add(pb[1]);

            do
            {
                string _tmp = reader.ReadLine();

                _tmp = _tmp.ToLower();

                string dir      = _tmp.Split(',')[1] + " " + _tmp.Split(',')[3];
                string turnover = _tmp.Split(',').Length > 4 ? ", Turnover: " + _tmp.Split(',')[_tmp.Split(',').Length - 1] : "";
                if (dir.Contains("τ.θ.") ||
                    dir.Contains("τ.") ||
                    dir.Contains("θ.") ||
                    dir.Contains("τθ") ||
                    dir.Contains("τθ."))
                {
                    dir.Replace("τ.θ.", "");
                    dir.Replace("τ.", "");
                    dir.Replace("θ.", "");
                    dir.Replace("τθ", "");
                    dir.Replace("τθ.", "");
                }

                if (dir.Contains("οδοσ"))
                {
                    dir.Replace("οδοσ", "οδός");
                }

                if (dir.Contains("εθν.οδοσ"))
                {
                    dir.Replace("εθν.οδοσ", "εθνική");
                }

                dir            = dir.ToLower();
                _retries_index = 0;
                bool _found = false;
                pb[1].Value = 1;
                while (!_found)
                {
                    var coords     = GMapProviders.GoogleMap.GetPoint(dir, out GeoCoderStatusCode _e);
                    var _tmpCoords = new Placemark?();
                    if (coords.HasValue)
                    {
                        _tmpCoords = GMapProviders.GoogleMap.GetPlacemark(coords.Value, out GeoCoderStatusCode _geo);
                    }

                    if (_tmpCoords.HasValue && _e.Equals(GeoCoderStatusCode.G_GEO_SUCCESS))
                    {
                        PointLatLng points = new PointLatLng(coords.Value.Lat, coords.Value.Lng);
                        GMapMarker  marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(points, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);

                        marker.Tag         = _tmpCoords.Value.Address;
                        marker.ToolTipText = _tmpCoords.Value.Address + turnover;
                        marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

                        markers_overlay.Markers.Add(marker);

                        mymap.UpdateMarkerLocalPosition(marker);
                        mymap.Overlays.Clear();
                        mymap.Overlays.Add(markers_overlay);
                        _found = true;
                    }
                    else
                    {
                        dir    = FirstLetterToUpper(dir);
                        coords = GMapProviders.GoogleMap.GetPoint(dir, out GeoCoderStatusCode __e);
                        if (_tmpCoords.HasValue && _e.Equals(GeoCoderStatusCode.G_GEO_SUCCESS))
                        {
                            PointLatLng points = new PointLatLng(coords.Value.Lat, coords.Value.Lng);
                            GMapMarker  marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(points, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);

                            marker.Tag         = _tmpCoords.Value.Address;
                            marker.ToolTipText = _tmpCoords.Value.Address + turnover;
                            marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;

                            markers_overlay.Markers.Add(marker);

                            mymap.UpdateMarkerLocalPosition(marker);
                            mymap.Overlays.Clear();
                            mymap.Overlays.Add(markers_overlay);
                        }
                    }
                    if (_retries_index >= _retries)
                    {
                        break;
                    }
                    _retries_index++;
                    lb_progress[1].Text = "Retrying request: " + _retries_index + "/" + _retries + "\n" + dir;
                    pb[1].PerformStep();
                    Application.DoEvents();
                }
                if (!_found)
                {
                    notFound.Add(dir);
                }
                mymap.SetZoomToFitRect(mymap.GetRectOfAllMarkers(mymap.Overlays[0].Id).Value);

                _csv_index++;
                lb_progress[0].Text = "Completed: " + ((100 * _csv_index) / _csv_entries) + "% (Parsed Addresses: " + _csv_index + "/" + _csv_entries + ")";
                lb_progress[1].Text = "Done";
                pb[1].Value         = pb[1].Maximum;
                pb[0].PerformStep();
                Application.DoEvents();
            } while (!reader.EndOfStream);
            EditMarkersMenuStripItem();
            Controls.Remove(pb[1]);
            Controls.Remove(lb_progress[1]);
            MessageBox.Show("Finding process is completed.", "Finished", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Controls.Remove(pb[0]);
            Controls.Remove(lb_progress[0]);
            pb.Clear();
            lb_progress.Clear();
            LogTheNotFoundTargetsList(notFound);
        }
Ejemplo n.º 32
0
        //inicializador de los marcadores
        private void showMarkers()
        {
            markers = new GMapOverlay("markers");

            GMapMarker marker0 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3428955230271846, -76.53060189679638),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker0);
            marker0.Tag         = "Cuadrante 1";
            marker0.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker0.ToolTipText = "Cuadrante 1";

            GMapMarker marker1 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3428633912857353, -76.52969531014935),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker1);
            marker1.Tag         = "Cuadrante 2";
            marker1.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker1.ToolTipText = "Cuadrante 2";

            GMapMarker marker2 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3418458855956312, -76.53060189679638),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker2);
            marker2.Tag         = "Cuadrante 3";
            marker2.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker2.ToolTipText = "Cuadrante 3";

            GMapMarker marker3 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3417441349685766, -76.52988306478039),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker3);
            marker3.Tag         = "Cuadrante 4";
            marker3.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker3.ToolTipText = "Cuadrante 4";

            GMapMarker marker4 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3409676166778137, -76.5303712268211),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker4);
            marker4.Tag         = "Cuadrante 5";
            marker4.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker4.ToolTipText = "Cuadrante 5";

            GMapMarker marker5 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3410265249834823, -76.5295236487724),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker5);
            marker5.Tag         = "Cuadrante 6";
            marker5.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker5.ToolTipText = "Cuadrante 6";

            GMapMarker marker6 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.3423225068134284, -76.52858685086301),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker6);
            marker6.Tag         = "Cuadrante 7";
            marker6.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker6.ToolTipText = "Cuadrante 7";

            GMapMarker marker7 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.341031880283825, -76.52863513062528),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker7);
            marker7.Tag         = "Cuadrante 8";
            marker7.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker7.ToolTipText = "Cuadrante 8";

            GMapMarker marker8 =
                new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(3.340964031809507, -76.5278379618959),
                    GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);

            markers.Markers.Add(marker8);
            marker8.Tag         = "Cuadrante 9";
            marker8.ToolTipMode = MarkerTooltipMode.OnMouseOver;
            marker8.ToolTipText = "Cuadrante 9";

            gMapControl1.Overlays.Add(markers);
        }
        private GMap.NET.WindowsForms.Markers.GMarkerGoogle AddDeliveryMarker(PointLatLng aPointToPlaceDriverMarker, Color aMarkerColour, int aOrderNumber)
        {
            GMap.NET.WindowsForms.Markers.GMarkerGoogle marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(aPointToPlaceDriverMarker, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green);
            marker.ToolTipText = mTotalItems.ToString();
            gMapControl_MainMap_MainMapForm.Overlays.Add(mDeliveryMarkers);
            mDeliveryMarkers.Markers.Add(marker);

            return marker;
        }
Ejemplo n.º 34
0
        //method to display the coordinates on google maps
        private static void showLocation(StringBuilder s)
        {
            try
            {
                gMap.Overlays.Clear();
                //getting the coordinates
                String[] strings   = s.ToString().Split(new char[] { ' ' });
                int      length    = strings.Length;
                double   latitude  = Double.Parse(strings[length - 4]);
                double   longitude = Double.Parse(strings[length - 3]);

                if (markers.Markers.Count > 0)
                {   //starting at the second marker find maximum and minumum longitude and latitude
                    if (latitude > maxLat)
                    {
                        maxLat = latitude;
                    }
                    else if (latitude < minLat)
                    {
                        minLat = latitude;
                    }
                    if (longitude > maxLong)
                    {
                        maxLong = longitude;
                    }
                    else if (longitude < minLong)
                    {
                        minLong = longitude;
                    }
                }
                else
                {   // first marker
                    maxLat  = latitude + 1;
                    maxLong = longitude + 1;
                    minLat  = latitude - 1;
                    minLong = longitude - 1;
                }


                //creating a marker
                GMap.NET.WindowsForms.GMapMarker marker =
                    new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                        new GMap.NET.PointLatLng(latitude, longitude),
                        GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_small);
                gMap.Overlays.Add(markers);
                marker.ToolTipText = s.ToString(); //when going over a marker it shows the location
                markers.Markers.Add(marker);       //add to the list
                double mid1  = (maxLat - minLat) / 2 + minLat;
                double mid2  = (maxLong - minLong) / 2 + minLong;
                double dist1 = maxLong - minLong;
                double dist2 = maxLat - minLat;


                //The zoom and center gave me trouble, that's why all the try's and catch's are here
                try
                {   //center the map in the middle of all markers using the middle coordinates
                    gMap.SetPositionByKeywords(mid1 + " " + mid2);
                }
                catch
                {
                }
                try
                {
                    //zoom all the way out before adjusting zoom
                    gMap.Zoom = 2;
                }
                catch
                {
                }
                while (gMap.ViewArea.WidthLng > dist1 && gMap.ViewArea.HeightLat > dist2 && gMap.Zoom <= 15)
                {
                    //while the markers are visible zoom in
                    increaseZoom();
                }
                //the zoom in the loop is going to be one zoom in too much
                //zoom out one, so that all the markers are visible. The if statement is there, because 2 is the min zoom
                if (gMap.Zoom > 2)
                {
                    gMap.Zoom--;
                }

                //setArea(r2);
            }
            catch
            {
            }
        }
Ejemplo n.º 35
0
        private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                label9.Text = e.Error.Message;
                label9.Update();
            }
            else
            {
                label9.Text = "Done";
                label9.Update();
            }

            GMap.NET.WindowsForms.GMapOverlay routes  = new GMap.NET.WindowsForms.GMapOverlay("routes");
            GMap.NET.WindowsForms.GMapOverlay routes2 = new GMap.NET.WindowsForms.GMapOverlay("routes2");
            GMap.NET.WindowsForms.GMapRoute   route   = new GMap.NET.WindowsForms.GMapRoute(pts1, "sbet");
            GMap.NET.WindowsForms.GMapRoute   route2  = new GMap.NET.WindowsForms.GMapRoute(pts2, "vnav");
            route.Stroke  = new Pen(Color.Red, 3);
            route2.Stroke = new Pen(Color.Blue, 3);
            routes.Routes.Add(route);
            routes2.Routes.Add(route2);
            gMapControl1.Overlays.Add(routes2);
            gMapControl1.Overlays.Add(routes);

            GMap.NET.WindowsForms.GMapOverlay markers = new GMap.NET.WindowsForms.GMapOverlay("markers");
            foreach (var p in err)
            {
                GMap.NET.WindowsForms.GMapMarker mark = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(p, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.orange_dot);
                markers.Markers.Add(mark);
                mark.ToolTipText         = "Coord:\nLat: " + lat1.ToString() + "\nLon: " + lon1.ToString();
                mark.ToolTip.Fill        = Brushes.Black;
                mark.ToolTip.Foreground  = Brushes.White;
                mark.ToolTip.Stroke      = Pens.Black;
                mark.ToolTip.TextPadding = new Size(15, 20);
            }

            GMap.NET.WindowsForms.GMapMarker markS = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pts1[0], GMap.NET.WindowsForms.Markers.GMarkerGoogleType.gray_small);
            markers.Markers.Add(markS);
            markS.ToolTipText         = "Start";
            markS.ToolTip.Fill        = Brushes.Black;
            markS.ToolTip.Foreground  = Brushes.White;
            markS.ToolTip.Stroke      = Pens.Black;
            markS.ToolTip.TextPadding = new Size(10, 15);

            GMap.NET.WindowsForms.GMapMarker markE = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pts1[pts1.Count - 1], GMap.NET.WindowsForms.Markers.GMarkerGoogleType.gray_small);
            markers.Markers.Add(markE);
            markE.ToolTipText         = "End";
            markE.ToolTip.Fill        = Brushes.Black;
            markE.ToolTip.Foreground  = Brushes.White;
            markE.ToolTip.Stroke      = Pens.Black;
            markE.ToolTip.TextPadding = new Size(10, 15);

            GMap.NET.WindowsForms.GMapMarker markS2 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pts2[0], GMap.NET.WindowsForms.Markers.GMarkerGoogleType.gray_small);
            markers.Markers.Add(markS2);
            markS2.ToolTipText         = "Start";
            markS2.ToolTip.Fill        = Brushes.Black;
            markS2.ToolTip.Foreground  = Brushes.White;
            markS2.ToolTip.Stroke      = Pens.Black;
            markS2.ToolTip.TextPadding = new Size(10, 15);

            GMap.NET.WindowsForms.GMapMarker markE2 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(pts2[pts2.Count - 1], GMap.NET.WindowsForms.Markers.GMarkerGoogleType.gray_small);
            markers.Markers.Add(markE2);
            markE2.ToolTipText         = "End";
            markE2.ToolTip.Fill        = Brushes.Black;
            markE2.ToolTip.Foreground  = Brushes.White;
            markE2.ToolTip.Stroke      = Pens.Black;
            markE2.ToolTip.TextPadding = new Size(10, 15);

            gMapControl1.Overlays.Add(markers);
            gMapControl1.ZoomAndCenterRoute(route);

            label2.Text = "Lat: " + lat1.ToString();
            label3.Text = "Lon: " + lon1.ToString();
            label7.Text = "Times over 5: " + err.Count();
            Max m = new Max();

            //Console.WriteLine("hehre");
            label4.Text = "Max Diff(m): " + mx;
            alt.Sort();
            //Console.WriteLine("hehr1e");
            label5.Text = "Max Elev(m): " + alt[alt.Count - 1];
            label6.Text = "Min Elev(m): " + alt[0];
            label2.Update();
            label3.Update();
            label4.Update();
            label5.Update();
            label6.Update();
            label7.Update();
            comboBox2.Enabled = true;
            checkBox1.Enabled = true;

            /*double lat1 = 0; double lon1 = 0; string ps = "";
             * Console.WriteLine(list.Count.ToString());
             * var res = list.Distinct(new SBETcomp());
             * Console.WriteLine(res.Count().ToString());
             *
             * foreach (var found in res)
             * {
             *  double lat = Deg(found.lat);
             *  double lon = Deg(found.lon);
             *  string p = load + lat + "," + lon;
             *  gMapControl1.Position = new GMap.NET.PointLatLng(lat, lon);
             *  GMap.NET.WindowsForms.GMapOverlay marks = new GMap.NET.WindowsForms.GMapOverlay("marks");
             *  GMap.NET.WindowsForms.GMapMarker mark = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(gMapControl1.Position, GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot);
             *  marks.Markers.Add(mark);
             *  gMapControl1.Overlays.Add(marks);
             *  lat1 = lat;
             *  lon1 = lon;
             *  ps = p;
             *  Console.WriteLine(lat1.ToString() + "," + lon1.ToString());
             * }
             * gMapControl1.ZoomAndCenterMarkers("marks");
             * find = ps;
             * label3.Text = "Lat: " + lat1.ToString();
             * label4.Text = "Lon: " + lon1.ToString();*/
            return;
        }