public static SpatialContextInfo Edit(FdoConnection conn, SpatialContextInfo ctx) { FdoSpatialContextDialog diag = new FdoSpatialContextDialog(conn, ctx); if (diag.ShowDialog() == DialogResult.OK) { SpatialContextInfo sci = new SpatialContextInfo(); sci.Name = diag.ContextName; sci.Description = diag.Description; sci.CoordinateSystem = diag.CoordinateSystem; sci.CoordinateSystemWkt = diag.CoordinateSystemWkt; sci.XYTolerance = Convert.ToDouble(diag.XYTolerance); sci.ZTolerance = Convert.ToDouble(diag.ZTolerance); sci.ExtentType = diag.SelectedExtentType; //Only consider extent if all 4 values are defined if (diag.IsExtentDefined) { string wktfmt = "POLYGON (({0} {1}, {2} {3}, {4} {5}, {6} {7}, {0} {1}))"; double llx = Convert.ToDouble(diag.LowerLeftX); double lly = Convert.ToDouble(diag.LowerLeftY); double urx = Convert.ToDouble(diag.UpperRightX); double ury = Convert.ToDouble(diag.UpperRightY); sci.ExtentGeometryText = string.Format(wktfmt, llx, lly, urx, lly, urx, ury, llx, ury, llx, lly); } return(sci); } return(null); }
public static SpatialContextInfo Edit(FdoConnection conn, SpatialContextInfo ctx) { FdoSpatialContextDialog diag = new FdoSpatialContextDialog(conn, ctx); if (diag.ShowDialog() == DialogResult.OK) { SpatialContextInfo sci = new SpatialContextInfo(); sci.Name = diag.ContextName; sci.Description = diag.Description; sci.CoordinateSystem = diag.CoordinateSystem; sci.CoordinateSystemWkt = diag.CoordinateSystemWkt; sci.XYTolerance = Convert.ToDouble(diag.XYTolerance); sci.ZTolerance = Convert.ToDouble(diag.ZTolerance); sci.ExtentType = diag.SelectedExtentType; //Only consider extent if all 4 values are defined if (diag.IsExtentDefined) { string wktfmt = "POLYGON (({0} {1}, {2} {3}, {4} {5}, {6} {7}, {0} {1}))"; double llx = Convert.ToDouble(diag.LowerLeftX); double lly = Convert.ToDouble(diag.LowerLeftY); double urx = Convert.ToDouble(diag.UpperRightX); double ury = Convert.ToDouble(diag.UpperRightY); sci.ExtentGeometryText = string.Format(wktfmt, llx, lly, urx, lly, urx, ury, llx, ury, llx, lly); } return sci; } return null; }