static bool BinaryPredicate(MgGeometryRef thisRef, IGeometryRef otherRef, Func <MgGeometry, MgGeometry, bool> operation) { var impl = otherRef as MgGeometryRef; if (impl != null) { return(operation(thisRef._geom, impl._geom)); } throw new ArgumentException("Incorrect IGeometryRef implementation"); }
static IGeometryRef BinaryOperator(MgGeometryRef thisRef, IGeometryRef otherRef, Func <MgGeometry, MgGeometry, MgGeometry> operation) { var impl = otherRef as MgGeometryRef; if (impl != null) { var result = operation(thisRef._geom, impl._geom); return(new MgGeometryRef(result)); } throw new ArgumentException("Incorrect IGeometryRef implementation"); }
/// <summary> /// Sets the geometry value of the specified property /// </summary> /// <param name="name"></param> /// <param name="value"></param> public void SetGeometry(string name, IGeometryRef value) { var propVal = _values[name] as GeometryValue; if (propVal == null) { throw new InvalidOperationException(string.Format(Strings.ERR_PROPERTY_VALUE_NOT_OF_TYPE, name, PropertyValueType.Geometry.ToString())); } propVal.Value = value; }
public static MgByteReader GetAgf(IGeometryRef geom) { MgGeometry mgeom = _wktRw.Read(geom.AsText()); return(_agfRw.Write(mgeom)); }
public bool Within(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Within(b));
public IGeometryRef Union(IGeometryRef other) => BinaryOperator(this, other, (a, b) => a.Union(b));
public bool Touches(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Touches(b));
public IGeometryRef SymmetricDifference(IGeometryRef other) => BinaryOperator(this, other, (a, b) => a.SymetricDifference(b));
public bool Overlaps(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Overlaps(b));
public IGeometryRef Intersection(IGeometryRef other) => BinaryOperator(this, other, (a, b) => a.Intersection(b));
public bool Intersects(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Intersects(b));
public bool Equals(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Equals(b));
public bool Disjoint(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Disjoint(b));
public bool Crosses(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Crosses(b));
public bool Contains(IGeometryRef other) => BinaryPredicate(this, other, (a, b) => a.Contains(b));
/// <summary> /// Sets the geometry value at the specified index /// </summary> /// <param name="index"></param> /// <param name="value"></param> public void SetGeometry(int index, IGeometryRef value) { SetGeometry(_ordinalMap[index], value); }