/// <summary> /// Initializes a new instance of the <see cref="ResizeGripHandle"/> class. /// </summary> /// <param name="parent">The data for the object that is about to be resized.</param> /// <param name="relPos">The relative position of the handle. A value of 0 designates left (x) or top (y). A value of 1 designates right (x) or bottom (y).</param> /// <param name="spanningHalfYRhombus">The spanning half y rhombus.</param> public ResizeGripHandle(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.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition); _spanningHalfYRhombus = spanningHalfYRhombus; }
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; }
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; }
public void CopyFrom(MatrixD2D from) { if (object.ReferenceEquals(this, from)) return; this.sx = from.sx; this.rx = from.rx; this.ry = from.ry; this.sy = from.sy; this.dx = from.dx; this.dy = from.dy; this.determinant = from.determinant; }
public void CopyFrom(MatrixD2D from) { if (object.ReferenceEquals(this, from)) { return; } sx = from.sx; rx = from.rx; ry = from.ry; sy = from.sy; dx = from.dx; dy = from.dy; determinant = from.determinant; }
public HitTestPointData NewFromAdditionalTransformation(MatrixD2D additionalTransformation) { var result = new HitTestPointData(this); result.Transformation.PrependTransform(additionalTransformation); return result; }
/// <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; }
public MatrixD2D(MatrixD2D from) { CopyFrom(from); }
/// <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); }
public void AppendInverseTransform(MatrixD2D t) { AppendTransform(t.sy / t.determinant, -t.ry / t.determinant, -t.rx / t.determinant, t.sx / t.determinant, (t.dy * t.rx - t.dx * t.sy) / t.determinant, (t.dx * t.ry - t.dy * t.sx) / t.determinant); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">Another HitTestData object to copy from.</param> public HitTestPointData(HitTestPointData from) { _hittedPointInPageCoord = from._hittedPointInPageCoord; this._pageScale = from._pageScale; this._transformation = new MatrixD2D(from._transformation); }
/// <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); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">Another HitTestData object to copy from.</param> public HitTestRectangularData(HitTestRectangularData from) { _hittedAreaInPageCoord = from._hittedAreaInPageCoord; this._pageScale = from._pageScale; this._transformation = new MatrixD2D(from._transformation); }
/// <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(); }
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 bool IsCovering(PointD2D pt, MatrixD2D additionalTransform) { pt = _transformation.TransformPoint(additionalTransform.TransformPoint(pt)); return _hittedAreaInPageCoord.Contains(pt); }
/// <summary> /// Returns the hitted area 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 MatrixD2D GetHittedAreaInWorldCoord(MatrixD2D additionalTransform) { var pt0 = _transformation.InverseTransformPoint(_hittedAreaInPageCoord.Location); var pt1 = _transformation.InverseTransformVector(new PointD2D(0, _hittedAreaInPageCoord.Height)); var pt2 = _transformation.InverseTransformPoint(new PointD2D(_hittedAreaInPageCoord.Width, 0)); pt0 = additionalTransform.InverseTransformPoint(pt0); pt1 = additionalTransform.InverseTransformVector(pt1); pt2 = additionalTransform.InverseTransformVector(pt2); var result = new MatrixD2D(pt1.X, pt1.Y, pt2.X, pt2.Y, pt0.X, pt0.Y); return result; }
/// <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() { MatrixD2D m = new MatrixD2D(); m.SetTranslationRotationShearxScale(AbsolutePivotPositionX, AbsolutePivotPositionY, -Rotation, ShearX, ScaleX, ScaleY); m.TranslatePrepend(AbsoluteVectorPivotToLeftUpper.X, AbsoluteVectorPivotToLeftUpper.Y); var s = this.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; }
/// <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; }
/// <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(); }
/// <summary> /// Creates a new HitTestObject. /// </summary> /// <param name="hitobject">The hitted object.</param> public HitTestObjectBase(object hitobject) { _hitobject = hitobject; _matrix = new MatrixD2D(); }
public void PrependTransform(MatrixD2D t) { PrependTransform(t.sx, t.ry, t.rx, t.sy, t.dx, t.dy); }
/// <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); }
/// <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); }