UMD.HCIL.Piccolo.PNode.GlobalToLocal C# (CSharp) Method

GlobalToLocal() public method

Transform the given point from global coordinates to this node's local coordinate system.
public GlobalToLocal ( PointF point ) : PointF
point System.Drawing.PointF The point in global coordinates to be transformed.
return System.Drawing.PointF
		public virtual PointF GlobalToLocal(PointF point) {
			if (Parent != null) {
				point = Parent.GlobalToLocal(point);
			}
			return ParentToLocal(point);
		}

Same methods

PNode::GlobalToLocal ( RectangleF rectangle ) : RectangleF
PNode::GlobalToLocal ( SizeF size ) : SizeF

Usage Example

		public virtual PActivity DirectCameraViewToFocus(PCamera aCamera, PNode aFocusNode, PPickPath path, int duration) {
			PMatrix originalViewMatrix = aCamera.ViewMatrix;

			// Scale the canvas to include
			SizeF s = new SizeF(1, 0);
			s = aFocusNode.GlobalToLocal(s);
		
			float scaleFactor = s.Width / aCamera.ViewScale;
			PointF scalePoint = PUtil.CenterOfRectangle(aFocusNode.GlobalFullBounds);
			if (scaleFactor != 1) {
				aCamera.ScaleViewBy(scaleFactor, scalePoint.X, scalePoint.Y);
			}
		
			// Pan the canvas to include the view bounds with minimal canvas
			// movement.
			aCamera.AnimateViewToPanToBounds(aFocusNode.GlobalFullBounds, 0);

			// Get rid of any white space. The canvas may be panned and
			// zoomed in to do this. But make sure not stay constrained by max
			// magnification.
			//FillViewWhiteSpace(aCamera);

			PMatrix resultingMatrix = aCamera.ViewMatrix;
			aCamera.ViewMatrix = originalViewMatrix;

			// Animate the canvas so that it ends up with the given
			// view transform.
			PActivity animateCameraViewActivity = AnimateCameraViewMatrixTo(aCamera, resultingMatrix, duration);

			PControl controlNode = (PControl)aFocusNode;
			aCamera.Root.WaitForActivities();

			controlNode.CurrentCanvas = path.TopCamera.Canvas;
			PointF pf = path.GetPathTransformTo(controlNode).Transform(new PointF(controlNode.X, controlNode.Y));
			controlNode.ControlLocation = new Point((int)pf.X, (int)pf.Y);

			controlNode.Editing = true;

			return animateCameraViewActivity;
		}
All Usage Examples Of UMD.HCIL.Piccolo.PNode::GlobalToLocal