Exemplo n.º 1
0
        /// <summary>
        /// Gets the transformation of this item plus an additional transformation. Both together transform world coordinates to page coordinates.
        /// </summary>
        /// <param name="additionalTransformation">The additional transformation matrix.</param>
        /// <returns></returns>
        public MatrixD2D GetTransformation(MatrixD2D additionalTransformation)
        {
            var result = new MatrixD2D(_transformation);

            result.PrependTransform(additionalTransformation);
            return(result);
        }
Exemplo n.º 2
0
        public HitTestRectangularData NewFromAdditionalTransformation(MatrixD2D additionalTransformation)
        {
            var result = new HitTestRectangularData(this);

            result.Transformation.PrependTransform(additionalTransformation);
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the hitted point in world coordinated by applying the inverse current coordinate transformation and then the provided inverse coordinate transformation.
        /// </summary>
        /// <returns>Hitted point in world coordinates.</returns>
        public PointD2D GetHittedPointInWorldCoord(MatrixD2D additionalTransform)
        {
            var result = GetHittedPointInWorldCoord();

            result = additionalTransform.InverseTransformPoint(result);
            return(result);
        }
Exemplo n.º 4
0
        public bool IsCovering(RectangleD2D rect, MatrixD2D additionalTransform)
        {
            PointD2D pt;

            pt = _transformation.TransformPoint(additionalTransform.TransformPoint(new PointD2D(rect.X, rect.Y)));
            if (!_hittedAreaInPageCoord.Contains(pt))
            {
                return(false);
            }

            pt = _transformation.TransformPoint(additionalTransform.TransformPoint(new PointD2D(rect.Right, rect.Y)));
            if (!_hittedAreaInPageCoord.Contains(pt))
            {
                return(false);
            }

            pt = _transformation.TransformPoint(additionalTransform.TransformPoint(new PointD2D(rect.X, rect.Bottom)));
            if (!_hittedAreaInPageCoord.Contains(pt))
            {
                return(false);
            }

            pt = _transformation.TransformPoint(additionalTransform.TransformPoint(new PointD2D(rect.Right, rect.Bottom)));
            if (!_hittedAreaInPageCoord.Contains(pt))
            {
                return(false);
            }

            return(true);
        }
 public RotationGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
 {
     _parent               = parent;
     _drawrPosition        = relPos;
     _fixrPosition         = new PointD2D(0.5, 0.5);
     _fixaPosition         = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);
     _spanningHalfYRhombus = spanningHalfYRhombus;
 }
