private void Button_OctreeLevelCompute_Click(object sender, RoutedEventArgs e) { int fedModelID = 0; FederatedModelInfo selFedModel; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; try { if (selFedModelsItem == null) { return; // do nothing, no selection made } else { selFedModel = selFedModelsItem; fedModelID = selFedModel.FederatedID; int level = DBOperation.computeRecomOctreeLevel(fedModelID); if (level > 0) { TextBox_OctreeLevel.Text = level.ToString(); } } } catch (SystemException excp) { string excStr = "%% Error - " + excp.Message + "\n\t"; BIMRLCommonRef.StackPushError(excStr); if (BIMRLCommonRef.BIMRLErrorStackCount > 0) { showError(null); } } }
private void Button_genX3D_Click(object sender, RoutedEventArgs e) { string whereCond = string.Empty; int fedModelID = 0; FederatedModelInfo selFedModel; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { selFedModel = selFedModelsItem; fedModelID = selFedModel.FederatedID; } try { BIMRLModelInfo selModelInfo; BIMRLModelInfo?selModelInfosItem = DataGrid_ModelInfos.SelectedItem as BIMRLModelInfo?; if (selModelInfosItem != null) { if (selModelInfosItem.HasValue) { selModelInfo = selModelInfosItem.Value; whereCond += " and ModelID = " + selModelInfo.ModelID + " "; } } if (!string.IsNullOrEmpty(TextBox_Additional_Condition.Text)) { if (!string.IsNullOrEmpty(whereCond)) { whereCond += " AND "; } whereCond += " " + TextBox_Additional_Condition.Text + " "; } BIMRLExportSDOToX3D x3dExp = new BIMRLExportSDOToX3D(BIMRLCommonRef, TextBox_X3D_filename.Text); if (!string.IsNullOrEmpty(TextBox_AlternateUserTable.Text)) { x3dExp.altUserTable = TextBox_AlternateUserTable.Text; } x3dExp.exportToX3D(fedModelID, whereCond, drawElemGeom, drawUserGeom, drawFacesOnly, drawOctree, drawWorldBB); x3dExp.endExportToX3D(); } catch (SystemException excp) { string excStr = "%% Error - " + excp.Message + "\n\t"; BIMRLCommonRef.StackPushError(excStr); if (BIMRLCommonRef.BIMRLErrorStackCount > 0) { showError(null); } } }
private void DataGrid_FedModels_SelectionChanged(object sender, SelectionChangedEventArgs e) { FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { modelInfos.Clear(); // clear the list first DBOperation.currFedModel = selFedModelsItem; modelInfos = _qModel.getModelInfos(DBOperation.currFedModel.FederatedID); DataGrid_ModelInfos.AutoGenerateColumns = true; DataGrid_ModelInfos.IsReadOnly = true; DataGrid_ModelInfos.ItemsSource = modelInfos; Button_RegenGeometry.IsEnabled = true; Button_EnhanceSpB.IsEnabled = true; Button_genGraph.IsEnabled = true; projectUnit projectUnit = DBOperation.getProjectUnitLength(DBOperation.currFedModel.FederatedID); DBOperation.currModelProjectUnitLength = projectUnit; if (projectUnit == projectUnit.SIUnit_Length_MilliMeter) { MathUtils.tol = 0.1; MathUtils._doubleDecimalPrecision = 1; MathUtils._floatDecimalPrecision = 1; } else if (projectUnit == projectUnit.SIUnit_Length_Meter) { MathUtils.tol = 0.0001; MathUtils._doubleDecimalPrecision = 4; MathUtils._floatDecimalPrecision = 4; } else if (projectUnit == projectUnit.Imperial_Length_Foot) { MathUtils.tol = 0.0003; MathUtils._doubleDecimalPrecision = 4; MathUtils._floatDecimalPrecision = 4; } else if (projectUnit == projectUnit.Imperial_Length_Inch) { MathUtils.tol = 0.004; MathUtils._doubleDecimalPrecision = 3; MathUtils._floatDecimalPrecision = 3; } DBOperation.currSelFedID = DBOperation.currFedModel.FederatedID; // set a static variable keeping the currently selected Fed Id DBOperation.OctreeSubdivLevel = DBOperation.currFedModel.OctreeMaxDepth; TextBox_OctreeLevel.Text = DBOperation.currFedModel.OctreeMaxDepth.ToString(); } }
private void dataGrid_ModelList_SelectionChanged(object sender, SelectionChangedEventArgs e) { FederatedModelInfo selFedModelsItem = dataGrid_ModelList.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { button_1stModel.IsEnabled = true; button_2ndModel.IsEnabled = true; } }
private void Button_genGraph_Click(object sender, RoutedEventArgs e) { // 1. Generate Circulation graph data in the database int FedID = -1; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { FederatedModelInfo selFedModel = selFedModelsItem; FedID = selFedModel.FederatedID; } GraphData graphData = new GraphData(); graphData.createCirculationGraph(FedID); if (GraphData.refBimrlCommon.BIMRLErrorStackCount > 0) { string wholeStack = string.Empty; while (true) { wholeStack += GraphData.refBimrlCommon.StackPopError() + "\n"; if (GraphData.refBimrlCommon.BIMRLErrorStackCount == 0) { break; } } return; } // 2. (TODO) Generate Adjacency graph data in the database graphData.createSpaceAdjacencyGraph(FedID); if (GraphData.refBimrlCommon.BIMRLErrorStackCount > 0) { string wholeStack = string.Empty; while (true) { wholeStack += GraphData.refBimrlCommon.StackPopError() + "\n"; if (GraphData.refBimrlCommon.BIMRLErrorStackCount == 0) { break; } } return; } }
private void Button_DeleteModel_Click(object sender, RoutedEventArgs e) { FederatedModelInfo selFedModel; int FedID = -1; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { selFedModel = selFedModelsItem; FedID = selFedModel.FederatedID; } try { if (FedID >= 0 && _deleteModel) { _qModel.deleteModel(FedID); // Refresh the model list fedModels = _qModel.getFederatedModels(); DataGrid_FedModels.AutoGenerateColumns = true; DataGrid_FedModels.IsReadOnly = true; DataGrid_FedModels.ItemsSource = fedModels; DataGrid_FedModels.MinRowHeight = 20; // Always turn off the check box to delete the model _deleteModel = false; CheckBox_DeleteModel.IsChecked = false; Button_DeleteModel.IsEnabled = false; } } catch (SystemException excp) { string excStr = "%% Error - " + excp.Message + "\n\t"; BIMRLCommonRef.StackPushError(excStr); if (BIMRLCommonRef.BIMRLErrorStackCount > 0) { showError(null); } } }
private void button_1stModel_Click(object sender, RoutedEventArgs e) { FederatedModelInfo selFedModelsItem = dataGrid_ModelList.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { FederatedModelInfo selModel = selFedModelsItem; if (modelIDRef >= 0 && modelIDRef == selModel.FederatedID) { return; // Can't select the same model to compare } textBox_1stModel.Text = "(ID: " + selModel.FederatedID.ToString() + ") " + selModel.ModelName + "; " + selModel.ProjectNumber + "; " + selModel.ProjectName; modelIDNew = selModel.FederatedID; } //if (!string.IsNullOrEmpty(textBox_2ndModel.Text)) // button_Run.IsEnabled = true; }
private void Button_EnhanceSpB_Click(object sender, RoutedEventArgs e) { string whereCond = string.Empty; double currentTol = MathUtils.tol; // Temporarily change the tolerance if it is set in the UI if (!string.IsNullOrEmpty(TextBox_Tolerance.Text)) { double tolSetting; if (double.TryParse(TextBox_Tolerance.Text, out tolSetting)) { MathUtils.tol = tolSetting; } } int fedModelID = 0; FederatedModelInfo selFedModel; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { selFedModel = selFedModelsItem; fedModelID = selFedModel.FederatedID; } try { if (!string.IsNullOrEmpty(TextBox_Additional_Condition.Text)) { BIMRLCommon.appendToString(TextBox_Additional_Condition.Text, " AND ", ref whereCond); string whereCondD = Regex.Replace(whereCond, "elementid", "spaceelementid", RegexOptions.IgnoreCase); DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_RELSPACEB_DETAIL", fedModelID) + " WHERE " + whereCondD); } else { if (DBOperation.DBUserID.Equals(selFedModel.Owner)) { DBOperation.executeSingleStmt("TRUNCATE TABLE " + DBOperation.formatTabName("BIMRL_RELSPACEB_DETAIL", fedModelID)); } else { DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_RELSPACEB_DETAIL", fedModelID)); } } DBOperation.commitInterval = 5000; EnhanceBRep eBrep = new EnhanceBRep(); eBrep.enhanceSpaceBoundary(whereCond); // We will procees the normal face first and then after that the spacial ones (OBB, PROJOBB) string whereCond2 = whereCond; BIMRLCommon.appendToString(" TYPE NOT IN ('OBB','PROJOBB')", " AND ", ref whereCond2); eBrep.ProcessOrientation(whereCond2); whereCond2 = whereCond; BIMRLCommon.appendToString(" TYPE='OBB'", " AND ", ref whereCond2); eBrep.ProcessOrientation(whereCond2); whereCond2 = whereCond; BIMRLCommon.appendToString(" TYPE='PROJOBB'", " AND ", ref whereCond2); eBrep.ProcessOrientation(whereCond2); } catch (SystemException excp) { string excStr = "%% Error - " + excp.Message + "\n\t"; BIMRLCommonRef.StackPushError(excStr); if (BIMRLCommonRef.BIMRLErrorStackCount > 0) { showError(null); } } MathUtils.tol = currentTol; }
private void Button_RegenGeometry_Click(object sender, RoutedEventArgs e) { BIMRLSpatialIndex spIdx = new BIMRLSpatialIndex(BIMRLCommonRef); DBOperation.commitInterval = 5000; double currentTol = MathUtils.tol; var location = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase); string exePath = new FileInfo(location.AbsolutePath).Directory.FullName; // Temporarily change the tolerance if it is set in the UI if (!string.IsNullOrEmpty(TextBox_Tolerance.Text)) { double tolSetting; if (double.TryParse(TextBox_Tolerance.Text, out tolSetting)) { MathUtils.tol = tolSetting; } } if (!string.IsNullOrEmpty(TextBox_OctreeLevel.Text)) { int level = -1; level = int.Parse(TextBox_OctreeLevel.Text); if (level > 0) { DBOperation.OctreeSubdivLevel = level; } } int FedID = -1; FederatedModelInfo selFedModelsItem = DataGrid_FedModels.SelectedItem as FederatedModelInfo; if (selFedModelsItem == null) { return; // do nothing, no selection made } else { FederatedModelInfo selFedModel = selFedModelsItem; FedID = selFedModel.FederatedID; } try { if (FedID >= 0) { string whereCond = null; string updOctreeLevel = ""; if (!string.IsNullOrEmpty(TextBox_Additional_Condition.Text)) { whereCond = TextBox_Additional_Condition.Text; // Spatial always needs to be reconstructed even when one object is updated to maintain integrity of non-overlapping octree concept if (regenSpatialIndex) { // We need the existing data to regenerate the dictionary. Truncate operation will be deferred until just before insert into the table // DBOperation.executeSingleStmt("TRUNCATE TABLE BIMRL_SPATIALINDEX_" + FedID.ToString("X4")); // DBOperation.executeSingleStmt("DELETE FROM BIMRL_SPATIALINDEX_" + FedID.ToString("X4") + " WHERE " + whereCond); } if (regenBoundaryFaces) { DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_TOPO_FACE", FedID) + " WHERE " + whereCond); } } else { FederatedModelInfo fedModel = DBOperation.getFederatedModelByID(FedID); if (DBOperation.DBUserID.Equals(fedModel.Owner)) { if (regenSpatialIndex) { DBOperation.executeSingleStmt("TRUNCATE TABLE " + DBOperation.formatTabName("BIMRL_SPATIALINDEX", FedID)); } if (regenBoundaryFaces) { DBOperation.executeSingleStmt("TRUNCATE TABLE " + DBOperation.formatTabName("BIMRL_TOPO_FACE", FedID)); } } else { if (regenSpatialIndex) { DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_SPATIALINDEX", FedID)); } if (regenBoundaryFaces) { DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_TOPO_FACE", FedID)); } } } // Update Spatial index (including major axes and OBB) and Boundary faces if (regenSpatialIndex && regenBoundaryFaces && _majorAxes) { spIdx.createSpatialIndexFromBIMRLElement(FedID, whereCond, true); BIMRLUtils.updateMajorAxesAndOBB(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_SpatialIndexes.sql"), FedID); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_TopoFace.sql"), FedID); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_MajorAxes.sql"), FedID); updOctreeLevel = "MAXOCTREELEVEL=" + DBOperation.OctreeSubdivLevel; } else if (regenSpatialIndex && regenBoundaryFaces && !_majorAxes) { spIdx.createSpatialIndexFromBIMRLElement(FedID, whereCond, true); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_SpatialIndexes.sql"), FedID); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_TopoFace.sql"), FedID); updOctreeLevel = "MAXOCTREELEVEL=" + DBOperation.OctreeSubdivLevel; } // Update Spatial index (including major axes and OBB) only else if (regenSpatialIndex && !regenBoundaryFaces && _majorAxes) { spIdx.createSpatialIndexFromBIMRLElement(FedID, whereCond, false); BIMRLUtils.updateMajorAxesAndOBB(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_SpatialIndexes.sql"), FedID); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_MajorAxes.sql"), FedID); updOctreeLevel = "MAXOCTREELEVEL=" + DBOperation.OctreeSubdivLevel; } // Update Boundary faces and MajorAxes else if (!regenSpatialIndex && regenBoundaryFaces && _majorAxes) { spIdx.createFacesFromBIMRLElement(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_TopoFace.sql"), FedID); BIMRLUtils.updateMajorAxesAndOBB(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_MajorAxes.sql"), FedID); } // Update Spatial Index only else if (regenSpatialIndex && !regenBoundaryFaces && !_majorAxes) { spIdx.createSpatialIndexFromBIMRLElement(FedID, whereCond, false); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_SpatialIndexes.sql"), FedID); updOctreeLevel = "MAXOCTREELEVEL=" + DBOperation.OctreeSubdivLevel; } // update faces only else if (!regenSpatialIndex && regenBoundaryFaces && !_majorAxes) { spIdx.createFacesFromBIMRLElement(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_TopoFace.sql"), FedID); } // Update only the major axes and OBB only else if (!regenSpatialIndex && !regenBoundaryFaces && _majorAxes) { BIMRLUtils.updateMajorAxesAndOBB(FedID, whereCond); DBOperation.executeScript(Path.Combine(exePath, "script", "BIMRL_Idx_MajorAxes.sql"), FedID); } else { // Invalid option } string sqlStmt = "UPDATE BIMRL_FEDERATEDMODEL SET LASTUPDATEDATE=sysdate"; BIMRLCommon.appendToString(updOctreeLevel, ", ", ref sqlStmt); BIMRLCommon.appendToString("WHERE FEDERATEDID=" + FedID, " ", ref sqlStmt); DBOperation.executeSingleStmt(sqlStmt); } } catch (SystemException excp) { string excStr = "%% Error - " + excp.Message + "\n\t"; BIMRLCommonRef.StackPushError(excStr); if (BIMRLCommonRef.BIMRLErrorStackCount > 0) { showError(null); } } MathUtils.tol = currentTol; }
public void createSpatialIndexFromBIMRLElement(int federatedId, string whereCond, bool createFaces = true, bool createSpIdx = true) { DBOperation.beginTransaction(); string currStep = string.Empty; OracleCommand command = new OracleCommand(" ", DBOperation.DBConn); OracleDataReader reader; bool selectedRegen = false; Point3D llb; Point3D urt; DBOperation.getWorldBB(federatedId, out llb, out urt); Octree.WorldBB = new BoundingBox3D(llb, urt); Octree.MaxDepth = DBOperation.OctreeSubdivLevel; try { command.CommandText = "SELECT COUNT(*) FROM " + DBOperation.formatTabName("BIMRL_ELEMENT", federatedId) + " where geometrybody is not null "; object rC = command.ExecuteScalar(); int totalRowCount = Convert.ToInt32(rC.ToString()) * (int)Math.Pow(8, 2); string sqlStmt = "select elementid, elementtype, geometrybody from " + DBOperation.formatTabName("BIMRL_ELEMENT", federatedId) + " where geometrybody is not null "; if (!string.IsNullOrEmpty(whereCond)) { sqlStmt += " and " + whereCond; selectedRegen = true; } currStep = sqlStmt; command.CommandText = sqlStmt; command.FetchSize = 20; // The following is needed to update the element table with Bbox information string sqlStmt3 = "UPDATE " + DBOperation.formatTabName("BIMRL_ELEMENT", federatedId) + " SET GeometryBody_BBOX = :bbox, " + "GeometryBody_BBOX_CENTROID = :cent WHERE ELEMENTID = :eid"; OracleCommand commandUpdBbox = new OracleCommand(" ", DBOperation.DBConn); commandUpdBbox.CommandText = sqlStmt3; commandUpdBbox.Parameters.Clear(); OracleParameter[] Bbox = new OracleParameter[3]; Bbox[0] = commandUpdBbox.Parameters.Add("bbox", OracleDbType.Object); Bbox[0].Direction = ParameterDirection.Input; Bbox[0].UdtTypeName = "MDSYS.SDO_GEOMETRY"; List <List <SdoGeometry> > bboxListList = new List <List <SdoGeometry> >(); List <SdoGeometry> bboxList = new List <SdoGeometry>(); Bbox[1] = commandUpdBbox.Parameters.Add("cent", OracleDbType.Object); Bbox[1].Direction = ParameterDirection.Input; Bbox[1].UdtTypeName = "MDSYS.SDO_GEOMETRY"; List <List <SdoGeometry> > centListList = new List <List <SdoGeometry> >(); List <SdoGeometry> centList = new List <SdoGeometry>(); Bbox[2] = commandUpdBbox.Parameters.Add("eid", OracleDbType.Varchar2); Bbox[2].Direction = ParameterDirection.Input; List <List <string> > eidUpdListList = new List <List <string> >(); List <string> eidUpdList = new List <string>(); int sublistCnt = 0; // end for Bbox Octree octreeInstance = null; if (selectedRegen) { octreeInstance = new Octree(federatedId, totalRowCount, DBOperation.OctreeSubdivLevel); } else { octreeInstance = new Octree(federatedId, totalRowCount, DBOperation.OctreeSubdivLevel, false, true); // Since it is not selectedRegen, we will rebuild the entire tree, skip Dict regen for this case } reader = command.ExecuteReader(); while (reader.Read()) { string elemID = reader.GetString(0); string elemTyp = reader.GetString(1); SdoGeometry sdoGeomData = reader.GetValue(2) as SdoGeometry; Polyhedron geom; if (!SDOGeomUtils.generate_Polyhedron(sdoGeomData, out geom)) { continue; // if there is something not right, skip the geometry } // - Update geometry info with BBox information SdoGeometry bbox = new SdoGeometry(); bbox.Dimensionality = 3; bbox.LRS = 0; bbox.GeometryType = (int)SdoGeometryTypes.GTYPE.POLYGON; int gType = bbox.PropertiesToGTYPE(); double[] arrCoord = new double[6]; int[] elemInfoArr = { 1, (int)SdoGeometryTypes.ETYPE_SIMPLE.POLYGON_EXTERIOR, 1 }; arrCoord[0] = geom.boundingBox.LLB.X; arrCoord[1] = geom.boundingBox.LLB.Y; arrCoord[2] = geom.boundingBox.LLB.Z; arrCoord[3] = geom.boundingBox.URT.X; arrCoord[4] = geom.boundingBox.URT.Y; arrCoord[5] = geom.boundingBox.URT.Z; bbox.ElemArrayOfInts = elemInfoArr; bbox.OrdinatesArrayOfDoubles = arrCoord; bboxList.Add(bbox); SdoGeometry centroid = new SdoGeometry(); centroid.Dimensionality = 3; centroid.LRS = 0; centroid.GeometryType = (int)SdoGeometryTypes.GTYPE.POINT; gType = centroid.PropertiesToGTYPE(); SdoPoint cent = new SdoPoint(); cent.XD = geom.boundingBox.Center.X; cent.YD = geom.boundingBox.Center.Y; cent.ZD = geom.boundingBox.Center.Z; centroid.SdoPoint = cent; centList.Add(centroid); eidUpdList.Add(elemID); sublistCnt++; // Set 1000 records as a threshold for interval commit later on if (sublistCnt >= 500) { bboxListList.Add(bboxList); centListList.Add(centList); eidUpdListList.Add(eidUpdList); sublistCnt = 0; bboxList = new List <SdoGeometry>(); centList = new List <SdoGeometry>(); eidUpdList = new List <string>(); } // We will skip large buildinglementproxy that has more than 5000 vertices bool largeMesh = (string.Compare(elemTyp, "IFCBUILDINGELEMENTPROXY", true) == 0) && geom.Vertices.Count > 5000; if ((createFaces && !largeMesh) || (createFaces && selectedRegen)) { // - Process face information and create consolidated faces and store them into BIMRL_TOPO_FACE table BIMRLGeometryPostProcess processFaces = new BIMRLGeometryPostProcess(elemID, geom, _refBIMRLCommon, federatedId, null); processFaces.simplifyAndMergeFaces(); processFaces.insertIntoDB(false); } if (createSpIdx) { octreeInstance.ComputeOctree(elemID, geom); } } reader.Dispose(); if (createSpIdx) { // Truncate the table first before reinserting the records FederatedModelInfo fedModel = DBOperation.getFederatedModelByID(federatedId); if (DBOperation.DBUserID.Equals(fedModel.FederatedID)) { DBOperation.executeSingleStmt("TRUNCATE TABLE " + DBOperation.formatTabName("BIMRL_SPATIALINDEX", federatedId)); } else { DBOperation.executeSingleStmt("DELETE FROM " + DBOperation.formatTabName("BIMRL_SPATIALINDEX")); } collectSpatialIndexAndInsert(octreeInstance, federatedId); } if (sublistCnt > 0) { bboxListList.Add(bboxList); centListList.Add(centList); eidUpdListList.Add(eidUpdList); } for (int i = 0; i < eidUpdListList.Count; i++) { Bbox[0].Value = bboxListList[i].ToArray(); Bbox[0].Size = bboxListList[i].Count; Bbox[1].Value = centListList[i].ToArray(); Bbox[1].Size = centListList[i].Count; Bbox[2].Value = eidUpdListList[i].ToArray(); Bbox[2].Size = eidUpdListList[i].Count; commandUpdBbox.ArrayBindCount = eidUpdListList[i].Count; // No of values in the array to be inserted int commandStatus = commandUpdBbox.ExecuteNonQuery(); DBOperation.commitTransaction(); } if (!string.IsNullOrEmpty(whereCond) && createSpIdx) { command.CommandText = "UPDATE BIMRL_FEDERATEDMODEL SET MAXOCTREELEVEL=" + Octree.MaxDepth.ToString() + " WHERE FEDERATEDID=" + federatedId.ToString(); command.ExecuteNonQuery(); DBOperation.commitTransaction(); } } catch (OracleException e) { string excStr = "%%Read Error - " + e.Message + "\n\t" + currStep; _refBIMRLCommon.StackPushError(excStr); } catch (SystemException e) { string excStr = "%%Read Error - " + e.Message + "\n\t" + currStep; _refBIMRLCommon.StackPushError(excStr); throw; } command.Dispose(); }
public List <FederatedModelInfo> getFederatedModels() { List <FederatedModelInfo> fedModels = new List <FederatedModelInfo>(); DBOperation.beginTransaction(); string currStep = string.Empty; SdoGeometry worldBB = new SdoGeometry(); try { string sqlStmt = "select federatedID, ModelName, ProjectNumber, ProjectName, WORLDBBOX, MAXOCTREELEVEL, LastUpdateDate, Owner, DBConnection from BIMRL_FEDERATEDMODEL order by federatedID"; OracleCommand command = new OracleCommand(sqlStmt, DBOperation.DBConn); OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { FederatedModelInfo fedModel = new FederatedModelInfo(); fedModel.FederatedID = reader.GetInt32(0); fedModel.ModelName = reader.GetString(1); fedModel.ProjectNumber = reader.GetString(2); fedModel.ProjectName = reader.GetString(3); if (!reader.IsDBNull(4)) { worldBB = reader.GetValue(4) as SdoGeometry; Point3D LLB = new Point3D(worldBB.OrdinatesArrayOfDoubles[0], worldBB.OrdinatesArrayOfDoubles[1], worldBB.OrdinatesArrayOfDoubles[2]); Point3D URT = new Point3D(worldBB.OrdinatesArrayOfDoubles[3], worldBB.OrdinatesArrayOfDoubles[4], worldBB.OrdinatesArrayOfDoubles[5]); fedModel.WorldBoundingBox = LLB.ToString() + " " + URT.ToString(); } if (!reader.IsDBNull(5)) { fedModel.OctreeMaxDepth = reader.GetInt16(5); } if (!reader.IsDBNull(6)) { fedModel.LastUpdateDate = reader.GetDateTime(6); } if (!reader.IsDBNull(7)) { fedModel.Owner = reader.GetString(7); } if (!reader.IsDBNull(8)) { fedModel.DBConnection = reader.GetString(8); } fedModels.Add(fedModel); } reader.Close(); } catch (OracleException e) { string excStr = "%%Read Error - " + e.Message + "\n\t" + currStep; _refBIMRLCommon.StackPushError(excStr); } catch (SystemException e) { string excStr = "%%Read Error - " + e.Message + "\n\t" + currStep; _refBIMRLCommon.StackPushError(excStr); throw; } return(fedModels); }