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); }