public void ShowUsingMapView() { var points = new[, ] { { new Point(0, 0), new Point(1, 0), new Point(2, 0) }, { new Point(0, 1), new Point(1, 1), new Point(2, 1) }, }; var coverage = new DiscreteGridPointCoverage(2, 3, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.ShowModal(map); }
public void ShowUsingMapViewWhereValuesContainNoDataValue() { var points = new[,] { {new Point(0, 0), new Point(1, 0)}, {new Point(2, 1), new Point(3, 1.5)}, {new Point(1, 2), new Point(3, 3)} }; var coverage = new DiscreteGridPointCoverage(2, 3, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, -999.0} }; coverage.Components[0].NoDataValues = new [] {-999.0}; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.ShowModal(map); }
public void ShowUsingMapViewWhereValuesContainNoDataValue() { var points = new[, ] { { new Point(0, 0), new Point(1, 0) }, { new Point(2, 1), new Point(3, 1.5) }, { new Point(1, 2), new Point(3, 3) } }; var coverage = new DiscreteGridPointCoverage(2, 3, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, -999.0 } }; coverage.Components[0].NoDataValues = new [] { -999.0 }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.Show(map); }
public void ShowUsingMapViewWithFaces() { var points = new[, ] { { new Point(0.0, 1.0), new Point(0.0, 0.0) }, { new Point(0.5, 1.5), new Point(1.0, 0.0) }, { new Point(1.0, 2.0), new Point(2.0, 2.0) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.Show(map); }
public void ShowUsingMapView() { var points = new[,] { {new Point(0, 0), new Point(1, 0), new Point(2, 0)}, {new Point(0, 1), new Point(1, 1), new Point(2, 1)}, }; var coverage = new DiscreteGridPointCoverage(2, 3, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer {Coverage = coverage}; var map = new Map {Layers = {coverageLayer}}; MapTestHelper.ShowModal(map); }
public void Create() { var points = new IPoint[, ] { { new Point(0, 0), new Point(1, 0) }, { new Point(2, 1), new Point(3, 1.5) }, { new Point(1, 2), new Point(3, 3) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); var value = coverage.Evaluate(points[1, 1].Coordinate); const double expectedValue = 4.0; Assert.AreEqual(expectedValue, value); Assert.IsTrue(coverage.Components[0].Values.Cast <double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 })); Assert.AreEqual("new grid point coverage", coverage.Name); }
public void Create() { var points = new IPoint[,] { {new Point(0, 0), new Point(1, 0)}, {new Point(2, 1), new Point(3, 1.5)}, {new Point(1, 2), new Point(3, 3)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); var value = coverage.Evaluate(points[1, 1].Coordinate); const double expectedValue = 4.0; Assert.AreEqual(expectedValue, value); Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 })); Assert.AreEqual("new grid point coverage", coverage.Name); }
public void Create() { var points = new IPoint[,] { {new Point(0.0, 1.0), new Point(0.0, 0.0)}, {new Point(0.5, 1.5), new Point(1.0, 0.0)}, {new Point(1.0, 2.0), new Point(2.0, 2.0)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); /* var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.Show(map); */ var value = coverage.Evaluate(points[1, 1].Coordinate); const double expectedValue = 4.0; Assert.AreEqual(expectedValue, value); Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 })); Assert.AreEqual("new grid point coverage", coverage.Name); }
public void NoCrashOnEmptyCoverage() { var coverage = new DiscreteGridPointCoverage(); new DiscreteGridPointCoverageLayer { Coverage = coverage }; }
public void ShowUsingMapViewWithFacesAndTimeNavigation() { var points = new[, ] { { new Point(0.0, 1.0), new Point(0.0, 0.0) }, { new Point(0.5, 1.5), new Point(1.0, 0.0) }, { new Point(1.0, 2.0), new Point(2.0, 2.0) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()) { IsTimeDependent = true }; var values1 = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; var values2 = new[, ] { { 2.0, 2.0 }, { 2.0, 4.0 }, { 1.0, 2.0 } }; coverage[new DateTime(2000, 1, 1)] = values1; coverage[new DateTime(2001, 1, 1)] = values2; coverage[new DateTime(2002, 1, 1)] = values1; coverage[new DateTime(2003, 1, 1)] = values2; var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.Show(map); /* * var mapView = new MapView {Data = map}; * var timeNavigator = new TimeSeriesNavigator {Data = mapView}; * * WindowsFormsTestHelper.Show(timeNavigator); * WindowsFormsTestHelper.ShowModal(mapView); */ }
public IFunction CreateFunction(IEnumerable<IVariable> variables) { InitializeVariables(variables); var coverage = new DiscreteGridPointCoverage { Arguments = new EventedList<IVariable>(ValuesVariable.Arguments), Components = new EventedList<IVariable>(ValuesVariable.Components), X = XVariable, Y = YVariable, Index1 = Index1Variable, Index2 = Index2Variable }; return coverage; }
public void Faces() { // create coverage var points = new IPoint[, ] { { new Point(0, 0), new Point(1, 0) }, { new Point(2, 1), new Point(3, 1.5) }, { new Point(1, 2), new Point(3, 3) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); // check faces coverage.Faces.Count .Should().Be.EqualTo(2); var geometry = coverage.Faces.First().Geometry; geometry.Coordinates[0] .Should().Be.EqualTo(points[0, 0].Coordinate); geometry.Coordinates[3] .Should().Be.EqualTo(points[1, 0].Coordinate); geometry.Coordinates[2] .Should().Be.EqualTo(points[1, 1].Coordinate); geometry.Coordinates[1] .Should().Be.EqualTo(points[0, 1].Coordinate); geometry.Coordinates[4] .Should().Be.EqualTo(points[0, 0].Coordinate); }
public void CreateTimeDependent() { var points = new[, ] { { new Point(0, 0), new Point(1, 0) }, { new Point(2, 1), new Point(3, 1.5) }, { new Point(1, 2), new Point(3, 3) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()) { IsTimeDependent = true }; var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; var t = DateTime.Now; coverage.SetValues(values, new VariableValueFilter <DateTime>(coverage.Time, t)); values = new[, ] { { 10.0, 20.0 }, { 30.0, 40.0 }, { 50.0, 60.0 } }; coverage.SetValues(values, new VariableValueFilter <DateTime>(coverage.Time, t.AddYears(1))); var values1 = coverage.GetValues <double>(new VariableValueFilter <DateTime>(coverage.Time, t)); values1.Should().Have.SameSequenceAs(new[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }); var values2 = coverage.GetValues <double>(new VariableValueFilter <DateTime>(coverage.Time, t.AddYears(1))); values2.Should().Have.SameSequenceAs(new[] { 10.0, 20.0, 30.0, 40.0, 50.0, 60.0 }); }
[Category(TestCategory.WorkInProgress)] // Drag & Drop registration problems public void QueryValuesUsingProfileTool() { var points = new[, ] { { new Point(0.0, 1.0), new Point(0.0, 0.0) }, { new Point(0.5, 1.5), new Point(1.0, 0.0) }, { new Point(1.0, 2.0), new Point(2.0, 2.0) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true, ShowVertices = true }; var map = new Map { Layers = { coverageLayer } }; var mapControl = new MapControl { Map = map }; mapControl.FixedZoomOutTool.Execute(); // zoom out a bit mapControl.ActivateTool(mapControl.CoverageProfileTool); WindowsFormsTestHelper.ShowModal(mapControl); }
public void Create() { var points = new IPoint[, ] { { new Point(0.0, 1.0), new Point(0.0, 0.0) }, { new Point(0.5, 1.5), new Point(1.0, 0.0) }, { new Point(1.0, 2.0), new Point(2.0, 2.0) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()); var values = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; coverage.SetValues(values); /* * var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; * var map = new Map { Layers = { coverageLayer } }; * MapTestHelper.Show(map); */ var value = coverage.Evaluate(points[1, 1].Coordinate); const double expectedValue = 4.0; Assert.AreEqual(expectedValue, value); Assert.IsTrue(coverage.Components[0].Values.Cast <double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 })); Assert.AreEqual("new grid point coverage", coverage.Name); }
public void CreateTimeDependent() { var points = new[,] { {new Point(0, 0), new Point(1, 0)}, {new Point(2, 1), new Point(3, 1.5)}, {new Point(1, 2), new Point(3, 3)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()) { IsTimeDependent = true }; var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; var t = DateTime.Now; coverage.SetValues(values, new VariableValueFilter<DateTime>(coverage.Time, t)); values = new[,] { {10.0, 20.0}, {30.0, 40.0}, {50.0, 60.0} }; coverage.SetValues(values, new VariableValueFilter<DateTime>(coverage.Time, t.AddYears(1))); var values1 = coverage.GetValues<double>(new VariableValueFilter<DateTime>(coverage.Time, t)); values1.Should().Have.SameSequenceAs(new[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}); var values2 = coverage.GetValues<double>(new VariableValueFilter<DateTime>(coverage.Time, t.AddYears(1))); values2.Should().Have.SameSequenceAs(new[] { 10.0, 20.0, 30.0, 40.0, 50.0, 60.0 }); }
public void ShowUsingMapViewWithFaces() { var points = new[,] { {new Point(0.0, 1.0), new Point(0.0, 0.0)}, {new Point(0.5, 1.5), new Point(1.0, 0.0)}, {new Point(1.0, 2.0), new Point(2.0, 2.0)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true}; var map = new Map { Layers = { coverageLayer } }; MapTestHelper.ShowModal(map); }
public void ShowUsingMapViewWithFacesAndTimeNavigation() { LogHelper.ConfigureLogging(Level.Debug); var points = new[,] { {new Point(0.0, 1.0), new Point(0.0, 0.0)}, {new Point(0.5, 1.5), new Point(1.0, 0.0)}, {new Point(1.0, 2.0), new Point(2.0, 2.0)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()) { IsTimeDependent = true }; var values1 = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; var values2 = new[,] { {2.0, 2.0}, {2.0, 4.0}, {1.0, 2.0} }; coverage[new DateTime(2000, 1, 1)] = values1; coverage[new DateTime(2001, 1, 1)] = values2; coverage[new DateTime(2002, 1, 1)] = values1; coverage[new DateTime(2003, 1, 1)] = values2; var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; var map = new Map { Layers = { coverageLayer } }; // create time navigation track bar var form = new Form { Width = 500, Height = 100 }; var trackBar = new TrackBar { Dock = DockStyle.Fill, Minimum = 0, Maximum = coverage.Time.Values.Count - 1 }; trackBar.ValueChanged += delegate { coverageLayer.SetCurrentTimeSelection(coverage.Time.Values[trackBar.Value], null); }; form.Controls.Add(trackBar); WindowsFormsTestHelper.Show(form); WindowsFormsTestHelper.ShowModal(new MapControl { Map = map, AllowDrop = false }, coverageLayer); }
public void QueryValuesUsingProfileTool() { var points = new[,] { {new Point(0.0, 1.0), new Point(0.0, 0.0)}, {new Point(0.5, 1.5), new Point(1.0, 0.0)}, {new Point(1.0, 2.0), new Point(2.0, 2.0)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true, ShowVertices = true }; var map = new Map { Layers = { coverageLayer } }; var mapControl = new MapControl { Map = map, AllowDrop = false }; mapControl.FixedZoomOutTool.Execute(); // zoom out a bit mapControl.ActivateTool(mapControl.CoverageProfileTool); WindowsFormsTestHelper.ShowModal(mapControl); }
public void Faces() { // create coverage var points = new IPoint[,] { {new Point(0, 0), new Point(1, 0)}, {new Point(2, 1), new Point(3, 1.5)}, {new Point(1, 2), new Point(3, 3)} }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>()); var values = new[,] { {1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0} }; coverage.SetValues(values); // check faces coverage.Faces.Count .Should().Be.EqualTo(2); var geometry = coverage.Faces.First().Geometry; geometry.Coordinates[0] .Should().Be.EqualTo(points[0, 0].Coordinate); geometry.Coordinates[3] .Should().Be.EqualTo(points[1, 0].Coordinate); geometry.Coordinates[2] .Should().Be.EqualTo(points[1, 1].Coordinate); geometry.Coordinates[1] .Should().Be.EqualTo(points[0, 1].Coordinate); geometry.Coordinates[4] .Should().Be.EqualTo(points[0, 0].Coordinate); }
public void ShowUsingMapViewWithFacesAndTimeNavigation() { LogHelper.ConfigureLogging(Level.Debug); var points = new[, ] { { new Point(0.0, 1.0), new Point(0.0, 0.0) }, { new Point(0.5, 1.5), new Point(1.0, 0.0) }, { new Point(1.0, 2.0), new Point(2.0, 2.0) } }; var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast <IPoint>()) { IsTimeDependent = true }; var values1 = new[, ] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 } }; var values2 = new[, ] { { 2.0, 2.0 }, { 2.0, 4.0 }, { 1.0, 2.0 } }; coverage[new DateTime(2000, 1, 1)] = values1; coverage[new DateTime(2001, 1, 1)] = values2; coverage[new DateTime(2002, 1, 1)] = values1; coverage[new DateTime(2003, 1, 1)] = values2; var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true }; var map = new Map { Layers = { coverageLayer } }; // create time navigation track bar var form = new Form { Width = 500, Height = 100 }; var trackBar = new TrackBar { Dock = DockStyle.Fill, Minimum = 0, Maximum = coverage.Time.Values.Count - 1 }; trackBar.ValueChanged += delegate { coverageLayer.SetCurrentTimeSelection(coverage.Time.Values[trackBar.Value], null); }; form.Controls.Add(trackBar); WindowsFormsTestHelper.Show(form); WindowsFormsTestHelper.ShowModal(new MapControl { Map = map, AllowDrop = false }, coverageLayer); }