Пример #1
0
        /// <inheritdoc/>
        public override void Configure(
            StreamVisualizationObjectCanvasView <LabeledRectangleListVisualizationObject, List <Tuple <System.Drawing.Rectangle, string, string> > > canvasView,
            LabeledRectangleListVisualizationObject visualizationObject)
        {
            this.Rectangle.Data.Transform = canvasView.TransformGroup;

            // Create bindings for lines
            var binding = new Binding(nameof(LabeledRectangleListVisualizationObject.Color))
            {
                Source    = visualizationObject,
                Converter = new Converters.ColorConverter(),
            };

            BindingOperations.SetBinding(this.Label, Grid.BackgroundProperty, binding);

            binding = new Binding(nameof(LabeledRectangleListVisualizationObject.Color))
            {
                Source    = visualizationObject,
                Converter = new Converters.ColorConverter(),
            };
            BindingOperations.SetBinding(this.Rectangle, Shape.StrokeProperty, binding);

            binding = new Binding(nameof(LabeledRectangleListVisualizationObject.LineWidth))
            {
                Source = visualizationObject,
            };
            BindingOperations.SetBinding(this.Rectangle, Shape.StrokeThicknessProperty, binding);
        }
Пример #2
0
        /// <inheritdoc/>
        public override void UpdateView(
            Tuple <System.Drawing.Rectangle, string, string> item,
            StreamVisualizationObjectCanvasView <LabeledRectangleListVisualizationObject, List <Tuple <System.Drawing.Rectangle, string, string> > > canvasView,
            LabeledRectangleListVisualizationObject visualizationObject)
        {
            var rectangle = item.Item1;
            var label     = item.Item2;
            var tooltip   = item.Item3;

            this.RectangleFigure.StartPoint = new System.Windows.Point(rectangle.Left, rectangle.Top);
            (this.RectangleFigure.Segments[0] as LineSegment).Point = new System.Windows.Point(rectangle.Left + rectangle.Width, rectangle.Top);
            (this.RectangleFigure.Segments[1] as LineSegment).Point = new System.Windows.Point(rectangle.Left + rectangle.Width, rectangle.Top + rectangle.Height);
            (this.RectangleFigure.Segments[2] as LineSegment).Point = new System.Windows.Point(rectangle.Left, rectangle.Top + rectangle.Height);
            (this.RectangleFigure.Segments[3] as LineSegment).Point = new System.Windows.Point(rectangle.Left, rectangle.Top);

            // update the label
            (this.Label.Children[0] as TextBlock).Text = label;
            this.Label.Width      = rectangle.Width * canvasView.ScaleTransform.ScaleX;
            this.Label.Height     = 30;
            this.Label.ToolTip    = tooltip;
            this.Label.Visibility = (label == default) ? Visibility.Collapsed : Visibility.Visible;

            // update the render transform for the label
            (this.Label.RenderTransform as TranslateTransform).X = (rectangle.Left + canvasView.TranslateTransform.X) * canvasView.ScaleTransform.ScaleX;
            (this.Label.RenderTransform as TranslateTransform).Y = (rectangle.Bottom + canvasView.TranslateTransform.Y) * canvasView.ScaleTransform.ScaleY;
        }
Пример #3
0
        /// <inheritdoc/>
        public override void Configure(
            StreamVisualizationObjectCanvasView <LabeledPointListVisualizationObject, List <Tuple <Point, string, string> > > canvasView,
            LabeledPointListVisualizationObject visualizationObject)
        {
            this.Point.Data.Transform = canvasView.TransformGroup;

            // Create bindings for lines
            var binding = new Binding(nameof(LabeledPointListVisualizationObject.LabelColor))
            {
                Source    = visualizationObject,
                Converter = new Converters.ColorConverter(),
            };

            BindingOperations.SetBinding(this.Label, Grid.BackgroundProperty, binding);

            binding = new Binding(nameof(LabeledPointListVisualizationObject.FillColor))
            {
                Source    = visualizationObject,
                Converter = new Converters.ColorConverter(),
            };
            BindingOperations.SetBinding(this.Point, Shape.StrokeProperty, binding);
            BindingOperations.SetBinding(this.Point, Shape.FillProperty, binding);

            binding = new Binding(nameof(LabeledPointListVisualizationObject.Radius))
            {
                Source = visualizationObject,
            };
            BindingOperations.SetBinding(this.Point.Data, EllipseGeometry.RadiusXProperty, binding);
            BindingOperations.SetBinding(this.Point.Data, EllipseGeometry.RadiusYProperty, binding);
        }
Пример #4
0
        /// <inheritdoc/>
        public override void UpdateView(
            Tuple <Point, string, string> item,
            StreamVisualizationObjectCanvasView <LabeledPointListVisualizationObject, List <Tuple <Point, string, string> > > canvasView,
            LabeledPointListVisualizationObject visualizationObject)
        {
            var point   = item.Item1;
            var label   = item.Item2;
            var tooltip = item.Item3;

            (this.Point.Data as EllipseGeometry).Center = point;

            // update the label
            (this.Label.Children[0] as TextBlock).Text = label;
            this.Label.Width      = 100 * canvasView.ScaleTransform.ScaleX;
            this.Label.Height     = 30;
            this.Label.ToolTip    = tooltip;
            this.Label.Visibility = (label == default) ? Visibility.Collapsed : Visibility.Visible;

            // update the render transform for the label
            (this.Label.RenderTransform as TranslateTransform).X = (point.X + canvasView.TranslateTransform.X) * canvasView.ScaleTransform.ScaleX;
            (this.Label.RenderTransform as TranslateTransform).Y = (point.Y + canvasView.TranslateTransform.Y) * canvasView.ScaleTransform.ScaleY;
        }
 /// <summary>
 /// Updaets the view.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="canvasView">The canvas view.</param>
 /// <param name="visualizationObject">The stream visualization object.</param>
 public abstract void UpdateView(
     TItem item,
     StreamVisualizationObjectCanvasView <TStreamVisualizationObject, TEnumerable> canvasView,
     TStreamVisualizationObject visualizationObject);
 /// <summary>
 /// Configures.
 /// </summary>
 /// <param name="canvasView">The canvas view.</param>
 /// <param name="visualizationObject">The stream visualization object.</param>
 public abstract void Configure(
     StreamVisualizationObjectCanvasView <TStreamVisualizationObject, TEnumerable> canvasView,
     TStreamVisualizationObject visualizationObject);