public void RecalcPrimaryDependant(Canguro.View.GraphicView activeView, PointMagnet primaryPoint, LineMagnet[] globalAxes)
        {
            if (primaryPoint != null)
            {
                // Move area to lay on the primaryPoint and to set its direction any canonic
                // plane (X=x, Y=y or Z=z) which is the most paralell to the screen plane
                position = primaryPoint.Position;

                // Get screen plane normal
                Vector3 s0 = screenNormal[0], s1 = screenNormal[1], sNormal;
                activeView.Unproject(ref s0);
                activeView.Unproject(ref s1);
                sNormal = s0 - s1;

                // Assign the area normal to the most paralell canonical plane
                // (giving priority to the Z plane)
                int   maxCosIndex = 2;
                float cosX, cosY, cosZ;
                cosX = Vector3.Dot(sNormal, globalAxes[0].Direction);
                cosY = Vector3.Dot(sNormal, globalAxes[1].Direction);
                cosZ = Vector3.Dot(sNormal, globalAxes[2].Direction);

                if (Math.Abs(cosZ) < minZPlaneAngle)
                {
                    maxCosIndex = (cosX >= cosY) ? ((cosX > cosZ) ? 0 : 2) : ((cosY > cosZ) ? 1 : 2);
                }

                normal = globalAxes[maxCosIndex].Direction;
            }
            else
            {
                position = Vector3.Empty;
                normal   = globalAxes[2].Direction;
            }
        }
Exemple #2
0
 /// <summary>
 /// Sets the RenderOptions.InternalForcesShown property to None
 /// </summary>
 /// <param name="activeView">The Active View object</param>
 public override void  Run(Canguro.View.GraphicView activeView)
 {
     if (activeView.ModelRenderer != null && activeView.ModelRenderer.ForcesRenderer != null)
     {
         activeView.ModelRenderer.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.None;
     }
 }
Exemple #3
0
        public bool MouseMove(object sender, MouseEventArgs e, Canguro.View.GraphicView activeView)
        {
            Viewport vp = activeView.Viewport;

            if (e.X >= vp.X && e.X <= vp.X + vp.Width && e.Y >= vp.Y && e.Y <= vp.Y + vp.Height)
            {
                bool needPaint = (trackingService != null);

                if (snapController.IsActive)
                {
                    needPaint |= snapController.MouseMove(activeView, e) || (trackingService != null);
                }

                if (hoverController.IsActive && !activeView.ModelRenderer.RenderOptions.ShowAnimated)
                {
                    needPaint |= hoverController.MouseMove(activeView, e);
                }

                if (needPaint && trackingService != null)
                {
                    trackingService.MouseMove(e.Location);
                }

                return(needPaint);
            }

            return(false);
        }
Exemple #4
0
        /// <summary>
        /// From min and max coords of the BB, project them according to the active view, for determining zooming scale
        /// </summary>
        /// <param name="min"> The min coord of BB </param>
        /// <param name="max"> The max coord of BB </param>
        /// <param name="activeView"> Active view to zoom </param>
        /// <returns> Returns an array of two vectos in screen space </returns>
        private Vector2[] findMaxPoints(Vector3 min, Vector3 max, Canguro.View.GraphicView activeView)
        {
            Vector3[] boundingVolume = new Vector3[8];

            Vector2[] screen = new Vector2[2];

            screen[0] = new Vector2(float.MaxValue, float.MaxValue);
            screen[1] = new Vector2(float.MinValue, float.MinValue);

            boundingVolume[0] = min;
            boundingVolume[1] = new Vector3(min.X, min.Y, max.Z);
            boundingVolume[2] = new Vector3(max.X, min.Y, max.Z);
            boundingVolume[3] = new Vector3(max.X, min.Y, min.Z);

            boundingVolume[4] = new Vector3(max.X, max.Y, min.Z);
            boundingVolume[5] = max;
            boundingVolume[6] = new Vector3(min.X, max.Y, max.Z);
            boundingVolume[7] = new Vector3(min.X, max.Y, min.Z);

            for (int i = 0; i < boundingVolume.GetLength(0); ++i)
            {
                activeView.Project(ref boundingVolume[i]);
                screen[0].X = (screen[0].X > boundingVolume[i].X) ? boundingVolume[i].X : screen[0].X;
                screen[0].Y = (screen[0].Y > boundingVolume[i].Y) ? boundingVolume[i].Y : screen[0].Y;

                screen[1].X = (screen[1].X < boundingVolume[i].X) ? boundingVolume[i].X : screen[1].X;
                screen[1].Y = (screen[1].Y < boundingVolume[i].Y) ? boundingVolume[i].Y : screen[1].Y;
            }

            return(screen);
        }
 public void RecalcPrimaryDependant(Canguro.View.GraphicView activeView, PointMagnet primaryPoint)
 {
     if (primaryPoint != null)
     {
         resetGlobalAxes(primaryPoint.Position);
     }
 }
