/// <summary> /// Gets the wms service description appropriate for the requested type, epsg, source /// </summary> /// <param name="type"></param> /// <param name="epsg"></param> /// <param name="source"></param> /// <returns></returns> private Cartomatic.Wms.WmsDriver.WmsServiceDescription GetWmsServiceDescription(string type, string epsg, string source) { var key = type + "_" + epsg + "_" + source; Cartomatic.Wms.WmsDriver.WmsServiceDescription sd = null; if (!RuntimeServiceDescriptions.ContainsKey(key)) { //extract service descriptions and create its safe copy sd = BaseServiceDescriptions["main"].Clone();; //if there is an additional service description available //extract it an merge with the main object if (BaseServiceDescriptions.ContainsKey(source)) { var sd_source = BaseServiceDescriptions[source]; sd.Merge(sd_source, new string[] { "Abstract" }); //merge the abstracts so it actually is made of the main and source abstract strings! } //adjust the base service url so it is paramless and valid for both - public facing and internal services sd.PublicAccessURL = GetPublicServiceUrl(type, epsg, source); //and save for further referencce RuntimeServiceDescriptions[key] = sd; } else { sd = RuntimeServiceDescriptions[key]; } return(sd); }
/// <summary> /// creates a new driver instance /// </summary> /// <param name="gdalPath">path to the gdal stuff</param> /// <param name="dataSource">data source file path</param> /// <param name="layerName">Optional layer name to be used in the LAYERS param of the GetMap request instead of the file name</param> /// <param name="srid">srid of the data source</param> /// <param name="serviceDescription">service description object</param> public WmsDriver( string gdalPath, string dataSource, string layerName, string srid, Cartomatic.Wms.WmsDriver.WmsServiceDescription serviceDescription ) { //wms service description this.ServiceDescription = serviceDescription; GdalPath = gdalPath; //well if this throws errors, then the param is not valid ayway ;) kinda forcing to check this prior to instantiating this object //the base wms driver tests the epsg in order to properly understand the bbox and it expets int hence parsing this.SRID = Int32.Parse(srid); this.DataSource = dataSource; this.DataSourceName = layerName; ApplyWmsSettings(); }