User Tools

Site Tools


source_code_worldmapwmsservice_project_templates_mvc_cs.zip

Source Code WorldMapWmsService Project Templates Mvc CS.zip

DefaultController.cs

 using System;  
 using System.Collections.ObjectModel;  
 using System.Globalization;  
 using System.IO;  
 using System.Linq;  
 using System.Net;  
 using System.Runtime.Serialization.Json;  
 using System.Text;  
 using System.Web.Mvc;  
 using System.Xml.Linq;  
 using System.Xml.XPath;  
 using ThinkGeo.MapSuite.Core;  
 using ThinkGeo.MapSuite.MvcEdition;  
 
 namespace ThinkGeo.MapSuite.WMSServiceClient  
 {  
     public class DefaultController : Controller  
     {  
         private static readonly string serviceUri;  
         private static readonly string highlightKey;  
         private static readonly string markerOverlayKey;  
         private static readonly Collection<User> users;  
 
         static DefaultController()  
         {  
             users = GetUsers();  
             highlightKey = "Highlight";  
             markerOverlayKey = "Marker Overlay";  
             serviceUri = "http://localhost:52289/WmsHandler.axd";  
         }  
 
         public ActionResult Index()  
         {  
             Map Map1 = new Map("Map1");  
             Map1.Width = System.Web.UI.WebControls.Unit.Percentage(100);  
             Map1.Height = System.Web.UI.WebControls.Unit.Percentage(100);  
             // Initialize map.  
             Map1.MapUnit = GeographyUnit.DecimalDegree;  
             Map1.CurrentExtent = new RectangleShape(-170, 70, 170, -70);  
             Map1.EditOverlay.TrackMode = TrackMode.None;  
             Map1.OnClientTrackShapeFinished = "MvcMapOnTrackShapeFinished";  
 
             InitializeOverlays(Map1);  
 
             ViewData["Users"] = users;  
 
             return View(Map1);  
         }  
 
         [MapActionFilter]  
         public ActionResult MapView(Map map, GeoCollection<object> args)  
         {  
             User currentUser = users.FirstOrDefault(a => a.UserName.Equals(args[0].ToString()));  
 
             WmsOverlay wmsOverlay = (WmsOverlay)map.CustomOverlays["worldMapService"];  
             wmsOverlay.Parameters["ClientId"] = currentUser.ClientId;  
             wmsOverlay.Parameters["UserName"] = currentUser.UserName;  
 
             return View(map);  
         }  
 
         [MapActionFilter]  
         public string SelectedUserChanged(Map map, GeoCollection<object> args)  
         {  
             User currentUser = users.FirstOrDefault(a => a.UserName.Equals(args[0].ToString()));  
 
             string result = string.Empty;  
             if (currentUser != null)  
             {  
                 Session["user"] = currentUser.UserName;  
                 Session["ClientId"] = currentUser.ClientId;  
                 result = currentUser.MapStyle + "|" + currentUser.ClientId;  
             }  
 
             return result;  
         }  
 
         [MapActionFilter]  
         public string MvcMapOnTrackShapeFinished(Map map, GeoCollection<object> args)  
         {  
             string result = "NoValidateClickPoint";  
             if (map != null)  
             {  
                 BaseShape shape = new Feature(args[0].ToString()).GetShape();  
                 string featureFormat = "TEXT/JSON";  
                 string mapFormat = "image/png";  
                 string mapPorjection = args[1].ToString().Equals("DecimalDegree") ? "EPSG:4326" : "EPSG:900913";  
 
                 if (shape is PointShape)  
                 {  
                     PointShape centerPoint = shape as PointShape;  
                     bool sucessful = DisplayHighlightLayer(map, centerPoint, featureFormat, mapFormat, mapPorjection);  
                     if (sucessful)  
                     {  
                         DisplayMarker(map, centerPoint);  
 
                         LayerOverlay hightOverlay = (LayerOverlay)map.CustomOverlays[highlightKey];  
                         InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)hightOverlay.Layers[0];  
                         result = highlightLayer.GetBoundingBox().GetWellKnownText();  
                     }  
                 }  
                 else  
                 {  
                     result = "OutOfBoundary";  
                 }  
             }  
             return result;  
         }  
 
         [MapActionFilter]  
         public string ClearAllShape(Map map, GeoCollection<object> args)  
         {  
             // Clear the highlight select layer.  
             LayerOverlay hightOverlay = (LayerOverlay)map.CustomOverlays[highlightKey];  
             InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)hightOverlay.Layers[0];  
             highlightLayer.InternalFeatures.Clear();  
 
             //Clear marker on marker.  
             InMemoryMarkerOverlay markerOverlay = (InMemoryMarkerOverlay)map.CustomOverlays[markerOverlayKey];  
             markerOverlay.FeatureSource.InternalFeatures.Clear();  
 
             return "success";  
         }  
 
         private void InitializeOverlays(Map map)  
         {  
             Uri uri = new Uri(serviceUri);  
             WmsOverlay wmsOverlay = new WmsOverlay("worldMapService", uri);  
             wmsOverlay.Parameters.Add("layers", "WorldMap");  
             wmsOverlay.Parameters.Add("styles", "DEFAULT");  
             wmsOverlay.Parameters.Add("srs", "EPSG:4326");  
             wmsOverlay.Parameters.Add("clientId", string.Empty);  
             wmsOverlay.Parameters.Add("userName", string.Empty);  
             wmsOverlay.WebImageFormat = WebImageFormat.Png;  
             wmsOverlay.IsBaseOverlay = true;  
             map.CustomOverlays.Add(wmsOverlay);  
 
             //Highlight layer.  
             LayerOverlay highlightOverlay = new LayerOverlay(highlightKey);  
             InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer();  
             GeoColor serviceAreaGeoColor = new GeoColor(120, GeoColor.FromHtml("#1749c9"));  
             highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(serviceAreaGeoColor, GeoColor.SimpleColors.Yellow, 1, LineDashStyle.Solid);  
             highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;  
             highlightOverlay.Layers.Add(highlightLayer);  
             map.CustomOverlays.Add(highlightOverlay);  
 
             //Marker Overlay  
             InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay(markerOverlayKey);  
             markerOverlay.FeatureSource.Open();  
             markerOverlay.Columns.Add(new FeatureSourceColumn("LONG_NAME"));  
             markerOverlay.Columns.Add(new FeatureSourceColumn("POP_CNTRY"));  
             markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = GetPopupContent();  
             markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoSize = true;  
             markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new WebImage(Url.Content("~/Images/drawPoint.png"), 32, 32, -16, -16);  
             markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;  
 
             map.CustomOverlays.Add(markerOverlay);  
         }  
 
         private bool DisplayHighlightLayer(Map map, PointShape centerPoint, string featureFormat, string mapForamt, string mapProjection)  
         {  
             bool successful = false;  
             Feature feature = QueryFeatureByPoint(map, centerPoint, featureFormat, mapForamt, mapProjection);  
 
             if (feature != null)  
             {  
                 LayerOverlay hightOverlay = (LayerOverlay)map.CustomOverlays[highlightKey];  
                 InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)hightOverlay.Layers[0];  
 
                 highlightLayer.Open();  
                 highlightLayer.InternalFeatures.Clear();  
                 highlightLayer.InternalFeatures.Add(feature);  
                 successful = true;  
             }  
             return successful;  
         }  
 
         private static void DisplayMarker(Map map, PointShape centerPoint)  
         {  
             var highlightLayer = ((LayerOverlay)map.CustomOverlays[highlightKey]).Layers.SingleOrDefault() as InMemoryFeatureLayer;  
 
             if (highlightLayer.InternalFeatures != null && highlightLayer.InternalFeatures.Count > 0)  
             {  
                 Feature currentFeature = highlightLayer.InternalFeatures.SingleOrDefault();  
                 var markerOverlay = (InMemoryMarkerOverlay)map.CustomOverlays.SingleOrDefault(a => a.Name.Equals(markerOverlayKey));  
 
                 Feature markerFeature = new Feature(centerPoint);  
 
                 string name = "LONG_NAME";  
                 string population = "POP_CNTRY";  
 
                 markerFeature.ColumnValues.Add(name, currentFeature.ColumnValues[name]);  
                 markerFeature.ColumnValues.Add(population, currentFeature.ColumnValues[population]);  
 
                 markerOverlay.FeatureSource.InternalFeatures.Clear();  
                 markerOverlay.FeatureSource.InternalFeatures.Add(markerFeature);  
             }  
         }  
 
         private Feature QueryFeatureByPoint(Map map, PointShape centerPoint, string featureFormat, string mapForamt, string mapProjection)  
         {  
             Feature feature = null;  
             // Construct the service request url.  
             string serviceUrl = GetQueryFeatureServiceUrl(map, centerPoint, featureFormat, mapForamt, mapProjection);  
 
             // Send request to server.  
             WebRequest getFeatureRequest = WebRequest.Create(serviceUrl);  
             WebResponse response = getFeatureRequest.GetResponse();  
 
             // Deserilize the feature from response.  
             DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(SerializableFeatures[]));  
             try  
             {  
                 Stream responseStream = response.GetResponseStream();  
                 if (responseStream != null)  
                 {  
                     SerializableFeatures[] features = (SerializableFeatures[])serializer.ReadObject(responseStream);  
                     if (features.Length != 0 || features.FirstOrDefault() != null)  
                     {  
                         var responseFeature = features.FirstOrDefault();  
                         if (responseFeature != null)  
                         {  
                             var realFeature = responseFeature.features.FirstOrDefault();  
                             feature = realFeature.RealFeature;  
                         }  
                     }  
                 }  
             }  
             catch (Exception)  
             {  
             }  
             return feature;  
         }  
 
         private string GetQueryFeatureServiceUrl(Map map, PointShape centerPoint, string featureFormat, string mapFormat, string projection)  
         {  
             ScreenPointF screenPoint = ExtentHelper.ToScreenCoordinate(map.CurrentExtent, centerPoint.X, centerPoint.Y, (float)map.WidthInPixels, (float)map.HeightInPixels);  
             string clientId = Session["ClientId"].ToString();  
             string bbox = ConvertBoundingBoxToString(map.CurrentExtent);  
 
             StringBuilder parameters = new StringBuilder();  
             parameters.Append(serviceUri + "?");  
             parameters.Append("LAYERS=WorldMap&");  
             parameters.Append("STYLES=DEFAULT&");  
             parameters.Append("SERVICE=WMS&");  
             parameters.Append("VERSION=1.1.1&");  
             parameters.Append("REQUEST=GETFEATUREINFO&");  
             parameters.Append("QUERY_LAYERS=WorldMap&");  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "X={0}&", (int)screenPoint.X);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "Y={0}&", (int)screenPoint.Y);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "INFO_FORMAT={0}&", featureFormat);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "ClientId={0}&", clientId);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "FEATURE_COUNT={0}&", 1);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "FORMAT={0}&", mapFormat);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "SRS={0}&", projection);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "WIDTH={0}&", map.WidthInPixels);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "HEIGHT={0}&", map.HeightInPixels);  
             parameters.AppendFormat(CultureInfo.InvariantCulture, "BBOX={0}", bbox);  
 
             return parameters.ToString();  
         }  
 
         private static string ConvertBoundingBoxToString(RectangleShape boundingBox)  
         {  
             return String.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", boundingBox.LowerLeftPoint.X, boundingBox.LowerLeftPoint.Y, boundingBox.UpperRightPoint.X, boundingBox.UpperRightPoint.Y);  
         }  
 
         private static string GetPopupContent()  
         {  
             StringBuilder popupContext = new StringBuilder("<div class = 'popup'>");  
             popupContext.Append("<table>");  
             popupContext.Append("<tr><td class='popupTitle'>Name: [#LONG_NAME#]</td></tr>");  
             popupContext.Append("<tr><td><div class='hrLine'></div></td></tr>");  
             popupContext.Append("<tr><td><font size='0.6px' color='gray'>");  
             popupContext.Append("Population: [#POP_CNTRY#]</td></tr>");  
             popupContext.Append("</table>");  
             popupContext.Append("</div>");  
             return popupContext.ToString();  
         }  
 
         private static Collection<User> GetUsers()  
         {  
             Collection<User> result = new Collection<User>();  
             string userXmlPath = System.Web.HttpContext.Current.Server.MapPath(@"~\UserDataXml\Users.xml");  
             XDocument xmlDocument = XDocument.Load(userXmlPath);  
             var usersInformation = xmlDocument.XPathSelectElements("Users/User");  
 
             //TODO:  
             foreach (var item in usersInformation)  
             {  
                 User user = new User();  
                 user.UserName = item.XPathSelectElement("UserName").Value;  
                 user.ClientId = item.XPathSelectElement("ClientId") == null ? string.Empty : item.XPathSelectElement("ClientId").Value;  
                 user.MapStyle = item.XPathSelectElement("MapStyle") == null ? string.Empty : item.XPathSelectElement("MapStyle").Value;  
                 result.Add(user);  
             }  
             return result;  
         }  
 
 
     }  
 }  
 

