public void ChangeWMSProviderLayout(List<WMSProviderSelectedMaps> NewWMSProviderMaps) { List<WMSProviderBase> overlays = new List<WMSProviderBase>(); WMSProviderBase MapProvider = null; //if (string.IsNullOrEmpty(UserSession.strWMSDefaultLayer) == false) //{ // bool isExist = Capabilities.Layers.Exists(t => t.MapName == UserSession.strWMSDefaultLayer); // if (isExist) // { // // provider.Init(UserSession.strWMSGeoserverUrl, "WorldMaps:World 250m", "png"); // // MapProvider = new WMSProviderBase(); // MapProvider = new WMSProviderBase(UserSession.strWMSDefaultLayer); // MapProvider.Init(UserSession.strWMSGeoserverUrl, UserSession.strWMSDefaultLayer, "png"); // //VH 26.08.2014 // // MapProvider.MaxZoom = 24; // // MapProvider.MinZoom = 0; // MapProvider.initialized = true; // overlays.Add(MapProvider); // } //} if (NewWMSProviderMaps != null) { foreach (WMSProviderSelectedMaps SelectedMap in NewWMSProviderMaps) { if (overlays.Exists(t => t.Name == SelectedMap.MapName)) continue; if (SelectedMap.isSelected) { WMSProviderBase provider = new WMSProviderBase(SelectedMap.MapName); provider.Init(strWMSGeoserverUrl, SelectedMap.MapName, "png"); provider.MinZoom = SelectedMap.UserMinZoom; provider.MaxZoom = SelectedMap.UserMaxZoom; overlays.Add(provider); if (MapProvider == null) { MapProvider = provider; } } } } if (MapProvider != null) { MapProvider.overlays = overlays.ToArray(); p_objMap.MapProvider = MapProvider; } }
public void ChangeWMSProviderLayout(List <WMSProviderSelectedMaps> NewWMSProviderMaps) { List <WMSProviderBase> overlays = new List <WMSProviderBase>(); WMSProviderBase MapProvider = null; //if (string.IsNullOrEmpty(UserSession.strWMSDefaultLayer) == false) //{ // bool isExist = Capabilities.Layers.Exists(t => t.MapName == UserSession.strWMSDefaultLayer); // if (isExist) // { // // provider.Init(UserSession.strWMSGeoserverUrl, "WorldMaps:World 250m", "png"); // // MapProvider = new WMSProviderBase(); // MapProvider = new WMSProviderBase(UserSession.strWMSDefaultLayer); // MapProvider.Init(UserSession.strWMSGeoserverUrl, UserSession.strWMSDefaultLayer, "png"); // //VH 26.08.2014 // // MapProvider.MaxZoom = 24; // // MapProvider.MinZoom = 0; // MapProvider.initialized = true; // overlays.Add(MapProvider); // } //} if (NewWMSProviderMaps != null) { foreach (WMSProviderSelectedMaps SelectedMap in NewWMSProviderMaps) { if (overlays.Exists(t => t.Name == SelectedMap.MapName)) { continue; } if (SelectedMap.isSelected) { WMSProviderBase provider = new WMSProviderBase(SelectedMap.MapName); provider.Init(strWMSGeoserverUrl, SelectedMap.MapName, "png"); provider.MinZoom = SelectedMap.UserMinZoom; provider.MaxZoom = SelectedMap.UserMaxZoom; overlays.Add(provider); if (MapProvider == null) { MapProvider = provider; } } } } if (MapProvider != null) { MapProvider.overlays = overlays.ToArray(); p_objMap.MapProvider = MapProvider; } }
public async Task<Exception> InitMapsAsync() { try { UserMaps usermaps = null; this.strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; string strMapCache_Path = ConfigurationManager.AppSettings["MapCache_Path"]; string strMapCacheEnable = ConfigurationManager.AppSettings["MapCacheEnable"]; bool MapCacheEnable = false; if (string.IsNullOrEmpty(strMapCacheEnable) == false) { if (strMapCacheEnable.ToLower() == "false") { MapCacheEnable = false; } else { MapCacheEnable = true; } } // string strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; if (string.IsNullOrEmpty(strWMSGeoserverUrl)) return null; WMSCapabilities Capabilities = await WMSProviderBase.WMSCapabilitiesRetrieve(strWMSGeoserverUrl); if (Capabilities != null && Capabilities.Error == null) { List<WMSProviderBase> overlays = new List<WMSProviderBase>(); WMSProviderBase MapProvider = null; if (VMMainViewModel.Instance.SimulationHubProxy != null) { usermaps = await SAGSignalR.GetUserMaps(VMMainViewModel.Instance.SimulationHubProxy, UserName); UserParameters userParameters = await SAGSignalR.GetUserParameters(VMMainViewModel.Instance.SimulationHubProxy, UserName); if(usermaps!=null) { foreach (UserMapPreference info in usermaps.maps) { if (overlays.Exists(t => t.Name == info.MapName)) continue; bool isExist = Capabilities.Layers.Exists(t => t.MapName == info.MapName); if (isExist) { WMSProviderBase provider = new WMSProviderBase(info.MapName); provider.Init(strWMSGeoserverUrl, info.MapName, "png"); provider.MinZoom = info.MinZoom; provider.MaxZoom = info.MaxZoom; overlays.Add(provider); if (MapProvider == null) { MapProvider = provider; } } } } if (MapProvider != null) { MapProvider.overlays = overlays.ToArray(); p_objMap.MapProvider = MapProvider; if (MapCacheEnable && string.IsNullOrEmpty(strMapCache_Path)==false) { p_objMap.Manager.Mode = AccessMode.ServerAndCache; p_objMap.CacheLocation = strMapCache_Path; } // p_objMap.Manager.Mode = AccessMode.ServerOnly; //TEMP // p_objMap.Manager.Mode = AccessMode.ServerAndCache; p_objMap.Manager.MemoryCache.Capacity = 44; p_objMap.Zoom = 10; if (userParameters!=null) { p_objMap.Position = new PointLatLng(userParameters.MapHomeCenterY, userParameters.MapHomeCenterX); p_objMap.Zoom = userParameters.MapHomeZoom; } p_objMap.ShowTileGridLines = false; p_objMap.InvalidateVisual(true); } // p_objMap.enGMapProvider = enGMapProviders.WMSCustomProvider; } } return Capabilities.Error; } catch (Exception ex) { return ex; } return null; }
public async Task <Exception> InitMapsAsync() { try { UserMaps usermaps = null; this.strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; string strMapCache_Path = ConfigurationManager.AppSettings["MapCache_Path"]; string strMapCacheEnable = ConfigurationManager.AppSettings["MapCacheEnable"]; bool MapCacheEnable = false; if (string.IsNullOrEmpty(strMapCacheEnable) == false) { if (strMapCacheEnable.ToLower() == "false") { MapCacheEnable = false; } else { MapCacheEnable = true; } } // string strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; if (string.IsNullOrEmpty(strWMSGeoserverUrl)) { return(null); } WMSCapabilities Capabilities = await WMSProviderBase.WMSCapabilitiesRetrieve(strWMSGeoserverUrl); if (Capabilities != null && Capabilities.Error == null) { List <WMSProviderBase> overlays = new List <WMSProviderBase>(); WMSProviderBase MapProvider = null; if (VMMainViewModel.Instance.SimulationHubProxy != null) { usermaps = await SAGSignalR.GetUserMaps(VMMainViewModel.Instance.SimulationHubProxy, UserName); UserParameters userParameters = await SAGSignalR.GetUserParameters(VMMainViewModel.Instance.SimulationHubProxy, UserName); if (usermaps != null) { foreach (UserMapPreference info in usermaps.maps) { if (overlays.Exists(t => t.Name == info.MapName)) { continue; } bool isExist = Capabilities.Layers.Exists(t => t.MapName == info.MapName); if (isExist) { WMSProviderBase provider = new WMSProviderBase(info.MapName); provider.Init(strWMSGeoserverUrl, info.MapName, "png"); provider.MinZoom = info.MinZoom; provider.MaxZoom = info.MaxZoom; overlays.Add(provider); if (MapProvider == null) { MapProvider = provider; } } } } if (MapProvider != null) { MapProvider.overlays = overlays.ToArray(); p_objMap.MapProvider = MapProvider; if (MapCacheEnable && string.IsNullOrEmpty(strMapCache_Path) == false) { p_objMap.Manager.Mode = AccessMode.ServerAndCache; p_objMap.CacheLocation = strMapCache_Path; } // p_objMap.Manager.Mode = AccessMode.ServerOnly; //TEMP // p_objMap.Manager.Mode = AccessMode.ServerAndCache; p_objMap.Manager.MemoryCache.Capacity = 44; p_objMap.Zoom = 10; if (userParameters != null) { p_objMap.Position = new PointLatLng(userParameters.MapHomeCenterY, userParameters.MapHomeCenterX); p_objMap.Zoom = userParameters.MapHomeZoom; } p_objMap.ShowTileGridLines = false; p_objMap.InvalidateVisual(true); } // p_objMap.enGMapProvider = enGMapProviders.WMSCustomProvider; } } return(Capabilities.Error); } catch (Exception ex) { return(ex); } return(null); }