/// <summary>
        /// Fills gridvalues function with profiledata based on profileline over the grid
        /// </summary>
        /// <param name="function"></param>
        /// <param name="coverage"></param>
        /// <param name="polyline"></param>
        /// <param name="resolution">Defines the sample resolution along <paramref name="polyline"/> (each resolution step a sample).
        /// Null will cause 101 samples to be take along the line uniformly.</param>
        /// <exception cref="ArgumentException">When <paramref name="resolution"/> is 0.0 or less.</exception>
        public static void UpdateProfileFunctionValues(Function function, ICoverage coverage, ILineString polyline, DateTime?time, double?resolution = null)
        {
            // when coverage is empty (has no times), we cannot call Evaluate below...
            if (time != null && time.Equals(default(DateTime)))
            {
                return;
            }

            function.Clear();
            double offset = 0;
            double step   = resolution ?? polyline.Length / 100;
            var    gridProfileCoordinates = GetGridProfileCoordinates(polyline, step).ToArray();

            foreach (ICoordinate coordinate in gridProfileCoordinates)
            {
                var value = time != null?coverage.Evaluate(coordinate, time.Value) : coverage.Evaluate(coordinate);

                if (value == null)
                {
                    offset += step;
                    continue;
                }
                function[offset] = value;
                offset          += step;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Fills gridvalues function with profiledata based on profileline over the grid
        /// </summary>
        /// <param name="function"></param>
        /// <param name="grid"></param>
        /// <param name="polyline"></param>
        public static void UpdateCoverageValues(Function function, ICoverage grid, ILineString polyline, DateTime?time)
        {
            function.Clear();
            double offset = 0;
            double step   = polyline.Length / 100;

            foreach (ICoordinate coordinate in GetGridProfileCoordinates(polyline, step))
            {
                function[offset] = time != null?grid.Evaluate(coordinate, time.Value) : grid.Evaluate(coordinate);

                offset += step;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Fills gridvalues function with profiledata based on profileline over the grid
        /// </summary>
        /// <param name="function"></param>
        /// <param name="coverage"></param>
        /// <param name="polyline"></param>
        /// <param name="resolution">Defines the sample resolution along <paramref name="polyline"/> (each resolution step a sample).
        /// Null will cause 101 samples to be take along the line uniformly.</param>
        /// <exception cref="ArgumentException">When <paramref name="resolution"/> is 0.0 or less.</exception> 
        public static void UpdateProfileFunctionValues(Function function, ICoverage coverage, ILineString polyline, DateTime? time, double? resolution = null)
        {
            // when coverage is empty (has no times), we cannot call Evaluate below...
            if (time != null && time.Equals(default(DateTime))) return;

            function.Clear();
            double offset = 0;
            double step = resolution ?? polyline.Length / 100;
            var gridProfileCoordinates = GetGridProfileCoordinates(polyline, step).ToArray();
            foreach (ICoordinate coordinate in gridProfileCoordinates)
            {
                var value = time != null ? coverage.Evaluate(coordinate, time.Value) : coverage.Evaluate(coordinate);
                if (value == null)
                {
                    offset += step;
                    continue;
                }
                function[offset] = value;
                offset += step;
            }
        }