[TASK] Initial commit with basic product setup

This commit is contained in:
2019-08-18 13:50:14 +02:00
commit 01a66a8e1f
2548 changed files with 167528 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class CameraBoundsTileProviderOptions : ExtentOptions
{
public Camera camera;
public int visibleBuffer;
public int disposeBuffer;
public override void SetOptions(ExtentOptions extentOptions)
{
CameraBoundsTileProviderOptions options = extentOptions as CameraBoundsTileProviderOptions;
if (options != null)
{
camera = options.camera;
visibleBuffer = options.visibleBuffer;
disposeBuffer = options.disposeBuffer;
}
else
{
Debug.LogError("ExtentOptions type mismatch : Using " + extentOptions.GetType() + " to set extent of type " + this.GetType());
}
}
public void SetOptions(Camera mapCamera, int visibleRange, int disposeRange)
{
camera = mapCamera;
visibleBuffer = visibleRange;
disposeBuffer = disposeRange;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 2a954ea9b37a847a796dd7c9a9eec9ef
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using Mapbox.Unity.SourceLayers;
namespace Mapbox.Unity.Map
{
using Mapbox.Unity.MeshGeneration.Modifiers;
using System;
[Serializable]
public class ColliderOptions : ModifierProperties, ISubLayerColliderOptions
{
public override Type ModifierType
{
get
{
return typeof(ColliderModifier);
}
}
public ColliderType colliderType = ColliderType.None;
/// <summary>
/// Enable/Disable feature colliders and sets the type of colliders to use.
/// </summary>
/// <param name="colliderType">Type of the collider to use on features.</param>
public virtual void SetFeatureCollider(ColliderType colType)
{
if (colliderType != colType)
{
colliderType = colType;
HasChanged = true;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: f38b85c80ace3431c90c6b093436742d
timeCreated: 1522459497
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class ElevationModificationOptions
{
[Tooltip("Mesh resolution of terrain, results in n x n grid")]
[Range(2,255)]
public int sampleCount = 10;
[Tooltip("Use world relative scale to scale terrain height.")]
public bool useRelativeHeight = false;
[Tooltip("Earth radius in Unity units.")]
public float earthRadius = 1000f;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3ea9e2e957a054a95bf8ae23752c1817
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class ElevationRequiredOptions : MapboxDataProperty
{
[Range(0, 100)]
[Tooltip("Multiplication factor to vertically exaggerate elevation on terrain, does not work with Flat Terrain.")]
public float exaggerationFactor = 1;
public override bool NeedsForceUpdate()
{
return true;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ec77d5b3f43f8457c96da252d4a01aed
timeCreated: 1520011256
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
namespace Mapbox.Unity.Map
{
using UnityEngine;
public interface ITileProviderOptions
{
}
public interface ICameraBoundsExtentOptions : ITileProviderOptions
{
void SetOptions();
}
public class ExtentOptions : ITileProviderOptions
{
public virtual void SetOptions(ExtentOptions extentOptions)
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2169b8754ae6418f97dcea8b7ca62e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,268 @@
using Mapbox.Unity.SourceLayers;
namespace Mapbox.Unity.Map
{
using System;
using Mapbox.Unity.MeshGeneration.Modifiers;
using Mapbox.Unity.MeshGeneration.Data;
using UnityEngine;
[Serializable]
public class GeometryExtrusionOptions : ModifierProperties, ISubLayerExtrusionOptions
{
public override Type ModifierType
{
get
{
return typeof(HeightModifier);
}
}
[SerializeField]
private string _selectedLayerName;
public ExtrusionType extrusionType = ExtrusionType.None;
public ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
[Tooltip("Property name in feature layer to use for extrusion.")]
public string propertyName = "height";
public string propertyDescription = "";
public float minimumHeight = 0f;
public float maximumHeight = 0f;
[Tooltip("Scale factor to multiply the extrusion value of the feature.")]
public float extrusionScaleFactor = 1f;
public GeometryExtrusionWithAtlasOptions ToGeometryExtrusionWithAtlasOptions()
{
return new GeometryExtrusionWithAtlasOptions(this);
}
/// <summary>
/// Disable mesh extrusion for the features in this layer.
/// </summary>
public virtual void DisableExtrusion()
{
if (extrusionType != ExtrusionType.None)
{
extrusionType = ExtrusionType.None;
HasChanged = true;
}
}
/// <summary>
/// Sets the height value to be used for Absolute Height extrusion type.
/// Same field is used for the maximum height of Range Extrusion type so beware
/// of possible side effects.
/// </summary>
/// <param name="absoluteHeight">Fixed height value for all features in the layer.</param>
public virtual void SetAbsoluteHeight(float absoluteHeight)
{
if (maximumHeight != absoluteHeight)
{
maximumHeight = absoluteHeight;
HasChanged = true;
}
}
/// <summary>
/// Change the minimum and maximum height values used for Range Height option.
/// Maximum height is also used for Absolute Height option so beware of possible side
/// effects.
/// </summary>
/// <param name="minHeight">Lower bound to be used for extrusion</param>
/// <param name="maxHeight">Top bound to be used for extrusion</param>
public virtual void SetHeightRange(float minHeight, float maxHeight)
{
if (minimumHeight != minHeight ||
maximumHeight != maxHeight)
{
minimumHeight = minHeight;
maximumHeight = maxHeight;
HasChanged = true;
}
}
/// <summary>
/// Sets the extrusion multiplier which will be used only in the Y axis (height).
/// </summary>
/// <param name="multiplier">Multiplier value.</param>
public virtual void SetExtrusionMultiplier(float multiplier)
{
if (extrusionScaleFactor != multiplier)
{
extrusionScaleFactor = multiplier;
HasChanged = true;
}
}
/// <summary>
/// Changes extrusion type to "Absolute height" and extrudes all features by
/// the given fixed value.
/// </summary>
/// <param name="geometryType">Option to create top and side polygons after extrusion.</param>
/// <param name="height">Extrusion value</param>
/// <param name="scaleFactor">Height multiplier</param>
public virtual void EnableAbsoluteExtrusion(ExtrusionGeometryType geometryType, float height, float scaleFactor = 1)
{
if (extrusionType != ExtrusionType.AbsoluteHeight ||
extrusionGeometryType != geometryType ||
!Mathf.Approximately(maximumHeight, height) ||
!Mathf.Approximately(extrusionScaleFactor, scaleFactor))
{
extrusionType = ExtrusionType.AbsoluteHeight;
extrusionGeometryType = geometryType;
maximumHeight = height;
extrusionScaleFactor = scaleFactor;
HasChanged = true;
}
}
/// <summary>
/// Changes extrusion type to "Property" and extrudes all features by
/// the choosen property's value.
/// </summary>
/// <param name="geometryType">Option to create top and side polygons after extrusion.</param>
/// <param name="propertyAttribute">Name of the property to use for extrusion</param>
/// <param name="scaleFactor">Height multiplier</param>
public virtual void EnablePropertyExtrusion(ExtrusionGeometryType geometryType, string propertyAttribute = "height", float scaleFactor = 1)
{
if (extrusionType != ExtrusionType.PropertyHeight ||
extrusionGeometryType != geometryType ||
propertyName != propertyAttribute ||
!Mathf.Approximately(extrusionScaleFactor, scaleFactor))
{
extrusionType = ExtrusionType.PropertyHeight;
extrusionGeometryType = geometryType;
propertyName = propertyAttribute;
extrusionScaleFactor = scaleFactor;
HasChanged = true;
}
}
/// <summary>
/// Changes extrusion type to "Minimum Height" and extrudes all features by
/// the choosen property's value such that all vertices (roof) will be
/// flat at the lowest vertex elevation (after terrain elevation taken into account).
/// </summary>
/// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
/// <param name="propertyName">Name of the property to use for extrusion</param>
/// <param name="extrusionScaleFactor">Height multiplier</param>
public virtual void EnableMinExtrusion(ExtrusionGeometryType extrusionGeometryType, string propertyName = "height", float extrusionScaleFactor = 1)
{
if (extrusionType != ExtrusionType.MinHeight ||
this.extrusionGeometryType != extrusionGeometryType ||
this.propertyName != propertyName ||
!Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
{
extrusionType = ExtrusionType.MinHeight;
this.extrusionGeometryType = extrusionGeometryType;
this.propertyName = propertyName;
this.extrusionScaleFactor = extrusionScaleFactor;
HasChanged = true;
}
}
/// <summary>
/// Changes extrusion type to "Range Height" and extrudes all features by
/// the choosen property's value such that all vertices (roof) will be
/// flat at the highest vertex elevation (after terrain elevation taken into account).
/// </summary>
/// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
/// <param name="propertyName">Name of the property to use for extrusion</param>
/// <param name="extrusionScaleFactor">Height multiplier</param>
void ISubLayerExtrusionOptions.EnableMaxExtrusion(ExtrusionGeometryType extrusionGeometryType, string propertyName, float extrusionScaleFactor)
{
if (extrusionType != ExtrusionType.MaxHeight ||
this.extrusionGeometryType != extrusionGeometryType ||
this.propertyName != propertyName ||
!Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
{
this.extrusionType = ExtrusionType.MaxHeight;
this.extrusionGeometryType = extrusionGeometryType;
this.propertyName = propertyName;
this.extrusionScaleFactor = extrusionScaleFactor;
HasChanged = true;
}
}
/// /// <summary>
/// Changes extrusion type to "Minimum Height" and extrudes all features by
/// the choosen property's value such that they'll be in provided range.
/// Lower values will be increase to Minimum Height and higher values will
/// be lowered to Maximum height.
/// </summary>
/// <param name="extrusionGeometryType">Option to create top and side polygons after extrusion.</param>
/// <param name="minHeight">Lower bound to be used for extrusion</param>
/// <param name="maxHeight">Top bound to be used for extrusion</param>
/// <param name="extrusionScaleFactor">Height multiplier</param>
public virtual void EnableRangeExtrusion(ExtrusionGeometryType extrusionGeometryType, float minHeight, float maxHeight, float extrusionScaleFactor = 1)
{
if (extrusionType != ExtrusionType.RangeHeight ||
this.extrusionGeometryType != extrusionGeometryType ||
!Mathf.Approximately(minimumHeight, minHeight) ||
!Mathf.Approximately(maximumHeight, maxHeight) ||
!Mathf.Approximately(this.extrusionScaleFactor, extrusionScaleFactor))
{
extrusionType = ExtrusionType.RangeHeight;
this.extrusionGeometryType = extrusionGeometryType;
minimumHeight = minHeight;
maximumHeight = maxHeight;
this.extrusionScaleFactor = extrusionScaleFactor;
HasChanged = true;
}
}
}
[Serializable]
public class GeometryExtrusionWithAtlasOptions : ModifierProperties
{
public override Type ModifierType
{
get
{
return typeof(TextureSideWallModifier);
}
}
public UvMapType texturingType = UvMapType.Tiled;
public AtlasInfo atlasInfo;
public ExtrusionType extrusionType = ExtrusionType.None;
public ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
public string propertyName = "height";
public string propertyDescription = "";
public float minimumHeight = 0f;
public float maximumHeight = 0f;
public float extrusionScaleFactor = 1f;
public GeometryExtrusionWithAtlasOptions()
{
}
public GeometryExtrusionWithAtlasOptions(GeometryExtrusionOptions extrusionOptions, UVModifierOptions uvOptions)
{
extrusionType = extrusionOptions.extrusionType;
extrusionGeometryType = extrusionOptions.extrusionGeometryType;
propertyName = extrusionOptions.propertyName;
minimumHeight = extrusionOptions.minimumHeight;
maximumHeight = extrusionOptions.maximumHeight;
extrusionScaleFactor = extrusionOptions.extrusionScaleFactor;
texturingType = uvOptions.texturingType;
atlasInfo = uvOptions.atlasInfo;
}
public GeometryExtrusionWithAtlasOptions(GeometryExtrusionOptions extrusionOptions)
{
extrusionType = extrusionOptions.extrusionType;
extrusionGeometryType = extrusionOptions.extrusionGeometryType;
propertyName = extrusionOptions.propertyName;
minimumHeight = extrusionOptions.minimumHeight;
maximumHeight = extrusionOptions.maximumHeight;
extrusionScaleFactor = extrusionOptions.extrusionScaleFactor;
}
public GeometryExtrusionWithAtlasOptions(UVModifierOptions uvOptions)
{
texturingType = uvOptions.texturingType;
atlasInfo = uvOptions.atlasInfo;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 6b1ce30c2116b4d1dadcc0fd64b73d86
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,309 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
using System.IO;
using System.Collections.Generic;
using Mapbox.Unity.MeshGeneration.Modifiers;
using Mapbox.Unity.MeshGeneration.Data;
[Serializable]
public class CustomStyleBundle
{
public UvMapType texturingType = UvMapType.Tiled;
public MaterialList[] materials = new MaterialList[2];
public AtlasInfo atlasInfo;
public ScriptablePalette colorPalette;
public CustomStyleBundle()
{
materials = new MaterialList[2];
materials[0] = new MaterialList();
materials[1] = new MaterialList();
//SetDefaultAssets();
}
private void AssignAssets(StyleAssetPathBundle styleAssetPathBundle)
{
Material topMaterial = Resources.Load(styleAssetPathBundle.topMaterialPath, typeof(Material)) as Material;
Material sideMaterial = Resources.Load(styleAssetPathBundle.sideMaterialPath, typeof(Material)) as Material;
AtlasInfo atlas = Resources.Load(styleAssetPathBundle.atlasPath, typeof(AtlasInfo)) as AtlasInfo;
ScriptablePalette palette = Resources.Load(styleAssetPathBundle.palettePath, typeof(ScriptablePalette)) as ScriptablePalette;
materials[0].Materials[0] = new Material(topMaterial);
materials[1].Materials[0] = new Material(sideMaterial);
atlasInfo = atlas;
colorPalette = palette;
}
public void SetDefaultAssets(UvMapType mapType = UvMapType.Atlas)
{
StyleAssetPathBundle styleAssetPathBundle = new StyleAssetPathBundle("Default", Constants.Path.MAP_FEATURE_STYLES_DEFAULT_STYLE_ASSETS);
texturingType = mapType;
AssignAssets(styleAssetPathBundle);
}
}
[Serializable]
public class GeometryMaterialOptions : ModifierProperties, ISubLayerTexturing
{
public override Type ModifierType
{
get
{
return typeof(MaterialModifier);
}
}
private SubLayerDarkStyle _darkStyle;
public ISubLayerDarkStyle DarkStyle
{
get
{
if (_darkStyle == null)
{
_darkStyle = new SubLayerDarkStyle(this);
}
return _darkStyle;
}
}
private SubLayerLightStyle _lightStyle;
public ISubLayerLightStyle LightStyle
{
get
{
if (_lightStyle == null)
{
_lightStyle = new SubLayerLightStyle(this);
}
return _lightStyle;
}
}
private SubLayerColorStyle _colorStyle;
public ISubLayerColorStyle ColorStyle
{
get
{
if (_colorStyle == null)
{
_colorStyle = new SubLayerColorStyle(this);
}
return _colorStyle;
}
}
private SubLayerSimpleStyle _simpleStyle;
public ISubLayerSimpleStyle SimpleStyle
{
get
{
if (_simpleStyle == null)
{
_simpleStyle = new SubLayerSimpleStyle(this);
}
return _simpleStyle;
}
}
private SubLayerRealisticStyle _realisticStyle;
public ISubLayerRealisticStyle RealisticStyle
{
get
{
if (_realisticStyle == null)
{
_realisticStyle = new SubLayerRealisticStyle(this);
}
return _realisticStyle;
}
}
private SubLayerFantasyStyle _fantasyStyle;
public ISubLayerFantasyStyle FantasyStyle
{
get
{
if (_fantasyStyle == null)
{
_fantasyStyle = new SubLayerFantasyStyle(this);
}
return _fantasyStyle;
}
}
private SubLayerCustomStyle _customStyle;
public ISubLayerCustomStyle CustomStyle
{
get
{
if (_customStyle == null)
{
_customStyle = new SubLayerCustomStyle(this);
}
return _customStyle;
}
}
public StyleTypes style;
public UvMapType texturingType = UvMapType.Tiled;
public MaterialList[] materials = new MaterialList[2];
public AtlasInfo atlasInfo;
public float lightStyleOpacity = 1.0f;
public float darkStyleOpacity = 1.0f;
public Color colorStyleColor = Color.white;
public SamplePalettes samplePalettes;
public ScriptablePalette colorPalette;
[SerializeField]
public CustomStyleBundle customStyleOptions;
public GeometryMaterialOptions()
{
materials = new MaterialList[2];
materials[0] = new MaterialList();
materials[1] = new MaterialList();
}
/// <summary>
/// Sets up default values for GeometryMaterial Options.
/// If style is set to Custom, user defined values will be used.
/// </summary>
public void SetDefaultMaterialOptions()
{
{
string styleName = style.ToString();
if (customStyleOptions == null)
{
customStyleOptions = new CustomStyleBundle();
customStyleOptions.SetDefaultAssets();
}
if (style == StyleTypes.Custom)
{
//nothing to do. Use custom settings
}
else
{
string samplePaletteName = samplePalettes.ToString();
string path = Path.Combine(Constants.Path.MAP_FEATURE_STYLES_SAMPLES, Path.Combine(styleName, Constants.Path.MAPBOX_STYLES_ASSETS_FOLDER));
StyleAssetPathBundle styleAssetPathBundle = new StyleAssetPathBundle(styleName, path, samplePaletteName);
AssignAssets(styleAssetPathBundle);
}
switch (style)
{
case StyleTypes.Light:
Color lightColor = materials[0].Materials[0].color;
lightColor.a = lightStyleOpacity;
materials[0].Materials[0].color = lightColor;
lightColor = materials[1].Materials[0].color;
lightColor.a = lightStyleOpacity;
materials[1].Materials[0].color = lightColor;
break;
case StyleTypes.Dark:
Color darkColor = materials[0].Materials[0].color;
darkColor.a = darkStyleOpacity;
materials[0].Materials[0].color = darkColor;
darkColor = materials[1].Materials[0].color;
darkColor.a = darkStyleOpacity;
materials[1].Materials[0].color = darkColor;
break;
case StyleTypes.Color:
Color color = colorStyleColor;
materials[0].Materials[0].color = color;
materials[1].Materials[0].color = color;
break;
default:
break;
}
if (style == StyleTypes.Satellite)
{
texturingType = UvMapType.Tiled;
}
else
{
texturingType = (style != StyleTypes.Custom && style == StyleTypes.Simple) ? UvMapType.AtlasWithColorPalette : UvMapType.Atlas;
}
}
}
private void AssignAssets(StyleAssetPathBundle styleAssetPathBundle)
{
Material topMaterial = Resources.Load(styleAssetPathBundle.topMaterialPath, typeof(Material)) as Material;
Material sideMaterial = Resources.Load(styleAssetPathBundle.sideMaterialPath, typeof(Material)) as Material;
AtlasInfo atlas = Resources.Load(styleAssetPathBundle.atlasPath, typeof(AtlasInfo)) as AtlasInfo;
ScriptablePalette palette = Resources.Load(styleAssetPathBundle.palettePath, typeof(ScriptablePalette)) as ScriptablePalette;
materials[0].Materials[0] = new Material(topMaterial);
materials[1].Materials[0] = new Material(sideMaterial);
atlasInfo = atlas;
colorPalette = palette;
}
public void SetDefaultAssets(UvMapType mapType = UvMapType.Atlas)
{
StyleAssetPathBundle styleAssetPathBundle = new StyleAssetPathBundle("Default", Constants.Path.MAP_FEATURE_STYLES_DEFAULT_STYLE_ASSETS);
texturingType = mapType;
AssignAssets(styleAssetPathBundle);
}
/// <summary>
/// Sets the type of the style.
/// </summary>
/// <param name="styleType">Style type.</param>
public void SetStyleType(StyleTypes styleType)
{
style = styleType;
}
/// <summary>
/// Gets the type of style used in the layer.
/// </summary>
/// <returns>The style type.</returns>
public virtual StyleTypes GetStyleType()
{
return style;
}
}
[Serializable]
public class UVModifierOptions : ModifierProperties
{
public override Type ModifierType
{
get
{
return typeof(UvModifier);
}
}
public StyleTypes style;
public UvMapType texturingType = UvMapType.Tiled;
public AtlasInfo atlasInfo;
public GeometryExtrusionWithAtlasOptions ToGeometryExtrusionWithAtlasOptions()
{
return new GeometryExtrusionWithAtlasOptions(this);
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 86b7939f38d364d049e29aea11e9652c
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class ImageryRasterOptions : MapboxDataProperty
{
[Tooltip("Use higher resolution Mapbox imagery for retina displays; better visual quality and larger texture sizes.")]
public bool useRetina = false;
[Tooltip("Use Unity compression for the tile texture.")]
public bool useCompression = false;
[Tooltip("Use texture with Unity generated mipmaps.")]
public bool useMipMap = false;
public override bool NeedsForceUpdate()
{
return true;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: da8808496e454427ea89228f08bd6f78
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
namespace Mapbox.Unity.Map
{
using System;
using System.Collections.Generic;
using Mapbox.Unity.MeshGeneration.Modifiers;
using Mapbox.Unity.Utilities;
[Serializable]
public class LayerModifierOptions
{
public PositionTargetType moveFeaturePositionTo;
[NodeEditorElement("Mesh Modifiers")]
public List<MeshModifier> MeshModifiers;
[NodeEditorElement("Game Object Modifiers")]
public List<GameObjectModifier> GoModifiers;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 7ad2d6d13d7344c03aa1317615ba9aea
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class LayerPerformanceOptions : MapboxDataProperty
{
[Tooltip("Enable Coroutines to distribute tile loading using coroutines, reduces the load on the main thread and keeps applications responsive. First load may be slower but subsequent loading will be faster. ")]
public bool isEnabled = true;
[Tooltip("Number of feature entities to group in one single coroutine call. ")]
public int entityPerCoroutine = 20;
public override bool HasChanged
{
set
{
if (value == true)
{
OnPropertyHasChanged(new VectorLayerUpdateArgs { property = this });
}
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 06b8a4cffda584d2995645a0c0c69bc5
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
namespace Mapbox.Unity.Map
{
using System;
[Serializable]
public class Style
{
public string Name;
public string Id;
public string Modified;
public string UserName;
}
[Serializable]
public class LayerSourceOptions
{
public bool isActive;
public Style layerSource;
public string Id
{
get
{
return layerSource.Id;
}
set
{
layerSource.Id = value;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 2d109dd8fa7ac4aefa3e2dabac3a3e58
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@
using Mapbox.Unity.SourceLayers;
using UnityEngine;
namespace Mapbox.Unity.Map
{
using Mapbox.Unity.MeshGeneration.Modifiers;
using System;
[Serializable]
public class LineGeometryOptions : ModifierProperties, ISubLayerLineGeometryOptions
{
public override Type ModifierType
{
get
{
return typeof(LineMeshModifier);
}
}
[Tooltip("Width of the line feature.")]
public float Width = 1.0f;
/// <summary>
/// Sets the width of the mesh generated for line features.
/// </summary>
/// <param name="width">Width of the mesh generated for line features.</param>
public void SetLineWidth(float width)
{
if (Width != width)
{
Width = width;
HasChanged = true;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: cfba2df2ab678ce4c9dd019820140980
timeCreated: 1522459497
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
namespace Mapbox.Unity.Map
{
using UnityEngine;
using System.Collections.Generic;
public static class LocationPrefabCategoryOptions
{
static LocationPrefabCategoryOptions()
{
PopulateCategoriesToMakiDictionary();
}
private static Dictionary<LocationPrefabCategories, List<string>> CategoriesToMakiDictionary = new Dictionary<LocationPrefabCategories, List<string>>
{
{LocationPrefabCategories.ArtsAndEntertainment,new List<string>{"art-gallery", "cinema", "stadium", "museum", "library", "zoo", "music", "theatre", "amusement-park"}},
{LocationPrefabCategories.Food,new List<string>{"cafe", "bakery", "fast-food", "grocery", "ice-cream", "restaurant"}},
{LocationPrefabCategories.Nightlife,new List<string>{"bar", "beer"}},
{LocationPrefabCategories.OutdoorsAndRecreation,new List<string>{"aquarium", "campsite", "attraction", "castle", "cemetery", "dog-park", "drinking-water", "garden", "golf", "monument", "park", "picnic-site", "playground", "swimming"}},
{LocationPrefabCategories.Services,new List<string>{"bank", "dentist", "toilet", "veterinary", "pharmacy", "college", "school", "hospital", "place-of-worship", "religious-christian", "religious-jewish", "religious-muslim", "police", "post", "doctor", "fire-station", "information", "town-hall", "prison", "embassy", "fuel", "laundry", "lodging"}},
{LocationPrefabCategories.Shops,new List<string>{"alcohol-shop", "clothing-store", "shop"}},
{LocationPrefabCategories.Transportation,new List<string>{"bus", "car", "bicycle-share", "bicycle", "airfield", "ferry", "harbor", "heliport"}},
};
private static Dictionary<string, LocationPrefabCategories> MakiToCategoriesDictionary = new Dictionary<string, LocationPrefabCategories>();
//Creates a reverse reference from the CategoriesToMakiDictionary
private static void PopulateCategoriesToMakiDictionary ()
{
foreach(var item in CategoriesToMakiDictionary)
{
foreach(string makiTag in item.Value)
{
if (!MakiToCategoriesDictionary.ContainsKey(makiTag))
{
MakiToCategoriesDictionary.Add(makiTag, item.Key);
}
}
}
}
/// <summary>
/// Gets the maki tags list from a <see cref="LocationPrefabCategories"/> category
/// </summary>
/// <returns>The list of maki tags from supplied category.</returns>
/// <param name="category"><see cref="LocationPrefabCategories"/></param>
public static List<string> GetMakiListFromCategory(LocationPrefabCategories category)
{
List<string> returnList = new List<string>();
CategoriesToMakiDictionary.TryGetValue(category, out returnList);
return returnList;
}
/// <summary>
/// Gets the <see cref="LocationPrefabCategories"/> category that the maki tag belongs to.
/// </summary>
/// <returns>The <see cref="LocationPrefabCategories"/>category from maki tag.</returns>
/// <param name="makiTag">Maki tag</param>
public static LocationPrefabCategories GetCategoryFromMakiTag(string makiTag)
{
LocationPrefabCategories returnCategory;
if (MakiToCategoriesDictionary.TryGetValue(makiTag, out returnCategory))
return returnCategory;
return LocationPrefabCategories.AnyCategory;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: fcad5e29c050446fb8a3d19a42549875
timeCreated: 1523660773
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class MapExtentOptions : MapboxDataProperty
{
public MapExtentType extentType = MapExtentType.CameraBounds;
public DefaultMapExtents defaultExtents = new DefaultMapExtents();
public MapExtentOptions(MapExtentType type)
{
extentType = type;
}
public ExtentOptions GetTileProviderOptions()
{
ExtentOptions options = new ExtentOptions();
switch (extentType)
{
case MapExtentType.CameraBounds:
options = defaultExtents.cameraBoundsOptions;
break;
case MapExtentType.RangeAroundCenter:
options = defaultExtents.rangeAroundCenterOptions;
break;
case MapExtentType.RangeAroundTransform:
options = defaultExtents.rangeAroundTransformOptions;
break;
default:
break;
}
return options;
}
}
[Serializable]
public class DefaultMapExtents : MapboxDataProperty
{
public CameraBoundsTileProviderOptions cameraBoundsOptions = new CameraBoundsTileProviderOptions();
public RangeTileProviderOptions rangeAroundCenterOptions = new RangeTileProviderOptions();
public RangeAroundTransformTileProviderOptions rangeAroundTransformOptions = new RangeAroundTransformTileProviderOptions();
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: fe478189bf1ab44ce81a642a8a46a211
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
using Mapbox.Unity.Utilities;
[Serializable]
public class MapLocationOptions : MapboxDataProperty
{
[Geocode]
[Tooltip("The coordinates to build a map around")]
public string latitudeLongitude = "0,0";
[Range(0, 22)]
[Tooltip("The zoom level of the map")]
public float zoom = 4.0f;
//TODO : Add Coordinate conversion class.
[NonSerialized]
public MapCoordinateSystemType coordinateSystemType = MapCoordinateSystemType.WebMercator;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 53cdeb2ee544b4361845e801728f9950
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class MapOptions : MapboxDataProperty
{
public MapLocationOptions locationOptions = new MapLocationOptions();
public MapExtentOptions extentOptions = new MapExtentOptions(MapExtentType.RangeAroundCenter);
public MapPlacementOptions placementOptions = new MapPlacementOptions();
public MapScalingOptions scalingOptions = new MapScalingOptions();
[Tooltip("Texture used while tiles are loading.")]
public Texture2D loadingTexture = null;
public Material tileMaterial = null;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 5d04cfc6bdccb40148fc327eca9fd012
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using Mapbox.Unity.Map.Interfaces;
namespace Mapbox.Unity.Map
{
using System;
[Serializable]
public class MapPlacementOptions : MapboxDataProperty
{
public MapPlacementType placementType = MapPlacementType.AtLocationCenter;
public bool snapMapToZero = false;
public IMapPlacementStrategy placementStrategy;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: c075375ebec1542e9938c24aee596fca
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using Mapbox.Unity.Map.Interfaces;
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class MapScalingOptions : MapboxDataProperty
{
public MapScalingType scalingType = MapScalingType.Custom;
//public MapUnitType unitType = MapUnitType.meters;
[Tooltip("Size of each tile in Unity units.")]
public float unityTileSize = 100f;
public IMapScalingStrategy scalingStrategy;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 854768e662c984068bc22c2607fb9a45
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
using Mapbox.Unity.MeshGeneration.Data;
namespace Mapbox.Unity.Map
{
public abstract class MapboxDataProperty
{
public event System.EventHandler PropertyHasChanged;
protected virtual void OnPropertyHasChanged(System.EventArgs e)
{
System.EventHandler handler = PropertyHasChanged;
if (handler != null)
{
handler(this, e);
}
}
public virtual bool HasChanged
{
set
{
if (value == true)
{
OnPropertyHasChanged(null /*Pass args here */);
}
}
}
public virtual bool NeedsForceUpdate()
{
return false;
}
public virtual void UpdateProperty(UnityTile tile)
{
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d7e99aece91ce4463b09850af8e3df52
timeCreated: 1536268482
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,388 @@
namespace Mapbox.Unity.Map
{
using System.ComponentModel;
// Map related enums
public enum MapPresetType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Map with imagery and terrain, used along with a location provider.")]
#endif
LocationBasedMap,
#if !ENABLE_WINMD_SUPPORT
[Description("Map with imagery and terrain and vector data - building,roads and poi's.")]
#endif
WorldSimulator,
#if !ENABLE_WINMD_SUPPORT
[Description("Map with imagery and terrain and vector data, used for AR tabletop scenario.")]
#endif
ARTableTop,
#if !ENABLE_WINMD_SUPPORT
[Description("Map with imagery and terrain and vector data, used for world scale AR scenario.")]
#endif
ARWorldScale,
}
public enum MapPlacementType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Map's root is located at the center of tile containing location specified.")]
#endif
AtTileCenter,
#if !ENABLE_WINMD_SUPPORT
[Description("Map's root is located at the location specified.")]
#endif
AtLocationCenter
}
public enum MapScalingType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Map is rendered at actual scale, unity to mercator conversion factor is ignored. ")]
#endif
WorldScale,
#if !ENABLE_WINMD_SUPPORT
[Description("Map is rendered at the scale defined by unity to mercator conversion factor. ")]
#endif
Custom
}
public enum MapUnitType
{
meters,
kilometers,
miles
}
public enum MapExtentType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Map extent defined by the camera's viewport bounds.")]
#endif
CameraBounds,
#if !ENABLE_WINMD_SUPPORT
[Description("Map extent defined by range of tiles around map's center tile.")]
#endif
RangeAroundCenter,
#if !ENABLE_WINMD_SUPPORT
[Description("Map extent defined by range of tiles around a target transform.")]
#endif
RangeAroundTransform,
#if !ENABLE_WINMD_SUPPORT
[Description("Map extent defined by custom tile provider.")]
#endif
Custom,
}
public enum MapCoordinateSystemType
{
WebMercator,
}
//Layer related enums.
public enum MapLayerType
{
Imagery,
Elevation,
Vector
}
public enum VectorPrimitiveType
{
Point,
Line,
Polygon,
Custom
}
public enum UvMapType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Use image texture using tiled UV.")]
#endif
Tiled = 0,
#if !ENABLE_WINMD_SUPPORT
[Description("Use an image texture atlas to define textures for roof & sides of buildings.")]
#endif
Atlas = 2,
#if !ENABLE_WINMD_SUPPORT
[Description("Use an image texture atlas and a color pallete to define textures for roof & sides of buildings.")]
#endif
AtlasWithColorPalette = 3,
}
public enum ImagerySourceType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Streets is a comprehensive, general-purpose map that emphasizes accurate, legible styling of road and transit networks")]
#endif
MapboxStreets,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Outdoors is a general-purpose map with curated tilesets and specialized styling tailored to hiking, biking, and the most adventurous use cases.")]
#endif
MapboxOutdoors,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Light and Mapbox Dark are subtle, full-featured maps designed to provide geographic context while highlighting the data on your analytics dashboard, data visualization, or data overlay.")]
#endif
MapboxDark,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Light and Mapbox Dark are subtle, full-featured maps designed to provide geographic context while highlighting the data on your analytics dashboard, data visualization, or data overlay.")]
#endif
MapboxLight,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Satellite is our full global base map that is perfect as a blank canvas or an overlay for your own data.")]
#endif
MapboxSatellite,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Satellite Streets combines our Mapbox Satellite with vector data from Mapbox Streets. The comprehensive set of road, label, and POI information brings clarity and context to the crisp detail in our high-resolution satellite imagery.")]
#endif
MapboxSatelliteStreet,
#if !ENABLE_WINMD_SUPPORT
[Description("Use custom tilesets created using Mapbox studio.")]
#endif
Custom,
#if !ENABLE_WINMD_SUPPORT
[Description("Turn off image rendering.")]
#endif
None
}
public enum ElevationSourceType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Terrain provides digital elevation model with worldwide coverage. ")]
#endif
MapboxTerrain,
#if !ENABLE_WINMD_SUPPORT
[Description("Use custom digital elevation model tileset.")]
#endif
Custom,
#if !ENABLE_WINMD_SUPPORT
[Description("Render flat terrain.")]
#endif
None
}
public enum VectorSourceType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Streets along with unique identifiers for building features. Combines building footprints that may be in different tiles.")]
#endif
MapboxStreetsWithBuildingIds,
#if !ENABLE_WINMD_SUPPORT
[Description("Mapbox Streets vector tiles are largely based on data from OpenStreetMap, a free & global source of geographic data built by volunteers.")]
#endif
MapboxStreets,
#if !ENABLE_WINMD_SUPPORT
[Description("Use custom tilesets created using Mapbox studio. ")]
#endif
Custom,
#if !ENABLE_WINMD_SUPPORT
[Description("Turn off vector data rendering.")]
#endif
None
}
public enum ElevationLayerType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Render flat terrain with no elevation.")]
#endif
FlatTerrain,
#if !ENABLE_WINMD_SUPPORT
[Description("Render terrain with elevation from the source specified.")]
#endif
TerrainWithElevation,
#if !ENABLE_WINMD_SUPPORT
[Description("Render low polygon terrain with elevation from the source specified")]
#endif
LowPolygonTerrain,
// TODO : Might want to reconsider this option.
#if !ENABLE_WINMD_SUPPORT
[Description("Render terrain with no elevation for a globe.")]
#endif
GlobeTerrain
}
public enum TileTerrainType
{
//starting from -1 to match ElevationLayerType
None = -1,
Flat = 0,
Elevated = 1,
LowPoly = 2,
Globe = 3
}
public enum ExtrusionType
{
#if !ENABLE_WINMD_SUPPORT
[Description("No extrusion.")]
#endif
None,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrude features using the property value.")]
#endif
PropertyHeight,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrude features using the property value. Sets height based on property's minimum height, if height isn't uniform. Results in flat tops.")]
#endif
MinHeight,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrude features using the property value. Sets height based on property's maximum height, if height isn't uniform. Results in flat tops.")]
#endif
MaxHeight,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrude features using the property value. Values are clamped in to min and max values if they are lower or greater than min,max values respectively.")]
#endif
RangeHeight,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrude all features using the fixed value.")]
#endif
AbsoluteHeight,
}
public enum ExtrusionGeometryType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Extrudes both roof and side wall geometry of the vector feature.")]
#endif
RoofAndSide,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrudes only roof geometry of the vector feature.")]
#endif
RoofOnly,
#if !ENABLE_WINMD_SUPPORT
[Description("Extrudes only side wall geometry of the vector feature.")]
#endif
SideOnly,
}
public enum ColliderType
{
#if !ENABLE_WINMD_SUPPORT
[Description("No collider.")]
#endif
None,
#if !ENABLE_WINMD_SUPPORT
[Description("Box collider addded to the GameObject.")]
#endif
BoxCollider,
#if !ENABLE_WINMD_SUPPORT
[Description("Mesh collider added to the GameObject.")]
#endif
MeshCollider,
#if !ENABLE_WINMD_SUPPORT
[Description("Sphere collider added to the GameObject.")]
#endif
SphereCollider,
}
public enum MapFeatureType
{
#if !ENABLE_WINMD_SUPPORT
[Description("Building Layer.")]
#endif
Building,
#if !ENABLE_WINMD_SUPPORT
[Description("Road Layer.")]
#endif
Road,
#if !ENABLE_WINMD_SUPPORT
[Description("Parkland Layer.")]
#endif
Parkland,
};
public enum StyleTypes
{
#if !ENABLE_WINMD_SUPPORT
[Description("Custom style.")]
#endif
Custom,
#if !ENABLE_WINMD_SUPPORT
[Description("Simple style combines stylized vector designs with scriptable palettes to create a simple, procedurally colored rendering style.")]
#endif
Simple,
#if !ENABLE_WINMD_SUPPORT
[Description("Light style uses colored materials to create light, greyscale shading for your map.")]
#endif
Light,
#if !ENABLE_WINMD_SUPPORT
[Description("Dark style uses colored materials to create dark, greyscale shading for your map.")]
#endif
Dark,
#if !ENABLE_WINMD_SUPPORT
[Description("Realistic style combines modern, urban designs with physically based rendering materials to help create a contemporary, realistic rendering style.")]
#endif
Realistic,
#if !ENABLE_WINMD_SUPPORT
[Description("Fantasy style combines old world medieval designs with physically based rendering materials to help create a fantasy rendering style.")]
#endif
Fantasy,
#if !ENABLE_WINMD_SUPPORT
[Description("Satellite style uses high-resolution satellite imagery as a texture set. The comprehensive set of road, label, and POI information brings clarity and context to the crisp detail in our high-resolution satellite imagery.")]
#endif
Satellite,
#if !ENABLE_WINMD_SUPPORT
[Description("Color style uses user-defined color and opacity to create colorful, flat shading for your map.")]
#endif
Color,
}
public enum SamplePalettes
{
City,
Urban,
Warm,
Cool,
Rainbow
}
public enum LocationPrefabFindBy
{
#if !ENABLE_WINMD_SUPPORT
[Description("Display points of interest based on a choice of categories")]
#endif
MapboxCategory,
#if !ENABLE_WINMD_SUPPORT
[Description("Display points of interest based on name")]
#endif
POIName,
#if !ENABLE_WINMD_SUPPORT
[Description("Display points of interest at specific address or geographical co-ordinates on the map")]
#endif
AddressOrLatLon,
}
public enum LocationPrefabCategories
{
None = 0,
AnyCategory = ~0,
ArtsAndEntertainment = 1 << 0,
Food = 1 << 1,
Nightlife = 1 << 2,
OutdoorsAndRecreation = 1 << 3,
Services = 1 << 4,
Shops = 1 << 5,
Transportation = 1 << 6
}
public enum FeatureProcessingStage
{
PreProcess,
Process,
PostProcess
}
public enum PresetFeatureType
{
Buildings,
Roads,
Landuse,
Points,
Custom
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 076cfb625c7cd447089acf2294b1d75e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class RangeAroundTransformTileProviderOptions : ExtentOptions
{
public Transform targetTransform;
public int visibleBuffer;
public int disposeBuffer;
public override void SetOptions(ExtentOptions extentOptions)
{
RangeAroundTransformTileProviderOptions options = extentOptions as RangeAroundTransformTileProviderOptions;
if (options != null)
{
SetOptions(options.targetTransform, options.visibleBuffer, options.disposeBuffer);
}
else
{
Debug.LogError("ExtentOptions type mismatch : Using " + extentOptions.GetType() + " to set extent of type " + this.GetType());
}
}
public void SetOptions(Transform tgtTransform = null, int visibleRange = 1, int disposeRange = 1)
{
targetTransform = tgtTransform;
visibleBuffer = visibleRange;
disposeBuffer = disposeRange;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: fe9e24e68033f4630b1635d66c71a3cc
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class RangeTileProviderOptions : ExtentOptions
{
[Range(0, 10)]
public int west = 1;
[Range(0, 10)]
public int north = 1;
[Range(0, 10)]
public int east = 1;
[Range(0, 10)]
public int south = 1;
public override void SetOptions(ExtentOptions extentOptions)
{
RangeTileProviderOptions options = extentOptions as RangeTileProviderOptions;
if (options != null)
{
west = options.west;
north = options.north;
east = options.east;
south = options.south;
}
else
{
Debug.LogError("ExtentOptions type mismatch : Using " + extentOptions.GetType() + " to set extent of type " + this.GetType());
}
}
public void SetOptions(int northRange = 1, int southRange = 1, int eastRange = 1, int westRange = 1)
{
west = westRange;
north = northRange;
east = eastRange;
south = southRange;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: c619de083ef9446b4b774933701dd923
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
namespace Mapbox.Unity.Map
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mapbox.Unity.MeshGeneration.Modifiers;
using System;
using Mapbox.Unity.Map;
[Serializable]
public class SpawnPrefabOptions : ModifierProperties
{
public override Type ModifierType
{
get
{
return typeof(PrefabModifier);
}
}
public GameObject prefab;
public bool scaleDownWithWorld = true;
[NonSerialized]
public Action<List<GameObject>> AllPrefabsInstatiated = delegate { };
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ae0dbe1711e344fd9908394c6270d93a
timeCreated: 1523916609
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
namespace Mapbox.Unity.Map
{
using System;
using Mapbox.Unity.MeshGeneration.Data;
using UnityEngine;
[Serializable]
public class TerrainColliderOptions : MapboxDataProperty
{
[Tooltip("Add Unity Physics collider to terrain tiles, used for detecting collisions etc.")]
public bool addCollider = false;
public override void UpdateProperty(UnityTile tile)
{
var existingCollider = tile.Collider;
if (addCollider)
{
if (existingCollider == null)
{
tile.gameObject.AddComponent<MeshCollider>();
}
}
else
{
UnityEngine.Object.Destroy(tile.Collider);
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 5e3e24bd5ee1ac74eb27105f96121ab9
timeCreated: 1520011256
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class TerrainSideWallOptions
{
[Tooltip("Adds side walls to terrain meshes, reduces visual artifacts.")]
public bool isActive = false;
[Tooltip("Height of side walls.")]
public float wallHeight = 10;
[Tooltip("Unity material to use for side walls.")]
public Material wallMaterial;// = Resources.Load("TerrainMaterial", typeof(Material)) as Material;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: cd7e5d3c41f4f4894871e76b0d68a448
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,190 @@
namespace Mapbox.Unity.Map
{
using System;
using System.Collections.Generic;
using Mapbox.Platform.TilesetTileJSON;
using UnityEngine;
[Serializable]
public class TileJsonData
{
public readonly string commonLayersKey = "(layer found in more than one data source)";
public readonly string optionalPropertiesString = "(may not appear across all locations)";
/// <summary>
/// This boolean is to check if tile JSON data has loaded after the data source has changed
/// </summary>
public bool tileJSONLoaded = false;
/// <summary>
/// Layer Display Names seen in the editor
/// </summary>
public List<string> LayerDisplayNames = new List<string>();
/// <summary>
/// Property Display Names seen in the editor
/// </summary>
public Dictionary<string, List<string>> PropertyDisplayNames = new Dictionary<string, List<string>>();
/// <summary>
/// The description of the property in a layer
/// </summary>
public Dictionary<string, Dictionary<string, string>> LayerPropertyDescriptionDictionary = new Dictionary<string, Dictionary<string, string>>();
/// <summary>
/// List of data sources (tileset ids) linked to a layer name
/// </summary>
public Dictionary<string, List<string>> LayerSourcesDictionary = new Dictionary<string, List<string>>();
/// <summary>
/// Dictionary containting the list of layers in a source
/// </summary>
public Dictionary<string, List<string>> SourceLayersDictionary = new Dictionary<string, List<string>>();
public void ClearData()
{
tileJSONLoaded = false;
LayerPropertyDescriptionDictionary.Clear();
LayerSourcesDictionary.Clear();
SourceLayersDictionary.Clear();
LayerDisplayNames.Clear();
PropertyDisplayNames.Clear();
}
public void ProcessTileJSONData(TileJSONResponse tjr)
{
tileJSONLoaded = true;
List<string> layerPropertiesList = new List<string>();
// Un-comment if required. Throws a warning right now.
//List<string> sourceLayersList = new List<string>();
if (tjr == null || tjr.VectorLayers == null || tjr.VectorLayers.Length == 0)
{
return;
}
ClearData();
var propertyName = "";
var propertyDescription = "";
var layerSource = "";
foreach (var layer in tjr.VectorLayers)
{
//load layer names
var layerName = layer.Id;
layerPropertiesList = new List<string>();
layerSource = layer.Source;
//if (layer.Fields.Count == 0)
//continue;
//loading layer sources
if (LayerSourcesDictionary.ContainsKey(layerName))
{
LayerSourcesDictionary[layerName].Add(layerSource);
}
else
{
LayerSourcesDictionary.Add(layerName, new List<string>() { layerSource });
}
//loading layers to a data source
if (SourceLayersDictionary.ContainsKey(layerSource))
{
List<string> sourceList = new List<string>();
LayerSourcesDictionary.TryGetValue(layerName, out sourceList);
if (sourceList.Count > 1 && sourceList.Contains(layerSource)) // the current layerName has more than one source
{
if (SourceLayersDictionary.ContainsKey(commonLayersKey))
{
SourceLayersDictionary[commonLayersKey].Add(layerName);
}
else
{
SourceLayersDictionary.Add(commonLayersKey, new List<string>() { layerName });
}
if (LayerDisplayNames.Contains(layerName))
{
LayerDisplayNames.Remove(layerName);
}
LayerDisplayNames.Add(layerName);
// LayerDisplayNames.Add(layerName + " " + commonLayersKey);
}
else
{
SourceLayersDictionary[layerSource].Add(layerName);
LayerDisplayNames.Add(layerName);
}
}
else
{
SourceLayersDictionary.Add(layerSource, new List<string>() { layerName });
LayerDisplayNames.Add(layerName);
}
//Load properties
foreach (var property in layer.Fields)
{
propertyName = property.Key;
propertyDescription = property.Value;
layerPropertiesList.Add(propertyName);
//adding property descriptions
if (LayerPropertyDescriptionDictionary.ContainsKey(layerName))
{
if (!LayerPropertyDescriptionDictionary[layerName].ContainsKey(propertyName))
{
LayerPropertyDescriptionDictionary[layerName].Add(propertyName, propertyDescription);
}
}
else
{
LayerPropertyDescriptionDictionary.Add(layerName, new Dictionary<string, string>() { { propertyName, propertyDescription } });
}
//Loading display names for properties
if (PropertyDisplayNames.ContainsKey(layerName))
{
if (!PropertyDisplayNames[layerName].Contains(propertyName))
{
PropertyDisplayNames[layerName].Add(propertyName);
//logic to add the list of masked properties from all sources that are not #1
if (LayerSourcesDictionary[layerName].Count > 1 && !string.IsNullOrEmpty(tjr.Source))
{
var firstSource = tjr.Source.Split(new string[] { "," }, System.StringSplitOptions.None)[0].Trim();
if (layerSource != firstSource)
{
if (PropertyDisplayNames[layerName].Contains(propertyName))
{
PropertyDisplayNames[layerName].Remove(propertyName);
}
PropertyDisplayNames[layerName].Add(propertyName);
//PropertyDisplayNames[layerName].Add(propertyName + " " + optionalPropertiesString);
}
}
}
}
else
{
PropertyDisplayNames.Add(layerName, new List<string> { propertyName });
}
}
if (PropertyDisplayNames.ContainsKey(layerName) && PropertyDisplayNames[layerName].Count > 1)
{
PropertyDisplayNames[layerName].Sort();
}
}
if (LayerDisplayNames.Count > 1)
{
LayerDisplayNames.Sort();
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 52cf051b4afa24ba6895b9a42b179eed
timeCreated: 1524801966
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
namespace Mapbox.Unity.Map
{
using System;
using System.Collections.Generic;
using Mapbox.Json;
public class TileStats
{
[JsonProperty("account")]
public string account;
[JsonProperty("tilesetid")]
public string tilesetid;
[JsonProperty("layers")]
public LayerStats[] layers;
}
public class LayerStats
{
[JsonProperty("account")]
public string account;
[JsonProperty("tilesetid")]
public string tilesetid;
[JsonProperty("layer")]
public string layer;
[JsonProperty("geometry")]
public string geometry;
[JsonProperty("count")]
public string count;
[JsonProperty("attributes")]
public AttributeStats[] attributes;
}
public class AttributeStats
{
[JsonProperty("attribute")]
public string attribute;
[JsonProperty("type")]
public string type;
[JsonProperty("values")]
public string[] values;
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: a54ae05a24f6b499c8ef1d26ffedbbf6
timeCreated: 1530635960
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
namespace Mapbox.Unity.Map
{
using System.IO;
using Mapbox.Unity.Map;
using UnityEngine;
using System.Text;
using Mapbox.Json;
public class TileStatsFetcher
{
private static TileStatsFetcher _instance;
private string _filePath = "Assets/Mapbox/Unity/DataContainers/streets-v7-stats.json";
public static TileStatsFetcher Instance
{
get
{
if (_instance == null)
{
_instance = new TileStatsFetcher();
}
return _instance;
}
}
/// <summary>
/// Gets the tile stats json for the supplied source Id.
/// </summary>
/// <returns>A prepopulated <see cref=" TileStats"/> instance.</returns>
/// <param name="sourceId">Source Id of the Mapbox Tileset.</param>
public TileStats GetTileStats(VectorSourceType sourceType)
{
TileStats stats = null;
switch (sourceType)
{
case VectorSourceType.MapboxStreets:
case VectorSourceType.MapboxStreetsWithBuildingIds:
using (Stream stream = new FileStream(_filePath, FileMode.Open))
{
using (StreamReader reader = new StreamReader(stream))
{
stats = JsonConvert.DeserializeObject<TileStats>(reader.ReadToEnd());
}
}
break;
default:
break;
}
return stats;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 7fcfafee1945e413e804e0b0e25ae560
timeCreated: 1530635960
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
namespace Mapbox.Unity.Map
{
using System;
using Mapbox.Unity.Utilities;
[Serializable]
public class UnifiedMapOptions
{
public MapPresetType mapPreset = MapPresetType.LocationBasedMap;
public MapOptions mapOptions = new MapOptions();
[NodeEditorElement("Image Layer")]
public ImageryLayerProperties imageryLayerProperties = new ImageryLayerProperties();
[NodeEditorElement("Terrain Layer")]
public ElevationLayerProperties elevationLayerProperties = new ElevationLayerProperties();
[NodeEditorElement("Vector Layer")]
public VectorLayerProperties vectorLayerProperties = new VectorLayerProperties();
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4ee20976ba70747b18ae908f30927ca9
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using Mapbox.Unity.MeshGeneration.Data;
namespace Mapbox.Unity.Map
{
using System;
using UnityEngine;
[Serializable]
public class UnityLayerOptions : MapboxDataProperty
{
[Tooltip("Add terrain tiles to Unity Layer")]
public bool addToLayer = false;
[Tooltip("Unity Layer id to which terrain tiles will get added.")]
public int layerId = 0;
public override void UpdateProperty(UnityTile tile)
{
tile.gameObject.layer = layerId;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 8ecbb47ee371342fb90233bf8ae8c471
timeCreated: 1519860268
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 575f56052354f4672bed93408ec3e403
timeCreated: 1530664790
licenseType: Pro
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: