public void TranslateRefConnections(Vector _offset) { // REFERENCES foreach (Polyline ncpl_in in this.node_references_out) { // rebuild the polyline Point startP_old = ncpl_in.Points[0]; Point startP_new = new Point(startP_old.X + _offset.X, startP_old.Y + _offset.Y); Point endP_new = ncpl_in.Points[ncpl_in.Points.Count - 1]; ncpl_in.Points = NodeVisualization.Create2StepPointCollection(startP_new, endP_new, this.Height, this.Height, new Vector(1, -1)); } foreach (Polyline ncpl_in in this.node_references_in) { // rebuild the polyline Point startP_new = ncpl_in.Points[0]; Point endP_old = ncpl_in.Points[ncpl_in.Points.Count - 1]; Point endP_new = new Point(endP_old.X + _offset.X, endP_old.Y + _offset.Y); ncpl_in.Points = NodeVisualization.Create2StepPointCollection(startP_new, endP_new, this.Height, this.Height, new Vector(1, -1)); } // CONENCTIONS Calculation -> Parameter foreach (Polyline pl in this.node_param_calc_in) { // rebuild the polyline SolidColorBrush scb = pl.Stroke as SolidColorBrush; int arrow_dir = 0; if (scb != null) { arrow_dir = (scb.Color == NodeVisualization.NODE_COLOR_CALC_IN) ? 1 : -1; } pl.Points = NodeVisualization.Adapt2StepPointCollectionWArrow(pl.Points, _offset, false, arrow_dir); } foreach (Polyline pl in this.node_param_calc_out) { // rebuild the polyline SolidColorBrush scb = pl.Stroke as SolidColorBrush; int arrow_dir = 0; if (scb != null) { arrow_dir = (scb.Color == NodeVisualization.NODE_COLOR_CALC_IN) ? 1 : -1; } pl.Points = NodeVisualization.Adapt2StepPointCollectionWArrow(pl.Points, _offset, true, arrow_dir); } // recursion foreach (NodeVisualization nvis in this.node_children) { nvis.TranslateRefConnections(_offset); } }
protected Polyline Create2StepReferencePolyline(Point _startP, Point _endP, double _node_start_H, double _node_end_H, bool _direct = true) { if (this.parent_canvas == null) { return(null); } Polyline pline = new Polyline(); pline.Stroke = (_direct) ? new SolidColorBrush(NodeVisualization.NODE_COLOR_YES) : new SolidColorBrush(NodeVisualization.NODE_COLOR_MAYBE); pline.StrokeThickness = 2; pline.FillRule = FillRule.EvenOdd; PointCollection pointCollection = NodeVisualization.Create2StepPointCollection(_startP, _endP, _node_start_H, _node_end_H, new Vector(1, -1)); pline.Points = pointCollection; this.parent_canvas.Children.Add(pline); return(pline); }