Exemplo n.º 1
0
        public StateLink(IReadOnlyItem item, Dictionary <string, StateNode> nodes)
        {
            Id    = item.Id();
            Label = item.Property("label").Value;
            Name  = item.Property("name").Value
                    ?? item.Property("role").KeyedName().Value;
            if (item.Property("segments").HasValue())
            {
                Segments.AddRange(item.Property("segments").Value
                                  .Split('|')
                                  .Select(p => p.Split(','))
                                  .Select(p => new Point(int.Parse(p[0]), int.Parse(p[1]))));
            }

            if (nodes.TryGetValue(item.Property("from_state").Value ?? item.SourceItem().Id() ?? "", out var sourceNode))
            {
                Source = sourceNode;
            }
            if (nodes.TryGetValue(item.Property("to_state").Value ?? item.RelatedId().Value ?? "", out var relatedNode))
            {
                Related = relatedNode;
            }

            IsDefault  = item.Property("is_default").AsBoolean(false);
            IsOverride = item.Property("is_override").AsBoolean(false);
        }
Exemplo n.º 2
0
        public IfcGradientCurve(IfcBoundedCurve baseCurve, IEnumerable <IfcAlignmentVerticalSegment> segments, double distAlongHorizontal) : base(baseCurve.Database)
        {
            BaseCurve = baseCurve;
            IEnumerable <IfcCurveSegment> curveSegments = segments.Select(x => x.generateCurveSegment(distAlongHorizontal));

            Segments.AddRange(curveSegments);
        }
Exemplo n.º 3
0
        public void ExpandPath()
        {
            //
            // Flatten all paths by converting <dim, greater-path> pairs by sequences of dimensions <dim, dim2, dim3,...>
            //
            List <DcColumn> allSegments = GetAllSegments();

            Segments.Clear();
            if (allSegments != null && allSegments.Count != 0)
            {
                Segments.AddRange(allSegments);
            }
            else
            {
                // ERROR: Wrong use: The path does not have the corresponding dimension
            }

            //
            // Adding missing paths. Particularly, non-stored paths (paths returning values which are stored only in the greater sets but not in this set).
            //
            if (!String.IsNullOrEmpty(RelationalFkName) /*&& Output.IdentityPrimitiveArity == 1*/)
            {
                Segments[0].Name = Name; // FK-name is overwritten and lost - attribute name is used instead
            }

            //
            // Dim name adjustment: for 1-column FK dimensions, we prefer to use its only column name instead of the FK-name (fkName is not used)
            //
            if (!String.IsNullOrEmpty(RelationalFkName) /*&& Output.IdentityPrimitiveArity == 1*/)
            {
                Segments[0].Name = Name; // FK-name is overwritten and lost - attribute name is used instead
            }
        }
Exemplo n.º 4
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JToken startDistAlong = obj.GetValue("StartDistAlong", StringComparison.InvariantCultureIgnoreCase);

            Segments.AddRange(mDatabase.extractJArray <IfcAlignmentVerticalSegment>(obj.GetValue("Segments", StringComparison.InvariantCultureIgnoreCase) as JArray));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Merges a graph within this one
        /// </summary>
        /// <param name="subGraph"></param>
        public void Merge(Graph subGraph)
        {
            List <Segment> toProcess = new List <Segment>(subGraph.Segments);
            List <Segment> toAdd     = new List <Segment>();

            while (toProcess.Count > 0)
            {
                Segment segment = toProcess[0];
                toProcess.Remove(segment);

                // Reduce this segment according to the existing segments
                foreach (Segment existingSegment in Segments)
                {
                    if (existingSegment.Start <= segment.Start)
                    {
                        if (existingSegment.End < segment.End)
                        {
                            // The existing segment reduces the start of this segment
                            segment.Start = Math.Max(segment.Start, existingSegment.End);
                        }
                        else
                        {
                            // This segment is completely overriden by the existing segment;
                            segment = null;
                            break;
                        }
                    }
                    else
                    {
                        // existingSegment.Start >= segment.Start
                        if (existingSegment.Start < segment.End)
                        {
                            if (existingSegment.End < segment.End)
                            {
                                // This segment splits the current segment in two.
                                Segment newSegment = new Segment(existingSegment.End, segment.End, segment.Expression);
                                toProcess.Insert(0, newSegment);
                            }
                            segment.End = existingSegment.Start;
                        }
                        else
                        {
                            // the existing segment does not impact this segment
                        }
                    }
                }

                if (segment != null)
                {
                    if (segment.Start < segment.End)
                    {
                        toAdd.Add(segment);
                    }
                }
            }

            Segments.AddRange(toAdd);
            Segments.Sort();
        }
Exemplo n.º 6
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JToken token = obj.GetValue("StartDistAlong", StringComparison.InvariantCultureIgnoreCase);

            if (token != null)
            {
                StartDistAlong = token.Value <double>();
            }
            Segments.AddRange(mDatabase.extractJArray <IfcAlignment2DHorizontalSegment>(obj.GetValue("Segments", StringComparison.InvariantCultureIgnoreCase) as JArray));
        }
