Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        private void SetEvaluationTolerance(ICoverage coverage)
        {
            var featureCoverage1 = coverage as FeatureCoverage;

            if (featureCoverage1 != null)
            {
                var tolerance       = Map.PixelSize * 5;
                var featureCoverage = featureCoverage1;
                if (featureCoverage.EvaluateTolerance != tolerance)
                {
                    featureCoverage.EvaluateTolerance = tolerance;
                }
            }

            var networkCoverage = coverage as NetworkCoverage;

            if (networkCoverage != null)
            {
                var tolerance = Map.PixelSize * 20;
                if (networkCoverage.EvaluateTolerance != tolerance)
                {
                    networkCoverage.EvaluateTolerance = tolerance;
                }
            }
        }
Ejemplo n.º 3
0
 public Report(IReportOptions options, IEnviornmentVariables enviornmentVariables, ISourceCode sourceCode, ICoverage coverage)
 {
     _reportOptions       = new Lazy <IReportOptions>(() => options);
     EnviornmentVariables = enviornmentVariables;
     SourceCode           = sourceCode;
     Coverage             = coverage;
     _reporter            = new Lazy <string>(() => $"{Env}{Network}{CombinedCoverage}");
 }
Ejemplo n.º 4
0
 public bool IsSuperCoverage(ICoverage subCov)
 {
     if (Bitness != subCov.Bitness)
     {
         throw new ArgumentException();
     }
     return(Intersection(subCov).Equals(subCov));
 }
Ejemplo n.º 5
0
 public ICube[] Intersection(ICoverage intrsctCov)
 {
     if (Bitness != intrsctCov.Bitness)
     {
         throw new ArgumentException();
     }
     return(Cubes.Intersect(intrsctCov.ToCubesArray()).ToArray());
 }
Ejemplo n.º 6
0
 public ICube[] Except(ICoverage excptCov)
 {
     if (Bitness != excptCov.Bitness)
     {
         throw new ArgumentException();
     }
     return(Cubes.Except(excptCov.ToCubesArray()).ToArray());
 }
Ejemplo n.º 7
0
 public UploadFacade(IContinuousIntegrationServer continuousIntegrationServer, IVersionControlSystem versionControlSystem, IYaml yaml, ICoverage coverage, IEnviornmentVariables enviornmentVariables, IUrl url, IUpload upload)
 {
     _continuousIntegrationServer = continuousIntegrationServer;
     _versionControlSystem        = versionControlSystem;
     _yaml                 = yaml;
     _coverage             = coverage;
     _enviornmentVariables = enviornmentVariables;
     _url    = url;
     _upload = upload;
 }
Ejemplo n.º 8
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;
            }
        }
        private void UpdateCoverageTimeFilters(ICoverage coverage)
        {
            var currentTimeFilter = coverage.Filters
                        .OfType<IVariableValueFilter>()
                        .Where(f => f.Variable is Variable<DateTime>)
                        .FirstOrDefault();

            //update the time filter and we're done
            if (currentTimeFilter != null)
            {
                currentTimeFilter.Values[0] = CurrentTime; 
            }
        }
Ejemplo n.º 10
0
        private void UpdateCoverageTimeFilters(ICoverage coverage)
        {
            var currentTimeFilter = coverage.Filters
                                    .OfType <IVariableValueFilter>()
                                    .Where(f => f.Variable is Variable <DateTime>)
                                    .FirstOrDefault();

            //update the time filter and we're done
            if (currentTimeFilter != null)
            {
                currentTimeFilter.Values[0] = CurrentTime;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Defines the gridProfile function
        /// </summary>
        /// <param name="grid"></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 Function GetCoverageValues(ICoverage grid, ILineString polyline, DateTime? time, double? resolution = null)
        {
            var function = new Function { Name = grid.Name };

            function.Arguments.Add(new Variable<double>("offset"));
            function.Components.Add((IVariable)TypeUtils.CreateGeneric(typeof(Variable<>), grid.Components[0].ValueType, new object[] { "value" }));
            function.Components[0].NoDataValues = grid.Components[0].NoDataValues;

            if (null == polyline)
            {
                return function;
            }

            UpdateProfileFunctionValues(function, grid, polyline, time, resolution);

            return function;
        }
        private void UpdateCoverageTimeFilters(ICoverage coverage)
        {
            var currentTimeFilter = coverage.Filters
                                    .OfType <IVariableValueFilter>()
                                    .FirstOrDefault(f => f.Variable is Variable <DateTime>);

            //update the time filter and we're done
            if (currentTimeFilter != null)
            {
                if (TimeSelectionStart.HasValue && TimeSelectionStart.Value == DateTime.MinValue)
                {
                    SetCurrentTimeSelection(coverage.Time.AllValues.FirstOrDefault(), null);
                }

                currentTimeFilter.Values[0] = TimeSelectionStart;
            }
        }
Ejemplo n.º 13
0
 private void btnBulid_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.listView1.SelectedIndices.Count > 0)
         {
             ICoverage    coverage         = (this.icoverageName_0 as IName).Open() as ICoverage;
             ListViewItem item             = this.listView1.SelectedItems[0];
             ICoverageFeatureClassName tag = item.Tag as ICoverageFeatureClassName;
             coverage.Build(tag.FeatureClassType, "");
             coverage = null;
             MessageBox.Show("Bulid成功!");
         }
     }
     catch (Exception exception)
     {
         Logger.Current.Error("", exception, "");
         MessageBox.Show("Bulid失败!");
     }
 }
