Inheritance: IfcBoundedCurve
Exemplo n.º 1
0
        internal static void parseFields(IfcIndexedPolyCurve c, List <string> arrFields, ref int ipos)
        {
            IfcBoundedCurve.parseFields(c, arrFields, ref ipos);
            c.mPoints = ParserSTEP.ParseLink(arrFields[ipos++]);
            string str = arrFields[ipos++];

            if (str != "$")
            {
                List <string> strs = ParserSTEP.SplitLineFields(str.Substring(1, str.Length - 2));
                foreach (string s in strs)
                {
                    if (s.ToUpper().StartsWith("IFCLINEINDEX"))
                    {
                        c.mSegments.Add(new IfcLineIndex(ParserSTEP.SplitListSTPIntegers(s.Substring(13, s.Length - 14))));
                    }
                    else
                    {
                        List <int> ints = ParserSTEP.SplitListSTPIntegers(s.Substring(12, s.Length - 13));
                        c.mSegments.Add(new IfcArcIndex(ints[0], ints[1], ints[2]));
                    }
                }
            }
            str = arrFields[ipos++];
            if (str[0] == '.')
            {
                c.mSelfIntersect = str[1] == 'T' ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE;
            }
        }
Exemplo n.º 2
0
        internal static IfcIndexedPolyCurve Parse(string str)
        {
            IfcIndexedPolyCurve c = new IfcIndexedPolyCurve();
            int pos = 0, len = str.Length;

            c.mPoints = ParserSTEP.StripLink(str, ref pos, len);
            string field = ParserSTEP.StripField(str, ref pos, len);

            if (field != "$")
            {
                List <string> strs = ParserSTEP.SplitLineFields(field.Substring(1, field.Length - 2));
                foreach (string s in strs)
                {
                    if (s.ToUpper().StartsWith("IFCLINEINDEX"))
                    {
                        c.mSegments.Add(new IfcLineIndex(ParserSTEP.SplitListSTPIntegers(s.Substring(13, s.Length - 14))));
                    }
                    else
                    {
                        List <int> ints = ParserSTEP.SplitListSTPIntegers(s.Substring(12, s.Length - 13));
                        c.mSegments.Add(new IfcArcIndex(ints[0], ints[1], ints[2]));
                    }
                }
            }
            field = ParserSTEP.StripField(str, ref pos, len);
            if (field[0] == '.')
            {
                c.mSelfIntersect = field[1] == 'T' ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE;
            }
            return(c);
        }
Exemplo n.º 3
0
 internal IfcIndexedPolyCurve(DatabaseIfc db, IfcIndexedPolyCurve c) : base(db, c)
 {
     Points = db.Factory.Duplicate(c.Points) as IfcCartesianPointList; mSegments.AddRange(c.mSegments); mSelfIntersect = c.mSelfIntersect;
 }
Exemplo n.º 4
0
        internal static IfcBoundedCurve convCurve(DatabaseIfc db, Curve crv, IfcCartesianPoint optStrt, bool twoD, out IfcCartesianPoint end)
        {
            double tol = db.Tolerance;

            end = null;
            Curve c = crv.DuplicateCurve();

            if (c.IsLinear(tol))
            {
                if (twoD)
                {
                    end = new IfcCartesianPoint(db, new Point2d(c.PointAtEnd.X, c.PointAtEnd.Y));
                }
                else
                {
                    end = new IfcCartesianPoint(db, c.PointAtEnd);
                }
                if (optStrt == null)
                {
                    if (twoD)
                    {
                        optStrt = new IfcCartesianPoint(db, new Point2d(c.PointAtStart.X, c.PointAtStart.Y));
                    }
                    else
                    {
                        optStrt = new IfcCartesianPoint(db, c.PointAtStart);
                    }
                }
                return(new IfcPolyline(optStrt, end));
            }
            ArcCurve ac = c as ArcCurve;

            if (ac != null)
            {
                return(new IfcTrimmedCurve(db, ac.Arc, twoD, optStrt, out end));
            }
            Arc arc = Arc.Unset;

            if (c.TryGetArc(out arc, tol))
            {
                return(new IfcTrimmedCurve(db, arc, twoD, optStrt, out end));
            }

            Polyline pl = new Polyline();

            if (c.TryGetPolyline(out pl))
            {
                if (db.mRelease != ReleaseVersion.IFC2x3 && db.mRelease != ReleaseVersion.IFC4)
                {
                    if (twoD)
                    {
                        return(new IfcIndexedPolyCurve(new IfcCartesianPointList2D(db, pl.ConvertAll(x => new Point2d(x.X, x.Y)))));
                    }
                    else
                    {
                        return(new IfcIndexedPolyCurve(new IfcCartesianPointList3D(db, pl)));
                    }
                }
                List <IfcCartesianPoint> cps = new List <IfcCartesianPoint>();
                if (twoD)
                {
                    Point2d p = new Point2d(pl[0].X, pl[0].Y), n;
                    cps.Add(new IfcCartesianPoint(db, p));
                    for (int icounter = 1; icounter < pl.Count - 1; icounter++)
                    {
                        n = new Point2d(pl[icounter].X, pl[icounter].Y);
                        if (n.DistanceTo(p) > tol)
                        {
                            cps.Add(new IfcCartesianPoint(db, n));
                            p = n;
                        }
                    }
                    n = new Point2d(pl[pl.Count - 1].X, pl[pl.Count - 1].Y);
                    if (n.DistanceTo(p) > tol)
                    {
                        if (pl.IsClosed)
                        {
                            cps.Add(cps[0]);
                        }
                        else
                        {
                            cps.Add(new IfcCartesianPoint(db, n));
                        }
                    }
                }
                else
                {
                    Point3d p = pl[0], n;
                    cps.Add(new IfcCartesianPoint(db, p));
                    for (int icounter = 1; icounter < pl.Count; icounter++)
                    {
                        n = pl[icounter];
                        if (n.DistanceTo(p) > tol)
                        {
                            cps.Add(new IfcCartesianPoint(db, n));
                            p = n;
                        }
                    }
                }
                return(new IfcPolyline(cps));
            }
            PolyCurve plc = c as PolyCurve;

            if (plc != null)
            {
                if (db.mRelease != ReleaseVersion.IFC2x3 && db.mRelease != ReleaseVersion.IFC4)
                {
                    IfcIndexedPolyCurve ipc = IfcIndexedPolyCurve.Convert(db, plc, twoD);
                    if (ipc != null)
                    {
                        return(ipc);
                    }
                }
                return(new IfcCompositeCurve(db, plc, twoD));
            }
            if (db.mRelease != ReleaseVersion.IFC2x3)
            {
                NurbsCurve nc = c as NurbsCurve;
                if (nc != null)
                {
                    if (nc.IsRational)
                    {
                        return(new IfcRationalBSplineCurveWithKnots(db, nc, twoD));
                    }
                    return(new IfcBSplineCurveWithKnots(db, nc, twoD));
                }
            }

            return(null);
        }