SerializableFeature.cs

 using System.Collections.Generic;  
 using System.Runtime.Serialization;  
 using ThinkGeo.MapSuite.Core;  
 
 namespace ThinkGeo.MapSuite.WMSServiceClient  
 {  
     [DataContract]  
     public class SerializableFeature  
     {  
         private string id;  
         private string wkt;  
         private Feature feature;  
 
         [DataMember(Name|= "fieldValues")]  
         public Dictionary<string, string> fieldValues { get; set; }  
 
         [DataMember(Name|= "id")]  
         public string Id  
         {  
             get { return id; }  
             set { id = value; }  
         }  
 
         [DataMember(Name|= "wkt")]  
         public string Wkt  
         {  
             get { return wkt; }  
             set  
             {  
                 wkt = value;  
                 feature = new Feature(wkt);  
                 foreach (var fieldValue in fieldValues)  
                 {  
                     feature.ColumnValues.Add(fieldValue.Key, fieldValue.Value);  
                 }  
             }  
         }  
 
         public Feature RealFeature  
         {  
             get { return feature; }  
             set { feature = value; }  
         }  
     }  
 
     public class SerializableFeatures  
     {  
         private string name;  
 
         [DataMember(Name|= "name")]  
         public string Name  
         {  
             get { return name; }  
             set { name = value; }  
         }  
 
         [DataMember(Name|= "features")]  
         public SerializableFeature[] features { get; set; }  
     }  
 }  
 

