Пример #1
0
        private void imageTfBackground_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 2) // double click
            {
                var x = e.GetPosition(canvasTf).X;
                var value = x * (Builder.MaxValue - Builder.MinValue) / canvasTf.ActualWidth + Builder.MinValue;

                var item = new TransferFunction1DItem(value, CreateTransferFunction().GetColor(value));
                Builder.Items.Add(item);
                Builder.CurrentItem = item;
            }
        }
Пример #2
0
        private void Update(TransferFunction1DItem tfItem)
        {
            double x;

            x = (tfItem.Value - Builder.MinValue) / (Builder.MaxValue - Builder.MinValue) * canvasTf.ActualWidth;

            var rectangle = (Rectangle)tfItem.Tag;
            Canvas.SetLeft(rectangle, x);
            if (tfItem == Builder.CurrentItem)
            {
                rectangle.StrokeThickness = 2;
                rectangle.Stroke = brushStrokeSelected;
            }
            else
            {
                rectangle.StrokeThickness = 1;
                rectangle.Stroke = brushStroke;
            }

            rectangle.Fill = new SolidColorBrush(tfItem.Color);
        }
Пример #3
0
        private void ButtonItemAdd_Click(object sender, RoutedEventArgs e)
        {
            double value = 0;
            if (Builder.Items.Count > 0)
            {
                value = Builder.Items[Builder.Items.Count - 1].Value + 100;
            }

            var item = new TransferFunction1DItem(value);
            Builder.Items.Add(item);
            Builder.CurrentItem = item;
        }