using System.Linq;
using Mapbox.Unity.MeshGeneration.Data;
using Mapbox.Unity.SourceLayers;
namespace Mapbox.Unity.Map
{
using System;
using System.Collections.Generic;
using Mapbox.Unity.MeshGeneration.Filters;
using Mapbox.Utils;
using UnityEngine;
public interface ILayer
{
///
/// Gets the type of feature from the `FEATURES` section.
///
MapLayerType LayerType { get; }
///
/// Boolean for setting the feature layer active or inactive.
///
bool IsLayerActive { get; }
///
/// Gets the source ID for the feature layer.
///
string LayerSourceId { get; }
///
/// Gets the `Data Source` for the `MAP LAYERS` section.
///
void SetLayerSource(string source);
void Initialize();
void Initialize(LayerProperties properties);
void Update(LayerProperties properties);
void Remove();
}
public interface IVectorDataLayer : ILayer
{
#region Layer Level APIs
TileJsonData GetTileJsonData();
///
/// Gets the `Data Source` for the `MAP LAYERS` section.
///
void SetLayerSource(VectorSourceType vectorSource);
///
/// Adds the provided `Data Source` (`Tileset ID`) to existing ones. For multiple
/// sources, you can separate with a comma. `Tileset ID` string is added at the
/// end of the existing sources.
///
/// `Data Source` (`Tileset ID`) to add to existing sources.
void AddLayerSource(string vectorSource);
///
/// Sets the layer source as Style-optimized vector tiles
///
/// Vector source.
/// Style-Optimized style id.
/// Modified date.
/// Style name.
void SetLayerSourceWithOptimizedStyle(string vectorSource, string styleId, string modifiedDate, string styleName = null);
///
/// Sets the layer source as Style-optimized vector tiles
///
/// Vector source.
/// Style-Optimized style id.
/// Modified date.
/// Style name.
void SetLayerSourceWithOptimizedStyle(VectorSourceType vectorSource, string styleId, string modifiedDate, string styleName = null);
///
/// Enables coroutines for vector features. Processes the specified amount
/// of them each frame.
///
/// Numbers of features to process each frame.
void EnableVectorFeatureProcessingWithCoroutines(int entityPerCoroutine = 20);
///
/// Disables processing of vector features on coroutines.
///
void DisableVectorFeatureProcessingWithCoroutines();
#endregion
#region LayerOperations
// FEATURE LAYER OPERATIONS
void AddFeatureSubLayer(VectorSubLayerProperties subLayerProperties);
///
/// Adds a sub layer to render polygon features.
/// Default settings include :
/// Extrusion = true
/// ExtrusionType = PropertyHeight
/// ExtrusionGeometryType = Roof And Sides
/// Testuring = Realistic.
///
/// Assigned sub layer name.
/// Data layer name in service.
void AddPolygonFeatureSubLayer(string assignedSubLayerName, string dataLayerNameInService);
///
/// Adds a sub layer to render line features.
/// Default settings include :
/// LineWidth = 1
/// Extrusion = true
/// ExtrusionType = AbsoluteHeight
/// ExtrusionGeometryType = Roof And Sides
/// Testuring = Dark.
///
/// Assigned sub layer name.
/// Data layer name in service.
/// Line width.
void AddLineFeatureSubLayer(string assignedSubLayerName, string dataLayerNameInService, float lineWidth = 1);
///
/// Adds a sub layer to render point features.
///
/// Assigned sub layer name.
/// Data layer name in service.
void AddPointFeatureSubLayer(string assignedSubLayerName, string dataLayerNameInService);
///
/// Adds feature sub layer for rendering using a custom pipeline.
/// Custom Feature Sub Layer should be used with custom modifiers to leverage the layer data or render it using a non-standard pipeline.
///
/// Assigned sub layer name.
/// Data layer name in service.
void AddCustomFeatureSubLayer(string assignedSubLayerName, string dataLayerNameInService);
IEnumerable GetAllFeatureSubLayers();
IEnumerable GetAllPolygonFeatureSubLayers();
IEnumerable GetAllLineFeatureSubLayers();
IEnumerable GetAllPointFeatureSubLayers();
IEnumerable GetFeatureSubLayerByQuery(Func query);
VectorSubLayerProperties GetFeatureSubLayerAtIndex(int i);
VectorSubLayerProperties FindFeatureSubLayerWithName(string featureLayerName);
void RemoveFeatureSubLayerWithName(string featureLayerName);
void RemoveFeatureSubLayer(VectorSubLayerProperties layer);
// POI LAYER OPERATIONS
void AddPointsOfInterestSubLayer(PrefabItemOptions poiLayerProperties);
IEnumerable GetAllPointsOfInterestSubLayers();
PrefabItemOptions GetPointsOfInterestSubLayerAtIndex(int i);
IEnumerable GetPointsOfInterestSubLayerByQuery(Func query);
PrefabItemOptions FindPointsofInterestSubLayerWithName(string poiLayerName);
void RemovePointsOfInterestSubLayerWithName(string poiLayerName);
void RemovePointsOfInterestSubLayer(PrefabItemOptions layer);
#endregion
#region Poi Api Methods
///
/// Places a prefab at the specified LatLon on the Map.
///
/// A Game Object Prefab.
/// A Vector2d(Latitude Longitude) object
void SpawnPrefabAtGeoLocation(GameObject prefab,
Vector2d LatLon,
Action> callback = null,
bool scaleDownWithWorld = true,
string locationItemName = "New Location");
///
/// Places a prefab at all locations specified by the LatLon array.
///
/// A Game Object Prefab.
/// A Vector2d(Latitude Longitude) object
void SpawnPrefabAtGeoLocation(GameObject prefab,
Vector2d[] LatLon,
Action> callback = null,
bool scaleDownWithWorld = true,
string locationItemName = "New Location");
///
/// Places the prefab for supplied categories.
///
/// GameObject Prefab
/// For more than one category separate them by pipe
/// (eg: LocationPrefabCategories.Food | LocationPrefabCategories.Nightlife)
/// Density controls the number of POIs on the map.(Integer value between 1 and 30)
/// Name of this location prefab item for future reference
/// Should the prefab scale up/down along with the map game object?
void SpawnPrefabByCategory(GameObject prefab,
LocationPrefabCategories categories = LocationPrefabCategories.AnyCategory,
int density = 30, Action> callback = null,
bool scaleDownWithWorld = true,
string locationItemName = "New Location");
///
/// Places the prefab at POI locations if its name contains the supplied string
/// GameObject Prefab
/// This is the string that will be checked against the POI name to see if is contained in it, and ony those POIs will be spawned
/// Density (Integer value between 1 and 30)
/// Name of this location prefab item for future reference
/// Should the prefab scale up/down along with the map game object?
///
void SpawnPrefabByName(GameObject prefab,
string nameString,
int density = 30,
Action> callback = null,
bool scaleDownWithWorld = true,
string locationItemName = "New Location");
#endregion
}
// TODO: Move interfaces into individual files.
public interface ISubLayerPolygonGeometryOptions
{
}
public interface ISubLayerFiltering
{
ILayerFilter AddStringFilterContains(string key, string property);
ILayerFilter AddNumericFilterEquals(string key, float value);
ILayerFilter AddNumericFilterLessThan(string key, float value);
ILayerFilter AddNumericFilterGreaterThan(string key, float value);
ILayerFilter AddNumericFilterInRange(string key, float min, float max);
ILayerFilter GetFilter(int index);
void RemoveFilter(int index);
void RemoveFilter(LayerFilter filter);
void RemoveFilter(ILayerFilter filter);
void RemoveAllFilters();
IEnumerable GetAllFilters();
IEnumerable GetFiltersByQuery(System.Func query);
LayerFilterCombinerOperationType GetFilterCombinerType();
void SetFilterCombinerType(LayerFilterCombinerOperationType layerFilterCombinerOperationType);
}
public interface ILayerFilter
{
bool FilterKeyContains(string key);
bool FilterKeyMatchesExact(string key);
bool FilterUsesOperationType(LayerFilterOperationType layerFilterOperationType);
bool FilterPropertyContains(string property);
bool FilterPropertyMatchesExact(string property);
bool FilterNumberValueEquals(float value);
bool FilterNumberValueIsGreaterThan(float value);
bool FilterNumberValueIsLessThan(float value);
bool FilterIsInRangeValueContains(float value);
string GetKey { get; }
LayerFilterOperationType GetFilterOperationType { get; }
string GetPropertyValue { get; }
float GetNumberValue { get; }
float GetMinValue { get; }
float GetMaxValue { get; }
void SetStringContains(string key, string property);
void SetNumberIsEqual(string key, float value);
void SetNumberIsLessThan(string key, float value);
void SetNumberIsGreaterThan(string key, float value);
void SetNumberIsInRange(string key, float min, float max);
}
public interface IVectorSubLayer
{
///
/// Gets `Filters` data from the feature.
///
ISubLayerFiltering Filtering { get; }
///
/// Gets `Modeling` data from the feature.
///
ISubLayerModeling Modeling { get; }
///
/// Gets `Texturing` data from the feature.
///
ISubLayerTexturing Texturing { get; }
///
/// Gets `Behavior Modifiers` data from the feature.
///
ISubLayerBehaviorModifiers BehaviorModifiers { get; }
}
}