Inheritance: IfcColourSpecification, IfcColourOrFactor
Beispiel #1
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);
        }
        public static string STEPString(IfcColourOrFactor colourOrFactor)
        {
            if (colourOrFactor == null)
            {
                return("$");
            }
            IfcColourRgb colourRgb = colourOrFactor as IfcColourRgb;

            if (colourRgb != null)
            {
                return("#" + colourRgb.StepId);
            }
            IfcNormalisedRatioMeasure normalisedRatioMeasure = colourOrFactor as IfcNormalisedRatioMeasure;

            if (normalisedRatioMeasure != null)
            {
                return(normalisedRatioMeasure.ToString());
            }
            return("$");
        }
Beispiel #3
0
        internal static IfcColourOrFactor parseColourOrFactor(string str)
        {
            if (str[0] == '#')
            {
                return(null);
            }
            string kw = "", def = "";
            int    id = 0;

            ParserIfc.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)));
        }
        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);
        }
        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)));
        }
        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);
        }
Beispiel #7
0
		internal static void parseFields(IfcColourRgb c, List<string> arrFields, ref int ipos) { IfcColourSpecification.parseFields(c, arrFields, ref ipos); c.mRed = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mGreen = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mBlue = ParserSTEP.ParseDouble(arrFields[ipos++]); }
Beispiel #8
0
		internal static IfcColourRgb Parse(string strDef) { IfcColourRgb c = new IfcColourRgb(); int ipos = 0; parseFields(c, ParserSTEP.SplitLineFields(strDef), ref ipos); return c; }
Beispiel #9
0
		internal IfcColourRgb(IfcColourRgb c) : base(c) { mRed = c.mRed; mGreen = c.mGreen; mBlue = c.mBlue; }
Beispiel #10
0
		public IfcSurfaceStyleShading(DatabaseIfc m, Color surface) : base(m) { mSurfaceColour =  new IfcColourRgb(m,"",surface).mIndex; }