コード例 #1
0
        public void computeMajorAxes(int federatedId, string whereCond)
        {
            DBOperation.beginTransaction();
            string           currStep = string.Empty;
            OracleCommand    command  = new OracleCommand(" ", DBOperation.DBConn);
            OracleDataReader reader;

            try
            {
                SdoGeometry sdoGeomData = new SdoGeometry();

                string sqlStmt = "select elementid, geometrybody from " + DBOperation.formatTabName("BIMRL_ELEMENT", federatedId) + " where geometrybody is not null ";
                if (!string.IsNullOrEmpty(whereCond))
                {
                    sqlStmt += " and " + whereCond;
                }
                currStep = sqlStmt;

                command.CommandText = sqlStmt;
                command.FetchSize   = 20;

                reader = command.ExecuteReader();

                while (reader.Read())
                {
                    string elemID = reader.GetString(0);
                    sdoGeomData = reader.GetValue(1) as SdoGeometry;

                    Polyhedron geom;
                    if (!SDOGeomUtils.generate_Polyhedron(sdoGeomData, out geom))
                    {
                        continue;                                       // if there is something not right, skip the geometry
                    }
                    // - Process face information and create consolidated faces and store them into BIMRL_TOPO_FACE table
                    BIMRLGeometryPostProcess majorAxes = new BIMRLGeometryPostProcess(elemID, geom, _refBIMRLCommon, federatedId, null);
                    majorAxes.deriveMajorAxes();
                }
                reader.Dispose();
            }
            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();
        }
コード例 #2
0
ファイル: BIMRLUtils.cs プロジェクト: jdimyadi/BIMRL-DBETL
        /// <summary>
        /// This function is to patch data, updating element's major axes and their OBB at the same time
        /// </summary>
        /// <param name="fedID"></param>
        /// <param name="whereCond"></param>
        public static void updateMajorAxesAndOBB(int fedID, string whereCond)
        {
            BIMRLCommon bimrlCommon = new BIMRLCommon();

            string sqlStmt = "SELECT ELEMENTID, GEOMETRYBODY FROM " + DBOperation.formatTabName("BIMRL_ELEMENT", fedID) + " WHERE GEOMETRYBODY IS NOT NULL";

            if (!string.IsNullOrEmpty(whereCond))
            {
                sqlStmt += " AND " + whereCond;
            }

            OracleCommand    cmd    = new OracleCommand(sqlStmt, DBOperation.DBConn);
            OracleDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                string      elementid = reader.GetString(0);
                SdoGeometry geom      = reader.GetValue(1) as SdoGeometry;

                Polyhedron polyH;
                if (!SDOGeomUtils.generate_Polyhedron(geom, out polyH))
                {
                    continue;  // something wrong, unable to get the polyhedron, skip
                }
                BIMRLGeometryPostProcess postProc = new BIMRLGeometryPostProcess(elementid, polyH, bimrlCommon, fedID, null);
                postProc.deriveMajorAxes();
                postProc.trueOBBFaces();
                postProc.projectedFaces();

                //// create OBB topo face information
                //if (postProc.OBB != null)
                //{
                //    Polyhedron obbGeom;
                //    if (SDOGeomUtils.generate_Polyhedron(postProc.OBB, out obbGeom))
                //    {
                //        BIMRLGeometryPostProcess processFaces = new BIMRLGeometryPostProcess(elementid, obbGeom, bimrlCommon, fedID, "OBB");
                //        processFaces.simplifyAndMergeFaces();
                //        processFaces.insertIntoDB(false);
                //    }
                //}
            }
            reader.Close();
        }