User.cs

 
 namespace ThinkGeo.MapSuite.WMSServiceClient  
 {  
     public class User  
     {  
         private string userName;  
         private string clientId;  
         private string mapStyle;  
 
         public string UserName  
         {  
             get { return userName; }  
             set { userName = value; }  
         }  
 
         public string ClientId  
         {  
             get { return clientId; }  
             set { clientId = value; }  
         }  
 
         public string MapStyle  
         {  
             get { return mapStyle; }  
             set { mapStyle = value; }  
         }  
     }  
 }  
 

UserModel.cs

 using System.Collections.ObjectModel;  
 using System.Web.Mvc;  
 
 namespace ThinkGeo.MapSuite.WMSServiceClient  
 {  
     public class UsersModel  
     {  
         public Collection<SelectListItem> users { get; set; }  
     }  
 }  
 

ready-functions.js

 $(document).ready(function () {  
     window.onload = resizeElementHeight();  
     $(window).resize(resizeElementHeight);  
 
     $("#toggle").bind("click", function () {  
         if ($("#leftContainer").is(':visible')) {  
             $("#collapse").attr("src", "Images/expand.gif");  
             $("#map-content").css("width", "99%");  
             $("#toggle").css("left", "5px");  
             $("#leftContainer").hide();  
         }  
         else {  
             $("#leftContainer").show();  
             $("#collapse").attr("src", "Images/collapse.gif");  
             $("#map-content").css("width", "80%");  
             $("#toggle").css("left", "20%");  
         }  
         resizeElementHeight();  
     });  
     var btnTracks = $("#divTrackMode").find("img");  
     for (var i = 0; i < btnTracks.length; i++) {  
         $(btnTracks[i]).css("cursor", "pointer");  
         $(btnTracks[i]).bind("click", function () {  
             var btnTracks = $("#divTrackMode").find("img");  
             for (var i = 0; i < btnTracks.length; i++) {  
                 $(btnTracks[i]).css("border", "0px solid #D3D3D3");  
                 $(btnTracks[i]).css("background-color", "transparent");  
             }  
             $(this).css("border", "1px solid #D3D3D3");  
             $(this).css("background-color", "#eeeeee");  
         });  
     };  
 
     $("#dlgErrorMessage").dialog({  
         autoOpen: false,  
         modal: true,  
         buttons: {  
             Ok: function () {  
                 $(this).dialog("close");  
             }  
         }  
     });  
 
     $("#dlgLoginRequired").dialog({  
         autoOpen: false,  
         modal: true,  
         buttons: {  
             Ok: function () {  
                 $(this).dialog("close");  
             }  
         }  
     });  
 
     initEvent();  
 });  
 
 
 function onmapcreating(map) {  
     if (map.units == "m") {  
         map.maxExtent = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);  
         map.restrictedExtent = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);  
         maxResolution = 19567.87923828125;  
     }  
     else {  
         map.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);  
         map.restrictedExtent = new OpenLayers.Bounds(-180, -90, 180, 90);  
         maxResolution = 0.17578125;  
     }  
 }  
 
 function cbxUserSelectedIndexChanged() {  
     var userName = $('#sltUserList').val();  
     Map1.ajaxCallAction('Default', 'SelectedUserChanged', { selectUser: userName }, function (result) {  
         var response = result.get_responseData().split("|");  
         $("#txtStyle").val(response[0]);  
 
         var wmsOverlay = Map1.getLayer("worldMapService");  
         wmsOverlay.params["CLIENTID"] = response[1];  
         wmsOverlay.params["USERNAME"] = userName;  
 
         wmsOverlay.redraw(true);  
     });  
 }  
 
 function cbxPictureFormatSelectedIndexChanged() {  
     var wmsOverlay = Map1.getLayer("worldMapService");  
     var mapFormat = $('#cbxPictureFormat').find('option:selected').val();  
     if (mapFormat == "Png")  
         wmsOverlay.params["FORMAT"] = "image/png";  
     else {  
         wmsOverlay.params["FORMAT"] = "image/jpeg";  
     }  
     wmsOverlay.redraw(true);  
 }  
 
 function cbxMapProjectSelectedIndexChanged() {  
     OperateMap("clearAll");  
     var mapProject = $('#cbxMapProject').find('option:selected').val();  
     var wmsOverlay = Map1.getLayer("worldMapService");  
     if (mapProject == "DecimalDegree") {  
         Map1.units = 'degrees';  
         //Map1.MapUnit = "DecimalDegree";  
         wmsOverlay.params["SRS"] = "EPSG:4326";  
         wmsOverlay.projection = new OpenLayers.Projection("EPSG:4326");  
         Map1.displayProjection = new OpenLayers.Projection("EPSG:4326");  
         Map1.projection = new OpenLayers.Projection("EPSG:4326");  
     }  
     else {  
         //Map1.MapUnit = "Meter";  
         wmsOverlay.params["SRS"] = "EPSG:900913";  
         wmsOverlay.projection = new OpenLayers.Projection("EPSG:900913");  
         Map1.displayProjection = new OpenLayers.Projection("EPSG:900913");  
         Map1.projection = "EPSG:900913";  
         ////Map1.projection.addTransform("EPSG:4326", "EPSG:900913", OpenLayers.Projection.nullTransform);  
         Map1.maxExtent = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);  
         Map1.maxResolution = 156543.03390625;  
         Map1.units = 'm';  
     }  
     wmsOverlay.redraw(true);  
 }  
 
 function OperateMap(operate) {  
     switch (operate) {  
         case "drawPoint":  
             var userName = $('#sltUserList').val();  
             if (userName == "Anonymous") {  
                 var btnTracks = $("#divTrackMode").find("img");  
                 $(btnTracks[0]).css("border", "1px solid #D3D3D3");  
                 $(btnTracks[0]).css("background-color", "#eeeeee");  
                 $(btnTracks[1]).css("border", "0px solid #D3D3D3");  
                 $(btnTracks[1]).css("background-color", "transparent");  
 
     $("#btnApply").trigger("click");  
                 $("#imgPan").trigger("click");  
                 $("#dlgLoginRequired").dialog("open");  
                 $(".ui-dialog-titlebar").hide();  
             } else {  
                 Map1.setDrawMode('Point');  
             }  
             break;  
         case "clearAll":  
             Map1.ajaxCallAction('Default', 'ClearAllShape', null, function (result) {  
                 if (result.get_responseData() == "success") {  
                     Map1.getLayer("Highlight").redraw(true);  
                     Map1.getLayer("Marker Overlay").redraw();  
                     $("#imgPan").trigger("click");  
                 }  
             });  
             break;  
         default:  
             Map1.setDrawMode('Normal');  
             break;  
     }  
 }  
 
 function initEvent() {  
     Map1.events.register("mousemove", Map1, function (e) {  
         var mouseCoordinate = this.getLonLatFromPixel(new OpenLayers.Pixel(e.clientX, e.clientY));  
         if (mouseCoordinate) {  
             $("#spanMouseCoordinate").text("X:" + mouseCoordinate.lon.toFixed(6) + "  Y: " + mouseCoordinate.lat.toFixed(6));  
         }  
     });  
 }  
 
 function resizeElementHeight() {  
     var documentheight = $(window).height();  
     var contentDivH = documentheight - $("#footer").height() - $("#header").height() - 1;  
     $("#content-container").height(contentDivH + "px");  
 
     $("#leftContainer").height(contentDivH + "px");  
     $("#map-content").height(contentDivH - 2 + "px");  
     $("#toggle").css("line-height", contentDivH + "px");  
 
     // refresh the map.  
     Map1.updateSize();  
 }  
 
 function MvcMapOnTrackShapeFinished(e) {  
     Map1.ajaxCallAction('Default', 'MvcMapOnTrackShapeFinished',  
         {  
             featureWkt: JSON.parse(e.features)[0].wkt,  
             mapPorjection: $('#cbxMapProject').find('option:selected').val()  
         },  
         function (result) {  
             Map1.getEditOverlay().removeAllFeatures();  
             if (result.get_responseData() == "" || result.get_responseData() == "OutOfBoundary" || result.get_responseData() == "NoValidateClickPoint") {  
                 $("#dlgErrorMessage").dialog("open");  
             } else {  
                 var bbox = OpenLayers.Geometry.fromWKT(result.get_responseData()).getBounds();  
                 Map1.zoomToExtent(bbox, false);  
 
                 Map1.getLayer("Highlight").redraw(true);  
                 Map1.getLayer("Marker Overlay").redraw(true);  
             }  
         });  
 }  
 

