public double STDistance(Geospatial x) { if (_innerValue != null && x.InnerValue != null && !_innerValue.ToString().Equals(EMPTY_GEOGRAPHY) && !x.InnerValue.ToString().Equals(EMPTY_GEOGRAPHY)) { try { return(((SqlDouble)(ClassLoader.Invoke(_innerValue, "STDistance", new object[] { x.InnerValue }))).Value); } catch (Exception ex) { GXLogging.Debug(log, "Error calling Distance() exception:"); GXLogging.Debug(log, ex.ToString()); return(0); } } else { if (_innerValue == null) { GXLogging.Debug(log, "STDistance: _innerValue is not valid"); } else { GXLogging.Debug(log, "STDistance: x.InnerValue is not valid"); } return(0); } }
public Boolean STIntersect(Geospatial x) { if (_innerValue != null && x.InnerValue != null && !_innerValue.ToString().Equals(EMPTY_GEOGRAPHY) && !x.InnerValue.ToString().Equals(EMPTY_GEOGRAPHY)) { try { return(((SqlBoolean)(ClassLoader.Invoke(_innerValue, "STIntersects", new object[] { x.InnerValue }))).Equals(SqlBoolean.True)); } catch (Exception ex) { GXLogging.Debug(log, "Error calling Intersect() exception:"); GXLogging.Debug(log, ex.ToString()); return(false); } } else { if (_innerValue == null) { GXLogging.Debug(log, "STIntersect: _innerValue is not valid"); } else { GXLogging.Debug(log, "STIntersect: x.InnerValue is not valid"); } return(false); } }
internal static decimal GetIfxDecimal(IDataReader reader, int i) { decimal result; string ifxDecimal = ClassLoader.Invoke(reader, "GetIfxDecimal", new object[] { i }).ToString(); Decimal.TryParse(ifxDecimal, NumberStyles.Number, CultureInfo.InvariantCulture, out result); return(result); }
internal static object STGeomFromText(string geoText, int sRID) { object cwPolygon = SQLGeographyWrapper.GeometryParse(geoText); object stStartPoint = ClassLoader.Invoke(cwPolygon, "STStartPoint", null); object validPolygon = ClassLoader.Invoke(cwPolygon, "MakeValid", null); cwPolygon = ClassLoader.Invoke(validPolygon, "STUnion", new object[] { stStartPoint }); object stAsText = ClassLoader.Invoke(cwPolygon, "STAsText", null); return(ClassLoader.InvokeStatic(SQLGeographyWrapper.GeoAssembly, SQLGeographyWrapper.SqlGeographyClass, "STGeomFromText", new object[] { stAsText, sRID })); }
internal static bool IsValid(object instance) { try { return(((SqlBoolean)ClassLoader.Invoke(instance, "STIsValid", null)).Value); } catch (MissingMethodException ex) { GXLogging.Debug(log, "IsValid not Found: " + ex.Message); return(true); } }
internal static decimal GetIfxDecimal(IDataReader reader, int i) { try { decimal result; string ifxDecimal = ClassLoader.Invoke(reader, "GetIfxDecimal", new object[] { i }).ToString(); Decimal.TryParse(ifxDecimal, NumberStyles.Number, CultureInfo.InvariantCulture, out result); return(result); }catch (Exception) { return(Convert.ToInt64(reader.GetValue(i))); } }
public double STArea() { if (_innerValue != null && !_innerValue.ToString().Equals(EMPTY_GEOGRAPHY) && GeographicType == GeoGraphicTypeValue.Polygon) { try { return(((SqlDouble)(ClassLoader.Invoke(_innerValue, "STArea", Array.Empty <object>()))).Value); } catch (Exception ex) { GXLogging.Debug(log, "Error calling Area() exception:"); GXLogging.Debug(log, ex.ToString()); return(0); } } else { GXLogging.Debug(log, "STArea: _innerValue is not valid"); return(0); } }
ArrayList geoToArray(String geoType, Object geoInstance) { ArrayList ArrayOfPoints = new ArrayList(); if (geoType.Equals("MultiPoint") || geoType.Equals("LineString")) { SqlInt32 points = (SqlInt32)ClassLoader.Invoke(geoInstance, "STNumPoints", null); for (int i = 1; i <= points.Value; i++) { double[] CurrentPoint = new double[2]; object currentPoint = ClassLoader.Invoke(geoInstance, "STPointN", new object[] { i }); CurrentPoint[0] = SQLGeographyWrapper.Long(currentPoint); CurrentPoint[1] = SQLGeographyWrapper.Lat(currentPoint); ArrayOfPoints.Add(CurrentPoint); } } else if (geoType.Equals("Point")) { object currentPoint = ClassLoader.Invoke(geoInstance, "STPointN", new object[] { 1 }); ArrayOfPoints.Add(SQLGeographyWrapper.Long(currentPoint)); ArrayOfPoints.Add(SQLGeographyWrapper.Lat(currentPoint)); } else if (geoType.Equals("Polygon")) { SqlInt32 rings = (SqlInt32)ClassLoader.Invoke(geoInstance, "NumRings", null); for (int j = 1; j <= rings.Value; j++) { ArrayList RingArray = new ArrayList(); object currentRing = ClassLoader.Invoke(geoInstance, "RingN", new object[] { j }); SqlInt32 p = (SqlInt32)ClassLoader.Invoke(currentRing, "STNumPoints", null); for (int i = 1; i < p.Value; i++) { double[] CurrentPoint = new double[2]; object currentPoint = ClassLoader.Invoke(currentRing, "STPointN", new object[] { i }); CurrentPoint[0] = SQLGeographyWrapper.Long(currentPoint); CurrentPoint[1] = SQLGeographyWrapper.Lat(currentPoint); RingArray.Add(CurrentPoint); } ArrayOfPoints.Add(RingArray); } } else if (geoType.Equals("MultiLineString")) { SqlInt32 geoms = (SqlInt32)ClassLoader.Invoke(geoInstance, "STNumGeometries", null); for (int j = 1; j <= geoms.Value; j++) { object currentgeom = ClassLoader.Invoke(geoInstance, "STGeometryN", new object[] { j }); ArrayOfPoints.Add(geoToArray("LineString", currentgeom)); } } else if (geoType.Equals("MultiPolygon")) { SqlInt32 geoms = (SqlInt32)ClassLoader.Invoke(geoInstance, "STNumGeometries", null); for (int j = 1; j <= geoms.Value; j++) { object currentgeom = ClassLoader.Invoke(geoInstance, "STGeometryN", new object[] { j }); ArrayOfPoints.Add(geoToArray("Polygon", currentgeom)); } } return(ArrayOfPoints); }
internal static object STGeometryType(object instance) { return(ClassLoader.Invoke(instance, "STGeometryType", null)); }
internal static object MakeValid(object instance) { return(ClassLoader.Invoke(instance, "MakeValid", null)); }
public static string Suggest(string phrase) { return((string)ClassLoader.Invoke(m_SpellingInstance, "Suggest", new object[] { phrase })); }
public static bool BuildDictionary() { return((bool)ClassLoader.Invoke(m_SpellingInstance, "BuildDictionary", null)); }
public static SearchResult Search(string query, int itemsPerPage, int pageNumber, IGxContext context) { return((SearchResult)ClassLoader.Invoke(m_SearcherInstance, "Search", new object[] { query, itemsPerPage, pageNumber, context })); }
public static bool RemoveEntity(string entityType) { return((bool)ClassLoader.Invoke(m_IndexerInstance, "RemoveEntity", new object[] { entityType })); }
public static bool RemoveContent(object obj) { return((bool)ClassLoader.Invoke(m_IndexerInstance, "RemoveContent", new object[] { obj })); }
public static bool UpdateContent(object obj, GxContentInfo contentInfo) { return((bool)ClassLoader.Invoke(m_IndexerInstance, "UpdateContent", new object[] { obj, contentInfo })); }