public MainWindowViewModel()
 {
     this.defaultController = new PlotController();
     this.Examples = ExampleLibrary.Examples.GetList();
     this.ExamplesView = CollectionViewSource.GetDefaultView(this.Examples.OrderBy(e => e.Category));
     this.ExamplesView.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
 }
Beispiel #2
0
 public MainWindowViewModel()
 {
     this.defaultController = new PlotController();
     this.Examples          = ExampleLibrary.Examples.GetList();
     this.ExamplesView      = CollectionViewSource.GetDefaultView(this.Examples.OrderBy(e => e.Category));
     this.ExamplesView.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
 }
 private void CustomizeController(IPlotController controller)
 {
     controller.UnbindAll();
     // actual changes to the controller
     controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Shift, PlotCommands.ZoomRectangle);
     controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.PanAt);
     controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.SnapTrack);
     controller.BindKeyDown(OxyKey.Home, PlotCommands.Reset);
     controller.BindMouseWheel(PlotCommands.ZoomWheel);
     controller.BindMouseWheel(OxyModifierKeys.Control, PlotCommands.ZoomWheelFine);
 }
Beispiel #4
0
 public PlotViewModel(PlotValue plot, IVisualizer visualizer, IConsole console)
 {
     _controller = ControllerFactory.Create(plot);
     _console    = new RelayCommand(_ => ShowConsole(console));
     _settings   = new RelayCommand(_ => ShowSettings(plot));
     _series     = new RelayCommand(_ => ShowSeries(plot));
     _grid       = new RelayCommand(_ => _controller.ToggleGrid());
     _center     = new RelayCommand(_ => _controller.CenterPlot());
     _dock       = new RelayCommand(_ => visualizer.Dock(this));
     _undock     = new RelayCommand(_ => visualizer.Undock());
     _print      = new RelayCommand(obj => Print(plot, obj as IPlotSerializer));
     _save       = new RelayCommand(obj => Save(plot, obj as IPlotSerializer));
 }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Plot" /> class.
        /// </summary>
        public Plot()
        {
            this.series = new ObservableCollection<Series>();
            this.axes = new ObservableCollection<Axis>();
            this.annotations = new ObservableCollection<Annotation>();

            this.series.CollectionChanged += this.OnSeriesChanged;
            this.axes.CollectionChanged += this.OnAxesChanged;
            this.annotations.CollectionChanged += this.OnAnnotationsChanged;

            this.defaultController = new PlotController();
            this.internalModel = new PlotModel();
            ((IPlotModel)this.internalModel).AttachPlotView(this);
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Plot" /> class.
        /// </summary>
        public Plot()
        {
            this.series      = new ObservableCollection <Series>();
            this.axes        = new ObservableCollection <Axis>();
            this.annotations = new ObservableCollection <Annotation>();

            this.series.CollectionChanged      += this.OnSeriesChanged;
            this.axes.CollectionChanged        += this.OnAxesChanged;
            this.annotations.CollectionChanged += this.OnAnnotationsChanged;

            this.defaultController = new PlotController();
            this.internalModel     = new PlotModel();
            ((IPlotModel)this.internalModel).AttachPlotView(this);
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Plot" /> class.
        /// </summary>
        public Plot()
        {
            series      = new ObservableCollection <Series>();
            axes        = new ObservableCollection <Axis>();
            annotations = new ObservableCollection <Annotation>();
            legends     = new ObservableCollection <Legend>();

            series.CollectionChanged      += OnSeriesChanged;
            axes.CollectionChanged        += OnAxesChanged;
            annotations.CollectionChanged += OnAnnotationsChanged;
            legends.CollectionChanged     += this.OnAnnotationsChanged;

            defaultController = new PlotController();
            internalModel     = new PlotModel();
            ((IPlotModel)internalModel).AttachPlotView(this);
        }
Beispiel #8
0
        /// <summary>
        /// Initializes this instance if it is not already initialized.
        /// </summary>
        private void EnsureInitialized()
        {
            if (this.initialized)
            {
                return;
            }

            this.initialized = true;

            var result = this.GetResult();

            if (result is PlotModel plotModel)
            {
                this.model = plotModel;
            }
            else if (result is Example example)
            {
                this.model          = example.Model;
                this.plotController = example.Controller;
            }

            if (this.model?.IsTransposable() != true)
            {
                return;
            }

            var result2 = this.GetResult();

            if (result2 is PlotModel plotModel2)
            {
                this.transposedModel = plotModel2.Transpose();
            }
            else if (result2 is Example example2)
            {
                this.transposedModel          = example2.Model.Transpose();
                this.transposedPlotController = example2.Controller;
            }
        }
Beispiel #9
0
 public Example(PlotModel model, IPlotController controller = null)
 {
     this.Model      = model;
     this.Controller = controller;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Example"/> class.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="controller">The controller.</param>
 public Example(PlotModel model, IPlotController controller = null)
 {
     this.Model = model;
     this.Controller = controller;
 }
Beispiel #11
0
 public PlotViewModel(PlotModel plot)
 {
     Plot           = plot;
     PlotController = CreatePlotController();
 }