Esempio n. 1
0
        public void TestAsArgument()
        {
            IVariable<IFeatureLocation> a = new Variable<IFeatureLocation>("argument");
            IVariable<double> c1 = new Variable<double>("value");
            IVariable<string> c2 = new Variable<string>("description");

            // f = (a, p)(h)
            IFunction f = new Function("rating curve");
            f.Arguments.Add(a);
            f.Components.Add(c1);
            f.Components.Add(c2);

            SimpleFeature simpleFeature = new SimpleFeature(10.0);
            IFeatureLocation featureLocation = new FeatureLocation { Feature = simpleFeature };

            // value based argument referencing.
            f[featureLocation] = new object[] { 1.0, "jemig de pemig" };

            IMultiDimensionalArray<double> c1Value = f.GetValues<double>(new ComponentFilter(f.Components[0]),
                                                                         new VariableValueFilter<IFeatureLocation>(
                                                                             f.Arguments[0],
                                                                             new FeatureLocation
                                                                                 {Feature = simpleFeature}));

            Assert.AreEqual(1.0, c1Value[0], 1.0e-6);

            //IMultiDimensionalArray<string> c2Value = f.GetValues<string>(new ComponentFilter(f.Components[1]),
            //                                                             new VariableValueFilter<IFeatureLocation>(
            //                                                                 f.Arguments[0], featureLocation));

            //Assert.AreEqual("jemig de pemig", c2Value[0]);
        }
Esempio n. 2
0
 public void Equality()
 {
     var simpleFeatureA = new SimpleFeature(10.0);
     var simpleFeatureB = new SimpleFeature(20.0);
     // two FeatureLocation with same feature and offset should be equal ( valuetype)
     Assert.AreEqual(new FeatureLocation { Feature = simpleFeatureA }, new FeatureLocation { Feature = simpleFeatureA });
     Assert.AreNotEqual(new FeatureLocation { Feature = simpleFeatureA }, new FeatureLocation { Feature = simpleFeatureB });
 }
Esempio n. 3
0
        public void SetUp()
        {
            boundaries = new EventedList <SimpleFeature>();

            // Add boundaries; offset is used to sort the boundaries within a branch.
            boundary11 = new SimpleFeature(1);
            boundary12 = new SimpleFeature(2);
            boundary13 = new SimpleFeature(3);

            boundaries.Add(boundary11);
            boundaries.Add(boundary12);
            boundaries.Add(boundary13);

            boundary21 = new SimpleFeature(4);
            boundary22 = new SimpleFeature(5);
            boundary23 = new SimpleFeature(6);

            boundaries.Add(boundary21);
            boundaries.Add(boundary22);
            boundaries.Add(boundary23);
        }
Esempio n. 4
0
        public void SetUp()
        {
            boundaries = new EventedList<SimpleFeature>();
            
            // Add boundaries; offset is used to sort the boundaries within a branch.
            boundary11 = new SimpleFeature(1);
            boundary12 = new SimpleFeature(2);
            boundary13 = new SimpleFeature(3);

            boundaries.Add(boundary11);
            boundaries.Add(boundary12);
            boundaries.Add(boundary13);

            boundary21 = new SimpleFeature(4);
            boundary22 = new SimpleFeature(5);
            boundary23 = new SimpleFeature(6);

            boundaries.Add(boundary21);
            boundaries.Add(boundary22);
            boundaries.Add(boundary23);
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <returns>
        /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than <paramref name="obj" />. Zero This instance is equal to <paramref name="obj" />. Greater than zero This instance is greater than <paramref name="obj" />.
        /// </returns>
        /// <param name="obj">An object to compare with this instance. </param>
        /// <exception cref="T:System.ArgumentException"><paramref name="obj" /> is not the same type as this instance. </exception><filterpriority>2</filterpriority>
        public int CompareTo(object obj)
        {
            SimpleFeature simpleFeature = (SimpleFeature)obj;

            return(Offset.CompareTo(simpleFeature.Offset));
        }