GeometryGym.Ifc.ParserIfc.ParseLine C# (CSharp) Méthode

ParseLine() static private méthode

static private ParseLine ( string line, ReleaseVersion schema ) : BaseClassIfc
line string
schema ReleaseVersion
Résultat BaseClassIfc
        internal static BaseClassIfc ParseLine(string line, ReleaseVersion schema)
        {
            string kw = "", str = "";
            int ifcID = 0;
            if (string.IsNullOrEmpty(line))
                return null;
            if (line.Length < 5 || line.StartsWith("ISO"))
                return null;
            GetKeyWord(line, out ifcID, out kw, out str);
            if (string.IsNullOrEmpty(kw))
                return null;
            str = str.Trim();
            BaseClassIfc result = LineParser(kw, str, schema);
            if (result == null)
                return null;
            result.mIFCString = str;
            result.mIndex = ifcID;
            return result;
        }

Usage Example

Exemple #1
0
        internal BaseClassIfc InterpretLine(string line)
        {
            if (line.StartsWith("ISO"))
            {
                return(null);
            }
            string ts = line.Trim().Replace(" ", "");

            if (ts.StartsWith("FILE_SCHEMA(('IFC2X4", true, System.Globalization.CultureInfo.CurrentCulture) ||
                ts.StartsWith("FILE_SCHEMA(('IFC4", true, System.Globalization.CultureInfo.CurrentCulture))
            {
                mRelease = ReleaseVersion.IFC4;
                return(null);
            }
            BaseClassIfc result = ParserIfc.ParseLine(line, mRelease);

            if (result == null)
            {
                int    ifcID = 0;
                string kw = "", str = "";
                ParserIfc.GetKeyWord(line, out ifcID, out kw, out str);
                if (string.IsNullOrEmpty(kw))
                {
                    return(null);
                }

                result = new BaseClassIfc(ifcID, kw, str);
            }
            if (result == null)
            {
                return(null);
            }
            IfcApplication application = result as IfcApplication;

            if (application != null)
            {
                IfcApplication ea = mFactory.mApplication;
                if (ea != null && ea.mVersion == application.mVersion)
                {
                    if (string.Compare(ea.ApplicationFullName, application.ApplicationFullName, true) == 0)
                    {
                        if (string.Compare(ea.mApplicationIdentifier, application.mApplicationIdentifier) == 0)
                        {
                            mIfcObjects[ea.mIndex] = null;
                            mFactory.mApplication  = application;
                            mFactory.OwnerHistory(IfcChangeActionEnum.ADDED).mLastModifyingApplication = application.mIndex;
                            if (mFactory.mOwnerHistoryModify != null)
                            {
                                mFactory.mOwnerHistoryModify.mLastModifyingApplication = application.mIndex;
                            }
                        }
                    }
                }
            }
            IfcContext context = result as IfcContext;

            if (context != null)
            {
                mContext = context;
            }
            IfcGeometricRepresentationContext geometricRepresentationContext = result as IfcGeometricRepresentationContext;

            if (geometricRepresentationContext != null)
            {
                if (string.Compare(geometricRepresentationContext.mContextType, "Plan", true) != 0)
                {
                    mFactory.mGeomRepContxt = geometricRepresentationContext;
                }
                if (geometricRepresentationContext.mPrecision > 1e-6)
                {
                    Tolerance = geometricRepresentationContext.mPrecision;
                }
            }
            IfcSIUnit unit = result as IfcSIUnit;

            if (unit != null)
            {
                if (unit.Name == IfcSIUnitName.METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSILength = unit;
                }
                else if (unit.Name == IfcSIUnitName.SQUARE_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIArea = unit;
                }
                else if (unit.Name == IfcSIUnitName.CUBIC_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIVolume = unit;
                }
            }
            this[result.mIndex] = result;

            //IfcWorkPlan workPlan = result as IfcWorkPlan;
            //if(workPlan != null)
            //{
            //	mWorkPlans.Add(workPlan);
            //	return workPlan;
            //}
            return(result);
        }
All Usage Examples Of GeometryGym.Ifc.ParserIfc::ParseLine