Exemple #1
0
        public override void Drag(Telerik.Windows.Diagrams.Core.Point newPoint)
        {
            Telerik.Windows.Diagrams.Core.Point dragPoint = newPoint;
            if (this.DragMode == DragMode.Horizontal)
            {
                dragPoint = new Telerik.Windows.Diagrams.Core.Point(newPoint.X, this.startDragPoint.Y);
            }
            else if (this.DragMode == DragMode.Vertical)
            {
                dragPoint = new Telerik.Windows.Diagrams.Core.Point(this.startDragPoint.X, newPoint.Y);
            }

            base.Drag(dragPoint);
        }
Exemple #2
0
        private OrgContainerShape CreateNode(AlimexDAL.Entity.Organization element, OrgContainerShape parentNode)
        {
            OrgContainerShape orgTeam = new OrgContainerShape(_userContext)
            {
                Name = element.Name,
                Id   = element.Id
            };

            orgTeam.ToggleCollapseButton.ImagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
            orgTeam.Text = orgTeam.Name;
            orgTeam.Tag  = element.Id.ToString();
            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;
                connection.Route          = true;

                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);
        }
Exemple #3
0
        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]);
            }
        }
Exemple #4
0
        public override void InitializeDrag(Telerik.Windows.Diagrams.Core.Point point)
        {
            this.startDragPoint = point;

            base.InitializeDrag(point);
        }