internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "BasisCurve") == 0) { BasisCurve = mDatabase.ParseXml <IfcCurve>(child as XmlElement); } else if (string.Compare(name, "Trim1") == 0) { mTrim1 = IfcTrimmingSelect.Parse(child as XmlElement, mDatabase); } else if (string.Compare(name, "Trim2") == 0) { mTrim2 = IfcTrimmingSelect.Parse(child as XmlElement, mDatabase); } } if (xml.HasAttribute("SenseAgreement")) { bool.TryParse(xml.Attributes["SenseAgreement"].Value, out mSenseAgreement); } if (xml.HasAttribute("MasterRepresentation")) { Enum.TryParse <IfcTrimmingPreference>(xml.Attributes["MasterRepresentation"].Value, true, out mMasterRepresentation); } }
public IfcTrimmedCurve(IfcCartesianPoint s, IfcCartesianPoint e) : base(s.mDatabase) { BasisCurve = new IfcLine(s, new IfcVector(s.mDatabase, e.Location - s.Location)); mTrim1 = new IfcTrimmingSelect(s); mTrim2 = new IfcTrimmingSelect(e); mMasterRepresentation = IfcTrimmingPreference.CARTESIAN; mSenseAgreement = true; }
public IfcTrimmedCurve(IfcCartesianPoint s, IfcCartesianPoint e) : base(s.mDatabase) { IfcLine il = new IfcLine(s, new IfcVector(s.mDatabase,e.Location- s.Location)); mBasisCurve = il.mIndex; mTrim1 = new IfcTrimmingSelect(s); mTrim2 = new IfcTrimmingSelect(e); mMasterRepresentation = IfcTrimmingPreference.CARTESIAN; mSenseAgreement = true; }
internal IfcTrimmedCurve(DatabaseIfc db, Arc a, bool twoD, IfcCartesianPoint optStrt, out IfcCartesianPoint end) : base(db) { Point3d o = a.Plane.Origin, s = a.StartPoint, e = a.EndPoint; Vector3d x = s - o; mSenseAgreement = true; if (optStrt == null) { optStrt = twoD ? new IfcCartesianPoint(db, new Point2d(s.X, s.Y)) : new IfcCartesianPoint(db, s); } end = twoD ? new IfcCartesianPoint(db, new Point2d(e.X, e.Y)) : new IfcCartesianPoint(db, e); double angleFactor = mDatabase.mContext.UnitsInContext.getScaleSI(IfcUnitEnum.PLANEANGLEUNIT); if (twoD) { if (a.Plane.ZAxis.Z < 0) { mSenseAgreement = false; x = e - o; IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y)); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(a.Angle / angleFactor, optStrt); mTrim2 = new IfcTrimmingSelect(0, end); } else { IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y)); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(0, optStrt); mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end); } } else { Vector3d y = Vector3d.CrossProduct(a.Plane.ZAxis, x); Plane pl = new Plane(o, x, y); IfcAxis2Placement3D ap = new IfcAxis2Placement3D(db, pl); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(0, optStrt); mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end); } mMasterRepresentation = IfcTrimmingPreference.PARAMETER; }
internal IfcTrimmedCurve(DatabaseIfc db, Arc a, bool twoD, IfcCartesianPoint optStrt, out IfcCartesianPoint end) : base(db) { Point3d o = a.Plane.Origin, s = a.StartPoint, e = a.EndPoint; Vector3d x = s - o; mSenseAgreement = true; if (optStrt == null) optStrt = twoD ? new IfcCartesianPoint(db, new Point2d(s.X, s.Y)) : new IfcCartesianPoint(db, s); end = twoD ? new IfcCartesianPoint(db, new Point2d(e.X, e.Y)) : new IfcCartesianPoint(db,e); double angleFactor = mDatabase.mContext.UnitsInContext.getScaleSI(IfcUnitEnum.PLANEANGLEUNIT); if (twoD) { if (a.Plane.ZAxis.Z < 0) { mSenseAgreement = false; x = e - o; IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y)); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(a.Angle / angleFactor, optStrt); mTrim2 = new IfcTrimmingSelect(0, end); } else { IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y)); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(0, optStrt); mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end); } } else { Vector3d y = Vector3d.CrossProduct(a.Plane.ZAxis, x); Plane pl = new Plane(o, x, y); IfcAxis2Placement3D ap = new IfcAxis2Placement3D(db, pl); BasisCurve = new IfcCircle(ap, a.Radius); mTrim1 = new IfcTrimmingSelect(0, optStrt); mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end); } mMasterRepresentation = IfcTrimmingPreference.PARAMETER; }
internal static IfcTrimmingSelect Parse(XmlElement xml, DatabaseIfc db) { IfcTrimmingSelect result = new IfcTrimmingSelect(); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "IfcParameterValue-wrapper") == 0) { result.mIfcParameterValue = double.Parse(child.InnerText); } else if (string.Compare(name, "IfcCartesianPoint") == 0) { IfcCartesianPoint p = db.ParseXml <IfcCartesianPoint>(child as XmlElement); if (p != null) { result.mIfcCartesianPoint = p.mIndex; } } } return(result); }
internal static IfcTrimmingSelect Parse(string str) { IfcTrimmingSelect ts = new IfcTrimmingSelect(); ts.mIfcParameterValue = double.NaN; int i = 0; if (str[i] == '(') i++; char c = str[i]; if (c == '#') { string ls = "#"; i++; while (i < str.Length) { c = str[i]; if (c == ',' || c == ')') break; ls += c; i++; } ts.mIfcCartesianPoint = ParserSTEP.ParseLink(ls); if (c == ',') { if (str.Substring(i + 1).StartsWith("IFCPARAMETERVALUE(", true, System.Globalization.CultureInfo.CurrentCulture)) { i += 19; string pv = ""; while (str[i] != ')') { pv += str[i++]; } ts.mIfcParameterValue = ParserSTEP.ParseDouble(pv); } } } else { if (str.Substring(i).StartsWith("IFCPARAMETERVALUE(", true, System.Globalization.CultureInfo.CurrentCulture)) { i += 18; string pv = ""; while (str[i] != ')') { pv += str[i++]; } ts.mIfcParameterValue = ParserSTEP.ParseDouble(pv); } if (++i < str.Length) { if (str[i++] == ',') { ts.mIfcCartesianPoint = ParserSTEP.ParseLink(str.Substring(i, str.Length - i - 1)); } } } return ts; }
internal IfcTrimmedCurve(IfcCurve basis, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp) : base(basis.mDatabase) { mBasisCurve = basis.mIndex; mTrim1 = start; mTrim2 = end; mSenseAgreement = senseAgreement; mMasterRepresentation = tp; }
internal IfcTrimmedCurve(IfcTrimmedCurve c) : base(c) { mBasisCurve = c.mBasisCurve; mTrim1 = c.mTrim1; mTrim2 = c.mTrim2; mSenseAgreement = c.mSenseAgreement; mMasterRepresentation = c.mMasterRepresentation; }