Exemplo n.º 6
0
 public ShearGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
 {
     _parent               = parent;
     _drawrPosition        = relPos;
     _fixrPosition         = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
     _fixaPosition         = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);
     _spanningHalfYRhombus = spanningHalfYRhombus;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Returns the hitted area in world coordinated by applying the inverse current coordinate transformation.
        /// </summary>
        /// <returns>Hitted point in world coordinates.</returns>
        public MatrixD2D GetHittedAreaInWorldCoord()
        {
            var pt0 = _transformation.InverseTransformPoint(_hittedAreaInPageCoord.Location);
            var pt1 = _transformation.InverseTransformVector(new PointD2D(0, _hittedAreaInPageCoord.Height));
            var pt2 = _transformation.InverseTransformPoint(new PointD2D(_hittedAreaInPageCoord.Width, 0));

            var result = new MatrixD2D(pt1.X, pt1.Y, pt2.X, pt2.Y, pt0.X, pt0.Y);

            return(result);
        }
            public RescaleGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
            {
                _parent        = parent;
                _drawrPosition = relPos;
                _drawaPosition = GraphObject.RelativeToAbsolutePosition(_drawrPosition, true);

                _fixrPosition = new PointD2D(1 - relPos.X, 1 - relPos.Y);
                _fixaPosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);

                _spanningHalfYRhombus = spanningHalfYRhombus;
            }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the absolute enclosing rectangle, taking into account ScaleX, ScaleY, Rotation and Shear (SSRS).
        /// </summary>
        /// <returns>The enclosing rectangle in absolute values.</returns>
        public RectangleD2D GetAbsoluteEnclosingRectangle()
        {
            var m = new MatrixD2D();

            m.SetTranslationRotationShearxScale(AbsolutePivotPositionX, AbsolutePivotPositionY, -Rotation, ShearX, ScaleX, ScaleY);
            m.TranslatePrepend(AbsoluteVectorPivotToLeftUpper.X, AbsoluteVectorPivotToLeftUpper.Y);

            var s  = AbsoluteSize;
            var p1 = m.TransformPoint(new PointD2D(0, 0));
            var p2 = m.TransformPoint(new PointD2D(s.X, 0));
            var p3 = m.TransformPoint(new PointD2D(0, s.Y));
            var p4 = m.TransformPoint(new PointD2D(s.X, s.Y));

            var r = new RectangleD2D(p1, PointD2D.Empty);

            r.ExpandToInclude(p2);
            r.ExpandToInclude(p3);
            r.ExpandToInclude(p4);
            return(r);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Appends a transformation to the transformation matrix of the hit test object. Call this while walking down the hierarchie of objects.
 /// </summary>
 /// <param name="x">The transformation to append.</param>
 public override void Transform(MatrixD2D x)
 {
     base.Transform(x);
     _objectPath.Transform(x);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Appends a transformation to the transformation matrix of the hit test object. Call this while walking down the hierarchie of objects.
 /// </summary>
 /// <param name="x">The transformation to append.</param>
 public virtual void Transform(MatrixD2D x)
 {
     _matrix.AppendTransform(x);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a new HitTestObject.
 /// </summary>
 /// <param name="objectPath">Path of the object outline used for arrangement of multiple objects.
 /// This path is in object world coordinates.</param>
 /// <param name="transformation">Transformation matrix of the object.</param>
 /// <param name="hitobject">The hitted object.</param>
 public HitTestObject(GraphicsPath objectPath, MatrixD2D transformation, object hitobject)
     : base(hitobject)
 {
     _objectPath = objectPath;
     _objectPath.Transform(transformation);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="hitPointPageCoord">Page coordinates (unit: points).</param>
 /// <param name="pageScale">Current zoom factor, i.e. ration between displayed size on the screen and given size.</param>
 public HitTestPointData(PointD2D hitPointPageCoord, double pageScale)
 {
     _hittedPointInPageCoord = hitPointPageCoord;
     _pageScale      = pageScale;
     _transformation = new MatrixD2D();
 }
Exemplo n.º 14
0
 /// <summary>
 /// Creates a new HitTestObject.
 /// </summary>
 /// <param name="hitobject">The hitted object.</param>
 public HitTestObjectBase(object hitobject)
 {
     _hitobject = hitobject;
     _matrix    = new MatrixD2D();
 }
Exemplo n.º 15
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">Another HitTestData object to copy from.</param>
 public HitTestPointData(HitTestPointData from)
 {
     _hittedPointInPageCoord = from._hittedPointInPageCoord;
     _pageScale      = from._pageScale;
     _transformation = new MatrixD2D(from._transformation);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">Another HitTestData object to copy from.</param>
 public HitTestRectangularData(HitTestRectangularData from)
 {
     _hittedAreaInPageCoord = from._hittedAreaInPageCoord;
     _pageScale             = from._pageScale;
     _transformation        = new MatrixD2D(from._transformation);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="hitAreaPageCoord">Page coordinates (unit: points).</param>
 /// <param name="pageScale">Current zoom factor, i.e. ration between displayed size on the screen and given size.</param>
 public HitTestRectangularData(RectangleD2D hitAreaPageCoord, double pageScale)
 {
     _hittedAreaInPageCoord = hitAreaPageCoord;
     _pageScale             = pageScale;
     _transformation        = new MatrixD2D();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Sets the value for translation, roation, shear and scale from a transformation matrix.
 /// </summary>
 /// <param name="transformation"></param>
 public void SetFrom(MatrixD2D transformation)
 {
     SetTranslationRotationShearxScale(transformation.X, transformation.Y, transformation.Rotation, transformation.Shear, transformation.ScaleX, transformation.ScaleY);
 }
Exemplo n.º 19
0
 public bool IsCovering(PointD2D pt, MatrixD2D additionalTransform)
 {
     pt = _transformation.TransformPoint(additionalTransform.TransformPoint(pt));
     return(_hittedAreaInPageCoord.Contains(pt));
 }