示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.DisplayASimpleMap);

            ManagedProj4Projection proj4Projection = new ManagedProj4Projection();

            proj4Projection.InternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(4326);
            proj4Projection.ExternalProjectionParametersString = ManagedProj4Projection.GetGoogleMapParametersString();

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"SampleData/Countries02.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldLayer.FeatureSource.Projection = proj4Projection;

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add(worldLayer);

            androidMap               = FindViewById <MapView>(Resource.Id.androidmap);
            androidMap.MapUnit       = GeographyUnit.Meter;
            androidMap.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
            androidMap.Overlays.Add(staticOverlay);

            SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType());
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.DisplayASimpleMap);

            androidMap              = FindViewById <MapView>(Resource.Id.androidmap);
            androidMap.MapUnit      = GeographyUnit.Meter;
            androidMap.ZoomLevelSet = new GoogleMapsZoomLevelSet();

            GoogleMapsOverlay googleMapsOverlay = new GoogleMapsOverlay();

            googleMapsOverlay.TileType = TileType.MultiTile;
            androidMap.Overlays.Add(googleMapsOverlay);

            ManagedProj4Projection proj4 = new ManagedProj4Projection();

            proj4.InternalProjectionParametersString = ManagedProj4Projection.GetDecimalDegreesParametersString();
            proj4.ExternalProjectionParametersString = ManagedProj4Projection.GetGoogleMapParametersString();
            proj4.Open();

            androidMap.CurrentExtent = proj4.ConvertToExternalProjection(new RectangleShape(-139.2, 92.4, 120.9, -93.2)) as RectangleShape;

            SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType());
        }