private void FillPTLineTransitionGroups(ProbabilisticTransitionLine line) { Debug.Assert(line.TransitionGroups.Count == 0); string filter = string.Format(CultureInfo.InvariantCulture, "TransitionTypeID={0}", line.TransitionTypeId); DataRow[] trrows = this.m_TTGDataSheet.GetData().Select(filter); foreach (DataRow dr in trrows) { int TransitionGroupId = Convert.ToInt32(dr["TransitionGroupID"], CultureInfo.InvariantCulture); line.TransitionGroups.Add(TransitionGroupId); } }
private static ProbabilisticTransitionLine CreatePTLineToSelf(StateClassShape shape, int transitionTypeId) { ProbabilisticTransitionLine Line = new ProbabilisticTransitionLine( transitionTypeId, Constants.PROBABILISTIC_TRANSITION_LINE_COLOR); const int PT_CIRCLE_RADIUS = 10; int lrx = shape.Bounds.X + shape.Bounds.Width - PT_CIRCLE_RADIUS; int lry = shape.Bounds.Y + shape.Bounds.Height - PT_CIRCLE_RADIUS; Rectangle rc = new Rectangle(lrx, lry, 2 * PT_CIRCLE_RADIUS, 2 * PT_CIRCLE_RADIUS); Line.AddEllipse(rc); return(Line); }
private ProbabilisticTransitionLine CreateIncomingPTOffStratumCue(StateClassShape shape, Transition t) { int X1 = shape.Bounds.X - Constants.TRANSITION_DIAGRAM_OFF_STRATUM_CUE_SIZE; int Y1 = shape.Bounds.Y - Constants.TRANSITION_DIAGRAM_OFF_STRATUM_CUE_SIZE; int X2 = shape.Bounds.X; int Y2 = shape.Bounds.Y; ProbabilisticTransitionLine Line = new ProbabilisticTransitionLine( t.TransitionTypeId, Constants.PROBABILISTIC_TRANSITION_LINE_COLOR); this.FillPTLineTransitionGroups(Line); Line.AddLineSegment(X1, Y1, X2, Y2); Line.AddArrowSegments(X2, Y2, BoxArrowDiagramArrowDirection.Southeast); return(Line); }
private void InternalFilterTransitions(TransitionFilterCriteria criteria) { bool dtflt = (!criteria.IncludeDeterministic); bool ptflt = (!criteria.IncludeProbabilistic); bool tgflt = IsTransitionGroupFilterApplied(criteria); this.m_IsFilterApplied = (dtflt || ptflt || tgflt); foreach (TransitionDiagramLine Line in this.Lines) { if ((Line) is DeterministicTransitionLine) { Line.IsVisible = criteria.IncludeDeterministic; } else { Line.IsVisible = criteria.IncludeProbabilistic; //If no filtering has been done then make the line visible. But if any filters have been //applied then only make the line visible if one of its transition groups is not filtered out. if (criteria.IncludeProbabilistic && tgflt) { ProbabilisticTransitionLine ptline = (ProbabilisticTransitionLine)Line; if (ptline.TransitionGroups.Count > 0) { ptline.IsVisible = false; foreach (int tg in ptline.TransitionGroups) { if (criteria.TransitionGroups[tg]) { ptline.IsVisible = true; break; } } } } } } this.Invalidate(); }
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); } } }