internal void FreeSeCoordRef(SE_COORDREF coordRef) { if (coordRef.handle != 0) { Wrapper92.SE_coordref_free(coordRef); } coordRef.handle = 0; }
/* * internal SdeConnection AllocConnection() * { * if (_sConnection == null) return null; * return _current = _sConnection.AllocConnection(); * } * * internal void FreeConnection() * { * if (_sConnection == null) return; * _current = null; * _sConnection.FreeConnection(); * } */ internal SE_COORDREF GetSeCoordRef(ArcSdeConnection connection, string table, string spatialColumnName, ref SE_ENVELOPE envelope) { _errMsg = ""; if (connection == null || connection.SeConnection.handle == 0) { _errMsg = "GetSeCoordRef:\n No Connection allocated!"; return(new SE_COORDREF()); } SE_COORDREF coordRef = new SE_COORDREF(); SE_LAYERINFO layerInfo = new SE_LAYERINFO(); Int32 _err_no = 0; try { _err_no = Wrapper92.SE_coordref_create(ref coordRef); if (_err_no != 0) { return(new SE_COORDREF()); } _err_no = Wrapper92.SE_layerinfo_create(coordRef, ref layerInfo); if (_err_no != 0) { return(new SE_COORDREF()); } _err_no = Wrapper92.SE_layer_get_info(connection.SeConnection, table, spatialColumnName, layerInfo); if (_err_no != 0) { return(new SE_COORDREF()); } _err_no = Wrapper92.SE_layerinfo_get_coordref(layerInfo, coordRef); if (_err_no != 0) { return(new SE_COORDREF()); } _err_no = Wrapper92.SE_coordref_get_xy_envelope(coordRef, ref envelope); if (_err_no != 0) { return(new SE_COORDREF()); } return(coordRef); } catch (Exception ex) { _errMsg = "GetSeCoordRef:\n " + ex.Message + "\n" + ex.StackTrace; return(new SE_COORDREF()); } finally { if (layerInfo.handle != 0) { Wrapper92.SE_layerinfo_free(layerInfo); } if (_err_no != 0) { if (coordRef.handle != 0) { Wrapper92.SE_coordref_free(coordRef); } _errMsg = Wrapper92.GetErrorMsg(new SE_CONNECTION(), _err_no); } } }