From 446e0aadff648c04b58a2a96ded70d8c4be6f779 Mon Sep 17 00:00:00 2001 From: bozmir Date: Mon, 14 Oct 2024 14:23:29 +0200 Subject: [PATCH] Setting uri property data which is still url propertydata, directly instead of SetURL --- .../Wms/Scripts/WMSImportAdapter.cs | 11 +++-------- .../Wms/Scripts/WMSLayerGameObject.cs | 14 +++++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs b/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs index 33a3052f..5e711a12 100644 --- a/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs +++ b/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs @@ -127,14 +127,9 @@ private void AddWMSLayer(WMS.WMSLayerQueryParams layer, string sourceUrl, Folder WMSLayerGameObject newLayer = Instantiate(layerPrefab); newLayer.LayerData.SetParent(folderLayer); newLayer.Name = layer.name; - - Debug.Log("Adding WMS layer: " + layer.name); - // Create a layerType URL for the specific layerType UriBuilder uriBuilder = CreateLayerUri(layer, sourceUrl); - var getLayerTypeUrl = uriBuilder.Uri.ToString(); - string finalUrl = Uri.UnescapeDataString(getLayerTypeUrl); - - newLayer.SetURL(finalUrl); + var uri = uriBuilder.Uri.ToString(); + newLayer.SetUrlPropertyData(uri); newLayer.LayerData.ActiveSelf = defaultEnabled; } @@ -143,7 +138,7 @@ private UriBuilder CreateLayerUri(WMS.WMSLayerQueryParams layer, string sourceUr // Start by removing any query parameters we want to inject var uriBuilder = new UriBuilder(sourceUrl); - // Make sure we have a wfsVersion set + // Make sure we have a wmsVersion set if (string.IsNullOrEmpty(wmsVersion)) { Debug.LogWarning("WMS version could not be determined, defaulting to " + defaultFallbackVersion); diff --git a/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs b/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs index 06a8968f..d4d887f4 100644 --- a/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs +++ b/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs @@ -10,7 +10,6 @@ namespace Netherlands3D.Twin.Layers /// public class WMSLayerGameObject : CartesianTileLayerGameObject, ILayerWithPropertyData { - private WMSTileDataLayer wmsProjectionLayer; public WMSTileDataLayer WMSProjectionLayer { get @@ -20,14 +19,14 @@ public WMSTileDataLayer WMSProjectionLayer return wmsProjectionLayer; } } - - private LayerURLPropertyData urlPropertyData = new(); - LayerPropertyData ILayerWithPropertyData.PropertyData => urlPropertyData; - + public LayerPropertyData PropertyData => urlPropertyData; public bool TransparencyEnabled { get => WMSProjectionLayer.TransparencyEnabled; } public int DefaultEnabledLayersMax { get => WMSProjectionLayer.DefaultEnabledLayersMax; } public Vector2Int PreferredImageSize { get => WMSProjectionLayer.PreferredImageSize; } + private WMSTileDataLayer wmsProjectionLayer; + private LayerURLPropertyData urlPropertyData; + protected override void Awake() { base.Awake(); @@ -40,9 +39,10 @@ protected override void Start() wmsProjectionLayer.WmsUrl = this.urlPropertyData.url; } - public void SetURL(string url) + public void SetUrlPropertyData(string url) { - this.urlPropertyData.url = url; + urlPropertyData = new LayerURLPropertyData(); + urlPropertyData.url = url; } //a higher order means rendering over lower indices