public void TestViewportContentBounds() { ChartPlotter plotter = new ChartPlotter(); TempIPlotterElement element = new TempIPlotterElement(); plotter.Children.Add(element); plotter.PerformLoad(); plotter.Viewport.ClipToBoundsEnlargeFactor = 1.0; Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible); Viewport2D.SetContentBounds(element, new DataRect(0, 0, 2, 2)); Assert.AreEqual(new DataRect(0, 0, 2, 2), plotter.Visible); plotter.Children.Remove(element); Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible); plotter.Children.Add(element); Assert.AreEqual(new DataRect(0, 0, 2, 2), plotter.Visible); Viewport2D.SetIsContentBoundsHost(element, false); Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible); }
protected override void Initialize() { deviceContext.IA.SetPrimitiveTopology(PrimitiveTopology.LineStrip); using (Stream stream = this.GetType().Assembly.GetManifestResourceStream("Microsoft.Research.DynamicDataDisplay.DirectX11.Shaders.Precompiled.Basic.Render.vs")) { vertexShader = device.CreateVertexShader(stream); deviceContext.VS.SetShader(vertexShader); stream.Position = 0; InputLayout inputLayout = device.CreateInputLayout( VertexPosition.InputElementsDescription, stream); deviceContext.IA.SetInputLayout(inputLayout); } // Open precompiled vertex shader using (Stream stream = this.GetType().Assembly.GetManifestResourceStream("Microsoft.Research.DynamicDataDisplay.DirectX11.Shaders.Precompiled.Basic.Render.ps")) { pixelShader = device.CreatePixelShader(stream); } deviceContext.PS.SetShader(pixelShader, null); SetShaderMatrices(); SetShaderLineColor(new ColorRgba(1, 0, 0, 1)); Viewport2D.SetIsContentBoundsHost(this, true); }
public Map() { Viewport2D.SetIsContentBoundsHost(this, true); Viewport2D.SetContentBounds(this, new DataRect(new Point(-180, -90), new Point(180, 90))); server.ImageLoaded += OnTileLoaded; server.SourceServerChanged += OnSourceServerChanged; #if DEBUG drawDebugBounds = false; #endif }
public void OnPlotterAttached(Plotter plotter) { if (Parent == null) { hostPanel = new ViewportHostPanel(); Viewport2D.SetIsContentBoundsHost(hostPanel, false); hostPanel.Children.Add(this); plotter.Dispatcher.BeginInvoke(() => { plotter.Children.Add(hostPanel); }, DispatcherPriority.Send); } #if !old Canvas hostCanvas = (Canvas)hostPanel.FindName(canvasName); if (hostCanvas == null) { hostCanvas = new Canvas { ClipToBounds = true }; Panel.SetZIndex(hostCanvas, 1); INameScope nameScope = NameScope.GetNameScope(hostPanel); if (nameScope == null) { nameScope = new NameScope(); NameScope.SetNameScope(hostPanel, nameScope); } hostPanel.RegisterName(canvasName, hostCanvas); hostPanel.Children.Add(hostCanvas); } hostCanvas.Children.Add(this); #else #endif Plotter2D plotter2d = (Plotter2D)plotter; this.plotter = plotter2d; OnPositionChanged(new DependencyPropertyChangedEventArgs()); }
private void OnDataSourceChanged(IPointDataSource oldDataSource, IPointDataSource currentDataSource) { if (oldDataSource != null) { oldDataSource.Changed -= OnDataSourceChangedEvent; INotifyCollectionChanged observableCollection = oldDataSource as INotifyCollectionChanged; if (observableCollection != null) { observableCollection.CollectionChanged -= observableCollection_CollectionChanged; } } if (currentDataSource != null) { currentDataSource.Changed += OnDataSourceChangedEvent; INotifyCollectionChanged observableCollection = currentDataSource as INotifyCollectionChanged; if (observableCollection != null) { observableCollection.CollectionChanged += observableCollection_CollectionChanged; } } DependencyObject oldDependencyDataSource = oldDataSource as DependencyObject; DependencyObject currentDependencyDataSource = currentDataSource as DependencyObject; hasContinousDataSource = currentDependencyDataSource != null; if (oldDependencyDataSource != null && currentDependencyDataSource == null && currentDataSource != null) { Viewport2D.SetIsContentBoundsHost(this, true); } else if (oldDependencyDataSource == null && currentDependencyDataSource != null) { Viewport2D.SetIsContentBoundsHost(this, false); } UpdateUIRepresentation(); }
/// <summary> /// Initializes a new instance of the <see cref="IsolineGraph"/> class. /// </summary> public IsolineGraph() { Content = content; Viewport2D.SetIsContentBoundsHost(this, true); }
/// <summary> /// Initializes a new instance of the <see cref="MarkerChart"/> class. /// </summary> public MarkerChart() { Viewport2D.SetIsContentBoundsHost(this, true); }
/// <summary> /// Initializes a new instance of the <see cref="PointChartBase"/> class. /// </summary> public PointChartBase() { Viewport2D.SetIsContentBoundsHost(this, true); }
/// <summary> /// Initializes a new instance of the <see cref="LineChart"/> class. /// </summary> public LineChart() { Viewport2D.SetIsContentBoundsHost(this, true); filters.CollectionChanged += new NotifyCollectionChangedEventHandler(filters_CollectionChanged); }
public TempIPlotterElement() { Viewport2D.SetIsContentBoundsHost(this, true); }