Exemple #6
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the RotationMatrix for the View with a Default 3D View and Executes ZoomAll.
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void Run(Canguro.View.GraphicView activeView)
 {
     activeView.ArcBallCtrl.ResetRotation();
     activeView.ArcBallCtrl.RotationMatrix = Matrix.RotationX(-(float)Math.PI / 2.0f) * Matrix.RotationY(-3.0f * (float)Math.PI / 4.0f) * Matrix.RotationX((float)Math.PI / 6.0f);
     activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
     ZoomAll.Instance.Run(activeView);
 }
Exemple #7
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the InternalForcesShown property of RenderOptions to Mx
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void Run(Canguro.View.GraphicView activeView)
 {
     Canguro.View.Renderer.ModelRenderer mr = activeView.ModelRenderer;
     if (mr != null)
     {
         mr.RenderOptions.LineColoredBy = Canguro.View.Renderer.RenderOptions.LineColorBy.NonDefaultPropertyAssigned;
     }
 }
 /// <summary>
 /// If Right Mouse Button was clicked, then end current selection cycle
 /// </summary>
 /// <param name="activeView">The active View</param>
 /// <param name="e">MouseUp event arguments</param>
 public override void ButtonUp(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
 {
     // If right Button Click, end current selection cycle
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         endCycle(null);
     }
 }
Exemple #9
0
        /// <summary>
        /// Makes zoom based in an arcball property and a step value for unification with the rest of zoom commands
        /// </summary>
        /// <param name="activeView"> Active view in scene panel </param>
        /// <param name="step"> Zoom step: How much the scene view is zoomed </param>
        private void Zoom(Canguro.View.GraphicView activeView, float step)
        {
            // Invoke arcball's zooming routine
            activeView.ArcBallCtrl.ZoomStep(step);

            // Update activeView view matrix
            activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
        }
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            gv = activeView;
            oldM = gv.ViewMatrix;
            firstY = e.Y;

            gv.ArcBallCtrl.OnBeginZoom(e);
        }
Exemple #11
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the InternalForcesShown property of RenderOptions to Mx
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void Run(Canguro.View.GraphicView activeView)
 {
     Canguro.View.Renderer.ModelRenderer mr = activeView.ModelRenderer;
     if (mr != null)
     {
         mr.RenderOptions.LineColoredBy = Canguro.View.Renderer.RenderOptions.LineColorBy.Material;
     }
 }
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            gv     = activeView;
            oldM   = gv.ViewMatrix;
            firstY = e.Y;

            gv.ArcBallCtrl.OnBeginZoom(e);
        }
Exemple #13
0
 public void Reset(Canguro.View.GraphicView activeView)
 {
     if (trackingService != null)
     {
         trackingService.Reset(activeView);
     }
     snapController.Reset(activeView);
     hoverController.Reset(activeView);
 }
Exemple #14
0
        private Controller.Snap.Magnet pickPoint(Canguro.View.GraphicView activeView)
        {
            return(Controller.Controller.Instance.TrackingController.SnapController.SnapMagnet);
            //Controller.Snap.Magnet magnet = Controller.Controller.Instance.TrackingController.SnapController.SnapMagnet;
            //if (magnet != null)
            //    return magnet.SnapPosition;

            //Vector3 v = new Vector3(fx, fy, 0.5f);
            //activeView.Unproject(ref v);
            //return v;
        }
