protected override object ShapeParameterValue(OgcSpatialFeatureclass fClass, gView.Framework.Geometry.IGeometry shape, int srid, out bool AsSqlParameter) { if (shape is IPolygon) { #region Check Polygon Rings IPolygon p = new Polygon(); for (int i = 0; i < ((IPolygon)shape).RingCount; i++) { IRing ring = ((IPolygon)shape)[i]; if (ring != null && ring.Area > 0D) { p.AddRing(ring); } } if (p.RingCount == 0) { AsSqlParameter = true; return(null); } shape = p; #endregion } else if (shape is IPolyline) { #region Check Polyline Paths IPolyline l = new Polyline(); for (int i = 0; i < ((IPolyline)shape).PathCount; i++) { IPath path = ((IPolyline)shape)[i]; if (path != null && path.Length > 0D) { l.AddPath(path); } } if (l.PathCount == 0) { AsSqlParameter = true; return(null); } shape = l; #endregion } AsSqlParameter = false; //return gView.Framework.OGC.OGC.GeometryToWKB(shape, gView.Framework.OGC.OGC.WkbByteOrder.Ndr); string geometryString = (shape is IPolygon) ? "geometry::STGeomFromText('" + gView.Framework.OGC.WKT.ToWKT(shape) + "'," + srid + ").MakeValid()" : "geometry::STGeomFromText('" + gView.Framework.OGC.WKT.ToWKT(shape) + "'," + srid + ")"; return(geometryString); //return "geometry::STGeomFromText('" + geometryString + "',0)"; }
protected override object ShapeParameterValue(OgcSpatialFeatureclass fClass, IGeometry shape, int srid, out bool AsSqlParameter) { AsSqlParameter = true; byte[] geometry = gView.Framework.OGC.OGC.GeometryToWKB(shape, srid, gView.Framework.OGC.OGC.WkbByteOrder.Ndr, fClass.GeometryTypeString); string geometryString = gView.Framework.OGC.OGC.BytesToHexString(geometry); return(geometryString); }
protected override string InsertShapeParameterExpression(OgcSpatialFeatureclass featureClass, IGeometry shape) { if (shape is IPolygon) { return("ST_MakeValid({0})"); } else { return(base.InsertShapeParameterExpression(featureClass, shape)); } }
public override bool CanEditFeatureClass(IFeatureClass fc, EditCommands command) { if (fc is OgcSpatialFeatureclass) { OgcSpatialFeatureclass ogcFc = (OgcSpatialFeatureclass)fc; if (ogcFc.GeometryTypeString.ToUpper().EndsWith("M") || ogcFc.GeometryTypeString.ToUpper().EndsWith("Z")) { switch (command) { case EditCommands.Insert: _errMsg = "Can't insert features for geometrytype " + ogcFc.GeometryTypeString + "."; return(false); case EditCommands.Update: _errMsg = "Can't update features for geometrytype " + ogcFc.GeometryTypeString + "."; return(false); } } return(true); } return(false); }
override protected object ShapeParameterValue(OgcSpatialFeatureclass featureClass, IGeometry shape, int srid, out bool AsSqlParameter) { AsSqlParameter = false; return(SdoGeometry.FromGeometry(shape, srid)); }