Exemplo n.º 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);
                    }
                }
            }
        }
Exemplo n.º 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);
             }
         }
     }
 }
Exemplo n.º 3
0
 void mapControl1_MapMouseMove(MapControlEventArgs e)
 {
     OsmSharp.Logging.Log.TraceEvent("MapControlForm", OsmSharp.Logging.TraceEventType.Information, "Map mouse move");
 }
Exemplo n.º 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);
                    }
                }
            }
        }
Exemplo n.º 5
0
 private void Route(MapControlEventArgs e)
 {
     //Route(e.Position);
 }
Exemplo n.º 6
0
 void mapControl1_MapMouseMove(MapControlEventArgs e)
 {
     OsmSharp.Logging.Log.TraceEvent("MapControlForm", OsmSharp.Logging.TraceEventType.Information, "Map mouse move");
 }
Exemplo n.º 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);
             }
         }
     }
 }