public IEnumerable <Point> GetPointsYaxis(double y, AxisOrientationEnum comparison) { IEnumerable <Point> temp = null; switch (comparison) { case AxisOrientationEnum.Greater: temp = Points.Where(p => p.Y > y); break; case AxisOrientationEnum.Less: temp = Points.Where(p => p.Y < y); break; case AxisOrientationEnum.Same: temp = Points.Where(p => Math.Abs(p.Y - y) < .005); break; } return(temp); }
public void TestDmsLabel(double fromVal, double toVal, double increment, AxisOrientationEnum axis) { // ok ok - testing private method suggests this method should be public and somewhere else // I think NTS would be good place, but at time of writing NTS was going through major version // upgrade, so have left this as is for next significant release of SharpMap var tolerance = 1.1E-8; char[] split = { '°', '\'', '"', 'N', 'S', 'E', 'W' }; Type type = typeof(SharpMap.Rendering.Decoration.Graticule.Graticule); BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Instance; MethodInfo method = type.GetMethod("GetFormattedLabel", bindingAttr); var gratitule = Activator.CreateInstance(type); var thisVal = fromVal; do { var dms = (string)method.Invoke(gratitule, new object [] { true, thisVal, axis }); //var dms = GetFormattedLabel(true, degree, axis); var tokens = dms.Split(split, StringSplitOptions.RemoveEmptyEntries); var dec = double.Parse(tokens[0]); if (tokens.Length >= 3) { dec += double.Parse(tokens[2]) / 3600; } if (tokens.Length >= 2) { dec += double.Parse(tokens[1]) / 60; } Assert.AreEqual(Math.Round(thisVal, 8), Math.Round(dec, 8), tolerance, $"{thisVal:N8} {dms} {dec:N8}"); thisVal += increment; } while (thisVal < toVal); }
/// <summary> /// Initializes a new instance of an AxisInfo. /// </summary> /// <param name="name">Name of axis</param> /// <param name="orientation">Axis orientation</param> public AxisInfo(string name, AxisOrientationEnum orientation) { _Name = name; _Orientation = orientation; }
public AxisInfo(string name, AxisOrientationEnum orientation) => throw null;