private void mapService_Initialized(object sender, SmMapService.MapServiceInitalizeArgs e) { if (e.MapService.MapServiceUrl == this.Url.Trim()) { if (base.Error != null) { base.Initialize(); } else { this.Bounds = this.mapService.MapServiceInfo.MapBounds; this.Dpi = ScaleHelper.GetSmDpi(this.mapService.MapServiceInfo.ReferViewBounds, this.mapService.MapServiceInfo.ReferViewer, this.mapService.MapServiceInfo.ReferScale); Dpi *= AdjustFactor; base.Initialize(); } } }
private void mapService_Fault(object sender, SmMapService.MapServiceFaultEventArgs args) { if (((args.Error is SecurityException) && !Application.Current.Host.Source.Scheme.Equals(Uri.UriSchemeHttp)) && !Application.Current.Host.Source.Scheme.Equals(Uri.UriSchemeHttps)) { base.Error = new SecurityException(SuperMap.Web.Resources.ExceptionStrings.InvalidURISchemeHost, args.Error); } else { base.Error = args.Error; } base.Initialize(); }
private void mapService_Initialized(object sender, SmMapService.MapServiceInitalizeArgs e) { if (e.MapService.MapServiceUrl == this.Url.Trim()) { if (base.Error != null) { base.Initialize(); } else { Bounds = this.mapService.MapServiceInfo.MapBounds; if (CRS == null) { CRS = this.mapService.MapServiceInfo.CRS; } Dpi = ScaleHelper.GetSmDpi(this.mapService.MapServiceInfo.ReferViewBounds, this.mapService.MapServiceInfo.ReferViewer, this.mapService.MapServiceInfo.ReferScale); Dpi *= AdjustFactor; //在这儿把Scales转换为Resolutions, Dpi已经获得值了 double[] resolutions = new double[Scales.Length]; for (int i = 0; i < Scales.Length; i++) { resolutions[i] = ScaleHelper.ScaleConversion(Scales[i], this.Dpi); } this.Resolutions = resolutions; base.Initialize(); } } }
/// <summary>${mapping_DynamicISLayer_method_Initialize_D}</summary> public override void Initialize() { if (!this.isInitializing && !base.IsInitialized) { #region 必设参数判断 if (string.IsNullOrEmpty(this.Url)) { base.Error = new ArgumentNullException(ExceptionStrings.InvalidUrl); base.Initialize(); return; } if (string.IsNullOrEmpty(this.MapName)) { base.Error = new ArgumentNullException(ExceptionStrings.MapNameIsNull); base.Initialize(); return; } #endregion if (!Url.Contains("http://")) //相对地址 { var pageUrl = System.Windows.Browser.HtmlPage.Document.DocumentUri; var localUrl = pageUrl.AbsoluteUri.Substring(0, pageUrl.AbsoluteUri.IndexOf(pageUrl.AbsolutePath)); Url = localUrl + Url; } if (IsSkipGetSMMapServiceInfo) { if (Bounds.IsEmpty) { Error = new ArgumentNullException("Bounds"); } Dpi = ScaleHelper.GetSmDpi(ReferViewBounds, ReferViewer, ReferScale); Dpi *= AdjustFactor; this.isInitializing = true; base.Initialize(); return; } this.isInitializing = true; this.mapService = new SmMapService(this.Url.Trim(), this.MapName); this.mapService.Initialized += new EventHandler<SmMapService.MapServiceInitalizeArgs>(mapService_Initialized); this.mapService.Failed += new SmMapService.MapServiceFaultEventHandler(mapService_Fault); this.mapService.Initialize(); } }
/// <summary>${mapping_Layer_method_initialize_D}</summary> public override void Initialize() { if (!this.isInitializing && !base.IsInitialized) { #region 必设参数判断 if (string.IsNullOrEmpty(this.Url)) { base.Error = new ArgumentNullException(ExceptionStrings.InvalidUrl); base.Initialize(); return; } if (string.IsNullOrEmpty(this.MapName)) { base.Error = new ArgumentNullException(ExceptionStrings.MapNameIsNull); base.Initialize(); return; } if (string.IsNullOrEmpty(this.MapServiceAddress)) { base.Error = new ArgumentNullException(ExceptionStrings.ServiceAddressError); base.Initialize(); return; } if (MapServicePort == int.MaxValue) { base.Error = new ArgumentNullException(ExceptionStrings.ServicePortIsNull); base.Initialize(); return; } if (this.Scales == null) { base.Error = new ArgumentNullException(ExceptionStrings.ScalesIsNull); base.Initialize(); return; }//如果是缓存必需设置Scales if (string.IsNullOrEmpty(CachedUrl)) { base.Error = new ArgumentNullException(ExceptionStrings.CachedUrlIsNull); base.Initialize(); return; } #endregion if (!Url.Contains("http://")) //相对地址 { var pageUrl = System.Windows.Browser.HtmlPage.Document.DocumentUri; var localUrl = pageUrl.AbsoluteUri.Substring(0, pageUrl.AbsoluteUri.IndexOf(pageUrl.AbsolutePath)); Url = localUrl + Url; } if (IsSkipGetSMMapServiceInfo) { if (Bounds.IsEmpty) { Error = new ArgumentNullException("Bounds"); } Dpi = ScaleHelper.GetSmDpi(ReferViewBounds, ReferViewer, ReferScale); Dpi *= AdjustFactor; double[] resolutions = new double[Scales.Length]; for (int i = 0; i < Scales.Length; i++) { resolutions[i] = ScaleHelper.ScaleConversion(Scales[i], this.Dpi); } this.Resolutions = resolutions; this.isInitializing = true; base.Initialize(); CreateUrl(); return; } this.isInitializing = true; this.mapService = new SmMapService(this.Url.Trim(), this.MapName, this.MapServiceAddress, this.MapServicePort); this.mapService.Initialized += new EventHandler<SmMapService.MapServiceInitalizeArgs>(mapService_Initialized); this.mapService.Failed += new SmMapService.MapServiceFaultEventHandler(mapService_Fault); this.mapService.Initialize(); CreateUrl(); } }