public ShowBIMRLModels()
        {
            InitializeComponent();
            BIMRLCommonRef.resetAll();

            // Connect to Oracle DB
            DBOperation.refBIMRLCommon = BIMRLCommonRef;      // important to ensure DBoperation has reference to this object!!
            if (DBOperation.Connect() == null)
            {
                BIMRLErrorDialog erroDlg = new BIMRLErrorDialog(BIMRLCommonRef);
                erroDlg.ShowDialog();
                return;
            }

            _qModel   = new BIMRLQueryModel(BIMRLCommonRef);
            fedModels = _qModel.getFederatedModels();
            DataGrid_FedModels.AutoGenerateColumns = true;
            DataGrid_FedModels.IsReadOnly          = true;
            DataGrid_FedModels.ItemsSource         = fedModels;
            DataGrid_FedModels.MinRowHeight        = 20;

            // Temp: disabled first for testing
            Button_genX3D.IsEnabled     = false; // Disable Gen X3D button until the file name is filled
            Button_EnhanceSpB.IsEnabled = false;
            Button_genGraph.IsEnabled   = false;
        }
Exemple #2
0
        public MainWindow()
        {
            BIMRLCommon BIMRLCommonRef = new BIMRLCommon();

            InitializeComponent();

            // Connect to Oracle DB
            DBOperation.refBIMRLCommon = BIMRLCommonRef;      // important to ensure DBoperation has reference to this object!!
            if (DBOperation.Connect() == null)
            {
                BIMRLErrorDialog erroDlg = new BIMRLErrorDialog(BIMRLCommonRef);
                erroDlg.ShowDialog();
                return;
            }

            BIMRLQueryModel      _qModel   = new BIMRLQueryModel(BIMRLCommonRef);
            List <BIMRLFedModel> fedModels = new List <BIMRLFedModel>();

            fedModels = _qModel.getFederatedModels();

            DataGrid_Oracle.AutoGenerateColumns = true;
            DataGrid_Oracle.IsReadOnly          = true;
            DataGrid_Oracle.ItemsSource         = fedModels;
            DataGrid_Oracle.MinRowHeight        = 20;
            Button_Copy.IsEnabled = false;

            DataGrid_Cassandra.IsReadOnly          = true;
            DataGrid_Cassandra.AutoGenerateColumns = true;
            DataGrid_Cassandra.MinRowHeight        = 20;

            QueryCassDB          qCDB      = new QueryCassDB();
            List <BIMRLFedModel> modelList = qCDB.getCassFedModels();

            DataGrid_Cassandra.ItemsSource = modelList;
        }
Exemple #3
0
        private void Button_OK_Click(object sender, RoutedEventArgs e)
        {
            DBOperation.DBUserID       = TextBox_DBUserID.Text;
            DBOperation.DBPassword     = TextBox_DBPassword.Text;
            DBOperation.DBConnecstring = TextBox_DBConn.Text;

            _bimrlCommon.resetAll();

            // Connect to Oracle DB
            DBOperation.refBIMRLCommon = _bimrlCommon;      // important to ensure DBoperation has reference to this object!!
            if (DBOperation.Connect() == null)
            {
                BIMRLErrorDialog erroDlg = new BIMRLErrorDialog(_bimrlCommon);
                erroDlg.ShowDialog();
                return;
            }

            // For object selections for Space Boundary
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_BeamSB.Content.ToString().ToUpper(), CB_BeamSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_ColumnSB.Content.ToString().ToUpper(), CB_ColumnSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_CurtainWallSB.Content.ToString().ToUpper(), CB_CurtainWallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_CoveringSB.Content.ToString().ToUpper(), CB_CoveringSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_DoorSB.Content.ToString().ToUpper(), CB_DoorSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_MemberSB.Content.ToString().ToUpper(), CB_MemberSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_OpeningSB.Content.ToString().ToUpper(), CB_OpeningSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_PlateSB.Content.ToString().ToUpper(), CB_PlateSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_RailingSB.Content.ToString().ToUpper(), CB_RailingSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCRAMP", CB_RampSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCRAMPFLIGHT", CB_RampSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_RoofSB.Content.ToString().ToUpper(), CB_RoofSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_SlabSB.Content.ToString().ToUpper(), CB_SlabSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_SpaceSB.Content.ToString().ToUpper(), CB_SpaceSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCSTAIR", CB_StairSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCSTAIRFLIGHT", CB_StairSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCWALL", CB_WallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCWALLSTANDARDCASE", CB_WallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_WindowSB.Content.ToString().ToUpper(), CB_WindowSB.IsChecked.Value);

            // For object selections for Connection (e.g. Envelop)
            registerObjectType(DBOperation.objectForConnection, CB_BeamConn.Content.ToString().ToUpper(), CB_BeamConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_ColumnConn.Content.ToString().ToUpper(), CB_ColumnConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_CurtainWallConn.Content.ToString().ToUpper(), CB_CurtainWallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_CoveringConn.Content.ToString().ToUpper(), CB_CoveringConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_DoorConn.Content.ToString().ToUpper(), CB_DoorConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_MemberConn.Content.ToString().ToUpper(), CB_MemberConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_OpeningConn.Content.ToString().ToUpper(), CB_OpeningConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_PlateConn.Content.ToString().ToUpper(), CB_PlateConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_RailingConn.Content.ToString().ToUpper(), CB_RailingConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCRAMP", CB_RampConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCRAMPFLIGHT", CB_RampConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_RoofConn.Content.ToString().ToUpper(), CB_RoofConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_SlabConn.Content.ToString().ToUpper(), CB_SlabConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_SpaceConn.Content.ToString().ToUpper(), CB_SpaceConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCSTAIR", CB_StairConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCSTAIRFLIGHT", CB_StairConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCWALL", CB_WallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCWALLSTANDARDCASE", CB_WallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_WindowConn.Content.ToString().ToUpper(), CB_WindowConn.IsChecked.Value);

            Close();
        }