Exemple #15
0
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            // Store initial state
            gv   = activeView;
            oldM = gv.ViewMatrix;

            // Get Screen Coordinates and prepare ArcBall
            //gv.InitArcBall(System.Windows.Forms.MouseEventArgs e)

            //gv.ArcBallCtrl.OnBeginRotate(e, new Vector3(8,8,8));
            gv.ArcBallCtrl.OnBeginRotate(e, Controller.Controller.Instance.SelectionCommand.GetViewableObjectsCentroid(activeView));
        }
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            // Store initial state
            gv = activeView;
            oldM = gv.ViewMatrix;

            // Get Screen Coordinates and prepare ArcBall
            //gv.InitArcBall(System.Windows.Forms.MouseEventArgs e)

            //gv.ArcBallCtrl.OnBeginRotate(e, new Vector3(8,8,8));
            gv.ArcBallCtrl.OnBeginRotate(e, Controller.Controller.Instance.SelectionCommand.GetViewableObjectsCentroid(activeView));
        }
        public override float Snap(Canguro.View.GraphicView activeView, Point mousePoint)
        {
            // Project point
            Vector3 p = position, q = new Vector3((float)mousePoint.X, (float)mousePoint.Y, 0.1f);

            activeView.Project(ref p);
            p.Z = 0.1f;

            Vector3 d = q - p;

            return(lastSnapFitness = Vector3.Dot(d, d));
        }
Exemple #18
0
        /// <summary>
        /// Method to return the four bounding planes given two points in screen coordinates
        /// (as in two mouse clicks). A plane can be defined by a point on it and its normal,
        /// which is what is beaing returned for each of the four planes as defined by selectWindow.
        ///
        /// For this, 8 points are calculated, two for each corner, for the front and back plane.
        /// This defines a box. The points are to be defined as pointing towards the screen (i.e. a1 lies
        /// in the middle of the volume and a2 is in the front plane), regardless of the coordinate system
        /// used (left or right handed), and the second point will be at the screen plane.
        /// </summary>
        /// <param name="activeView">The view that's used for calculating the bounding planes</param>
        /// <param name="fx1">Clicked first point, X screen coordinate</param>
        /// <param name="fy1">Clicked first point, Y screen coordinate</param>
        /// <param name="fx2">Clicked second point, X screen coordinate</param>
        /// <param name="fy2">Clicked second point, Y screen coordinate</param>
        /// <param name="nAB">Returns the calculated normal for the plane AB</param>
        /// <param name="sAB">Returns a point on the calculated plane AB</param>
        /// <param name="nBC">Returns the calculated normal for the plane BC</param>
        /// <param name="sBC">Returns a point on the calculated plane BC</param>
        /// <param name="nCD">Returns the calculated normal for the plane CD</param>
        /// <param name="sCD">Returns a point on the calculated plane CD</param>
        /// <param name="nDA">Returns the calculated normal for the plane DA</param>
        /// <param name="sDA">Returns a point on the calculated plane DA</param>
        private void getPlanes(Canguro.View.GraphicView activeView, int fx1, int fy1, int fx2, int fy2,
                               out Vector3 nAB, out Vector3 sAB, out Vector3 nBC, out Vector3 sBC,
                               out Vector3 nCD, out Vector3 sCD, out Vector3 nDA, out Vector3 sDA,
                               ref Vector3[] corners1, ref Vector3[] corners2)
        {
            // First calculate the 8 points (2 for each corner)
            Vector3 a1 = new Vector3(fx1, fy1, 0.5f);
            Vector3 a2 = new Vector3(fx1, fy1, 1);
            Vector3 b1 = new Vector3(fx2, fy1, 0.5f);
            Vector3 b2 = new Vector3(fx2, fy1, 1);
            Vector3 c1 = new Vector3(fx2, fy2, 0.5f);
            Vector3 c2 = new Vector3(fx2, fy2, 1);
            Vector3 d1 = new Vector3(fx1, fy2, 0.5f);
            Vector3 d2 = new Vector3(fx1, fy2, 1);

            activeView.Unproject(ref a1);
            activeView.Unproject(ref a2);
            activeView.Unproject(ref b1);
            activeView.Unproject(ref b2);
            activeView.Unproject(ref c1);
            activeView.Unproject(ref c2);
            activeView.Unproject(ref d1);
            activeView.Unproject(ref d2);

            if (corners1 != null && corners2 != null && corners1.Length == 4 && corners2.Length == 4)
            {
                corners1[0] = a1;
                corners1[1] = b1;
                corners1[2] = c1;
                corners1[3] = d1;

                corners2[0] = a2;
                corners2[1] = b2;
                corners2[2] = c2;
                corners2[3] = d2;
            }

            // Now calculate the normals
            // If points P and Q are consecutive and in CCW order, then
            // normal = (q2 - p1) x (q1 - p1)
            nAB = Vector3.Normalize(Vector3.Cross((b2 - a1), (b1 - a1)));
            nBC = Vector3.Normalize(Vector3.Cross((c2 - b1), (c1 - b1)));
            nCD = Vector3.Normalize(Vector3.Cross((d2 - c1), (d1 - c1)));
            nDA = Vector3.Normalize(Vector3.Cross((a2 - d1), (a1 - d1)));

            // Now assign the points on the planes.
            // Points calculated at the corners are used here
            sAB = a1;
            sBC = c1;
            sCD = c1;
            sDA = a1;
        }
        public override float Snap(Canguro.View.GraphicView activeView, Point mousePoint)
        {
            // Get ray from mouse position
            Vector3 rayP1 = new Vector3(mousePoint.X, mousePoint.Y, 1f);
            Vector3 rayP2 = new Vector3(mousePoint.X, mousePoint.Y, 0f);

            activeView.Unproject(ref rayP1);
            activeView.Unproject(ref rayP2);
            Vector3 ray = rayP2 - rayP1;

            ray.Normalize();

            // Check best plane angle
            Vector3 normalTmp = normal;
            float   cosAngle  = Math.Abs(Vector3.Dot(ray, normal));

            if (cosAngle < 0.03f)
            {
                float xCosAngle = Math.Abs(Vector3.Dot(ray, CommonAxes.GlobalAxes[0]));
                float yCosAngle = Math.Abs(Vector3.Dot(ray, CommonAxes.GlobalAxes[1]));
                float zCosAngle = Math.Abs(Vector3.Dot(ray, CommonAxes.GlobalAxes[2]));

                if (xCosAngle >= yCosAngle)
                {
                    if (xCosAngle > zCosAngle)
                    {
                        normalTmp = CommonAxes.GlobalAxes[0];   // YZ Plane
                    }
                    else
                    {
                        normalTmp = CommonAxes.GlobalAxes[2];   // XY Plane
                    }
                }
                else if (yCosAngle > zCosAngle)
                {
                    normalTmp = CommonAxes.GlobalAxes[1];   // XZ Plane
                }
                else
                {
                    normalTmp = CommonAxes.GlobalAxes[2];   // XY Plane
                }
            }

            float r = Vector3.Dot(position - rayP1, normalTmp) / Vector3.Dot(ray, normalTmp);

            snapPosition = rayP1 + Vector3.Scale(ray, r);

            return(lastSnapFitness = 0f);
        }
