Esempio n. 1
0
        protected override IGripManipulationHandle[] GetGrips(IHitTestObject hitTest, GripKind gripKind)
        {
            var list = new List <IGripManipulationHandle>();

            /*
             *
             * const double gripNominalSize = 10; // 10 Points nominal size on the screen
             *                if ((GripKind.Resize & gripKind) != 0)
             *                {
             *                        double gripSize = gripNominalSize / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 1; i < _gripRelPositions.Length; i++)
             *                        {
             *                                PointD2D outVec, pos;
             *                                if (1 == i % 2)
             *                                        GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *                                else
             *                                        GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new ResizeGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Rotate & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale;
             *                        // Rotation grips
             *                        for (int i = 1; i < _gripRelPositions.Length; i += 2)
             *                        {
             *                                PointD2D outVec, pos;
             *                                GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new RotationGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Rescale & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 1; i < _gripRelPositions.Length; i++)
             *                        {
             *                                PointD2D outVec, pos;
             *                                if (1 == i % 2)
             *                                        GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *                                else
             *                                        GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new RescaleGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Shear & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 2; i < _gripRelPositions.Length; i += 2)
             *                        {
             *                                PointD2D outVec, pos;
             *                                GetEdgeOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new ShearGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            if ((GripKind.Move & gripKind) != 0)
            {
                var bounds         = Bounds;
                var wn             = PolylineMath3D.GetWestNorthVectors(bounds.Size);
                var transformation = Matrix4x3.NewFromBasisVectorsAndLocation(wn.Item1, wn.Item2, bounds.Size.Normalized, PointD3D.Empty);

                transformation.AppendTransform(_transformation);
                transformation.AppendTransform(hitTest.Transformation);

                double t1            = 0.55 * _linePen.Thickness1;
                double t2            = 0.55 * _linePen.Thickness2;
                var    rect          = new RectangleD3D(-t1, -t2, 0, 2 * t1, 2 * t2, bounds.Size.Length);
                var    objectOutline = new RectangularObjectOutline(rect, transformation);
                list.Add(new MovementGripHandle(hitTest, objectOutline, null));
            }

            return(list.ToArray());
        }
Esempio n. 2
0
		protected override IGripManipulationHandle[] GetGrips(IHitTestObject hitTest, GripKind gripKind)
		{
			var list = new List<IGripManipulationHandle>();

			/*

const double gripNominalSize = 10; // 10 Points nominal size on the screen
			if ((GripKind.Resize & gripKind) != 0)
			{
				double gripSize = gripNominalSize / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 1; i < _gripRelPositions.Length; i++)
				{
					PointD2D outVec, pos;
					if (1 == i % 2)
						GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
					else
						GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new ResizeGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Rotate & gripKind) != 0)
			{
				double gripSize = 10 / pageScale;
				// Rotation grips
				for (int i = 1; i < _gripRelPositions.Length; i += 2)
				{
					PointD2D outVec, pos;
					GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new RotationGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Rescale & gripKind) != 0)
			{
				double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 1; i < _gripRelPositions.Length; i++)
				{
					PointD2D outVec, pos;
					if (1 == i % 2)
						GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
					else
						GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new RescaleGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Shear & gripKind) != 0)
			{
				double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 2; i < _gripRelPositions.Length; i += 2)
				{
					PointD2D outVec, pos;
					GetEdgeOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new ShearGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			if ((GripKind.Move & gripKind) != 0)
			{
				var bounds = this.Bounds;
				var wn = PolylineMath3D.GetWestNorthVectors(bounds.Size);
				var transformation = Matrix4x3.NewFromBasisVectorsAndLocation(wn.Item1, wn.Item2, bounds.Size.Normalized, PointD3D.Empty);

				transformation.AppendTransform(_transformation);
				transformation.AppendTransform(hitTest.Transformation);

				double t1 = 0.55 * _linePen.Thickness1;
				double t2 = 0.55 * _linePen.Thickness2;
				var rect = new RectangleD3D(-t1, -t2, 0, 2 * t1, 2 * t2, bounds.Size.Length);
				var objectOutline = new RectangularObjectOutline(rect, transformation);
				list.Add(new MovementGripHandle(hitTest, objectOutline, null));
			}

			return list.ToArray();
		}
Esempio n. 3
0
        protected virtual IGripManipulationHandle[] GetGrips(IHitTestObject hitTest, GripKind gripKind)
        {
            var list = new List <IGripManipulationHandle>();

            /*
             *
             * const double gripNominalSize = 10; // 10 Points nominal size on the screen
             *                if ((GripKind.Resize & gripKind) != 0)
             *                {
             *                        double gripSize = gripNominalSize / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 1; i < _gripRelPositions.Length; i++)
             *                        {
             *                                PointD2D outVec, pos;
             *                                if (1 == i % 2)
             *                                        GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *                                else
             *                                        GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new ResizeGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Rotate & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale;
             *                        // Rotation grips
             *                        for (int i = 1; i < _gripRelPositions.Length; i += 2)
             *                        {
             *                                PointD2D outVec, pos;
             *                                GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new RotationGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Rescale & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 1; i < _gripRelPositions.Length; i++)
             *                        {
             *                                PointD2D outVec, pos;
             *                                if (1 == i % 2)
             *                                        GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *                                else
             *                                        GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new RescaleGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            /*
             *                if ((GripKind.Shear & gripKind) != 0)
             *                {
             *                        double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
             *                        for (int i = 2; i < _gripRelPositions.Length; i += 2)
             *                        {
             *                                PointD2D outVec, pos;
             *                                GetEdgeOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
             *
             *                                outVec *= (gripSize / outVec.VectorLength);
             *                                PointD2D altVec = outVec.Get90DegreeRotated();
             *                                PointD2D ptStart = pos;
             *                                list.Add(new ShearGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
             *                        }
             *                }
             */

            if ((GripKind.Move & gripKind) != 0)
            {
                var transformation = _transformation;
                transformation.AppendTransform(hitTest.Transformation);
                var objectOutline = new RectangularObjectOutline(Bounds, transformation);
                list.Add(new MovementGripHandle(hitTest, objectOutline, null));
            }

            return(list.ToArray());
        }