Ejemplo n.º 14
0
 private void SetEvaluationTolerance(ICoverage coverage)
 {
     if (coverage is FeatureCoverage)
     {
         var tolerance       = Map.PixelSize * 5;
         var featureCoverage = ((FeatureCoverage)coverage);
         if (featureCoverage.EvaluateTolerance != tolerance)
         {
             featureCoverage.EvaluateTolerance = tolerance;
         }
     }
     if (coverage is NetworkCoverage)
     {
         var tolerance       = Map.PixelSize * 20;
         var networkCoverage = (NetworkCoverage)coverage;
         if (networkCoverage.EvaluateTolerance != tolerance)
         {
             networkCoverage.EvaluateTolerance = tolerance;
         }
     }
 }
Ejemplo n.º 15
0
 private void btnClean_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.listView1.SelectedIndices.Count > 0)
         {
             ICoverage    coverage         = (this.icoverageName_0 as IName).Open() as ICoverage;
             double       dangleTolerance  = coverage.get_Tolerance(esriCoverageToleranceType.esriCTTFuzzy);
             double       fuzzyTolerance   = coverage.get_Tolerance(esriCoverageToleranceType.esriCTTDangle);
             ListViewItem item             = this.listView1.SelectedItems[0];
             ICoverageFeatureClassName tag = item.Tag as ICoverageFeatureClassName;
             coverage.Clean(dangleTolerance, fuzzyTolerance, tag.FeatureClassType);
             coverage = null;
             MessageBox.Show("Clean成功!");
         }
     }
     catch (Exception exception)
     {
         Logger.Current.Error("", exception, "");
         MessageBox.Show("Clean失败!");
     }
 }
        private void UpdateCoverageTimeFilters(ICoverage coverage)
        {
            var currentTimeFilter = coverage.Filters
                                            .OfType<IVariableValueFilter>()
                                            .FirstOrDefault(f => f.Variable is Variable<DateTime>);

            //update the time filter and we're done
            if (currentTimeFilter != null)
            {
                if (TimeSelectionStart.HasValue && TimeSelectionStart.Value == DateTime.MinValue)
                    SetCurrentTimeSelection(coverage.Time.AllValues.FirstOrDefault(), null);

                currentTimeFilter.Values[0] = TimeSelectionStart;
            }
        }
Ejemplo n.º 17
0
 public ICube[] Intersection(ICoverage intrsctCov)
 {
     return(ToCubesArray());
 }
Ejemplo n.º 18
0
 public ICube[] Except(ICoverage subCov)
 {
     return(ToCubesArray());
 }
Ejemplo n.º 19
0
 public bool Equals(ICoverage coverage)
 {
     return(coverage.Bitness == Bitness &&
            coverage.Size == Size &&
            Intersection(coverage).Length == Size);
 }
Ejemplo n.º 20
0
 private static DateTime GetDefaultTimeFromCoverage(ICoverage coverage)
 {
     //if no time is specified we set a default (first or minvalue)
     return(coverage.Time.AllValues.Count > 0 ? coverage.Time.AllValues[0] : DateTime.MinValue);
 }
Ejemplo n.º 21
0
 public bool IsSubCoverage(ICoverage superCov)
 {
     return(true);
 }
Ejemplo n.º 22
0
 public bool IsSuperCoverage(ICoverage subCov)
 {
     return(subCov.GetType() == typeof(EmptyCube));
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Defines the gridProfile function
        /// </summary>
        /// <param name="grid"></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 Function GetCoverageValues(ICoverage grid, ILineString polyline, DateTime? time, double? resolution = null)
        {
            var function = new Function { Name = grid.Name };

            function.Arguments.Add(new Variable<double>("offset"));
            function.Components.Add((IVariable)TypeUtils.CreateGeneric(typeof(Variable<>), grid.Components[0].ValueType, new object[] { "value" }));
            function.Components[0].NoDataValues = grid.Components[0].NoDataValues;

            if (null == polyline)
            {
                return function;
            }

            UpdateProfileFunctionValues(function, grid, polyline, time, resolution);

            return function;
        }
Ejemplo n.º 24
0
 public CoverageTask(NUnitTask nunit, DevenvTask task, ICoverage instrument)
 {
     _nunit      = nunit;
     _builder    = task;
     _instrument = instrument;
 }
Ejemplo n.º 25
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;
            }
        }
Ejemplo n.º 26
0
        private void SetEvaluationTolerance(ICoverage coverage)
        {
            var featureCoverage1 = coverage as FeatureCoverage;
            if (featureCoverage1 != null)
            {
                var tolerance = Map.PixelSize * 5;
                var featureCoverage = featureCoverage1;
                if (featureCoverage.EvaluateTolerance != tolerance)
                {
                    featureCoverage.EvaluateTolerance = tolerance;
                }
            }

            var networkCoverage = coverage as NetworkCoverage;
            if (networkCoverage != null)
            {
                var tolerance = Map.PixelSize * 20;
                if (networkCoverage.EvaluateTolerance != tolerance)
                {
                    networkCoverage.EvaluateTolerance = tolerance;
                }
            }
        }
Ejemplo n.º 27
0
 public CoverageTask(NUnitTask nunit, DevenvTask task, ICoverage instrument)
 {
     _nunit = nunit;
     _builder = task;
     _instrument = instrument;
 }
Ejemplo n.º 28
0
 private static DateTime GetDefaultTimeFromCoverage(ICoverage coverage)
 {
     //if no time is specified we set a default (first or minvalue)
     return coverage.Time.AllValues.Count > 0 ? coverage.Time.AllValues[0] : DateTime.MinValue;
 }