Exemplo n.º 5
0
		internal IfcIndexedPolyCurve(IfcIndexedPolyCurve p) : base(p) { mPoints = p.mPoints; mSegments.AddRange(p.mSegments); mSelfIntersect = p.mSelfIntersect; }
Exemplo n.º 6
0
		internal static IfcIndexedPolyCurve Parse(string strDef) { IfcIndexedPolyCurve c = new IfcIndexedPolyCurve(); int ipos = 0; parseFields(c, ParserSTEP.SplitLineFields(strDef), ref ipos); return c; }
Exemplo n.º 7
0
		internal static void parseFields(IfcIndexedPolyCurve c, List<string> arrFields, ref int ipos)
		{
			IfcBoundedCurve.parseFields(c, arrFields, ref ipos);
			c.mPoints = ParserSTEP.ParseLink(arrFields[ipos++]);
			string str = arrFields[ipos++];
			if (str != "$")
			{
				List<string> strs = ParserSTEP.SplitLineFields(str.Substring(1, str.Length - 2));
				foreach (string s in strs)
				{
					if (s.ToUpper().StartsWith("IFCLINEINDEX"))
						c.mSegments.Add(new IfcLineIndex(ParserSTEP.SplitListSTPIntegers(s.Substring(13, s.Length - 14))));
					else
					{
						List<int> ints = ParserSTEP.SplitListSTPIntegers(s.Substring(12, s.Length - 13));
						c.mSegments.Add(new IfcArcIndex(ints[0], ints[1], ints[2]));
					}

				}
			}
			str = arrFields[ipos++];
			if (str[0] == '.')
				c.mSelfIntersect = str[1] == 'T' ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE;
		}
Exemplo n.º 8
0
 internal static IfcIndexedPolyCurve Parse(string strDef)
 {
     IfcIndexedPolyCurve c = new IfcIndexedPolyCurve(); int ipos = 0; parseFields(c, ParserSTEP.SplitLineFields(strDef), ref ipos); return(c);
 }
Exemplo n.º 9
0
        internal static IfcIndexedPolyCurve Parse(string str)
        {
            IfcIndexedPolyCurve c = new IfcIndexedPolyCurve();
            int pos = 0, len = str.Length;
            c.mPoints = ParserSTEP.StripLink(str, ref pos, len);
            string field = ParserSTEP.StripField(str, ref pos, len);
            if (field != "$")
            {
                List<string> strs = ParserSTEP.SplitLineFields(field.Substring(1, field.Length - 2));
                foreach (string s in strs)
                {
                    if (s.ToUpper().StartsWith("IFCLINEINDEX"))
                        c.mSegments.Add(new IfcLineIndex(ParserSTEP.SplitListSTPIntegers(s.Substring(13, s.Length - 14))));
                    else
                    {
                        List<int> ints = ParserSTEP.SplitListSTPIntegers(s.Substring(12, s.Length - 13));
                        c.mSegments.Add(new IfcArcIndex(ints[0], ints[1], ints[2]));
                    }

                }
            }
            field = ParserSTEP.StripField(str, ref pos, len);
            if (field[0] == '.')
                c.mSelfIntersect = field[1] == 'T' ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE;
            return c;
        }
Exemplo n.º 10
0
 internal IfcIndexedPolyCurve(DatabaseIfc db, IfcIndexedPolyCurve c)
     : base(db, c)
 {
     Points = db.Factory.Duplicate(c.Points) as IfcCartesianPointList; mSegments.AddRange(c.mSegments); mSelfIntersect = c.mSelfIntersect;
 }
Exemplo n.º 11
0
 internal IfcIndexedPolyCurve(IfcIndexedPolyCurve p) : base(p)
 {
     mPoints = p.mPoints; mSegments.AddRange(p.mSegments); mSelfIntersect = p.mSelfIntersect;
 }