Ejemplo n.º 1
0
        public static Octree.OctreeCheck getCellDescendants(CellID64 cellid, int fedID, out List <UInt64> IDsFound)
        {
            IDsFound = new List <UInt64>();
            Octree.OctreeCheck ret;

            string            whereCond = Octree.childrenCellCondition(cellid);
            string            sqlStmt   = "SELECT UNIQUE CELLID FROM " + DBOperation.formatTabName("BIMRL_SPATIALINDEX", fedID) + " WHERE " + whereCond;
            DataTable         dt        = new DataTable();
            OracleCommand     command   = new OracleCommand(sqlStmt, DBOperation.DBConn);
            OracleDataAdapter dtAdapter = new OracleDataAdapter(command);

            dtAdapter.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                ret = Octree.OctreeCheck.FOUNDDESCENDANT;
            }
            else
            {
                ret = Octree.OctreeCheck.NOTFOUND;
            }

            foreach (DataRow dtRow in dt.Rows)
            {
                CellID64 cell = new CellID64(dtRow["CELLID"].ToString());
                IDsFound.Add(cell.iCellID);
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public static int getModelID(int fedID)
        {
            string        sqlStmt    = "Select " + DBOperation.formatTabName("SEQ_BIMRL_MODELINFO", fedID) + ".nextval from dual";
            OracleCommand cmd        = new OracleCommand(sqlStmt, DBConn);
            int           newModelID = Convert.ToInt32(cmd.ExecuteScalar().ToString());

            cmd.Dispose();
            return(newModelID);
        }
Ejemplo n.º 3
0
        public static projectUnit getProjectUnitLength(int fedID)
        {
            projectUnit projectUnit = projectUnit.SIUnit_Length_Meter;

            string SqlStmt = "Select PROPERTYVALUE from " + DBOperation.formatTabName("BIMRL_PROPERTIES", fedID) + " P, " + DBOperation.formatTabName("BIMRL_ELEMENT", fedID) + " E"
                             + " where P.ELEMENTID=E.ELEMENTID and E.ELEMENTTYPE='IFCPROJECT' AND PROPERTYGROUPNAME='IFCATTRIBUTES' AND PROPERTYNAME='LENGTHUNIT'";
            string        currStep = SqlStmt;
            OracleCommand command  = new OracleCommand(SqlStmt, DBConn);

            try
            {
                object unitS = command.ExecuteScalar();
                if (unitS != null)
                {
                    string unitString = unitS as string;
                    if (string.Compare(unitString, "MILLI METRE", true) == 0)
                    {
                        projectUnit = projectUnit.SIUnit_Length_MilliMeter;
                    }
                    else if (string.Compare(unitString, "INCH", true) == 0)
                    {
                        projectUnit = projectUnit.Imperial_Length_Inch;
                    }
                    else if (string.Compare(unitString, "FOOT", true) == 0)
                    {
                        projectUnit = projectUnit.Imperial_Length_Foot;
                    }
                }
            }
            catch (OracleException e)
            {
                string excStr = "%%Error - " + e.Message + "\n\t" + currStep;
                refBIMRLCommon.StackPushError(excStr);
                command.Dispose();
            }
            command.Dispose();
            currModelProjectUnitLength = projectUnit;
            return(projectUnit);
        }
Ejemplo n.º 4
0
        public static void regenSpatialIndexDict(int fedID, OctreeDict regenSpIndexTree)
        {
            BIMRLCommon refBIMRLCommon = new BIMRLCommon();
            string      sqlStmt        = "SELECT ELEMENTID, CELLID FROM " + DBOperation.formatTabName("BIMRL_SPATIALINDEX", fedID);

            try
            {
                OracleCommand cmd = new OracleCommand(sqlStmt, DBOperation.DBConn);
                cmd.FetchSize = 100000;
                OracleDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string    elementid = reader.GetString(0);
                    ElementID eID       = new ElementID(elementid);
                    string    cellid    = reader.GetString(1);
                    CellID64  cell      = new CellID64(cellid);

                    SortedSet <int> cData = new SortedSet <int>();
                    cData.Add(getIndexForElementID(eID.ElementIDNo)); // the flag is no longer used, any value doesn't matter
                    CellData data = new CellData {
                        nodeType = 1, data = cData
                    };
                    regenSpIndexTree.AddOrUpdate(cell.iCellID, data);
                }
                reader.Dispose();
                cmd.Dispose();
            }
            catch (OracleException e)
            {
                string excStr = "%%Read Error - " + e.Message + "\n\t" + sqlStmt;
                refBIMRLCommon.StackPushError(excStr);
            }
            catch (SystemException e)
            {
                string excStr = "%%Read Error - " + e.Message + "\n\t" + sqlStmt;
                refBIMRLCommon.StackPushError(excStr);
                throw;
            }
        }