Esempio n. 1
0
        public OWLOSPetalControl(OWLOSThingControl parentOWLOSThingControl, double radius, double angel, double length, double width)
        {
            InitializeComponent();

            this.parentOWLOSThingControl = parentOWLOSThingControl;
            this.radius = radius;
            this.angel  = angel;
            this.length = length;

            parentOWLOSThingControl.parentControl.OnPositionChanged += ParentControl_OnPositionChanged;

            double startAngel = 0;

            petalBackground.Data            = HudLibrary.DrawArc(Gold.center, Gold.center, radius, startAngel, length);
            petalBackground.StrokeThickness = width;
            petalBorder1.Data = HudLibrary.DrawArc(Gold.center, Gold.center, radius + width / 2, startAngel, length);
            petalBorder2.Data = HudLibrary.DrawArc(Gold.center, Gold.center, radius - width / 2, startAngel, length);

            //подготавливаем конектор - элементы экосистемы могут соединятся друг с другом, в данном случае
            //одна нода имеет множество присоединеных драйверов. По этой причине нужно инкапсулировать много элементов
            //для соединеня
            connector = new EcosystemControl(null);
            connector.MoveTransform(0, 0);
            connector.Width  = 10;
            connector.Height = 10;
            connector.HorizontalAlignment = HorizontalAlignment.Center;
            connector.VerticalAlignment   = VerticalAlignment.Top;
            connector.Margin = new Thickness(0, 0, 0, 0);
            connector.MoveTransform(0, 330 - radius);


            Ellipse elipse = new Ellipse
            {
                Width  = 10,
                Height = 10,
                Fill   = (SolidColorBrush)App.Current.Resources["OWLOSWarning"]
            };

            connector.childHolderGrid.Children.Add(elipse);

            petalMainGrid.Children.Add(connector);
        }
Esempio n. 2
0
        private void ParentControl_OnShow(object sender, EventArgs e)
        {
            if (relatedPanel.window == null)
            {
                if (relationLine.curveLine == null)
                {
                    //вычисляем с какой стороны от hud ноды находится леписток драйвера и вычисляем позицию элемента таблицы относительно hud ноды
                    double xr = 1000 * Math.Cos(angel * Math.PI / 180 - Math.PI / 2) + parentOWLOSThingControl.parentControl.transform.X;
                    double yr = 1000 * Math.Sin(angel * Math.PI / 180 - Math.PI / 2) + parentOWLOSThingControl.parentControl.transform.Y;
                    relatedPanel.MoveTransform(xr, yr);

                    relationLine.DrawRelationLine(((SolidColorBrush)App.Current.Resources["OWLOSWarning"]).Color.ToString(), ((SolidColorBrush)App.Current.Resources["OWLOSWarning"]).Color.ToString());
                }
                relationLine.Show();
            }
        }
        public OWLOSNodeDriverControl(OWLOSNodeControl parentOWLOSNodeControl, OWLOSDriver driver, double radius, double angel)
        {
            InitializeComponent();

            this.driver = driver;

            this.radius = radius;
            this.angel  = angel;

            connector.MoveTransform(0, 0);
            connector.Width  = 10;
            connector.Height = 10;
            connector.HorizontalAlignment = HorizontalAlignment.Center;
            connector.VerticalAlignment   = VerticalAlignment.Top;
            connector.Margin = new Thickness(0, 0, 0, 0);

            connector.Background = (SolidColorBrush)App.Current.Resources["OWLOSWarning"];

            text2.Children.Add(connector);

            this.parentOWLOSNodeControl = parentOWLOSNodeControl;

            double _angel = 0;

            pathL1.Data = HudLibrary.DrawArc(350, 350, radius, _angel, _angel + 25);
            pathL2.Data = HudLibrary.DrawArc(350, 350, radius + 20, _angel, _angel + 25);
            pathL3.Data = HudLibrary.DrawArc(350, 350, radius - 20, _angel, _angel + 25);



            RotateTransform rotateTransform = new RotateTransform();

            rotateTransform.Angle = angel * 30;
            text2.RenderTransform = rotateTransform;

            driverNameText.Text = driver.name;

            driverCountrol = new OWLOSDriverControl(driver);
            driverCountrol.parentControl.Visibility = Visibility.Hidden;
            driverCountrol.parentControl.Hide();


            double xr = 1000 * Math.Cos(Math.PI * (angel / 6.0) - Math.PI / 2) + parentOWLOSNodeControl.parentControl.transform.X;
            double yr = 1000 * Math.Sin(Math.PI * (angel / 6.0) - Math.PI / 2) + parentOWLOSNodeControl.parentControl.transform.Y;

            driverCountrol.parentControl.MoveTransform(xr, yr);


            (parentOWLOSNodeControl.parentControl.Parent as Grid).Children.Add(driverCountrol.parentControl);
            parentOWLOSNodeControl.parentControl.OnPositionChanged += ParentControl_OnPositionChanged;

            relationLine = new EcosystemRelationLine(driverCountrol, driverCountrol.parentControl, connector, driverCountrol, parentOWLOSNodeControl.parentControl.Parent as Grid);
            relationLine.DrawRelationLine(((SolidColorBrush)App.Current.Resources["OWLOSInfo"]).Color.ToString(), ((SolidColorBrush)App.Current.Resources["OWLOSInfo"]).Color.ToString());
            relationLine.Hide();



            //driver.NewProperty += Driver_NewProperty;

            //DoubleAnimation rotate2 = new DoubleAnimation(1300.0f, 0.0f, new Duration(TimeSpan.FromMilliseconds(50000)));

            //RotateTransform rotateTransform2 = new RotateTransform();
            //text2.RenderTransform = rotateTransform2;
            //rotateTransform2.BeginAnimation(RotateTransform.AngleProperty, rotate2);
        }