From 95ca25186ad068389329e3ce01210b2a90d87801 Mon Sep 17 00:00:00 2001 From: bozmir Date: Mon, 21 Oct 2024 13:38:40 +0200 Subject: [PATCH] settings now come from the layer gameobject itself because the template prefab will not be initialized correctly in webgl --- .../_Functionalities/Wms/Prefabs/WMSLayer.prefab | 6 +++--- .../Wms/Scripts/WMSImportAdapter.cs | 2 +- .../Wms/Scripts/WMSLayerGameObject.cs | 14 +++++++------- .../Wms/Scripts/WMSTileDataLayer.cs | 9 +-------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Assets/_Functionalities/Wms/Prefabs/WMSLayer.prefab b/Assets/_Functionalities/Wms/Prefabs/WMSLayer.prefab index e8955a0d..56db2384 100644 --- a/Assets/_Functionalities/Wms/Prefabs/WMSLayer.prefab +++ b/Assets/_Functionalities/Wms/Prefabs/WMSLayer.prefab @@ -55,6 +55,9 @@ MonoBehaviour: onHide: m_PersistentCalls: m_Calls: [] + TransparencyEnabled: 1 + DefaultEnabledLayersMax: 5 + PreferredImageSize: {x: 1024, y: 1024} --- !u!114 &1347090001780688696 MonoBehaviour: m_ObjectHideFlags: 0 @@ -84,9 +87,6 @@ MonoBehaviour: onLogMessage: m_PersistentCalls: m_Calls: [] - TransparencyEnabled: 1 - DefaultEnabledLayersMax: 5 - PreferredImageSize: {x: 1024, y: 1024} --- !u!114 &7900166245345724691 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs b/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs index 6936622c..30c54dad 100644 --- a/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs +++ b/Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs @@ -69,7 +69,7 @@ public void Execute(LocalFile localFile) var sourceUrl = localFile.SourceUrl; string url = sourceUrl.Split('?')[0]; var wmsFolder = new FolderLayer(url); - + switch (wms.requestType) { case WMS.RequestType.GetCapabilities: diff --git a/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs b/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs index 647304de..a923b950 100644 --- a/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs +++ b/Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs @@ -11,10 +11,10 @@ namespace Netherlands3D.Twin.Layers /// public class WMSLayerGameObject : CartesianTileLayerGameObject, ILayerWithPropertyData { - public WMSTileDataLayer WMSProjectionLayer => wmsProjectionLayer; - public bool TransparencyEnabled => WMSProjectionLayer.TransparencyEnabled; - public int DefaultEnabledLayersMax => WMSProjectionLayer.DefaultEnabledLayersMax; - public Vector2Int PreferredImageSize => WMSProjectionLayer.PreferredImageSize; + public WMSTileDataLayer WMSProjectionLayer => wmsProjectionLayer; + public bool TransparencyEnabled = true; //this gives the requesting url the extra param to set transparancy enabled by default + public int DefaultEnabledLayersMax = 5; //in case the dataset is very large with many layers. lets topggle the layers after this count to not visible. + public Vector2Int PreferredImageSize = Vector2Int.one * 512; public LayerPropertyData PropertyData => urlPropertyData; private WMSTileDataLayer wmsProjectionLayer; @@ -28,8 +28,8 @@ protected override void Awake() protected override void Start() { - base.Start(); - wmsProjectionLayer.WmsUrl = urlPropertyData.Data.ToString(); + base.Start(); + WMSProjectionLayer.WmsUrl = urlPropertyData.Data.ToString(); LayerData.LayerOrderChanged.AddListener(SetRenderOrder); SetRenderOrder(LayerData.RootIndex); } @@ -38,7 +38,7 @@ protected override void Start() public void SetRenderOrder(int order) { //we have to flip the value because a lower layer with a higher index needs a lower render index - wmsProjectionLayer.RenderIndex = -order; + WMSProjectionLayer.RenderIndex = -order; } public virtual void LoadProperties(List properties) diff --git a/Assets/_Functionalities/Wms/Scripts/WMSTileDataLayer.cs b/Assets/_Functionalities/Wms/Scripts/WMSTileDataLayer.cs index 4313e96d..239c0a1c 100644 --- a/Assets/_Functionalities/Wms/Scripts/WMSTileDataLayer.cs +++ b/Assets/_Functionalities/Wms/Scripts/WMSTileDataLayer.cs @@ -10,14 +10,7 @@ namespace Netherlands3D.Twin { public class WMSTileDataLayer : ImageProjectionLayer - { - //this gives the requesting url the extra param to set transparancy enabled by default - public bool TransparencyEnabled = true; - - //in case the dataset is very large with many layers. lets topggle the layers after this count to not visible. - public int DefaultEnabledLayersMax = 5; - - public Vector2Int PreferredImageSize = Vector2Int.one * 512; + { public int RenderIndex {