Exemplo n.º 7
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            Segments.AddRange(mDatabase.extractJArray <IfcAlignment2DCantSegment>(obj.GetValue("Segments", StringComparison.InvariantCultureIgnoreCase) as JArray));
            JToken railHeadDistance = obj.GetValue("RailHeadDistance", StringComparison.InvariantCultureIgnoreCase);

            if (railHeadDistance != null)
            {
                mRailHeadDistance = railHeadDistance.Value <double>();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="start">The path's startpoint</param>
        /// <param name="segments">A collection of segments</param>
        public PathFigure(Point start, IEnumerable <PathSegment> segments, bool closed)
        {
            if (segments == null)
            {
                throw new ArgumentNullException(nameof(segments));
            }

            StartPoint = start;
            Segments.AddRange(segments);
            IsClosed = closed;
        }
Exemplo n.º 9
0
        private void onPreferencesChanged(IDatabasePreferences preferences)
        {
            DurationFormat = preferences.DurationFormat;
            dateFormat     = preferences.DateFormat;

            var segments = Segments.Select(segment => segment.WithDurationFormat(DurationFormat));

            Segments.Clear();
            Segments.AddRange(segments);

            updateCurrentDateRangeString();
        }
Exemplo n.º 10
0
        public ColumnPath(List <DcColumn> segs)
            : this()
        {
            if (segs == null || segs.Count == 0)
            {
                return;
            }

            Segments.AddRange(segs);
            Input  = Segments[0].Input;
            Output = Segments[Segments.Count - 1].Output;
        }
Exemplo n.º 11
0
        private void onReport(ProjectSummaryReport report)
        {
            TotalTime          = TimeSpan.FromSeconds(report.TotalSeconds);
            BillablePercentage = report.TotalSeconds == 0 ? null : (float?)report.BillablePercentage;

            var segments = report.Segments.Select(segment => segment.WithDurationFormat(DurationFormat));

            Segments.AddRange(segments);
            IsLoading = false;

            RaisePropertyChanged(nameof(Segments));
        }
Exemplo n.º 12
0
 internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary)
 {
     if (release != ReleaseVersion.IFC4X3_RC2)
     {
         base.parse(str, ref pos, release, len, dictionary);
     }
     BaseCurve = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcBoundedCurve;
     if (release == ReleaseVersion.IFC4X3_RC2)
     {
         Segments.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcCurveSegment));
     }
     EndPoint = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcPlacement;
 }
Exemplo n.º 13
0
        public JasperRoute(ISegment[] segments, string httpVerb)
        {
            Segments.AddRange(segments);

            validateSegments();

            HttpMethod = httpVerb;


            Name = $"{HttpMethod}:{Pattern}";

            setupArgumentsAndSpread();
        }
Exemplo n.º 14
0
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JObject jobj = obj.GetValue("BaseCurve", StringComparison.InvariantCultureIgnoreCase) as JObject;

            if (jobj != null)
            {
                BaseCurve = mDatabase.ParseJObject <IfcBoundedCurve>(jobj);
            }
            Segments.AddRange(mDatabase.extractJArray <IfcCurveSegment>(obj.GetValue("Segments", StringComparison.InvariantCultureIgnoreCase) as JArray));
            jobj = obj.GetValue("EndPoint", StringComparison.InvariantCultureIgnoreCase) as JObject;
            if (jobj != null)
            {
                EndPoint = mDatabase.ParseJObject <IfcCartesianPoint>(jobj);
            }
        }
Exemplo n.º 15
0
        public bool AddSegments(IEnumerable <RaceSegment> segmentsToAdd)
        {
            var last                 = Segments.LastOrDefault();
            var lastNo               = last != null ? last.No : 0;
            var lastSpeed            = last != null ? last.Speed : 0;
            var numberedSegmentsList = new List <RaceSegment>();

            lock (_syncObject)
            {
                foreach (var s in segmentsToAdd)
                {
                    s.No = lastNo + 1;
                    if (Math.Abs(s.Speed) < 0.0001)
                    {
                        s.Speed = lastSpeed;
                    }
                    lastNo = s.No;
                    numberedSegmentsList.Add(s);
                }
                Segments.AddRange(numberedSegmentsList);
            }
            return(true);
        }
Exemplo n.º 16
0
 internal IfcGradientCurve(DatabaseIfc db, IfcGradientCurve c, DuplicateOptions options) : base(db, c, options)
 {
     mBaseCurve = db.Factory.Duplicate(c.mBaseCurve) as IfcBoundedCurve;
     Segments.AddRange(c.Segments.ConvertAll(x => db.Factory.Duplicate(x) as IfcCurveSegment));
     mEndPoint = db.Factory.Duplicate(c.mEndPoint) as IfcCartesianPoint;
 }
Exemplo n.º 17
0
 public IfcGradientCurve(IfcBoundedCurve baseCurve, IEnumerable <IfcCurveSegment> segments) : base(baseCurve.Database)
 {
     BaseCurve = baseCurve;
     Segments.AddRange(segments);
 }
Exemplo n.º 18
0
 internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary)
 {
     Segments.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcAlignment2DCantSegment));
     RailHeadDistance = ParserSTEP.StripDouble(str, ref pos, len);
 }
Exemplo n.º 19
0
 internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary)
 {
     BaseCurve = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcBoundedCurve;
     Segments.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcCurveSegment));
     EndPoint = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcCartesianPoint;
 }