Index.cshtml

 @using ThinkGeo.MapSuite.Core  
 @using ThinkGeo.MapSuite.MvcEdition  
 @using System.Collections.ObjectModel;  
 @using ThinkGeo.MapSuite.WMSServiceClient;  
 @model ThinkGeo.MapSuite.MvcEdition.Map  
 @{  
     ViewBag.Title = "World Map WMS Service Client";  
 }  
 <div id="container">  
     <div id="header">  
         <div id="left-header">  
             <span id="header-mapsuite">Map Suite</span> <span id="header-title">World Map WMS Service  
                 Client</span>  
         </div>  
     </div>  
     <div id="content-container">  
         <div id="leftContainer">  
             <div id="leftContent">  
                 <h4>  
                     Access the WMS service as this user:  
                     <br />  
                     <span class="comments">("If you select "Anonymous", a watermark will be displayed and  
                         querying will be disabled.) </span>  
                 </h4>  
                 <div id="divConfig" class="divBorder">  
                     <div class="divSettingItem">  
                         <span class="title">User Name:</span>  
                         <select id="sltUserList" onchange="cbxUserSelectedIndexChanged();">  
                             @foreach (User user in (Collection<User>)ViewData["Users"])  
                             {  
                                 <option>@user.UserName</option>  
                             }  
                         </select>  
                     </div>  
                     <div class="divSettingItem">  
                         <span class="title">WMS Style:</span>  
                         <input type="text" runat="server" id="txtStyle" disabled="disabled" value="Default" />  
                     </div>  
                     <div class="divSettingItem">  
                         <span class="title">Map Projection:</span>  
                         <select id="cbxMapProject" onchange="cbxMapProjectSelectedIndexChanged()">  
                             <option value="DecimalDegree">DecimalDegree</option>  
                             <option value="Mercator">Mercator</option>  
                         </select>  
                     </div>  
                 </div>  
                 <h4>  
                     Select the pin and click on the map to highlight the country you clicked:</h4>  
                 <div id="divTrackMode" class="divBorder">  
                     <img id="imgPan" class="active" alt="Pan the map" title="Pan the map" src="/Images/pan.png"  
                         onclick="OperateMap('normal')" />  
                     <img alt="Highlight a country" title="Highlight a country" src="/Images/drawPoint.png"  
                         onclick="OperateMap('drawPoint')" />  
                     <img alt="Remove pin and selection" title="Remove pin and selection" src="/Images/clear.png"  
                         onclick="OperateMap('clearAll')" />  
                 </div>  
                 <div class="blueBanner">  
                     WMS Service Configurations:  
                 </div>  
                 <div>  
                     <a href="http://localhost:52289/WmsHandler.axd?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities"  
                         target="_blank">Get WMS Capabilities</a>  
                 </div>  
                 <div>  
                     <a href="http://localhost:52289/Default.aspx" target="_blank">View WMS Admin Page</a>  
                 </div>  
             </div>  
         </div>  
         <div id="toggle">  
             <img id="collapse" alt="collapse" src="/Images/collapse.gif" />  
         </div>  
         <div id="map-content" style="z-index: 8888;">  
             @{  
                 Html.RenderPartial("MapView", Model);  
             }  
         </div>  
     </div>  
     <div id="footer">  
         <span id="coordinate"><span id="spanMouseCoordinate"></span></span>  
     </div>  
     <div id="dlgLoginRequired" title="Login Required">  
         <p>  
             Anonymous is not allowed to query the WMS service by clicking the map.  
         </p>  
     </div>  
     <div id="dlgErrorMessage" title="Error Message">  
         <p>  
             No result found, please click on the continent to try again.  
         </p>  
     </div>  
 </div>  
 
 
source_code_worldmapwmsservice_project_templates_mvc_cs.zip.txt · Last modified: 2015/09/09 03:38 by admin