Exemple #4
0
        public void copyData(int fedID, string projectNumber, string projectName)
        {
            OracleConnection oraConn   = DBOperation.Connect();
            ISession         CSSession = CassandraDB.connect();

            CSSession.UserDefinedTypes.Define(UdtMap.For <CSType>(), UdtMap.For <CSPoint>(), UdtMap.For <CSGeometry>(), UdtMap.For <CSMatrix3D>(), UdtMap.For <CSSpatialIndex>(),
                                              UdtMap.For <CSTopoFace>(), UdtMap.For <CSProperty>(), UdtMap.For <CSMaterial>(), UdtMap.For <CSClassification>());

            PreparedStatement modelIns = CSSession.Prepare("Insert into bimrl_federatedmodel (projectnumber, projectname, federatedid, lastupdatedate, maxoctreelevel, projectid, worldbox) "
                                                           + "values (?, ?, ?, ?, ?, ?, ?)");
            PreparedStatement elemInsPrep = CSSession.Prepare("Insert into bimrl_element (federatedmodelid, projectname, projectnumber, elementid, lineno, elementtype, modelid, type, name, longname, "
                                                              + "ownerhistoryid, description, objecttype, tag, container, geometrybody, geometrybody_bbox, geometrybody_bbox_centroid, geometryfootprint, geometryaxis, "
                                                              + "transform, obb_major_axis, obb_major_axis_centroid, obb) "
                                                              + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,  ?, ?, ?, ?)");

            // Delete existing data first if already exists
            deleteData(fedID);

            string sqlStmt = string.Empty;

            sqlStmt = "Select e.elementid, e.lineno, e.elementtype, e.modelid, e.typeid, e.name, e.longname, e.ownerhistoryid, e.description, e.objecttype, "
                      + "e.tag, e.container, e.geometrybody, e.geometrybody_bbox, e.geometrybody_bbox_centroid, e.geometryfootprint, e.geometryaxis, e.transform_x_axis, e.transform_y_axis, e.transform_z_axis, "
                      + "e.body_major_axis1, e.body_major_axis2, e.body_major_axis3, e.body_major_axis_cnetroid, e.obb, t.elementid, t.ifctype, t.name, t.description, t.ownerhistoryid, "
                      + "t.modelid, t.applicableoccurence, t.tag, t.elementtype, t.predefinedtype, t.assembyplace, t.operationtype, t.constructiontype "
                      + "from bimrl_element_" + fedID.ToString("X4") + " e, bimrl_type_" + fedID.ToString("X4") + " t where t.elementid (+) =e.typeid";

            OracleCommand command = new OracleCommand(sqlStmt, oraConn);

            command.CommandText = sqlStmt;
            command.FetchSize   = 1000;
            OracleDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                CSType bType = new CSType();
                bType.typeid              = reader.GetString(22);
                bType.ifctype             = reader.GetString(23);
                bType.name                = reader.GetString(24);
                bType.description         = reader.GetString(25);
                bType.ownerhistoryid      = reader.GetInt32(26);
                bType.applicableoccurence = SafeGetString(reader, 27);
                bType.tag              = SafeGetString(reader, 28);
                bType.elementtype      = reader.GetString(29);
                bType.predefinedtype   = reader.GetString(30);
                bType.assemblyplace    = reader.GetString(31);
                bType.operationtype    = reader.GetString(32);
                bType.constructiontype = reader.GetString(33);

                List <CSPoint> transf = new List <CSPoint>();
                transf.Add(CSpointFromSdoGeom(reader, 17));
                transf.Add(CSpointFromSdoGeom(reader, 18));
                transf.Add(CSpointFromSdoGeom(reader, 19));
                CSMatrix3D transform = new CSMatrix3D();
                transform.matrix3d = transf;

                List <CSPoint> mjAxis = new List <CSPoint>();
                mjAxis.Add(CSpointFromSdoGeom(reader, 20));
                mjAxis.Add(CSpointFromSdoGeom(reader, 21));
                mjAxis.Add(CSpointFromSdoGeom(reader, 22));
                CSMatrix3D mjAxisMatrix = new CSMatrix3D();
                mjAxisMatrix.matrix3d = mjAxis;

                NetSdoGeometry.SdoGeometry bodyMjAxisCentroid = reader.GetValue(20) as NetSdoGeometry.SdoGeometry;
                NetSdoGeometry.SdoGeometry obb = reader.GetValue(21) as NetSdoGeometry.SdoGeometry;

                BoundStatement boundStmt = elemInsPrep.Bind(fedID, projectName, projectNumber, reader.GetString(0), reader.GetInt32(1), reader.GetString(2), reader.GetInt32(3), bType, SafeGetString(reader, 5), SafeGetString(reader, 6),
                                                            SafeGetValue(reader, 7), SafeGetString(reader, 8), SafeGetString(reader, 9), SafeGetString(reader, 10), SafeGetString(reader, 11), CSgeomFromSdoGeom(reader, 12), CSgeomFromSdoGeom(reader, 13), CSpointFromSdoGeom(reader, 14), CSgeomFromSdoGeom(reader, 15), CSgeomFromSdoGeom(reader, 16),
                                                            transform, mjAxisMatrix, CSpointFromSdoGeom(reader, 23), CSgeomFromSdoGeom(reader, 24));

                CSSession.Execute(boundStmt);
            }
        }