Exemple #20
0
        public override void Run(Canguro.View.GraphicView activeView)
        {
            if (activeView.ArcBallsInStack > 1)
            {
                activeView.PopArcBall();
                // Update activeView view matrix
                activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Culture.Get(Canguro.Properties.Resources.noZoomPreviousToDo));
            }

            //System.Windows.Forms.MessageBox.Show("Javier... Implementa!!!!");
        }
Exemple #21
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the InternalForcesShown property of RenderOptions to Sx
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void  Run(Canguro.View.GraphicView activeView)
 {
     Canguro.View.Renderer.ModelRenderer mr = activeView.ModelRenderer;
     if (mr != null && mr.ForcesRenderer != null)
     {
         if (mr.RenderOptions.InternalForcesShown == Canguro.View.Renderer.RenderOptions.InternalForces.Sx)
         {
             mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.None;
         }
         else
         {
             mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.Sx;
         }
     }
 }
Exemple #22
0
        public Vector3 GetViewableObjectsCentroid(Canguro.View.GraphicView activeView)
        {
            // Set window equal to viewport to select everything visible
            int fx1 = activeView.Viewport.X;
            int fy1 = activeView.Viewport.Y;
            int fx2 = activeView.Viewport.X + activeView.Viewport.Width;
            int fy2 = activeView.Viewport.Y + activeView.Viewport.Height;

            List <Canguro.Model.Item> crossingItems = new List <Canguro.Model.Item>();

            SelectWindow(activeView, fx1, fy1, fx2, fy2, crossingItems, Canguro.Controller.SelectionFilter.Joints | Canguro.Controller.SelectionFilter.Lines);

            int     centroidPts = 0;
            Vector3 centroid    = Vector3.Empty;

            foreach (Canguro.Model.Item item in crossingItems)
            {
                if (item is Canguro.Model.Joint)
                {
                    centroidPts++;
                    centroid += ((Canguro.Model.Joint)item).Position;
                }
                else if (item is Canguro.Model.LineElement)
                {
                    centroidPts++;
                    centroid += ((Canguro.Model.LineElement)item).I.Position;
                    centroidPts++;
                    centroid += ((Canguro.Model.LineElement)item).J.Position;
                }
            }

            if (centroidPts > 0)
            {
                return(centroid * (1.0f / centroidPts));
            }
            else
            {
                //if nothing is in view, then return the center of the viewing frustum
                Vector3 screenCenter = new Vector3(activeView.Viewport.X + activeView.Viewport.Width / 2, activeView.Viewport.Y + activeView.Viewport.Height / 2, 0.5f);
                activeView.Unproject(ref screenCenter);
                return(screenCenter);
            }
        }
        public void Snap(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            try
            {
                float snap, snapDelta = 0f;
                snapSqDistances.Clear();
                bool foundCurrentLine = false;

                LineMagnet currLineTmp = currentLine;

                foreach (Magnet m in this)
                {
                    if ((m != null) && (snap = m.Snap(activeView, e.Location)) < SnapController.SnapViewDistance)
                    {
                        if (m == currentLine)
                        {
                            foundCurrentLine = true;

                            // Penalize the snap of Axes LineMagnets to allow other magnets
                            // to appear and become active
                            if (currentLine != null &&
                                (currentLine.Type == LineMagnetType.FollowXAxis ||
                                 currentLine.Type == LineMagnetType.FollowYAxis ||
                                 currentLine.Type == LineMagnetType.FollowZAxis))
                            {
                                snap = Math.Min(snap + 10f, SnapController.SnapViewDistance - SnapController.SnapEpsilon);
                            }
                        }
                        snapSqDistances.Add(snap + snapDelta, m);
                        snapDelta += 0.01f;
                    }
                }

                if (!foundCurrentLine)
                {
                    CurrentLine = null;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Print(ex.Message);
            }
        }
Exemple #24
0
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            // Store initial state
            gv = activeView;
            oldM = gv.ViewMatrix;
            /*
            // Store fx and fy as first interaction point
            fx = e.X; fy = e.Y;

            // Calculate unitary (in terms of pixels) basis for displacement
            Vector3 zero = new Vector3(0, 0, 0.5f);
            basisU = new Vector3(1, 0, 0.5f);
            basisV = new Vector3(0, 1, 0.5f);
            gv.Unproject(ref zero);
            gv.Unproject(ref basisU);
            gv.Unproject(ref basisV);
            basisU -= zero;
            basisV -= zero;
            */
            gv.ArcBallCtrl.OnBeginPan(e);
        }
