Skip to content

Commit

Permalink
Setting uri property data which is still url propertydata, directly i…
Browse files Browse the repository at this point in the history
…nstead of SetURL
  • Loading branch information
bozmir committed Oct 14, 2024
1 parent bef2c32 commit 446e0aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
11 changes: 3 additions & 8 deletions Assets/_Functionalities/Wms/Scripts/WMSImportAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions Assets/_Functionalities/Wms/Scripts/WMSLayerGameObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Netherlands3D.Twin.Layers
/// </summary>
public class WMSLayerGameObject : CartesianTileLayerGameObject, ILayerWithPropertyData
{
private WMSTileDataLayer wmsProjectionLayer;
public WMSTileDataLayer WMSProjectionLayer
{
get
Expand All @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit 446e0aa

Please sign in to comment.