Exemple #1
0
        /// <summary>
        /// Adds elevation.
        /// </summary>
        public void AddElevation(ElevationHandler.GetElevationDelegate getElevationFunc)
        {
            if (_elevation == null)
            {
                _elevation = _createElevation(_coordinates.Length / 2);
            }

            for (var i = 0; i < _index.Length; i++)
            {
                ShapesArray.ExtractPointerAndSize(_index[i], out var pointer, out var size);
                if (size > 0)
                {
                    for (var p = 0; p < size; p++)
                    {
                        var lat = _coordinates[pointer + (p * 2)];
                        var lon = _coordinates[pointer + (p * 2) + 1];

                        var e = getElevationFunc(lat, lon);
                        if (e.HasValue)
                        {
                            _elevation[pointer / 2 + p] = e.Value;
                        }
                        else
                        {
                            _elevation[pointer / 2 + p] = NO_ELEVATION;
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Adds elevation.
        /// </summary>
        public void AddElevation(ElevationHandler.GetElevationDelegate getElevationFunc)
        {
            // add elevation to all vertices.
            for (uint v = 0; v < this.VertexCount; v++)
            {
                var location  = this.GetVertex(v);
                var elevation = getElevationFunc(location.Latitude, location.Longitude);

                this.UpdateVertex(v, location.Latitude, location.Longitude, elevation);
            }

            _shapes.AddElevation(getElevationFunc);
        }
Exemple #3
0
 /// <summary>
 /// Adds elevation to the given routerdb using the given elevation provider.
 /// </summary>
 public static void AddElevation(this RouterDb routerDb, ElevationHandler.GetElevationDelegate getElevationFunc)
 {
     routerDb.Network.GeometricGraph.AddElevation(getElevationFunc);
 }