Exemple #25
0
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            // Store initial state
            gv   = activeView;
            oldM = gv.ViewMatrix;

/*
 *          // Store fx and fy as first interaction point
 *          fx = e.X; fy = e.Y;
 *
 *          // Calculate unitary (in terms of pixels) basis for displacement
 *          Vector3 zero = new Vector3(0, 0, 0.5f);
 *          basisU = new Vector3(1, 0, 0.5f);
 *          basisV = new Vector3(0, 1, 0.5f);
 *          gv.Unproject(ref zero);
 *          gv.Unproject(ref basisU);
 *          gv.Unproject(ref basisV);
 *          basisU -= zero;
 *          basisV -= zero;
 */
            gv.ArcBallCtrl.OnBeginPan(e);
        }
        public void Snap(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            float snap;

            snapSqDistances.Clear();
            foreach (Magnet m in this)
            {
                if ((m != null) && (snap = m.Snap(activeView, e.Location)) < SnapController.SnapViewDistance)
                {
                    if ((m is PointMagnet) && ((PointMagnet)m).Joint == null)
                    {
                        snap += SnapController.NoJointMagnetPenalty;
                    }

                    if (!snapSqDistances.ContainsKey(snap))
                    {
                        snapSqDistances.Add(snap, new List <Magnet>());
                    }

                    snapSqDistances[snap].Add(m);
                }
            }
        }
        public override float Snap(Canguro.View.GraphicView activeView, Point mousePoint)
        {
            Vector3 mousePosition;

            // Project points
            Vector3 p = position, p2 = position + direction;

            activeView.Project(ref p);
            activeView.Project(ref p2);
            Vector3 v = p2 - p;

            p.Z = 0.1f;

            mousePosition = new Vector3((float)mousePoint.X, (float)mousePoint.Y, 0.1f);
            float   r         = Vector3.Dot(v, mousePosition - p) / Vector3.Dot(v, v);
            Vector3 snapPoint = p + Vector3.Scale(v, r);

            snapPosition = position + Vector3.Scale(direction, r);

            Vector3 d = mousePosition - snapPoint;

            return(lastSnapFitness = Vector3.Dot(d, d));
        }
