예제 #1
0
        internal static BaseClassIfc ParseLine(string line, ReleaseVersion schema)
        {
            string kw = "", str = "";
            int    ifcID = 0;

            if (string.IsNullOrEmpty(line))
            {
                return(null);
            }
            string upper = line.ToUpper();

            if (line.Length < 5)
            {
                return(null);
            }
            ParserSTEP.GetKeyWord(line, out ifcID, out kw, out str);
            if (string.IsNullOrEmpty(kw) || !kw.ToUpper().StartsWith("IFC"))
            {
                return(null);
            }
            str = str.Trim();
            BaseClassIfc result = BaseClassIfc.LineParser(kw, str, schema);

            if (result == null)
            {
                return(null);
            }
            result.mSTEPString = str;
            result.mIndex      = ifcID;
            return(result);
        }
예제 #2
0
        internal static BaseClassIfc ParseLine(string line, ReleaseVersion schema, ConcurrentDictionary <int, BaseClassIfc> dictionary)
        {
            string kw = "", str = "";
            int    stepID = 0;

            ParserSTEP.GetKeyWord(line, out stepID, out kw, out str);
            if (string.IsNullOrEmpty(kw) || !kw.ToUpper().StartsWith("IFC"))
            {
                return(null);
            }
            str = str.Trim();
            ConcurrentDictionary <int, BaseClassIfc> dict = dictionary;

            if (dict == null)
            {
                dict    = new ConcurrentDictionary <int, BaseClassIfc>();
                dict[0] = null;
            }
            BaseClassIfc result = BaseClassIfc.LineParser(kw, str, schema, dict);

            if (result == null)
            {
                return(null);
            }
            result.mStepId = stepID;
            return(result);
        }
예제 #3
0
        internal static IfcColour parseColour(string str)
        {
            string kw = "", def = "";
            int    id = 0;

            ParserSTEP.GetKeyWord(str, out id, out kw, out def);
            if (string.IsNullOrEmpty(kw))
            {
                return(null);
            }
            if (string.Compare(kw, "IFCCOLOURRGB", false) == 0)
            {
                return(IfcColourRgb.Parse(str));
            }
            if (string.Compare(kw, "IFCDRAUGHTINGPREDEFINEDCOLOUR", false) == 0)
            {
                return(IfcDraughtingPreDefinedColour.Parse(str));
            }
            return(null);
        }
예제 #4
0
        internal static IfcColourOrFactor parseColourOrFactor(string str)
        {
            if (string.IsNullOrEmpty(str) || str[0] == '#' || str[0] == '$')
            {
                return(null);
            }

            string kw = "", def = "";
            int    id = 0;

            ParserSTEP.GetKeyWord(str, out id, out kw, out def);
            if (string.IsNullOrEmpty(kw))
            {
                return(null);
            }
            if (string.Compare(kw, "IFCCOLOURRGB", false) == 0)
            {
                return(IfcColourRgb.Parse(str));
            }
            return(new IfcNormalisedRatioMeasure(ParserSTEP.ParseDouble(def)));
        }
예제 #5
0
        internal static IfcColourOrFactor parseColourOrFactor(string str, ConcurrentDictionary <int, BaseClassIfc> dictionary)
        {
            if (string.IsNullOrEmpty(str) || str[0] == '$')
            {
                return(null);
            }

            if (str[0] == '#')
            {
                int i = ParserSTEP.ParseLink(str);
                if (i > 0)
                {
                    return(dictionary[i] as IfcColourOrFactor);
                }
                return(null);
            }
            string kw = "", def = "";
            int    id = 0, pos = 0;

            ParserSTEP.GetKeyWord(str, out id, out kw, out def);
            if (string.IsNullOrEmpty(kw))
            {
                return(null);
            }
            if (string.Compare(kw, "IFCCOLOURRGB", true) == 0)
            {
                IfcColourRgb color = new IfcColourRgb();
                color.parse(def, ref pos, ReleaseVersion.IFC2x3, def.Length, null);
                return(color);
            }
            double ratio = 0;

            if (double.TryParse(def, System.Globalization.NumberStyles.Any, ParserSTEP.NumberFormat, out ratio))
            {
                return(new IfcNormalisedRatioMeasure(ratio));
            }
            return(null);
        }
예제 #6
0
        internal static IfcColourOrFactor parseColourOrFactor(string str)
        {
            if (string.IsNullOrEmpty(str) || str[0] == '#' || str[0] == '$')
            {
                return(null);
            }

            string kw = "", def = "";
            int    id = 0, pos = 0;

            ParserSTEP.GetKeyWord(str, out id, out kw, out def);
            if (string.IsNullOrEmpty(kw))
            {
                return(null);
            }
            if (string.Compare(kw, "IFCCOLOURRGB", false) == 0)
            {
                IfcColourRgb color = new IfcColourRgb();
                color.parse(def, ref pos, ReleaseVersion.IFC2x3, def.Length, null);
                return(color);
            }
            return(new IfcNormalisedRatioMeasure(ParserSTEP.ParseDouble(def)));
        }
예제 #7
0
        internal static IfcColour parseColour(string str)
        {
            string kw = "", def = "";
            int    id = 0, pos = 0;

            ParserSTEP.GetKeyWord(str, out id, out kw, out def);
            if (string.IsNullOrEmpty(kw))
            {
                return(null);
            }
            if (string.Compare(kw, "IFCCOLOURRGB", false) == 0)
            {
                IfcColourRgb color = new IfcColourRgb();
                color.parse(def, ref pos, ReleaseVersion.IFC2x3, def.Length, null);
                return(color);
            }
            if (string.Compare(kw, "IFCDRAUGHTINGPREDEFINEDCOLOUR", false) == 0)
            {
                IfcDraughtingPreDefinedColour color = new IfcDraughtingPreDefinedColour();
                color.parse(def, ref pos, ReleaseVersion.IFC2x3, def.Length, null);
                return(color);
            }
            return(null);
        }
예제 #8
0
        internal BaseClassIfc interpretLine(string line)
        {
            BaseClassIfc result = ParserIfc.ParseLine(line, mRelease);

            if (result == null)
            {
                if (line.StartsWith("ISO"))
                {
                    return(null);
                }
                if (setFileLine(line))
                {
                    return(null);
                }
                int    ifcID = 0;
                string kw = "", str = "";
                ParserSTEP.GetKeyWord(line, out ifcID, out kw, out str);
                if (string.IsNullOrEmpty(kw) || !kw.ToLower().StartsWith("ifc"))
                {
                    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)
                        {
                            this[ea.mIndex]       = null;
                            mFactory.mApplication = application;
                            //	mFactory.OwnerHistory(IfcChangeActionEnum.ADDED).mLastModifyingApplication = application.mIndex;
                            //	if (mFactory.mOwnerHistories.ContainsKey(IfcChangeActionEnum.MODIFIED))
                            //		mFactory.mOwnerHistories[IfcChangeActionEnum.MODIFIED].mLastModifyingApplication = application.mIndex;
                        }
                    }
                }
            }

            IfcGeometricRepresentationContext geometricRepresentationContext = result as IfcGeometricRepresentationContext;

            if (geometricRepresentationContext != null)
            {
                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;
                }
            }
            return(result);
        }