Example #1
0
 /// <remarks/>
 public void GetBestMapViewAsync(Location[] locations, string dataSourceName, object userState) {
     if ((this.GetBestMapViewOperationCompleted == null)) {
         this.GetBestMapViewOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetBestMapViewOperationCompleted);
     }
     this.InvokeAsync("GetBestMapView", new object[] {
                 locations,
                 dataSourceName}, this.GetBestMapViewOperationCompleted, userState);
 }
Example #2
0
 public MapViewRepresentations GetBestMapView(Location[] locations, string dataSourceName) {
     object[] results = this.Invoke("GetBestMapView", new object[] {
                 locations,
                 dataSourceName});
     return ((MapViewRepresentations)(results[0]));
 }
Example #3
0
 /// <remarks/>
 public void GetBestMapViewAsync(Location[] locations, string dataSourceName) {
     this.GetBestMapViewAsync(locations, dataSourceName, null);
 }
Example #4
0
    /*
    *********************************************************************************************************
    *                                              GetRouteFromGps()
    *
    * Description : Cette fonction effectue le trajet de génère la carte en bitmap
    *
    * Argument(s) : OrigLat         Coordonnée GPS Latitude du point d'origine
    *               OrigLong        Coordonnée GPS Longitude du point d'origine
    *               DestLat         Coordonnée GPS Latitude du point de destination
    *               DestLong        Coordonnée GPS Longitude du point de destination
    * 
    *********************************************************************************************************
    */
    public static MemoryStream GetRouteFromGps(double OrigLat, double OrigLong, double DestLat, double DestLong)
    {
        Location LocDepart = new Location();
        LocDepart.LatLong = new LatLong();
        LocDepart.LatLong.Latitude = OrigLat;
        LocDepart.LatLong.Longitude = OrigLong;

        Location LocArrivee = new Location();
        LocArrivee.LatLong = new LatLong();
        LocArrivee.LatLong.Latitude = DestLat;
        LocArrivee.LatLong.Longitude = DestLong;

        SegmentSpecification[] routeSegment;
        routeSegment = new SegmentSpecification[2];

        routeSegment[0] = new SegmentSpecification();
        routeSegment[0].Waypoint = new Waypoint();
        routeSegment[0].Waypoint.Name = "Depart";
        routeSegment[0].Waypoint.Location = LocDepart;

        routeSegment[1] = new SegmentSpecification();
        routeSegment[1].Waypoint = new Waypoint();
        routeSegment[1].Waypoint.Name = "Arrivee";
        routeSegment[1].Waypoint.Location = LocArrivee;


        RouteSpecification routeSpecs = new RouteSpecification();
        routeSpecs.DataSourceName = "MapPoint.NA";
        routeSpecs.Segments = routeSegment;
 
        RouteServiceSoap routeService = new RouteServiceSoap();
        routeService.Credentials = new System.Net.NetworkCredential("124624", "PDALE_projets5");
        routeService.PreAuthenticate = true;
        // routeService.Proxy = myProxy;

        Route route = new Route();
        route = routeService.CalculateRoute(routeSpecs);

        // Generate the Route Map
        MapSpecification mapSpec = new MapSpecification();
        mapSpec.Options = new MapOptions();
        mapSpec.Options.Format = new ImageFormat();

        //Set the map width and height 
        //according to the PictureBox
        mapSpec.Options.Format.Height = 248;
        mapSpec.Options.Format.Width = 240;

        //Set the Map Datasource
        mapSpec.DataSourceName = "MapPoint.NA"; ;

        mapSpec.Route = route;

        MemoryStream stream;

        // Get the map image
        RenderServiceSoap renderService = new RenderServiceSoap();
        renderService.Credentials = new System.Net.NetworkCredential("124624", "PDALE_projets5");
        MapImage tempImage = renderService.GetMap(mapSpec)[0];

        Bitmap myMap = new Bitmap(new MemoryStream(tempImage.MimeData.Bits, false), true);

        stream = new MemoryStream();
        myMap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

        return stream;

        //System.Threading.Thread.Sleep(1000);
        //System.Diagnostics.Process.Start("c:\\map\\bmpcvt.exe","c:\\map\\map.bmp -convertintobestpalette -saveasmap,3 -exit");
        //System.Diagnostics.Process.Start("c:\\map\\bmpcvt.exe", "c:\\map\\map.bmp -convertintobestpalette -saveasc:\\map\\toto.c,1 -exit");
        //stsMain.Text = "Done";//BmpCvt logo.bmp -convertintobestpalette -saveaslogo,1 -exit

    }