示例#1
0
 /// <summary>
 /// Pushes the given matrix onto the matrix stack.
 /// </summary>
 /// <param name="aMatrix">The matrix to push.</param>
 public virtual void PushMatrix(Matrix aMatrix)
 {
     matrixStack.Push(new PTuple(PickedNode, aMatrix));
     if (aMatrix != null)
     {
         RectangleFx pickBound     = PickBounds;
         RectangleFx newPickBounds = MatrixExtensions.InverseTransform(aMatrix, pickBound);
         pickBoundsStack.Push(newPickBounds);
     }
 }
示例#2
0
        /// <summary>
        /// Pushes the given matrix onto the transform stack.
        /// </summary>
        /// <param name="matrix">The matrix to push.</param>
        /// <remarks>
        /// This method also applies the matrix to the graphics context and the current local clip.
        /// The new local clip is then pushed onto the local clip stack.
        /// </remarks>
        public virtual void PushMatrix(Matrix matrix)
        {
            if (matrix == null)
            {
                return;
            }
            RectangleFx localClip    = LocalClip;
            RectangleFx newLocalClip = MatrixExtensions.InverseTransform(matrix, localClip);

            transformStack.Push(graphics.Transform);
            localClipStack.Push(newLocalClip);
            graphics.MultiplyTransform(matrix);
        }
示例#3
0
        /// <summary>
        /// Convert the given rectangle from canvas coordinates, down the pick path (and through
        /// any camera view transforms applied to the path) to the local coordinates of the given
        /// node.
        /// </summary>
        /// <param name="canvasRectangle">The rectangle in canvas coordinates.</param>
        /// <param name="nodeOnPath">
        /// The node for which the local coordinates will be computed.
        /// </param>
        /// <returns>The rectangle in the local coordinates of the given node.</returns>
        public virtual RectangleFx CanvasToLocal(RectangleFx canvasRectangle, PNode nodeOnPath)
        {
            Matrix path = GetPathTransformTo(nodeOnPath);

            return(MatrixExtensions.InverseTransform(path, canvasRectangle));
        }
示例#4
0
        //****************************************************************
        // Transforming Geometry - Methods to transform geometry through
        // this path.
        //
        // Note that this is different that just using the
        // PNode.LocalToGlobal (an other coord system transform methods).
        // The PNode coord system transform methods always go directly up
        // through their parents. The PPickPath coord system transform
        // methods go up through the list of picked nodes instead. And since
        // cameras can pick their layers in addition to their children these
        // two paths may be different.
        //****************************************************************

        /// <summary>
        /// Convert the given point from canvas coordinates, down the pick path (and through any
        /// camera view transforms applied to the path) to the local coordinates of the given node.
        /// </summary>
        /// <param name="canvasPoint">The point in canvas coordinates.</param>
        /// <param name="nodeOnPath">
        /// The node for which the local coordinates will be computed.
        /// </param>
        /// <returns>The point in the local coordinates of the given node.</returns>
        public virtual PointFx CanvasToLocal(PointFx canvasPoint, PNode nodeOnPath)
        {
            Matrix path = GetPathTransformTo(nodeOnPath);

            return(MatrixExtensions.InverseTransform(path, canvasPoint));
        }
示例#5
0
 /// <summary>
 /// Transform the rectangle from the camera's local coordinate system to the camera's
 /// view coordinate system.
 /// </summary>
 /// <param name="rectangle">
 /// The rectangle in the camera's local coordinate system to be transformed.
 /// </param>
 /// <returns>The rectangle in the camera's view coordinate system.</returns>
 public virtual RectangleFx LocalToView(RectangleFx rectangle)
 {
     return(MatrixExtensions.InverseTransform(viewMatrix, rectangle));
 }
示例#6
0
 /// <summary>
 /// Transform the size from the camera's local coordinate system to the camera's
 /// view coordinate system.
 /// </summary>
 /// <param name="size">
 /// The size in the camera's local coordinate system to be transformed.
 /// </param>
 /// <returns>The size in the camera's view coordinate system.</returns>
 public virtual SizeFx LocalToView(SizeFx size)
 {
     return(MatrixExtensions.InverseTransform(viewMatrix, size));
 }
示例#7
0
 /// <summary>
 /// Transform the point from the camera's local coordinate system to the camera's
 /// view coordinate system.
 /// </summary>
 /// <param name="point">
 /// The point in the camera's local coordinate system to be transformed.
 /// </param>
 /// <returns>The point in the camera's view coordinate system.</returns>
 public virtual PointFx LocalToView(PointFx point)
 {
     return(MatrixExtensions.InverseTransform(viewMatrix, point));
 }