示例#1
0
        private void CreateOutgoingDTOffStratumCues(StateClassShape shape, DTAnalyzer analyzer)
        {
            //If there is no destination state class then it is a transition-to-self

            if (!shape.StateClassIdDest.HasValue)
            {
                return;
            }

            int?StratumIdActual = null;

            analyzer.ResolveStateClassStratum(shape.StratumIdSource, shape.StratumIdDest, shape.StateClassIdDest.Value, ref StratumIdActual);

            //If the class was found in the current stratum then it is not an off-stratum transition

            if (NullableUtilities.NullableIdsEqual(StratumIdActual, this.m_StratumId))
            {
                return;
            }

            //If the class was found in the wild card stratum then it is not an off-stratum transition

            if (!StratumIdActual.HasValue)
            {
                return;
            }

            this.AddLine(CreateOutgoingDTOffStratumCue(shape));
        }
示例#2
0
        private void CreateOutgoingDTLines(StateClassShape fromShape, DTAnalyzer analyzer)
        {
            //If there is no destination state class then it is a transition-to-self

            if (!fromShape.StateClassIdDest.HasValue)
            {
                return;
            }

            StateClassShape ToShape         = null;
            int?            StratumIdActual = null;

            analyzer.ResolveStateClassStratum(fromShape.StratumIdSource, fromShape.StratumIdDest, fromShape.StateClassIdDest.Value, ref StratumIdActual);

            if (NullableUtilities.NullableIdsEqual(StratumIdActual, this.m_StratumId))
            {
                //If the class was found in the current stratum then it will be in the
                //explicit lookups if the current stratum is explicit and the wildcard
                //lookups if it is not.

                if (this.m_StratumId.HasValue)
                {
                    ToShape = this.m_ExplicitClasses[fromShape.StateClassIdDest.Value];
                }
                else
                {
                    ToShape = this.m_WildcardClasses[fromShape.StateClassIdDest.Value];
                }
            }
            else
            {
                //If the class was not found in the current stratum it will be in the
                //wild card lookups if its stratum is wild.

                if (this.m_StratumId.HasValue && (!StratumIdActual.HasValue))
                {
                    ToShape = this.m_WildcardClasses[fromShape.StateClassIdDest.Value];
                }
            }

            //If the class was not found or it is a transition-to-self then it is an
            //off stratum transition.  Otherwise, add an outgoing line.

            if ((ToShape != null) && (ToShape != fromShape))
            {
                DeterministicTransitionLine Line = new DeterministicTransitionLine(Constants.DETERMINISTIC_TRANSITION_LINE_COLOR);

                this.FillLineSegments(fromShape, ToShape, Line, BoxArrowDiagramConnectorMode.Horizontal);
                this.AddLine(Line);

                fromShape.OutgoingDTLines.Add(Line);
                ToShape.IncomingDTLines.Add(Line);
            }
        }
示例#3
0
        private void PastePTOutgoing(TransitionDiagramClipDataEntry entry, List <ProbabilisticTransitionClipData> alreadyPasted, DTAnalyzer analyzer)
        {
            foreach (ProbabilisticTransitionClipData t in entry.OutgoingPT)
            {
                if (AlreadyPastedPT(t, alreadyPasted))
                {
                    continue;
                }

                int?StratumIdDest = null;

                if (t.StateClassIdDest.HasValue)
                {
                    analyzer.ResolveStateClassStratum(t.StratumIdSource, t.StratumIdDest, t.StateClassIdDest.Value, ref StratumIdDest);
                }

                this.CreatePTRecord(this.m_StratumId, entry.ShapeData.StateClassIdSource, StratumIdDest, t.StateClassIdDest, t.TransitionTypeId, t.Probability, t.Proportion, t.AgeMin, t.AgeMax, t.AgeRelative, t.AgeReset, t.TstMin, t.TstMax, t.TstRelative);

                alreadyPasted.Add(t);
            }
        }
