当前位置: 首页>>代码示例>>C#>>正文


C# GMapRoute类代码示例

本文整理汇总了C#中GMapRoute的典型用法代码示例。如果您正苦于以下问题:C# GMapRoute类的具体用法?C# GMapRoute怎么用?C# GMapRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GMapRoute类属于命名空间,在下文中一共展示了GMapRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlaybackSbxjHelper

        public PlaybackSbxjHelper(RMap map,IContainer c) {
            _map = map;
            playOverlay = map.FindOverlay("play");
            if (playOverlay == null) {
                playOverlay = new GMapOverlay(map, "play");
                map.Overlays.Add(playOverlay);
                playRoute = new GMapRoute(new List<GMap.NET.PointLatLng>(), "play");
                playRoute.Stroke.Color = Color.Red;
                playRoute.Stroke.Width = 3;
                playOverlay.Routes.Add(playRoute);
            } 

            car = new GMapMarkerGoogleGreen(new GMap.NET.PointLatLng(0, 0));
            car.ToolTipMode = MarkerTooltipMode.Always;
            car.ToolTipText = "man";
            car.ToolTip.Format.Alignment = StringAlignment.Near;

            playOverlay.Markers.Add(car);

            queue_pos = new Queue<gps_position>();

            dataTimer = new Timer();
            dataTimer.Tick += new EventHandler(dataTimer_Tick);
            dataTimer.Interval = 1;
            playTimer = new Timer();
            playTimer.Tick += new EventHandler(playTimer_Tick);
            playTimer.Interval = 1000;
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:28,代码来源:PlaybackSbxjHelper.cs

示例2: RoutePointMarker

 public RoutePointMarker(GMap.NET.PointLatLng p, int routePointIndex, GMapRoute route)
     : base(p)
 {
     _route = route;
     _routePointIndex = routePointIndex;
     base.Size = new Size(8, 8);
     base.Offset = new Point((-1) * base.Size.Width / 2, (-1) * base.Size.Height / 2);
 }
开发者ID:chinnisuraj1984,项目名称:navigational,代码行数:8,代码来源:RoutePointMarker.cs

示例3: getDistance

        public double getDistance(PointLatLng p1, PointLatLng p2)
        {
            GMapRoute route = new GMapRoute("getDistance");
            route.Points.Add(p1);
            route.Points.Add(p2);
            double distance = route.Distance;
            route.Clear();
            route = null;

            return distance;
        }
开发者ID:nadar71,项目名称:Krea,代码行数:11,代码来源:GoogleMapControl.cs

示例4: GetRouteFromKml

        public static GMapRoute GetRouteFromKml(string fileName)
        {
            try
            {
                //XDocument root = XDocument.Load(new System.IO.StreamReader(fileName));
                XElement root = XElement.Load(new System.IO.StreamReader(fileName));
                IEnumerable<string> coordinates = from c in root.Descendants(XName.Get("coordinates", root.Name.NamespaceName))
                                                  select (string)c;
                foreach (string c in coordinates)
                {
                    List<PointLatLng> points = new List<GMap.NET.PointLatLng>();

                    string[] ss = c.Split(new char[] { ' ', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string sss in ss)
                    {
                        string[] ss2 = sss.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        points.Add(new PointLatLng(Convert.ToDouble(ss2[1]), Convert.ToDouble(ss2[0])));
                    }

                    GMapRoute rt = new GMapRoute(points, string.Empty);
                    {
                        rt.Stroke = new Pen(Color.FromArgb(144, Color.Red));
                        rt.Stroke.Width = 5;
                        rt.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                    }
                    return rt;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            return null;
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:34,代码来源:KmlOverlay.cs

示例5: MapControl_OnRouteEnter

        private void MapControl_OnRouteEnter(GMapRoute item)
        {
            if (marker != null)
                item.Overlay.Markers.Remove(marker);

            var point = item.Overlay.Control.PointToClient(Control.MousePosition);
            var pos = item.Overlay.Control.FromLocalToLatLng(point.X, point.Y);

            marker = new GMapMarkerRect(pos) { ToolTipMode = MarkerTooltipMode.Always, ToolTipText = createMessage(item.Tag), IsHitTestVisible = false };
            item.Overlay.Markers.Add(marker);
        }
开发者ID:ArduPilot,项目名称:MissionPlanner,代码行数:11,代码来源:MapAdapter.cs

示例6: timer1_Tick

        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();
            

        }
开发者ID:hkumar96,项目名称:sastr-navigation,代码行数:13,代码来源:Form1.cs

示例7: refreshRoute

        void refreshRoute() {
            List<PointLatLng> linePoints = new List<PointLatLng>();

            foreach (GMapMarker m in routes.Markers) {                
                m.Tag = linePoints.Count;
                linePoints.Add(m.Position);
                m.ToolTipMode = MarkerTooltipMode.Never;
            }
            if (routes.Markers.Count > 1) {
                routes.Markers[routes.Markers.Count - 1].ToolTipMode = MarkerTooltipMode.Always;
            }
            if (linePoints.Count > 0) {
                GMapRoute route = new GMapRoute(linePoints, "distance");
                route.Stroke.Width = 4;
                routes.Routes.Clear();
                routes.Routes.Add(route);
            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:18,代码来源:OperationDistance.cs

示例8: BuildRoute

        void BuildRoute()
        {
            if (markersOverlay.Markers.Count > 0)
            {
                List<PointLatLng> points = new List<PointLatLng>();

                for (int i = 0; i < markersOverlay.Markers.Count; i++)
                {
                    points.Add(markersOverlay.Markers[i].Position);
                }

                GMapRoute route = new GMapRoute(points, "myRoute");
                routeOverlay.Routes.Clear();
                routeOverlay.Routes.Add(route);
                MainMap.Overlays.Add(routeOverlay);
                MainMap.UpdateRouteLocalPosition(route);
            }
        }
开发者ID:vadimvoyevoda,项目名称:NetworkProgramming,代码行数:18,代码来源:Form1.cs

示例9: DrawMap

        public static void DrawMap(GMapControl map, List<Point> points, Color color, bool includeMarkers)
        {
            Pen pen = new Pen(color, 3.0f);

            List<PointLatLng> allMapPoints = points.Select(point => new PointLatLng(point.Latitude, point.Longitude)).ToList();
            GMapRoute route = new GMapRoute(allMapPoints, "Route");
            route.Stroke = pen;
            map.ZoomAndCenterRoute(route);

            GMapOverlay overlay = new GMapOverlay(map, "Overlay");
            if (includeMarkers)
            {
                overlay.Markers.Add(new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(new PointLatLng(allMapPoints.First().Lat, allMapPoints.First().Lng)));
                overlay.Markers.Add(new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleRed(new PointLatLng(allMapPoints.Last().Lat, allMapPoints.Last().Lng)));
            }
            overlay.Routes.Add(route);
            map.Overlays.Add(overlay);
        }
开发者ID:richardpianka,项目名称:Transit,代码行数:18,代码来源:MapUtilities.cs

示例10: Build

        public static void Build(ref GMapOverlay OverlayOut)
        {
            // Here loop through defined state borders and display them on the map
            foreach (SystemAdaptationDataSet.StateBorder State in SystemAdaptationDataSet.StateBorderDataSet)
            {
                System.Collections.Generic.List<PointLatLng> SectorPointList = new System.Collections.Generic.List<PointLatLng>();
                foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in State.StateBorderPoints)
                {
                    SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal));
                }

                GMapRoute StateBoundaryData = new GMapRoute(SectorPointList, State.StateName);
                StateBoundaryData.Stroke.Width = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineWidth;
                StateBoundaryData.Stroke.DashStyle = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineStyle;
                StateBoundaryData.Stroke.Color = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.StateBorder).LineColor;
                OverlayOut.Routes.Add(StateBoundaryData);
            }
        }
开发者ID:akapetanovic,项目名称:ASTERIX-ANALYSER-and-DATA-DISPLAY,代码行数:18,代码来源:StateBorderDisplay.cs

示例11: AddRoute

        public void AddRoute(List<PointLatLng> route)
        {
            // add route
            GMapRoute r = new GMapRoute(route, "test");
            routes.Routes.Add(r);

            //// add route start/end marks
            //GMapMarker m1 = new GMapMarkerGoogleRed(start);
            //m1.ToolTipText = "Start: " + start.ToString();
            //m1.TooltipMode = MarkerTooltipMode.Always;

            //GMapMarker m2 = new GMapMarkerGoogleGreen(end);
            //m2.ToolTipText = "End: " + end.ToString();
            //m2.TooltipMode = MarkerTooltipMode.Always;

            //objects.Markers.Add(m1);
            //objects.Markers.Add(m2);

            MainMap.ZoomAndCenterRoute(r);
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:20,代码来源:Map.cs

示例12: destinationMenuItem_Click

        private void destinationMenuItem_Click(object sender, EventArgs e)
        {
            GMarkerGoogle marker = new GMarkerGoogle(gPoint, GMarkerGoogleType.red);
            markers.Markers.Add(marker);
            PointLatLng start = new PointLatLng(markers.Markers[0].Position.Lat, markers.Markers[0].Position.Lng);
            PointLatLng end = new PointLatLng(markers.Markers[1].Position.Lat, markers.Markers[1].Position.Lng);
            MapRoute route = GMap.NET.MapProviders.GoogleMapProvider.Instance.GetRoute(
                start,
                end,
                false,
                false,
                14
            );
            GMapRoute r = new GMapRoute(route.Points, "My route");

            GMapOverlay routesOverlay = new GMapOverlay("routes");
            routesOverlay.Routes.Add(r);
            myMap.Overlays.Add(routesOverlay);

            // Térkép frissítése a route felrakása után, különben csak egy zoomolás után látszik a route.
            myMap.UpdateRouteLocalPosition(r);
            myMap.Invalidate();
        }
开发者ID:CsabaBarsony,项目名称:RouteSim,代码行数:23,代码来源:Form1.cs

示例13: mainloop


//.........这里部分代码省略.........
                        }

                        gMapControl1.HoldInvalidation = true;

                        while (gMapControl1.inOnPaint == true)
                        {
                            System.Threading.Thread.Sleep(1);
                        }

                        if (trackPoints.Count > int.Parse(MainV2.config["NUM_tracklength"].ToString()))
                        {
                            trackPoints.RemoveRange(0, trackPoints.Count - int.Parse(MainV2.config["NUM_tracklength"].ToString()));
                        }
                        if (MainV2.cs.lat != 0)
                            trackPoints.Add(new PointLatLng(MainV2.cs.lat, MainV2.cs.lng));

                        //                        if (CB_tuning.Checked == false) // draw if in view
                        {

                            if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null)
                            {
                                // this is for the pulled wp list from a mavlink logfile
                                FlightPlanner.pointlist.Clear();
                                FlightPlanner.pointlist.AddRange(MainV2.comPort.wps);
                            }

                            while (gMapControl1.inOnPaint == true)
                            {
                                System.Threading.Thread.Sleep(1);
                            }

                            updateClearRoutes();

                            route = new GMapRoute(trackPoints, "track");
                            //track.Stroke = Pens.Red;
                            //route.Stroke = new Pen(Color.FromArgb(144, Color.Red));
                            //route.Stroke.Width = 5;
                            //route.Tag = "track";

                            routes.Routes.Add(route);

                            if (waypoints.AddSeconds(10) < DateTime.Now)
                            {
                                //Console.WriteLine("Doing FD WP's");
                                polygons.Markers.Clear();

                                foreach (PointLatLngAlt plla in FlightPlanner.pointlist)
                                {
                                    if (plla == null || plla.Lng == 0 || plla.Lat == 0)
                                        break;
                                    addpolygonmarker(plla.Tag, plla.Lng, plla.Lat, (int)plla.Alt,plla.color,polygons);
                                }

                                RegeneratePolygon();

                                waypoints = DateTime.Now;
                            }

                            if (MainV2.cs.mode.ToLower() == "guided" && GuidedModeWP != null && GuidedModeWP.Lat != 0)
                            {
                                addpolygonmarker("Guided Mode", GuidedModeWP.Lng, GuidedModeWP.Lat, (int)GuidedModeWP.Alt, Color.Blue, routes);
                            }

                            //routes.Polygons.Add(poly);

                            if (trackPoints.Count > 0)
开发者ID:digitalcraft,项目名称:ardupilot-mega-buzz,代码行数:67,代码来源:FlightData.cs

示例14: mainloop


//.........这里部分代码省略.........
                        double time = (Environment.TickCount - tickStart) / 1000.0;
                        if (list1item != null)
                            list1.Add(time, (float)list1item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list2item != null)
                            list2.Add(time, (float)list2item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list3item != null)
                            list3.Add(time, (float)list3item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list4item != null)
                            list4.Add(time, (float)list4item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list5item != null)
                            list5.Add(time, (float)list5item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list6item != null)
                            list6.Add(time, (float)list6item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list7item != null)
                            list7.Add(time, (float)list7item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list8item != null)
                            list8.Add(time, (float)list8item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list9item != null)
                            list9.Add(time, (float)list9item.GetValue((object)MainV2.comPort.MAV.cs, null));
                        if (list10item != null)
                            list10.Add(time, (float)list10item.GetValue((object)MainV2.comPort.MAV.cs, null));
                    }

                    if (tracklast.AddSeconds(1) < DateTime.Now)
                    {
                        if (MainV2.config["CHK_maprotation"] != null && MainV2.config["CHK_maprotation"].ToString() == "True")
                        {
                            // dont holdinvalidation here
                            setMapBearing();
                        }

                        if (route == null)
                        {
                            route = new GMapRoute(trackPoints, "track");
                            routes.Routes.Add(route);
                        }

                        PointLatLng currentloc = new PointLatLng(MainV2.comPort.MAV.cs.lat, MainV2.comPort.MAV.cs.lng);

                        gMapControl1.HoldInvalidation = true;

                        int cnt = 0;

                        while (gMapControl1.inOnPaint == true)
                        {
                            System.Threading.Thread.Sleep(1);
                            cnt++;
                        }

                        while (route.Points.Count > 200)
                        {
                            //  trackPoints.RemoveRange(0, trackPoints.Count - int.Parse(MainV2.config["NUM_tracklength"].ToString()));
                            route.Points.RemoveAt(0);
                        }
                        if (MainV2.comPort.MAV.cs.lat != 0)
                        {
                            // trackPoints.Add(currentloc);
                            route.Points.Add(currentloc);
                        }

                        //                        if (CB_tuning.Checked == false) // draw if in view
                        {

                            while (gMapControl1.inOnPaint == true)
                            {
                                System.Threading.Thread.Sleep(1);
开发者ID:neolu,项目名称:MissionPlanner,代码行数:67,代码来源:Simple.cs

示例15: mainloop


//.........这里部分代码省略.........
                        if (list5item != null)
                            list5.Add(time, ConvertToDouble(list5item.GetValue(MainV2.comPort.MAV.cs, null)));
                        if (list6item != null)
                            list6.Add(time, ConvertToDouble(list6item.GetValue(MainV2.comPort.MAV.cs, null)));
                        if (list7item != null)
                            list7.Add(time, ConvertToDouble(list7item.GetValue(MainV2.comPort.MAV.cs, null)));
                        if (list8item != null)
                            list8.Add(time, ConvertToDouble(list8item.GetValue(MainV2.comPort.MAV.cs, null)));
                        if (list9item != null)
                            list9.Add(time, ConvertToDouble(list9item.GetValue(MainV2.comPort.MAV.cs, null)));
                        if (list10item != null)
                            list10.Add(time, ConvertToDouble(list10item.GetValue(MainV2.comPort.MAV.cs, null)));
                    }

                    // update map
                    if (tracklast.AddSeconds(1.2) < DateTime.Now)
                    {
                        // show disable joystick button
                        if (MainV2.joystick != null && MainV2.joystick.enabled)
                        {
                            this.Invoke((MethodInvoker) delegate {
                                but_disablejoystick.Visible = true;
                            });
                        }

                        if (Settings.Instance.GetBoolean("CHK_maprotation"))
                        {
                            // dont holdinvalidation here
                            setMapBearing();
                        }

                        if (route == null)
                        {
                            route = new GMapRoute(trackPoints, "track");
                            routes.Routes.Add(route);
                        }

                        PointLatLng currentloc = new PointLatLng(MainV2.comPort.MAV.cs.lat, MainV2.comPort.MAV.cs.lng);

                        gMapControl1.HoldInvalidation = true;

                        int numTrackLength = Settings.Instance.GetInt32("NUM_tracklength");
                        // maintain route history length
                        if (route.Points.Count > numTrackLength)
                        {
                            route.Points.RemoveRange(0,
                                route.Points.Count - numTrackLength);
                        }
                        // add new route point
                        if (MainV2.comPort.MAV.cs.lat != 0 && MainV2.comPort.MAV.cs.lng != 0)
                        {
                            route.Points.Add(currentloc);
                        }

                        gMapControl1.UpdateRouteLocalPosition(route);

                        // update programed wp course
                        if (waypoints.AddSeconds(5) < DateTime.Now)
                        {
                            //Console.WriteLine("Doing FD WP's");
                            updateClearMissionRouteMarkers();

                            float dist = 0;
                            float travdist = 0;
                            distanceBar1.ClearWPDist();
                            MAVLink.mavlink_mission_item_t lastplla = new MAVLink.mavlink_mission_item_t();
开发者ID:denisdifazio,项目名称:MissionPlanner,代码行数:67,代码来源:FlightData.cs


注:本文中的GMapRoute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。