Esempio n. 1
0
        /// <inheritdoc />
        public override void AddVisualizationObject(VisualizationObject visualizationObject)
        {
            base.AddVisualizationObject(visualizationObject);

            visualizationObject.CursorEpsilonNegMs = this.defaultCursorEpsilonNegMs;
            visualizationObject.CursorEpsilonPosMs = this.defaultCursorEpsilonPosMs;
        }
Esempio n. 2
0
        /// <summary>
        /// Sends a visualization object to the back.
        /// </summary>
        /// <param name="visualizationObject">The visualization object to bring to front.</param>
        public void SendToBack(VisualizationObject visualizationObject)
        {
            int oldIndex = this.VisualizationObjects.IndexOf(visualizationObject);

            if (oldIndex != 0)
            {
                this.VisualizationObjects.Move(oldIndex, 0);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Brings a visualization object to the front.
        /// </summary>
        /// <param name="visualizationObject">The visualization object to bring to front.</param>
        public void BringToFront(VisualizationObject visualizationObject)
        {
            int oldIndex = this.VisualizationObjects.IndexOf(visualizationObject);

            if (oldIndex != this.VisualizationObjects.Count - 1)
            {
                this.VisualizationObjects.Move(oldIndex, this.VisualizationObjects.Count - 1);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Called when the data context is changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The dependency property changed event arguments.</param>
        protected virtual void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.VisualizationObject = this.DataContext as VisualizationObject;

            // check that the visualization object is connected
            if (!this.VisualizationObject.IsConnected)
            {
                throw new Exception("Visualization object should be connected by the time the view is attached.");
            }

            this.VisualizationObject.PropertyChanging += this.DispatchVisualizationObjectPropertyChanging;
            this.VisualizationObject.PropertyChanged  += this.DispatchVisualizationObjectPropertyChanged;
        }
Esempio n. 5
0
        private void InsertPanelContextMenuItems(ContextMenu contextMenu)
        {
            contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.Legend, this.ShowLegend ? "Hide Legend" : "Show Legend", this.ShowHideLegendCommand));
            contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.RemovePanel, "Remove Panel", this.RemovePanelCommand));
            contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.ClearPanel, "Clear", this.ClearPanelCommand));

            // Get the visualization object currently being snapped to (if any)
            VisualizationObject snappedVisualizationObject = this.Container.SnapToVisualizationObject;

            // Work out how many visualization objects we could potentially snap to.  If one of
            // this panel's visualization objects is currently being snapped to, then this total
            // is actually one fewer, and we'll also need to add an "unsnap" menu item.
            int snappableVisualizationObjectsCount = this.VisualizationObjects.Count;

            if ((snappedVisualizationObject != null) && this.VisualizationObjects.Contains(snappedVisualizationObject))
            {
                snappableVisualizationObjectsCount--;
                contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.Stream, string.Format("Unsnap from {0}", this.Container.SnapToVisualizationObject.Name), new VisualizationCommand <VisualizerMetadata>((v) => this.Container.SnapToVisualizationObject.ToggleSnapToStream())));
            }

            // If there's only 1 snappable visualization object in this panel, then create a
            // direct menu, if there's more than 1 then create a cascading menu.
            if (snappableVisualizationObjectsCount == 1)
            {
                VisualizationObject snappableVisualizationObject = this.VisualizationObjects.First(vo => vo != this.Container.SnapToVisualizationObject);
                contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.SnapToStream, string.Format("Snap to {0}", snappableVisualizationObject.Name), new VisualizationCommand <VisualizerMetadata>((v) => snappableVisualizationObject.ToggleSnapToStream())));
            }
            else if (snappableVisualizationObjectsCount > 1)
            {
                // Create the top-level menu item
                var snapMenuItem = MenuItemHelper.CreateMenuItem(IconSourcePath.SnapToStream, "Snap To", null);

                // create the child menu items for each visualization object.
                foreach (VisualizationObject visualizationObject in this.VisualizationObjects)
                {
                    if (visualizationObject != this.Container.SnapToVisualizationObject)
                    {
                        snapMenuItem.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.SnapToStream, visualizationObject.Name, new VisualizationCommand <VisualizerMetadata>((v) => visualizationObject.ToggleSnapToStream())));
                    }
                }

                contextMenu.Items.Add(snapMenuItem);
            }

            contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.ZoomToSelection, "Zoom to Selection", this.ZoomToSelectionCommand));
            contextMenu.Items.Add(MenuItemHelper.CreateMenuItem(IconSourcePath.ZoomToSession, "Zoom to Session Extents", this.ZoomToSessionExtentsCommand));
        }
Esempio n. 6
0
        /// <summary>
        /// Removes a visualization object specified by a view model.
        /// </summary>
        /// <param name="visualizationObject">The visualization object to be removed.</param>
        private void RemoveVisualizationObject(VisualizationObject visualizationObject)
        {
            // change the current visualization object
            if (this.currentVisualizationObject == visualizationObject)
            {
                this.currentVisualizationObject = null;
            }

            // If the visualization object being deleted is the stream being snapped to, then reset the snap to stream object
            if (visualizationObject == this.Container.SnapToVisualizationObject)
            {
                this.Container.SnapToVisualizationObject = null;
            }

            visualizationObject.RemoveFromPanel();
            this.VisualizationObjects.Remove(visualizationObject);

            if ((this.currentVisualizationObject == null) && (this.VisualizationObjects.Count > 0))
            {
                this.CurrentVisualizationObject = this.VisualizationObjects.Last();
            }
        }
Esempio n. 7
0
        private void RemoveVisualForVisualizationObject(VisualizationObject visualizationObject)
        {
            Visual3D visual = ((I3DVisualizationObject)visualizationObject).Visual3D;

            this.SortingVisualRoot.Children.Remove(visual);
        }
Esempio n. 8
0
 /// <summary>
 /// Add a visualization object to the panel.
 /// </summary>
 /// <param name="visualizationObject">The visualization object to be added.</param>
 public void AddVisualizationObject(VisualizationObject visualizationObject)
 {
     visualizationObject.AddToPanel(this);
     this.VisualizationObjects.Add(visualizationObject);
     this.CurrentVisualizationObject = visualizationObject;
 }