void addTeam_Click(object sender, EventArgs e) { var parentTeam = this.FindAncestor <OrgContainerShape>(); var newTeam = new OrgContainerShape(_context) { Name = "New " + parentTeam.Tag.ToString() + " Team", BaseColor = parentTeam.BaseColor, }; parentTeam.ShowCollapseButton = true; newTeam.ToggleCollapseButton.ImagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Hidden; newTeam.Text = newTeam.Name; newTeam.Tag = parentTeam.Tag.ToString(); newTeam.Path = string.Format("{0}|{1}", parentTeam.Path, newTeam.Name); newTeam.TeamMembers = string.Format("0 Team Members"); newTeam.ShowCollapseButton = false; OrganizationShemaForm.currentLayoutSettings.Roots.Add(newTeam); var diagramElement = this.FindAncestor <RadDiagramElement>(); diagramElement.AddShape(newTeam); RadDiagramConnection connection = new RadDiagramConnection(); connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline; connection.Source = parentTeam; connection.Target = newTeam; connection.Route = true; diagramElement.AddConnection(connection); diagramElement.SetLayout(Telerik.Windows.Diagrams.Core.LayoutType.Tree, OrganizationShemaForm.currentLayoutSettings); }
private static void ExportConnection(RadDiagramConnection connection, Rect enclosingBounds, RadFixedPage page) { var bounds = new Rect(connection.Bounds.X - enclosingBounds.X, connection.Bounds.Y - enclosingBounds.Y, connection.Bounds.Width, connection.Bounds.Height); var pathGeometry = connection.Geometry as PathGeometry; var pathBounds = connection.ConnectionType == ConnectionType.Bezier ? pathGeometry.Bounds : new Rect(); var transformGroup = new TransformGroup(); transformGroup.Children.Add(new TranslateTransform() { X = bounds.X - pathBounds.X, Y = bounds.Y - pathBounds.Y }); var position = new MatrixPosition(transformGroup.Value); EditorInfo info = new EditorInfo(page, position, connection, bounds, connection.Stroke, 0); FixedContentEditor editor = CreateEditor(info, false); FixedContentEditor filledEditor = CreateEditor(info, true); ExportGeometry(editor, filledEditor, pathGeometry, true); if (connection.Content != null) { var center = bounds.Center(); ExportContent(connection, bounds, 0, page, (s) => { return(new Point(bounds.Center().X - s.Width / 2, center.Y - s.Height / 2)); }); } }
/// <summary> /// 이동하게 되는 노드의 정보를 임시 저장후 삭제한다. /// </summary> /// <param name="index"></param> public void tempMove_NaviPosition(int index) { //포지션을 이동했을 때 포지션을 새로 저장한다. var searchShape = Navidiagram.Items.OfType <NaviShape>().Where(x => x.Index == index).ToList(); if (searchShape.Count == 1) { var srcCon = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Target == searchShape[0]).ToList(); if (srcCon.Count == 1) { src = srcCon[0]; } else { src = null; } var dstCon = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Source == searchShape[0]).ToList(); if (dstCon.Count == 1) { dst = dstCon[0]; } else { dst = null; } pointtype = searchShape[0].PointType; create_newIndex = searchShape[0].Index; create_newPositionX = searchShape[0].Position.X; create_newPositionY = searchShape[0].Position.Y; Navidiagram.RemoveShape(searchShape[0]); } }
private void AddConnectionsClick(object sender, RoutedEventArgs e) { var connection = this.diagram.AddConnection(this.diagram.Shapes[0], this.diagram.Shapes[1], "match1shapeConnector1", "match2shapeConnector3"); (connection as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 255, 116, 2) }; var connection2 = this.diagram.AddConnection(this.diagram.Shapes[1], this.diagram.Shapes[2], "match2shapeConnector1", "match3shapeConnector4"); (connection2 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 255, 116, 2) }; var connection3 = this.diagram.AddConnection(this.diagram.Shapes[0], this.diagram.Shapes[4], "match1shapeConnector2", "match5shapeConnector3"); (connection3 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 242, 8, 8) }; var connection4 = this.diagram.AddConnection(this.diagram.Shapes[4], this.diagram.Shapes[5], "match5shapeConnector1", "match6shapeConnector3"); (connection4 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 242, 8, 8) }; var connection5 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 30, 30, 27) } }; connection5.Attach(this.diagram.Shapes[3].Connectors[5], this.diagram.Shapes[1].Connectors[8]); this.diagram.Items.Add(connection5); var connection6 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 30, 30, 27) } }; connection6.Attach(this.diagram.Shapes[1].Connectors[6], this.diagram.Shapes[5].Connectors[8]); this.diagram.Items.Add(connection6); var connection7 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 23, 156, 72) } }; connection7.Attach(this.diagram.Shapes[3].Connectors[6], this.diagram.Shapes[4].Connectors[8]); this.diagram.Items.Add(connection7); var connection8 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 23, 156, 72) } }; connection8.Attach(this.diagram.Shapes[4].Connectors[6], this.diagram.Shapes[2].Connectors[7]); this.diagram.Items.Add(connection8); SetConnectorsCenterPoints(); (sender as RadButton).Visibility = Visibility.Collapsed; }
private void Button_Click_1(object sender, RoutedEventArgs e) { this.SetLayoutRoots(); RadDiagramShape dummy = new RadDiagramShape(); this.diagram.Items.Add(dummy); List <IConnection> dummyConnections = new List <IConnection>(); foreach (var item in this.settings.Roots) { RadDiagramConnection connection = new RadDiagramConnection(); connection.Source = dummy; connection.Target = item; this.diagram.Items.Add(connection); dummyConnections.Add(connection); } settings.Roots.Clear(); settings.Roots.Add(dummy); this.diagram.Layout(LayoutType.Tree, settings); dummyConnections.ForEach(x => this.diagram.Items.Remove(x)); this.diagram.Items.Remove(dummy); this.diagram.AutoFit(); }
private void addNodes(SyntaxNode node, RadDiagramShape parentShape) { if (node.Child == null) { return; } foreach (var syntaxNode in node.Child) { string content = ""; if (syntaxNode is TerminalNode tn) { content = tn.Lex.StringValue; } else { content = syntaxNode.GetType().Name; } var shape = new RadDiagramShape() { Content = content }; shape.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape); var connection = new RadDiagramConnection() { Source = parentShape, Target = shape, SourceConnectorPosition = ConnectorPosition.Bottom, TargetConnectorPosition = ConnectorPosition.Left }; Diagram.Items.Add(shape); Diagram.Items.Add(connection); addNodes(syntaxNode, shape); } }
private void SetConnectorsCenterPoints() { RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[0] as DependencyObject, new Point(0.5, 0.25)); RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[1] as DependencyObject, new Point(0.5, 0.25)); RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[2] as DependencyObject, new Point(0.5, 0.25)); RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[3] as DependencyObject, new Point(0.5, 0.25)); RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[4] as DependencyObject, new Point(0.5, 0.25)); RadDiagramConnection.SetConnectorCenterPoint(this.diagram.Shapes[5] as DependencyObject, new Point(0.5, 0.25)); }
private void InitializeGraph() { var stateToShape = new Dictionary <AnalyzerState, RadDiagramShape>(); foreach (var state in slr1Table.States.Values) { var shape = new RadDiagramShape() { Content = String.Join("\n", from item in state.ItemSet select item.ToString()) }; shape.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape); ItemSetGraph.Items.Add(shape); stateToShape.Add(state, shape); } foreach (var state in slr1Table.States.Values) { foreach (var kv in state.Action) { if (kv.Value is ShiftOperation so) { var connection = new RadDiagramConnection() { Source = stateToShape[state], Target = stateToShape[so.NextState], Content = new TextBlock() { Text = kv.Key.Name } }; ItemSetGraph.Items.Add(connection); } } foreach (var kv in state.GotoTable) { var connection = new RadDiagramConnection() { Source = stateToShape[state], Target = stateToShape[kv.Value], Content = new TextBlock() { Text = kv.Key.ToString() } }; ItemSetGraph.Items.Add(connection); } } ItemSetGraph.AutoLayout = true; ItemSetGraph.Layout(LayoutType.Sugiyama, new SugiyamaSettings() { HorizontalDistance = 10, VerticalDistance = 10, Orientation = Telerik.Windows.Diagrams.Core.Orientation.Horizontal, }); }
void DiagramItemsChanged(object sender, DiagramItemsChangedEventArgs e) { if (e.NewItems.Count() > 0) { var connection = e.NewItems.ToList()[0] as RadDiagramConnection; if (connection != null) { lastAddedConnection = connection; } } this.diagram.ItemsChanged -= this.DiagramItemsChanged; }
private void Connect(GraphShape _source, GraphShape _target) { RadDiagramConnection _connection = new RadDiagramConnection(); _connection.AllowDelete = false; _connection.AllowCut = false; _connection.AllowCopy = false; _connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Bezier; _connection.Source = _source; _connection.Target = _target; AddConnection(_connection); }
// Suppresses the connection update from invoking too many times. Ensures the connectors and unvokes the Layout operation. private void LayoutOrgChart(bool shouldAutoFit) { // suspend auto update for all connections: this.diagram.Connections.ForEach(x => RadDiagramConnection.SetIsAutoUpdateSuppressed((RadDiagramConnection)x, true)); this.EnsureConnectors(); this.treeLayout.Layout(this.diagram, this.viewModel.ChildTreeLayoutViewModel.CurrentLayoutSettings); // unsuspend auto update for all connections & update: this.diagram.Connections.ForEach(x => RadDiagramConnection.SetIsAutoUpdateSuppressed((RadDiagramConnection)x, false)); this.diagram.Connections.ForEach(x => x.Update()); if (shouldAutoFit) { this.diagram.AutoFit(new Thickness(10), false); } }
private double AddShape(Point nextPoint, PeFundHirarchy nextLevel, RadDiagramShape sourceShape) { double newX = 0; Point startingPoint = nextPoint; RadDiagramShape topLevel = new RadDiagramShape() { Position = startingPoint, Width = width, Height = height, Content = nextLevel.Fund.FundName }; topLevel.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape); if (nextLevel.Fund.Id == fund.Id) { topLevel.Foreground = selectedFundForegroundColor; topLevel.Background = selectedFundColor; } diagram.Items.Add(topLevel); if (sourceShape != null) { // create connection between shape 'Toplevel' and 'SourceShape' RadDiagramConnection connection = new RadDiagramConnection(); connection.Source = sourceShape; connection.Target = topLevel; connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline; connection.SourceCapType = Telerik.Windows.Diagrams.Core.CapType.Arrow1; connection.TargetCapType = Telerik.Windows.Diagrams.Core.CapType.None; //connection.Content = $"{nextLevel.Fund.FundName} investiert in {sourceShape.Content.ToString()}"; diagram.AddConnection(connection); } startingPoint.Y += displacementY; foreach (PeFundHirarchy level in nextLevel.Feeder) { newX = AddShape(startingPoint, level, topLevel); startingPoint.X += displacementX; } return(startingPoint.X); }
private OrgContainerShape CreateNode(XElement element, OrgContainerShape parentNode) { OrgContainerShape orgTeam = new OrgContainerShape() { Name = Nom = element.Attribute("Depto").Value, }; orgTeam.ToggleCollapseButton.ImagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Hidden; orgTeam.Text = orgTeam.Name; orgTeam.Tag = Nombre = element.Attribute("Name").Value; orgTeam.Path = parentNode == null ? orgTeam.Name : string.Format("{0}|{1}", parentNode.Path, orgTeam.Name); currentLayoutSettings.Roots.Add(orgTeam); if (parentNode != null) { RadDiagramConnection connection = new RadDiagramConnection(); connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline; connection.Source = parentNode; connection.Target = orgTeam; this.radDiagram1.AddConnection(connection); } var teamMembers = this.GetTeamMembers(element, orgTeam); var position = new Telerik.Windows.Diagrams.Core.Point(10, 50); int memberCount = 0; foreach (var member in teamMembers) { this.radDiagram1.AddShape(member); orgTeam.Items.Add(member); member.Position = position; position.X += member.Width + 20; if (++memberCount % 2 == 0) { position = new Telerik.Windows.Diagrams.Core.Point(10, position.Y + member.Height + 10); } } orgTeam.IsCollapsedChanged += this.orgTeam_IsCollapsedChanged; return(orgTeam); }
private static void ExportConnection(RadDiagramConnection connection, Rect enclosingBounds, RadFixedPage page) { var bounds = new Rect(connection.Bounds.X - enclosingBounds.X, connection.Bounds.Y - enclosingBounds.Y, connection.Bounds.Width, connection.Bounds.Height); var pathGeometry = connection.Geometry as PathGeometry; var pathBounds = connection.ConnectionType == ConnectionType.Bezier ? pathGeometry.Bounds : new Rect(); var transformGroup = new TransformGroup(); transformGroup.Children.Add(new TranslateTransform() { X = bounds.X - pathBounds.X, Y = bounds.Y - pathBounds.Y }); var position = new MatrixPosition(transformGroup.Value); EditorInfo info = new EditorInfo(page, position, connection, bounds, connection.Stroke, 0); FixedContentEditor editor = CreateEditor(info, false); FixedContentEditor filledEditor = CreateEditor(info, true); ExportGeometry(editor, filledEditor, pathGeometry, true); if (connection.Content != null) { var center = bounds.Center(); ExportContent(connection, bounds, 0, page, (s) => { return new Point(bounds.Center().X - s.Width / 2, center.Y - s.Height / 2); }); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { this.SetLayoutRoots(); RadDiagramShape dummy = new RadDiagramShape(); this.diagram.Items.Add(dummy); List<IConnection> dummyConnections = new List<IConnection>(); foreach (var item in this.settings.Roots) { RadDiagramConnection connection = new RadDiagramConnection(); connection.Source = dummy; connection.Target = item; this.diagram.Items.Add(connection); dummyConnections.Add(connection); } settings.Roots.Clear(); settings.Roots.Add(dummy); this.diagram.Layout(LayoutType.Tree, settings); dummyConnections.ForEach(x => this.diagram.Items.Remove(x)); this.diagram.Items.Remove(dummy); this.diagram.AutoFit(); }
private void NaviDiagram_ConnectionManipulationCompleted(object sender, ManipulationRoutedEventArgs e) { IShape source = null; IShape target = null; try { source = e.Connection.Source; target = e.Connector.Shape; RadDiagramConnection con = e.Connection as RadDiagramConnection; con.TargetCapType = CapType.Arrow2Filled; con.Stroke = new SolidColorBrush(Colors.Black); con.StrokeThickness = 2; con.Foreground = new SolidColorBrush(Colors.Black); con.IsEditable = false; } catch { } //소스가 null 이면 삭제 if (source == null) { e.Handled = true; return; } //타겟이 null 이면 삭제 if (target == null) { e.Handled = true; return; } //같은 포트에 연결 하였다면 삭제 if (source == target) { e.Handled = true; return; } //같은 지점을 target으로 잡으면 안된다. var checkdata = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Target == target).ToList(); if (checkdata.Count >= 1) { e.Handled = true; return; } //목적지에서 다음 경로로 연결 할 수 없다. if (source is NaviShape) { NaviShape check = source as NaviShape; if (check.PointType == "2") { e.Handled = true; return; } } //시작지점이 중간 경로가 될 수 없다. if (target is NaviShape) { NaviShape check = target as NaviShape; if (check.PointType == "0") { e.Handled = true; return; } } //시작지점에서 커넥션이 1개만 있어야 한다. if (source is NaviShape) { NaviShape check = source as NaviShape; var cons = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Source == check).ToList(); if (cons.Count == 1) { e.Handled = true; return; } } }
private void AddConnectionsClick(object sender, RoutedEventArgs e) { var connection = this.diagram.AddConnection(this.diagram.Shapes[0], this.diagram.Shapes[1], "match1shapeConnector1Right", "match2shapeConnector3Left"); (connection as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 255, 116, 2) }; var connection2 = this.diagram.AddConnection(this.diagram.Shapes[1], this.diagram.Shapes[2], "match2shapeConnector1Right", "match3shapeConnector4Left"); (connection2 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 255, 116, 2) }; var connection3 = this.diagram.AddConnection(this.diagram.Shapes[0], this.diagram.Shapes[4], "match1shapeConnector2Right", "match5shapeConnector3Left"); (connection3 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 242, 8, 8) }; var connection4 = this.diagram.AddConnection(this.diagram.Shapes[4], this.diagram.Shapes[5], "match5shapeConnector1Right", "match6shapeConnector3Left"); (connection4 as RadDiagramConnection).Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 242, 8, 8) }; var connection5 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 30, 30, 27) } }; connection5.Attach(this.diagram.Shapes[3].Connectors[5], this.diagram.Shapes[1].Connectors[8]); this.diagram.Items.Add(connection5); var connection6 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 30, 30, 27) } }; connection6.Attach(this.diagram.Shapes[1].Connectors[6], this.diagram.Shapes[5].Connectors[8]); this.diagram.Items.Add(connection6); var connection7 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 23, 156, 72) } }; connection7.Attach(this.diagram.Shapes[3].Connectors[6], this.diagram.Shapes[4].Connectors[8]); this.diagram.Items.Add(connection7); var connection8 = new RadDiagramConnection() { Stroke = new SolidColorBrush() { Color = Color.FromArgb(255, 23, 156, 72) } }; connection8.Attach(this.diagram.Shapes[4].Connectors[6], this.diagram.Shapes[2].Connectors[7]); this.diagram.Items.Add(connection8); SetConnectorsCenterPoints(); (sender as RadButton).Visibility = Visibility.Collapsed; }
private void radButton1_Click(object sender, EventArgs e) { Distance_lbl.Text = "0"; if (HF.IsChecked) { Tuple <double[, ], List <double> > solution; TSP prob = new TSP(LH); solution = prob.Solve(); for (int j = 0; j < CountCities; j++) { for (int i = 0; i < CountCities; i++) { if (solution.Item1[i, j] == 1) { Map.AddConnection(j == 0 ? Cities[i] : Map.Connections[Map.Connections.Count - 1].Target, Cities[i]); RadDiagramConnection connection1 = (RadDiagramConnection)Map.Connections[Map.Connections.Count - 1]; connection1.BackColor = Color.LightSalmon; connection1.AllowDelete = false; connection1.IsDraggingEnabled = false; connection1.IsEditable = false; connection1.TargetCapSize = new SizeF(20, 25); connection1.IsHitTestVisible = true; connection1.Content = j + 1; connection1.ForeColor = Color.LightSalmon; connection1.Font = MouseCoords_lbl.Font; Distance_lbl.Text = (Convert.ToInt32(Distance_lbl.Text) + (connection1.StartPoint - connection1.EndPoint).LengthSquared).ToString(); Map.Refresh(); //connection1.Position = connection1.Target.Position; System.Windows.Forms.Application.DoEvents(); break; } } } for (int i = 0; i < solution.Item2.Count; i++) { Energy_list.Items.Add("Epoch: {0} => Energy = {1}", i + 1, solution.Item2[i]); } } if (GA.IsChecked) { int j = 0; Genetic.Path path = new GeneticAlgorithm(new Population(LG)).Solve(10000); foreach (var city in path.Cities) { Map.AddConnection(j == 0 ? Cities[j] : Map.Connections[Map.Connections.Count - 1].Target, Cities[j]); RadDiagramConnection connection1 = (RadDiagramConnection)Map.Connections[Map.Connections.Count - 1]; connection1.BackColor = Color.LightSalmon; connection1.AllowDelete = false; connection1.IsDraggingEnabled = false; connection1.IsEditable = false; connection1.TargetCapSize = new SizeF(20, 25); connection1.IsHitTestVisible = true; connection1.Content = j + 1; connection1.ForeColor = Color.LightSalmon; connection1.Font = MouseCoords_lbl.Font; Distance_lbl.Text = (Convert.ToInt32(Distance_lbl.Text) + (connection1.StartPoint - connection1.EndPoint).LengthSquared).ToString(); Energy_list.Items.Clear(); Map.Refresh(); //connection1.Position = connection1.Target.Position; System.Windows.Forms.Application.DoEvents(); j++; } } if (SA.IsChecked) { var result = new SimulatedAnnealing.SimulatedAnnealing(LG).Solve(); for (int j = 0; j < CountCities; j++) { Map.AddConnection(j == 0 ? Cities[j] : Map.Connections[Map.Connections.Count - 1].Target, Cities[j]); RadDiagramConnection connection1 = (RadDiagramConnection)Map.Connections[Map.Connections.Count - 1]; connection1.BackColor = Color.LightSalmon; connection1.AllowDelete = false; connection1.IsDraggingEnabled = false; connection1.IsEditable = false; connection1.TargetCapSize = new SizeF(20, 25); connection1.IsHitTestVisible = true; connection1.Content = j + 1; connection1.ForeColor = Color.LightSalmon; connection1.Font = MouseCoords_lbl.Font; Distance_lbl.Text = (Convert.ToInt32(Distance_lbl.Text) + (connection1.StartPoint - connection1.EndPoint).LengthSquared).ToString(); Energy_list.Items.Clear(); Map.Refresh(); //connection1.Position = connection1.Target.Position; System.Windows.Forms.Application.DoEvents(); } } //int k = 0; //foreach (RadDiagramConnection road in Map.Connections) //{ // //Console.WriteLine(road.Source.ToString()+road.Target.ToString() ); // Console.WriteLine(road.Position); //} }
public static void NetGraph(NeuralNetwork.NeuralNetwork nn, Telerik.WinControls.UI.RadDiagram radDiagram1) { List <Feature_shape> featureShapes = new List <Feature_shape>(); List <AF_shape> afShapes = new List <AF_shape>(); double x = 0; double y = 90; radDiagram1.AddShape(new Input_shape(), null, new Point(x, y)); for (int i = 0; i < nn.Layers.Count; i++) { x = i * 250 + 100; y = 0; //nn.Layers[i].Applier.ToString(); Point location = new Point(x, y); radDiagram1.AddShape(new Layer_shape("\n\t" + nn.Layers[i].NeuronsNumber, imgs[i]) { //Label = { Text ="Layer "+i , } //LayerBitmap=imgs[i] } , null, location); /** * featureShapes.Add(new Feature_shape() * { * Location = new Point(i * 250 + 100, 30), * Text = Convert.ToString(nn.Layers[i].NeuronsNumber) * } * ); * /** * afShapes.Add(new AF_shape() * { * Location = new Point(i * 250 + 200, 75), * Text = Convert.ToString(nn.Layers[i].Applier) * * } * ); * /**/ //(radDiagram1.Shapes[radDiagram1.Shapes.Count-1] as Layer_shape).addnodes(); } x = nn.Layers.Count * 250 + 100; y = 90; radDiagram1.AddShape(new Output_shape(), null, new Point(x, y)); Weight_edge edge; for (int i = 1; i < radDiagram1.Shapes.Count; i++) { radDiagram1.AddConnection((IShape)radDiagram1.Shapes[i - 1], (IShape)radDiagram1.Shapes[i]); radDiagram1.Connections[i - 1].TargetCapType = CapType.Arrow2Filled; radDiagram1.Connections[i - 1].AllowDelete = false; radDiagram1.Connections[i - 1].IsDraggingEnabled = false; radDiagram1.Connections[i - 1].IsEditable = false; radDiagram1.Connections[i - 1].TargetCapSize = new SizeF(20, 25); //I don't know how!! RadDiagramConnection connection1 = (RadDiagramConnection)radDiagram1.Connections[i - 1]; connection1.BackColor = Color.LightSalmon; // radDiagram1.AddConnection( // radDiagram1,i // //new Weight_edge( // //// (IShape)radDiagram1.Shapes[i], // ////(IShape)radDiagram1.Shapes[i - 1] //) // // ) // ; } for (int i = 0; i < featureShapes.Count; i++) { radDiagram1.AddShape(featureShapes[i]); //radDiagram1.AddShape(afShapes[i]); //radDiagram1.AddConnection((IShape) radDiagram1.Shapes[radDiagram1.Shapes.Count - 1], // (IShape) radDiagram1.Shapes[radDiagram1.Shapes.Count - 2]); } }
/// <summary> /// 경로 다이어그램 모델 삭제시 발생하는 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NaviDeleteCommandExecuted(object sender, ExecutedRoutedEventArgs e) { List <NaviShape> deldatas = new List <NaviShape>(); List <RadDiagramConnection> delcons = new List <RadDiagramConnection>(); //삭제 shape 파악 foreach (var item in Navidiagram.SelectedItems) { //NaviShape 가 삭제 되면 3D 부분에서도 삭제해야함. if (item is NaviShape) { NaviShape delshape = item as NaviShape; //VIewer3D.Instance.NaviPointGridRemove(delshape.NaviPointX, delshape.NaviPointY); deldatas.Add(delshape); } else if (item is RadDiagramConnection) { RadDiagramConnection delitem = item as RadDiagramConnection; delcons.Add(delitem); } } if (deldatas.Count > 0) { VIewer3D.Instance.RemoveNaviPoints(); } for (int i = 0; i < delcons.Count; i++) { Navidiagram.RemoveConnection(delcons[i]); } for (int i = 0; i < deldatas.Count; i++) { //삭제되는 shape에 connection 이 있는지 확인한다. //있는경우는 전부 삭제한다. var srcCon = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Source == deldatas[i]).ToList(); if (srcCon.Count > 0) { foreach (RadDiagramConnection item in srcCon) { Navidiagram.RemoveConnection(item); } } var dstCon = Navidiagram.Items.OfType <RadDiagramConnection>().Where(x => x.Target == deldatas[i]).ToList(); if (dstCon.Count > 0) { foreach (RadDiagramConnection item in dstCon) { Navidiagram.RemoveConnection(item); } } Navidiagram.RemoveShape(deldatas[i]); } reConnection(); if (loadTime == false) { Save(); } resetNodeNumber(); }