예제 #1
0
            /// <summary>
            /// Overriden to perform dragging
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            public override void OnDoDrag(object sender, Nevron.Chart.Windows.NMouseEventArgs e)
            {
                NChart chart = this.GetDocument().Charts[0];

                Trace.WriteLine("X:" + e.X.ToString() + ", Y:" + e.Y.ToString());
                NViewToScale3DTransformation viewToScale;

                switch (m_DragPlaneSurface)
                {
                case DragPlaneSurface.XY:
                    viewToScale = new NViewToScale3DTransformation(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY, (int)StandardAxis.Depth, m_OriginalPosition.Z);
                    break;

                case DragPlaneSurface.XZ:
                    viewToScale = new NViewToScale3DTransformation(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.Depth, (int)StandardAxis.PrimaryY, m_OriginalPosition.Y);
                    break;

                case DragPlaneSurface.ZY:
                    viewToScale = new NViewToScale3DTransformation(chart, (int)StandardAxis.Depth, (int)StandardAxis.PrimaryY, (int)StandardAxis.PrimaryX, m_OriginalPosition.X);
                    break;

                default:
                    Debug.Assert(false);                             // new drag plane
                    return;
                }

                NVector3DD vecNewPosition = new NVector3DD();

                viewToScale.Transform(new NPointF(e.X, e.Y), ref vecNewPosition);

                m_DragPlane.MovePoint(m_DragPlaneSurface, vecNewPosition, m_DataPointIndex);
                m_DragPlane.PointSeries.Document.Refresh();
            }
예제 #2
0
            /// <summary>
            /// Return true if dragging can start
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            /// <returns></returns>
            public override bool CanBeginDrag(object sender, Nevron.Chart.Windows.NMouseEventArgs e)
            {
                object[] constLines = GetSelectedObjectsOfType(typeof(NAxisConstLine));

                if (constLines.Length == 0)
                {
                    return(false);
                }

                m_ConstLine = (NAxisConstLine)constLines[0];
                m_OrgValue  = m_ConstLine.Value;

                return(true);
            }
예제 #3
0
            /// <summary>
            /// Return true if dragging can start
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            /// <returns></returns>
            public override bool CanBeginDrag(object sender, Nevron.Chart.Windows.NMouseEventArgs e)
            {
                if (!base.CanBeginDrag(sender, e))
                {
                    return(false);
                }

                NPoint       point       = new NPoint(e.X, e.Y);
                NPointSeries pointSeries = m_DragPlane.PointSeries;
                NChart       chart       = pointSeries.Chart;
                NModel3DToViewTransformation model3DToViewTransformation = new NModel3DToViewTransformation(GetView().Context, chart.Projection);

                float xHotSpotArea = 10;
                float yHotSpotArea = 10;

                int dataPointIndex = -1;

                for (int i = 0; i < pointSeries.Values.Count; i++)
                {
                    double x = (double)pointSeries.XValues[i];
                    double y = (double)pointSeries.Values[i];
                    double z = (double)pointSeries.ZValues[i];

                    NVector3DF vecModelPoint;
                    vecModelPoint.X = chart.Axis(StandardAxis.PrimaryX).TransformScaleToModel(false, x);
                    vecModelPoint.Y = chart.Axis(StandardAxis.PrimaryY).TransformScaleToModel(false, y);
                    vecModelPoint.Z = chart.Axis(StandardAxis.Depth).TransformScaleToModel(false, z);

                    NPointF viewPoint = NPointF.Empty;
                    model3DToViewTransformation.Transform(vecModelPoint, ref viewPoint);

                    if (Math.Abs(viewPoint.X - point.X) < xHotSpotArea &&
                        Math.Abs(viewPoint.Y - point.Y) < yHotSpotArea)
                    {
                        dataPointIndex = i;
                        break;
                    }
                }

                if (dataPointIndex == -1)
                {
                    return(false);
                }

                m_DataPointIndex   = dataPointIndex;
                m_OriginalPosition = m_DragPlane.GetVectorFromPoint(m_DataPointIndex);

                return(true);
            }
        /// <summary>
        /// Return true if dragging can start
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public override bool CanBeginDrag(object sender, Nevron.Chart.Windows.NMouseEventArgs e)
        {
            if (!base.CanBeginDrag(sender, e))
            {
                return(false);
            }

            m_LastMousePosition = e;
            int dataPointIndex = GetDataPointIndexFromPoint(new NPoint(e.X, e.Y));

            if (dataPointIndex == -1)
            {
                return(false);
            }

            m_DataPointIndex   = dataPointIndex;
            m_OriginalPosition = m_DragPlane.GetVectorFromPoint(m_DataPointIndex);

            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnMouseMove(object sender, Nevron.Chart.Windows.NMouseEventArgs e)
        {
            base.OnMouseMove(sender, e);

            m_LastMousePosition = e;
        }