Exemplo n.º 1
0
        /// <summary>
        /// Creates the prefab layer.
        /// </summary>
        /// <param name="item"> the options of the prefab layer.</param>
        private void CreatePrefabLayer(PrefabItemOptions item)
        {
            if (_vectorData.LayerProperty.sourceType == VectorSourceType.None ||
                !_vectorData.LayerProperty.sourceOptions.Id.Contains(MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id))
            {
                Debug.LogError("In order to place location prefabs please add \"mapbox.mapbox-streets-v7\" to the list of vector data sources");
                return;
            }

            //ensure that there is a vector layer
            if (_vectorData == null)
            {
                _vectorData = new VectorLayer();
            }

            //ensure that there is a list of prefabitems
            if (_vectorData.LocationPrefabsLayerProperties.locationPrefabList == null)
            {
                _vectorData.LocationPrefabsLayerProperties.locationPrefabList = new List <PrefabItemOptions>();
            }

            //add the prefab item if it doesn't already exist
            if (!_vectorData.LayerProperty.vectorSubLayers.Contains(item))
            {
                _vectorData.LocationPrefabsLayerProperties.locationPrefabList.Add(item);
                _vectorData.AddVectorLayer(item);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the prefab layer.
        /// </summary>
        /// <param name="item"> the options of the prefab layer.</param>
        private void CreatePrefabLayer(PrefabItemOptions item)
        {
            if (LayerProperty.sourceType == VectorSourceType.None ||
                !LayerProperty.sourceOptions.Id.Contains(MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id))
            {
                Debug.LogError("In order to place location prefabs please add \"mapbox.mapbox-streets-v7\" to the list of vector data sources");
                return;
            }

            AddPointsOfInterestSubLayer(item);
        }
Exemplo n.º 3
0
 private void SetLayerSourceInternal(VectorSourceType vectorSource)
 {
     if (vectorSource != VectorSourceType.Custom && vectorSource != VectorSourceType.None)
     {
         _layerProperty.sourceType = vectorSource;
         _layerProperty.sourceOptions.layerSource = MapboxDefaultVector.GetParameters(vectorSource);
     }
     else
     {
         Debug.LogWarning("Invalid style - trying to set " + vectorSource.ToString() + " as default style!");
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the prefab layer.
        /// </summary>
        /// <param name="item"> the options of the prefab layer.</param>
        private void CreatePrefabLayer(PrefabItemOptions item)
        {
            if (_vectorData.LayerProperty.sourceType == VectorSourceType.None ||
                !_vectorData.LayerProperty.sourceOptions.Id.Contains(MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id))
            {
                Debug.LogError("In order to place location prefabs please add \"mapbox.mapbox-streets-v7\" to the list of vector data sources");
                return;
            }

            //ensure that there is a vector layer
            if (_vectorData == null)
            {
                _vectorData = new VectorLayer();
            }

            _vectorData.AddLocationPrefabItem(item);
        }
Exemplo n.º 5
0
 public void Initialize()
 {
     _vectorTileFactory = ScriptableObject.CreateInstance <VectorTileFactory>();
     if (_layerProperty.sourceType != VectorSourceType.None || _layerProperty.sourceOptions.Id.Contains(MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets).Id))
     {
         foreach (var item in _locationPrefabsLayerProperties.locationPrefabList)
         {
             //Add PrefabItemOptions items as a VectorSubLayerProperties
             if (!_layerProperty.vectorSubLayers.Contains(item))
             {
                 //Add PrefabItemOptions items as a VectorSubLayerProperties
                 //if (_layerProperty.sourceType == VectorSourceType.Custom || _layerProperty.sourceType == VectorSourceType.None)
                 //{
                 //	if (_layerProperty.sourceType == VectorSourceType.None)
                 //		_layerProperty.sourceOptions.Id = "";
                 //	//This is the style id we need for instantiating POI location prefabs
                 //	Style streetsVectorSource = MapboxDefaultVector.GetParameters(VectorSourceType.MapboxStreets);
                 //	AddLayerSource(streetsVectorSource.Id);
                 //}
                 AddVectorLayer(item);
             }
         }
     }
     _vectorTileFactory.SetOptions(_layerProperty);
 }