private static FlowPathwayLine CreatePathwayLineToSelf(StockTypeShape shape, FlowPathway pathway) { FlowPathwayLine l = new FlowPathwayLine(Constants.DIAGRAM_FLOW_PATHWAY_LINE_COLOR, pathway); 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); l.AddEllipse(rc); return(l); }
private static FlowPathwayLine CreateNullFromStockTypeCue(StockTypeShape shape, FlowPathway fp) { int X1 = shape.Bounds.X - Constants.FLOW_PATHWAY_NULL_STOCK_TYPE_CUE_SIZE; int Y1 = shape.Bounds.Y - Constants.FLOW_PATHWAY_NULL_STOCK_TYPE_CUE_SIZE; int X2 = shape.Bounds.X; int Y2 = shape.Bounds.Y; FlowPathwayLine Line = new FlowPathwayLine(Constants.DIAGRAM_FLOW_PATHWAY_LINE_COLOR, fp); Line.AddLineSegment(X1, Y1, X2, Y2); Line.AddArrowSegments(X2, Y2, BoxArrowDiagramArrowDirection.Southeast); return(Line); }
private void RefreshFlowPathwayLines() { this.ClearLines(); if (this.Shapes.Count() == 0) { return; } foreach (StockTypeShape Shape in this.Shapes) { Shape.ResetConnectorPoints(); } Dictionary <string, FlowPathwayLine> AlreadyAdded = new Dictionary <string, FlowPathwayLine>(); foreach (StockTypeShape FromShape in this.Shapes) { foreach (FlowPathway Pathway in FromShape.OutgoingFlowPathways) { FlowPathwayLine l = null; if (!Pathway.ToStockTypeId.HasValue) { continue; } StockTypeShape ToShape = this.m_ShapeLookup[Pathway.ToStockTypeId.Value]; string Lookup = string.Format(CultureInfo.InvariantCulture, "k1{0}-k2{1}", FromShape.StockTypeId, Pathway.ToStockTypeId); if (AlreadyAdded.ContainsKey(Lookup)) { FlowPathwayLine ExistingLine = AlreadyAdded[Lookup]; l = new FlowPathwayLine(Constants.DIAGRAM_FLOW_PATHWAY_LINE_COLOR, Pathway); l.RenderPath = ExistingLine.CloneRenderPath(); } else { if (FromShape == ToShape) { l = CreatePathwayLineToSelf(FromShape, Pathway); } else { l = new FlowPathwayLine(Constants.DIAGRAM_FLOW_PATHWAY_LINE_COLOR, Pathway); this.FillLineSegments(FromShape, ToShape, l, BoxArrowDiagramConnectorMode.Vertical); } AlreadyAdded.Add(Lookup, l); } this.AddLine(l); } foreach (FlowPathway Pathway in FromShape.OutgoingFlowPathways) { if (!Pathway.ToStockTypeId.HasValue) { this.AddLine(CreateNullToStockTypeCue(FromShape, Pathway)); break; } } foreach (FlowPathway Pathway in FromShape.IncomingFlowPathways) { if (!Pathway.FromStockTypeId.HasValue) { this.AddLine(CreateNullFromStockTypeCue(FromShape, Pathway)); break; } } } }