コード例 #1
0
        protected void DetachFromItemsPanel()
        {
            ViewportHostPanel viewportItemsPanel = currentItemsPanel as ViewportHostPanel;

            if (viewportItemsPanel != null)
            {
                viewportItemsPanel.ContentBoundsChanged -= viewportItemsPanel_ContentBoundsChanged;
            }
            if (viewportItemsPanel != null && plotter != null)
            {
                viewportItemsPanel.OnPlotterDetaching(plotter);
            }

            Content = null;
        }
コード例 #2
0
        private void AddCircularArcGraph(Point startPoint, Point endPoint, Size size)
        {
            PathFigure pf = new PathFigure();

            pf.StartPoint = new Point(startPoint.X, startPoint.Y);

            ArcSegment arcSegment = new ArcSegment();

            arcSegment.Point          = new Point(endPoint.X, endPoint.Y);
            arcSegment.Size           = size;
            arcSegment.SweepDirection = SweepDirection.Counterclockwise;

            PathSegmentCollection psc = new PathSegmentCollection();

            psc.Add(arcSegment);

            pf.Segments = psc;

            PathFigureCollection pfc = new PathFigureCollection();

            pfc.Add(pf);

            PathGeometry pg = new PathGeometry();

            pg.Figures = pfc;

            var path = new Path();

            path.Stroke          = Brushes.Black;
            path.StrokeThickness = 1;
            path.Data            = pg;
            path.Fill            = Brushes.Orange;
            path.Stretch         = Stretch.Fill;

            var viewportPanel = new ViewportHostPanel();

            ViewportPanel.SetViewportBounds(path, new DataRect(0, 0, 50, 50));
            viewportPanel.Children.Add(path);
            plotter.Children.Add(viewportPanel);
        }
コード例 #3
0
        protected virtual void DrawAllMarkers(bool reuseExisting, bool continueAfterDataPrepaired)
        {
            if (!IsReadyToDrawMarkers())
            {
                return;
            }

            var dataSource = DataSource;

            dataSource.Environment = new DataSourceEnvironment {
                Plotter = this.Plotter, FirstDraw = true
            };

            if (!continueAfterDataPrepaired)
            {
                dataSource.PrepairData(getDataAsyncronously);
                if (getDataAsyncronously)
                {
                    LongOperationsIndicator.BeginLongOperation(this);
                    return;
                }
            }

            BuildCommonBindings();

            startIndex = 0;
            lastIndex  = startIndex;

            IndividualArrangePanel panel = CurrentItemsPanel as IndividualArrangePanel;

            if (panel != null)
            {
                panel.BeginBatchAdd();
            }

            ViewportHostPanel viewportPanel = CurrentItemsPanel as ViewportHostPanel;

            if (viewportPanel != null)
            {
                viewportPanel.OverallViewportBounds = DataRect.Empty;
            }

            foreach (var dataItem in dataSource.GetData())
            {
                lastIndex += CreateAndAddMarker(dataItem, lastIndex);

                if (showMarkersConsequently && lastIndex % 1000 == 0)
                {
                    // make dispatcher execute all operations in its queue;
                    // so that markers will appear on the screen step-by-step,
                    // making application more responsive.
                    Dispatcher.Invoke(() => { }, DispatcherPriority.Background);
                }
            }


            int len = CurrentItemsPanel.Children.Count;

            if (lastIndex < len)
            {
                for (int i = lastIndex; i < len; i++)
                {
                    UIElement element = CurrentItemsPanel.Children[i];
                    element.Visibility = Visibility.Collapsed;
                }
            }

            if (panel != null)
            {
                panel.EndBatchAdd();
            }

            LongOperationsIndicator.EndLongOperation(this);
        }