示例#1
0
        void mapControl1_MapMouseClick(MapControlEventArgs e)
        {
            if (_router != null)
            {
                var routerPoint = _router.Resolve(Vehicle.Car, e.Position);
                if (routerPoint != null)
                {
                    _points.Add(routerPoint);
                    _layerPrimitives.AddPoint(routerPoint.Location, 15, SimpleColor.FromKnownColor(KnownColor.Black).Value);
                    _layerPrimitives.AddPoint(routerPoint.Location, 7, SimpleColor.FromKnownColor(KnownColor.White).Value);
                }

                if (_points.Count > 1)
                {
                    var tspRouter = new RouterTSPWrapper <RouterTSPAEXGenetic>(
                        new RouterTSPAEXGenetic(), _router);

                    var route = tspRouter.CalculateTSP(Vehicle.Car, _points.ToArray());
                    if (route != null)
                    {
                        _layerRoute.Clear();
                        _layerRoute.AddRoute(route);
                    }
                }
            }
        }
示例#2
0
 void mapControl1_MapMouseClick(MapControlEventArgs e)
 {
     if (_router != null)
     {
         if (_point1 == null)
         {
             _point1 = _router.Resolve(Vehicle.Car, e.Position);
         }
         else if (_point2 == null)
         {
             _point2 = _router.Resolve(Vehicle.Car, e.Position);
         }
         else
         {
             _point1 = _point2;
             _point2 = _router.Resolve(Vehicle.Car, e.Position);
         }
         if (_point1 != null && _point2 != null)
         {
             Route route = _router.Calculate(Vehicle.Car,
                                             _point1, _point2);
             if (route != null)
             {
                 _routeLayer.Clear();
                 _routeLayer.AddRoute(route);
             }
         }
     }
 }
示例#3
0
 void mapControl1_MapMouseMove(MapControlEventArgs e)
 {
     OsmSharp.Logging.Log.TraceEvent("MapControlForm", OsmSharp.Logging.TraceEventType.Information, "Map mouse move");
 }
示例#4
0
        void mapControl1_MapMouseClick(MapControlEventArgs e)
        {
            if(_router != null)
            {
                var routerPoint = _router.Resolve(Vehicle.Car, e.Position);
                if(routerPoint != null)
                {
                    _points.Add(routerPoint);
                    _layerPrimitives.AddPoint(routerPoint.Location, 15, SimpleColor.FromKnownColor(KnownColor.Black).Value);
                    _layerPrimitives.AddPoint(routerPoint.Location, 7, SimpleColor.FromKnownColor(KnownColor.White).Value);
                }

                if(_points.Count > 1)
                {
                    var tspRouter = new RouterTSPWrapper<RouterTSPAEXGenetic>(
                        new RouterTSPAEXGenetic(), _router);

                    var route = tspRouter.CalculateTSP(Vehicle.Car, _points.ToArray());
                    if(route != null)
                    {
                        _layerRoute.Clear();
                        _layerRoute.AddRoute(route);
                    }
                }
            }
        }
示例#5
0
 private void Route(MapControlEventArgs e)
 {
     //Route(e.Position);
 }
示例#6
0
 void mapControl1_MapMouseMove(MapControlEventArgs e)
 {
     OsmSharp.Logging.Log.TraceEvent("MapControlForm", OsmSharp.Logging.TraceEventType.Information, "Map mouse move");
 }
示例#7
0
 void mapControl1_MapMouseClick(MapControlEventArgs e)
 {
     if (_router != null)
     {
         if (_point1 == null)
         {
             _point1 = _router.Resolve(Vehicle.Car, e.Position);
         }
         else if (_point2 == null)
         {
             _point2 = _router.Resolve(Vehicle.Car, e.Position);
         }
         else
         {
             _point1 = _point2;
             _point2 = _router.Resolve(Vehicle.Car, e.Position);
         }
         if (_point1 != null && _point2 != null)
         {
             Route route = _router.Calculate(Vehicle.Car,
                 _point1, _point2);
             if (route != null)
             {
                 _routeLayer.Clear();
                 _routeLayer.AddRoute(route);
             }
         }
     }
 }