Exemple #28
0
        void endWindowSelection(bool performSelection, Canguro.View.GraphicView activeView, Canguro.Controller.WaitingFor wf)
        {
            if (performSelection)
            {
                if (wfx > fx)
                {
                    int ffx = fx;
                    fx  = wfx;
                    wfx = ffx;
                }
                if (wfy > fy)
                {
                    int ffy = fy;
                    fy  = wfy;
                    wfy = ffy;
                }

                SelectWindow(activeView, wfx, wfy, fx, fy, null, Canguro.Controller.SelectionFilter.Joints | Canguro.Controller.SelectionFilter.Lines | Canguro.Controller.SelectionFilter.Areas);

                // TODO: Esto no está del todo bien porque avisa directo al Modelo
                if (newlySelected)
                {
                    Canguro.Model.Model.Instance.ChangeSelection(null);
                }
            }

            if (windowSelectionOn)
            {
                endTracking();
            }

            windowSelectionOn   = false;
            newlySelected       = false;
            crossingSelectionOn = false;

            resetCursor();
        }
Exemple #29
0
        private void zoom(Canguro.View.GraphicView activeView)
        {
            // use first & last points to find scale an translate values.
            float screenSize = (float)Math.Min(activeView.Viewport.Height, activeView.Viewport.Width);
            float sizeX      = last.X - first.X;
            float sizeY      = last.Y - first.Y;

            MouseEventArgs e = new MouseEventArgs(MouseButtons.Left, 1, (int)(first.X + sizeX / 2), (int)(first.Y + sizeY / 2), 0);

            activeView.ArcBallCtrl.OnBeginPan(e);

            e = new MouseEventArgs(MouseButtons.Left, 1, activeView.Viewport.Width / 2, activeView.Viewport.Height / 2, 0);
            activeView.ArcBallCtrl.OnMovePan(e);

            activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;

            // View volume scaling
            float newScale = 0.0f;

            newScale = screenSize * activeView.ArcBallCtrl.ScalingFac / (float)Math.Max(sizeX, sizeY);

            activeView.ArcBallCtrl.ZoomAbsolute(newScale);
            activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
        }
Exemple #30
0
        public override void MouseMove(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            if (windowSelectionOn)
            {
                // Switch between select Window and select Crossing
                // depending on the direction of the bounding rectangle
                RectangleTrackingService rts;
                rts = Canguro.Controller.Controller.Instance.TrackingController.TrackingService as RectangleTrackingService;

                if (rts != null)
                {
                    if (!crossingSelectionOn && (e.Location.X - wfx) < 0)
                    {
                        rts.SetColor(System.Drawing.Color.FromArgb(120, 173, 255, 200), System.Drawing.Color.Green);
                        crossingSelectionOn = true;
                    }
                    else if (crossingSelectionOn && (e.Location.X - wfx) >= 0)
                    {
                        rts.SetColor();
                        crossingSelectionOn = false;
                    }
                }
            }
        }
 public void RecalcPrimaryDependant(Canguro.View.GraphicView activeView)
 {
     needRecalcPrimaryPointDependant = false;
 }
Exemple #32
0
 public virtual void MouseWheel(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
 {
 }
Exemple #33
0
 public virtual void MouseMove(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// This method is called by the Controller to set up the Tracking service at
 /// the initial state and with the correct parameters
 /// </summary>
 /// <param name="gv">The ActiveView as known by the GraphicViewManager</param>
 public void Reset(Canguro.View.GraphicView gv)
 {
     graphicView = gv;
     reset();
 }