示例#4
0
        private void PasteStateClassesCreateNew(TransitionDiagramClipData cd, TransitionDiagramClipDataEntry entry, int dx, int dy, bool pasteNone, DTAnalyzer analyzer)
        {
            int TargetRow    = entry.Row + dy;
            int TargetColumn = entry.Column + dx;

            //If 'PasteNone" or there is no destination state class then
            //create a transition-to-self in this stratum.

            if (pasteNone || (!entry.ShapeData.StateClassIdDest.HasValue))
            {
                this.CreateDTRecord(entry.ShapeData.StateClassIdSource, null, null, entry.ShapeData.AgeMin, entry.ShapeData.AgeMax, TargetRow, TargetColumn);

                return;
            }

            //If the destination state class is in the clipboard then create a transition
            //to that state class in this stratum.

            if (ClipContainsStateClass(cd, entry.ShapeData.StateClassIdDest.Value))
            {
                this.CreateDTRecord(entry.ShapeData.StateClassIdSource, null, entry.ShapeData.StateClassIdDest.Value, entry.ShapeData.AgeMin, entry.ShapeData.AgeMax, TargetRow, TargetColumn);

                return;
            }

            //Resolve the destination stratum and create a transition to that stratum.  Note that the resolution
            //will fail if the destination state class no longer exists and is not in the wild card stratum.  In
            //this case, create a transition-to-self.

            int?StratumIdActual = null;

            if (analyzer.ResolveStateClassStratum(entry.ShapeData.StratumIdSource, entry.ShapeData.StratumIdDest, entry.ShapeData.StateClassIdDest.Value, ref StratumIdActual))
            {
                this.CreateDTRecord(entry.ShapeData.StateClassIdSource, StratumIdActual, entry.ShapeData.StateClassIdDest.Value, entry.ShapeData.AgeMin, entry.ShapeData.AgeMax, TargetRow, TargetColumn);
            }
            else
            {
                this.CreateDTRecord(entry.ShapeData.StateClassIdSource, null, null, entry.ShapeData.AgeMin, entry.ShapeData.AgeMax, TargetRow, TargetColumn);
            }
        }
示例#5
0
        private void CreateOutgoingPTOffStratumCues(StateClassShape shape, DTAnalyzer analyzer)
        {
            foreach (Transition t in shape.OutgoingPT)
            {
                //If it is a transition-to-self then it is not an off-stratum transition

                if (!t.StateClassIdDestination.HasValue)
                {
                    continue;
                }

                int?StratumIdActual = null;

                analyzer.ResolveStateClassStratum(
                    t.StratumIdSource,
                    t.StratumIdDestination,
                    t.StateClassIdDestination.Value,
                    ref StratumIdActual);

                //If the class was found in the current stratum then it is not an off-stratum transition

                if (NullableUtilities.NullableIdsEqual(StratumIdActual, this.m_StratumId))
                {
                    continue;
                }

                //If the class was found in the wild card stratum then it is not an off-stratum transition

                if (!StratumIdActual.HasValue)
                {
                    continue;
                }

                this.AddLine(this.CreateOutgoingPTOffStratumCue(shape, t));
            }
        }
示例#6
0
        private void CreateOutgoingPTLines(StateClassShape fromShape, DTAnalyzer analyzer)
        {
            foreach (Transition t in fromShape.OutgoingPT)
            {
                StateClassShape ToShape = null;

                //If there is no destination state class then it is a transition-to-self

                if (!t.StateClassIdDestination.HasValue)
                {
                    ToShape = fromShape;
                }
                else
                {
                    int?StratumIdActual = null;

                    analyzer.ResolveStateClassStratum(
                        t.StratumIdSource,
                        t.StratumIdDestination,
                        t.StateClassIdDestination.Value,
                        ref StratumIdActual);

                    if (NullableUtilities.NullableIdsEqual(StratumIdActual, this.m_StratumId))
                    {
                        //If the class was found in the current stratum then it will be in the
                        //explicit lookups if the current stratum is explicit and the wildcard
                        //lookups if it is not.

                        if (this.m_StratumId.HasValue)
                        {
                            ToShape = this.m_ExplicitClasses[t.StateClassIdDestination.Value];
                        }
                        else
                        {
                            ToShape = this.m_WildcardClasses[t.StateClassIdDestination.Value];
                        }
                    }
                    else
                    {
                        //If the class was not found in the current stratum it will be in the
                        //wild card lookups if its stratum is wild.

                        if (this.m_StratumId.HasValue && (!StratumIdActual.HasValue))
                        {
                            ToShape = this.m_WildcardClasses[t.StateClassIdDestination.Value];
                        }
                    }
                }

                //If a shape was not found then it is an off-stratum transition.
                //Otherwise, create the approprate line and add it to the diagram.

                if (ToShape != null)
                {
                    ProbabilisticTransitionLine Line = null;

                    if (fromShape == ToShape)
                    {
                        Line = CreatePTLineToSelf(fromShape, t.TransitionTypeId);
                    }
                    else
                    {
                        Line = new ProbabilisticTransitionLine(t.TransitionTypeId, Constants.PROBABILISTIC_TRANSITION_LINE_COLOR);
                        this.FillLineSegments(fromShape, ToShape, Line, BoxArrowDiagramConnectorMode.Vertical);
                    }

                    this.FillPTLineTransitionGroups(Line);
                    this.AddLine(Line);

                    fromShape.OutgoingPTLines.Add(Line);
                    ToShape.IncomingPTLines.Add(Line);
                }
            }
        }