Ejemplo n.º 1
0
        /// <summary>
        /// Gets or creates a tile.
        /// </summary>
        /// <param name="tree">The tree.</param>
        /// <param name="tileId">The tile id.</param>
        /// <returns>The vector tile.</returns>
        internal static VectorTile TryGetOrCreate(this VectorTileTree tree, ulong tileId)
        {
            if (tree.TryGet(tileId, out var vectorTile))
            {
                return(vectorTile);
            }

            vectorTile = new VectorTile
            {
                TileId = tileId
            };
            tree[tileId] = vectorTile;
            return(vectorTile);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the given features to the vector tile tree, expanding it if needed.
 /// </summary>
 /// <param name="tree">The tree.</param>
 /// <param name="featuresZoomAndLayer">The features to add and their zoom and layer.</param>
 public static void Add(this VectorTileTree tree, IEnumerable <(IFeature feature, int zoom, string layerName)> featuresZoomAndLayer)
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the given features to the vector tile tree, expanding it if needed.
 /// </summary>
 /// <param name="tree">The tree.</param>
 /// <param name="features">The features to add.</param>
 /// <param name="zoom">The zoom.</param>
 /// <param name="layerName">The layer name.</param>
 public static void Add(this VectorTileTree tree, FeatureCollection features, int zoom = 14, string layerName = "default")
 {
     tree.Add(features.Features.Select <IFeature, (IFeature feature, int zoom, string layer)>(x => (x, zoom, layer: layerName)));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the given features to the vector tile tree, expanding it if needed.
 /// </summary>
 /// <param name="tree">The tree.</param>
 /// <param name="features">The features to add.</param>
 /// <param name="toFeatureZoomAndLayer">The feature, zoom and layer function.</param>
 public static void Add(this VectorTileTree tree, IEnumerable <IFeature> features, ToFeatureZoomAndLayerFunc toFeatureZoomAndLayer)
 {
     tree.Add(features.ToFeaturesZoomAndLayer(toFeatureZoomAndLayer));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the given features to the vector tile tree, expanding it if needed.
 /// </summary>
 /// <param name="tree">The tree.</param>
 /// <param name="features">The features to add.</param>
 /// <param name="toFeatureZoomAndLayer">The feature, zoom and layer function.</param>
 public static void Add(this VectorTileTree tree, FeatureCollection features, ToFeatureZoomAndLayerFunc toFeatureZoomAndLayer)
 {
     tree.Add(features.Features.ToFeaturesZoomAndLayer(toFeatureZoomAndLayer));
 }