void mPlugin_AxisAdded(IAxis axis) { AxisPanel panel = new AxisPanel(axis, AxisBinding.X, AxisBinding.Y, AxisBinding.Z, AxisBinding.Pitch, AxisBinding.Yaw, AxisBinding.Z); panel.Anchor = AnchorStyles.Left | AnchorStyles.Right; panel.Width = axesBox.Width - PADDING * 2; axesBox.Controls.Add(panel); panel.SizeChanged += new EventHandler(panel_SizeChanged); RepositionPanels(); }
internal void ChangeGraduations() { if (_internalInterval <= 0) { _internalInterval = Interval; } if (Zooming != null) { Zooming(); } switch (AxisPanel.SaftyGetProperty <int, ScheduleGrid>(o => (int)o.ZoomValue, () => 1)) { case 1: Interval = _internalInterval; Graduations = new DoubleCollection { 14d, 3d, 7d, 3d }; break; case 2: Interval = _internalInterval * 4 / 6; Graduations = new DoubleCollection { 14d, 0d, 0d, 7d, 0d, 0d }; break; case 4: Interval = _internalInterval * 4 / 3; Graduations = new DoubleCollection { 14d, 3d, 3d }; break; case 12: Interval = _internalInterval; Graduations = new DoubleCollection { 14d, 0d, 0d, 0d }; break; } }
public AxesBoxVisual3DSample() { InitializeComponent(); // Customize the shown axis to show the XY axes horizontally and Z axis up (by default WPF as Y axis up). AxisPanel.CustomizeAxes(new Vector3D(1, 0, 0), "X", Colors.Red, new Vector3D(0, 1, 0), "Z", Colors.Blue, new Vector3D(0, 0, -1), "Y", Colors.Green); AxisShowingStrategyComboBox.ItemsSource = Enum.GetValues(typeof(AxesBoxVisual3D.AxisShowingStrategies)); AxisShowingStrategyComboBox.SelectedIndex = 1; // Axes colors and line thicknesses are set in XAML // Set axes data ranges: AxesBox.SetAxisDataRange(AxesBoxVisual3D.AxisTypes.XAxis, minimumValue: 0, maximumValue: 100, majorTicksStep: 10, minorTicksStep: 5, snapMaximumValueToMajorTicks: true); AxesBox.SetAxisDataRange(AxesBoxVisual3D.AxisTypes.YAxis, minimumValue: 0, maximumValue: 100, majorTicksStep: 10, minorTicksStep: 5, snapMaximumValueToMajorTicks: true); AxesBox.SetAxisDataRange(AxesBoxVisual3D.AxisTypes.ZAxis, minimumValue: -20, maximumValue: 200, majorTicksStep: 20, minorTicksStep: 5, snapMaximumValueToMajorTicks: true); // Set axes names: AxesBox.XAxis1.AxisTitle = "XAxis1"; AxesBox.XAxis2.AxisTitle = null; AxesBox.YAxis1.AxisTitle = "YAxis1"; AxesBox.YAxis2.AxisTitle = null; AxesBox.ZAxis1.AxisTitle = "ZAxis1"; AxesBox.ZAxis2.AxisTitle = null; AxesBox.OverlayCanvas = AxisOverlayCanvas; this.Unloaded += delegate(object sender, RoutedEventArgs args) { // It is recommended to call Dispose method when the AxesBox is no longer used. // This releases the native memory that is used by the RenderTargetBitmap objects that can be created by the TextBlockVisual3D object. AxesBox.Dispose(); }; }