Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Map1.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
                Map1.CurrentExtent = new RectangleShape(-10779959, 3909739, -10777699, 3908399);
                Map1.MapUnit       = GeographyUnit.Meter;

                Map1.MapTools.OverlaySwitcher.Enabled = true;
                Map1.MapTools.MouseCoordinate.Enabled = true;

                //Adds the Google Map as an overlay
                GoogleOverlay google = new GoogleOverlay("Google Map");
                google.GoogleMapType = GoogleMapType.Normal;
                Map1.CustomOverlays.Add(google);

                //Creates polygon feature to be added to the EditOverlay
                PolygonShape polygonShape = new PolygonShape();
                RingShape    ringShape    = new RingShape();
                ringShape.Vertices.Add(new Vertex(-10778968, 3909448));
                ringShape.Vertices.Add(new Vertex(-10778686, 3909443));
                ringShape.Vertices.Add(new Vertex(-10778691, 3909180));
                ringShape.Vertices.Add(new Vertex(-10778982, 3909175));
                ringShape.Vertices.Add(new Vertex(-10778968, 3909448));
                polygonShape.OuterRing = ringShape;

                Feature editFeature = new Feature(polygonShape);
                Map1.EditOverlay.Features.Add(editFeature);

                //Sets the properties so that the features can be only draggable.
                //Notice that we don't set the style here. We set the style in javascript in TestForm.aspx under the script tag.
                Map1.EditOverlay.TrackMode = TrackMode.Edit;
                Map1.EditOverlay.EditSettings.IsDraggable  = true;
                Map1.EditOverlay.EditSettings.IsReshapable = false;
                Map1.EditOverlay.EditSettings.IsResizable  = false;
                Map1.EditOverlay.EditSettings.IsRotatable  = false;
            }
        }
Exemplo n.º 2
0
        //
        // GET: /BaseOverlayChangedEvent/


        public ActionResult BaseOverlayChangedEvent()
        {
            Map map = new Map("Map1",
                              new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage),
                              new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage));

            map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
            map.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
            map.MapUnit       = GeographyUnit.Meter;

            map.MapTools.OverlaySwitcher.Enabled = true;

            GoogleOverlay google = new GoogleOverlay("Google Map");

            google.GoogleMapType        = GoogleMapType.Normal;
            google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUriV3"]);
            map.CustomOverlays.Add(google);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1);
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Proj4Projection proj4 = new Proj4Projection();

            proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
            proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
            worldLayer.FeatureSource.Projection      = proj4;

            LayerOverlay worldOverlay = new LayerOverlay("WorldOverlay");

            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            worldOverlay.Name = "ThinkGeoMap";
            map.CustomOverlays.Add(worldOverlay);

            return(View(map));
        }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
            //map1.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
            map1.CurrentExtent = new RectangleShape(-26939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
            map1.MapUnit = GeographyUnit.Meter;
           
            map1.MapTools.OverlaySwitcher.Enabled = true;
            map1.MapTools.MouseCoordinate.Enabled = true;

            GoogleOverlay google = new GoogleOverlay("Google Map");
            google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUriV3"]);
            google.GoogleMapType = GoogleMapType.Normal;

            map1.CustomOverlays.Clear();
            map1.CustomOverlays.Add(google);

            map1.ExtentChanged += new EventHandler<ExtentChangedEventArgs>(map1_ExtentChanged);            

            GridAllKapal.DataSource = String.Empty;
        }
    }