コード例 #1
0
        /// <summary>
        /// Tests the express where-clause specified in param 'clause'
        /// </summary>
        /// <param name="clause">The express clause to test</param>
        /// <returns>true if the clause is satisfied.</returns>
        public bool ValidateClause(IfcSectionedSpineClause clause)
        {
            var retVal = false;

            try
            {
                switch (clause)
                {
                case IfcSectionedSpineClause.WR1:
                    retVal = Functions.SIZEOF(CrossSections) == Functions.SIZEOF(CrossSectionPositions);
                    break;

                case IfcSectionedSpineClause.WR2:
                    retVal = Functions.SIZEOF(CrossSections.Where(temp => CrossSections.ItemAt(0).ProfileType != temp.ProfileType)) == 0;
                    break;

                case IfcSectionedSpineClause.WR3:
                    retVal = SpineCurve.Dim == 3;
                    break;
                }
            } catch (Exception ex) {
                var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc2x3.GeometricModelResource.IfcSectionedSpine>();
                log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcSectionedSpine.{0}' for #{1}.", clause, EntityLabel), ex);
            }
            return(retVal);
        }
コード例 #2
0
        /// <summary>
        /// Adds a cross section to this branch and gives it the right position
        /// </summary>
        /// <param name="cs"></param>
        public void AddCrossection(CrossSection cs)
        {
            CrossSections.Add(cs);

            M11Point p_upstream;
            M11Point p_downstream;

            //Find upstream POINTS.

            //The cross section is at the end of the branch. Cast to int to avoid rounding problems
            if (Math.Round(_points.Last().Chainage) == Math.Round(cs.Chainage))
            {
                p_upstream = _points.Last();
            }
            else
            {
                p_upstream = _points.FirstOrDefault(var => var.Chainage > cs.Chainage);
            }

            //Downstream point is the previous point
            p_downstream = _points[_points.IndexOf(p_upstream) - 1];

            //Set the POINTS on the cross section
            cs.SetPoints(p_downstream, p_upstream);
        }
コード例 #3
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["Directrix"]             = Directrix.getJson(this, options);
     obj["CrossSectionPositions"] = new JArray(CrossSectionPositions.Select(x => x.getJson(this, options)));
     obj["CrossSections"]         = new JArray(CrossSections.Select(x => x.getJson(this, options)));
     obj["FixedAxisVertical"]     = mFixedAxisVertical;
 }
コード例 #4
0
ファイル: IfcSectionedSpine.g.cs プロジェクト: vdubya/IFC-gen
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(SpineCurve != null ? SpineCurve.ToStepValue() : "$");
            parameters.Add(CrossSections != null ? CrossSections.ToStepValue() : "$");
            parameters.Add(CrossSectionPositions != null ? CrossSectionPositions.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
コード例 #5
0
        /// <summary>
        /// Gets the bottomlevel of the branch. Interpolates linearly between points
        /// </summary>
        /// <param name="chainage"></param>
        /// <returns></returns>
        public double GetBottomLevelAtChainage(double chainage)
        {
            if (chainage <= ChainageStart)
            {
                return(CrossSections.First().BottomLevel);
            }
            if (chainage >= ChainageEnd)
            {
                return(CrossSections.Last().BottomLevel);
            }

            LinearSplineInterpolation lsp = new LinearSplineInterpolation(CrossSections.Select(xc => xc.Chainage).ToList(), CrossSections.Select(xc => xc.BottomLevel).ToList());

            return(lsp.Interpolate(chainage));
        }
コード例 #6
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JObject jobj = obj.GetValue("Directrix", StringComparison.InvariantCultureIgnoreCase) as JObject;

            if (jobj != null)
            {
                Directrix = mDatabase.ParseJObject <IfcCurve>(jobj);
            }
            CrossSectionPositions.AddRange(mDatabase.extractJArray <IfcDistanceExpression>(obj.GetValue("CrossSectionPositions", StringComparison.InvariantCultureIgnoreCase) as JArray));
            CrossSections.AddRange(mDatabase.extractJArray <IfcProfileDef>(obj.GetValue("CrossSections", StringComparison.InvariantCultureIgnoreCase) as JArray));
            JToken fixedAxisVertical = obj.GetValue("FixedAxisVertical", StringComparison.InvariantCultureIgnoreCase);

            if (fixedAxisVertical != null)
            {
                mFixedAxisVertical = fixedAxisVertical.Value <bool>();
            }
        }