internal Viewport2dDeferredPanningProxy(Viewport2D viewport)
			: base(viewport.HostElement, viewport.Plotter2D)
		{
			viewport.PropertyChanged += viewport_PropertyChanged;
			viewport.PanningStateChanged += viewport_PanningStateChanged;
			this.viewport = viewport;
		}
Exemplo n.º 2
0
 public override DataRect Apply( DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport )
 {
     DataRect dataRect = proposedDataRect.WithY(other.Visible.YMin, other.Visible.YMax);
     if (dataRect != other.Visible)
     {
         other.Visible = dataRect;
     }
     return proposedDataRect;
 }
Exemplo n.º 3
0
		public InjectedPlotter()
			: base(PlotterLoadMode.Empty)
		{
			ViewportPanel = new Canvas();
			Grid.SetColumn(ViewportPanel, 1);
			Grid.SetRow(ViewportPanel, 1);

			Viewport = new Viewport2D(ViewportPanel, this);
		}
		public PhysicalRectAnimation(Viewport2D viewport, Point initialMousePos)
		{
			this.from = viewport.Visible;
			this.viewport = viewport;
			this.initialMousePos = initialMousePos;

			initialTransform = viewport.Transform;

			position = from.Location.ToVector();
		}
Exemplo n.º 5
0
		private void InitViewport()
		{
			viewportPanel = new Canvas();
			Grid.SetColumn(viewportPanel, 1);
			Grid.SetRow(viewportPanel, 1);

			viewport = new Viewport2D(viewportPanel, this);
			if (LoadMode != PlotterLoadMode.Empty)
			{
				MainGrid.Children.Add(viewportPanel);
			}
		}
Exemplo n.º 6
0
		public virtual void OnPlotterAttached(Plotter plotter)
		{
			this.plotter = (Plotter2D)plotter;
			viewport = this.plotter.Viewport;

			if (!IsMarkersHost)
			{
				plotter.CentralGrid.Children.Add(hostingCanvas);
			}
			if (Parent == null)
			{
				hostingCanvas.Children.Add(this);
			}
			this.plotter.Viewport.PropertyChanged += Viewport_PropertyChanged;
		}
        public Rect Apply(Rect oldVisible, Rect newVisible, Viewport2D viewport)
        {
            if (XRange != null)
            {
                newVisible.X = XRange.Start;
                newVisible.Width = XRange.End - XRange.Start;
            }

            if (YRange != null)
            {
                newVisible.Y = YRange.Start;
                newVisible.Height = YRange.End - YRange.Start;
            }
            return newVisible;
        }
Exemplo n.º 8
0
        public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport)
        {
            if (!proposedDataRect.IsEmpty)
            {
                if (XRange != null)
                {
                    proposedDataRect.XMin = Math.Max(XRange.Start, proposedDataRect.XMin);
                    proposedDataRect.Width = XRange.End - XRange.Start;
                }

                if (YRange != null)
                {
                    proposedDataRect.YMin = YRange.Start;
                    proposedDataRect.Height = YRange.End - YRange.Start;
                }
                return proposedDataRect;
            }
            return previousDataRect;
        }
Exemplo n.º 9
0
 public EqualXConstraint(Viewport2D other)
 {
     this.other = other;
 }
Exemplo n.º 10
0
 public XValueTextMarker(Viewport2D ct)
 {
     this.ct = ct;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PointsGraphBase"/> class.
 /// </summary>
 protected PointsGraphBase()
 {
     Viewport2D.SetIsContentBoundsHost(this, true);
 }
Exemplo n.º 12
0
		protected abstract void UpdateScrollBar(Viewport2D viewport);
Exemplo n.º 13
0
 public XConverter( Viewport2D viewport )
 {
     this.viewport = viewport;
 }
        protected override void OnPlotterDetaching(Plotter plotter)
        {
            base.OnPlotterDetaching(plotter);

            viewport.PropertyChanged -= OnViewportPropertyChanged;
            viewport = null;
            GetHostPanel(plotter).Children.Remove(this);
            plotter2D = null;
        }
        protected override void OnPlotterAttached(Plotter plotter)
        {
            base.OnPlotterAttached(plotter);

            plotter2D = (Plotter2D)plotter;
            GetHostPanel(plotter).Children.Add(this);
            viewport = plotter2D.Viewport;
            viewport.PropertyChanged += OnViewportPropertyChanged;
        }
Exemplo n.º 16
0
		public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport)
		{
			return DataRect.Create(proposedDataRect.XMin, 0, proposedDataRect.XMax, 1);
		}
        protected override void OnRenderCore(DrawingContext dc, RenderState state)
        {
            if (Marker == null)
            {
                return;
            }

            if (DataSource == null) // No data is specified
            {
                if (canvas != null)
                {
                    foreach (UIElement child in canvas.Children)
                    {
                        unused.Add(child);
                    }
                    canvas.Children.Clear();
                }
            }
            else // There is some data
            {
                int index     = 0;
                var transform = GetTransform();
                using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
                {
                    Point point = new Point();

                    DataRect bounds = DataRect.Empty;

                    while (enumerator.MoveNext())
                    {
                        enumerator.GetCurrent(ref point);
                        enumerator.ApplyMappings(Marker);

                        if (index >= canvas.Children.Count)
                        {
                            UIElement newMarker;
                            if (unused.Count > 0)
                            {
                                newMarker = unused[unused.Count - 1];
                                unused.RemoveAt(unused.Count - 1);
                            }
                            else
                            {
                                newMarker = Marker.CreateMarker();
                            }
                            canvas.Children.Add(newMarker);
                        }

                        Marker.SetMarkerProperties(canvas.Children[index]);
                        bounds.Union(point);
                        Point screenPoint = point.DataToScreen(transform);
                        Marker.SetPosition(canvas.Children[index], screenPoint);
                        index++;
                    }

                    Viewport2D.SetContentBounds(this, bounds);

                    while (index < canvas.Children.Count)
                    {
                        unused.Add(canvas.Children[index]);
                        canvas.Children.RemoveAt(index);
                    }
                }
            }
        }