Ejemplo n.º 1
0
            public override IGripManipulationHandle[] GetGrips(int gripLevel)
            {
                if (gripLevel <= 1)
                {
                    var ls  = (LineShape)_hitobject;
                    var pts = new PointD3D[] { PointD3D.Empty, (PointD3D)ls.Size };
                    for (int i = 0; i < pts.Length; i++)
                    {
                        var pt = ls._transformation.Transform(pts[i]);
                        pt     = Transformation.Transform(pt);
                        pts[i] = pt;
                    }

                    var grips = new IGripManipulationHandle[gripLevel == 0 ? 1 : 3];

                    // Translation grips
                    var bounds         = ls.Bounds;
                    var wn             = PolylineMath3D.GetWestNorthVectors(bounds.Size);
                    var transformation = Matrix4x3.NewFromBasisVectorsAndLocation(wn.Item1, wn.Item2, bounds.Size.Normalized, PointD3D.Empty);

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

                    double t1            = 0.55 * ls._linePen.Thickness1;
                    double t2            = 0.55 * ls._linePen.Thickness2;
                    var    rect          = new RectangleD3D(-t1, -t2, 0, 2 * t1, 2 * t2, bounds.Size.Length);
                    var    objectOutline = new RectangularObjectOutline(rect, transformation);
                    grips[0] = new MovementGripHandle(this, objectOutline, null);

                    // PathNode grips
                    if (gripLevel == 1)
                    {
                        grips[2] = grips[0]; // put the movement grip to the background, the two NodeGrips need more priority
                        var gripRadius = Math.Max(t1, t2);
                        grips[0] = new PathNodeGripHandle(this, new VectorD3D(0, 0, 0), pts[0], gripRadius);
                        grips[1] = new PathNodeGripHandle(this, new VectorD3D(1, 1, 1), pts[1], gripRadius);
                    }
                    return(grips);
                }
                else
                {
                    return(base.GetGrips(gripLevel));
                }
            }
Ejemplo n.º 2
0
			public override IGripManipulationHandle[] GetGrips(int gripLevel)
			{
				if (gripLevel <= 1)
				{
					LineShape ls = (LineShape)_hitobject;
					PointD3D[] pts = new PointD3D[] { PointD3D.Empty, (PointD3D)ls.Size };
					for (int i = 0; i < pts.Length; i++)
					{
						var pt = ls._transformation.Transform(pts[i]);
						pt = this.Transformation.Transform(pt);
						pts[i] = pt;
					}

					IGripManipulationHandle[] grips = new IGripManipulationHandle[gripLevel == 0 ? 1 : 3];

					// Translation grips
					var bounds = ls.Bounds;
					var wn = PolylineMath3D.GetWestNorthVectors(bounds.Size);
					var transformation = Matrix4x3.NewFromBasisVectorsAndLocation(wn.Item1, wn.Item2, bounds.Size.Normalized, PointD3D.Empty);

					transformation.AppendTransform(ls._transformation);
					transformation.AppendTransform(this.Transformation);

					double t1 = 0.55 * ls._linePen.Thickness1;
					double t2 = 0.55 * ls._linePen.Thickness2;
					var rect = new RectangleD3D(-t1, -t2, 0, 2 * t1, 2 * t2, bounds.Size.Length);
					var objectOutline = new RectangularObjectOutline(rect, transformation);
					grips[0] = new MovementGripHandle(this, objectOutline, null);

					// PathNode grips
					if (gripLevel == 1)
					{
						grips[2] = grips[0]; // put the movement grip to the background, the two NodeGrips need more priority
						var gripRadius = Math.Max(t1, t2);
						grips[0] = new PathNodeGripHandle(this, new VectorD3D(0, 0, 0), pts[0], gripRadius);
						grips[1] = new PathNodeGripHandle(this, new VectorD3D(1, 1, 1), pts[1], gripRadius);
					}
					return grips;
				}
				else
				{
					return base.GetGrips(gripLevel);
				}
			}
Ejemplo n.º 3
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();
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Paints the axis style labels.
        /// </summary>
        /// <param name="g">Graphics environment.</param>
        /// <param name="coordSyst">The coordinate system. Used to get the path along the axis.</param>
        /// <param name="scale">Scale.</param>
        /// <param name="tickSpacing">If not <c>null</c>, this parameter provides a custom tick spacing that is used instead of the default tick spacing of the scale.</param>
        /// <param name="styleInfo">Information about begin of axis, end of axis.</param>
        /// <param name="outerDistance">Distance between axis and labels.</param>
        /// <param name="useMinorTicks">If true, minor ticks are shown.</param>
        public virtual void Paint(IGraphicsContext3D g, G3DCoordinateSystem coordSyst, Scale scale, TickSpacing tickSpacing, CSAxisInformation styleInfo, double outerDistance, bool useMinorTicks)
        {
            _cachedAxisStyleInfo = styleInfo;
            CSLineID    styleID = styleInfo.Identifier;
            Scale       raxis   = scale;
            TickSpacing ticking = tickSpacing;

            var math = Matrix4x3.Identity;

            Logical3D r0 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisOrg);
            Logical3D r1 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisEnd);

            Logical3D outer;

            double[]        relpositions;
            AltaxoVariant[] ticks;
            if (useMinorTicks)
            {
                relpositions = ticking.GetMinorTicksNormal(raxis);
                ticks        = ticking.GetMinorTicksAsVariant();
            }
            else
            {
                relpositions = ticking.GetMajorTicksNormal(raxis);
                ticks        = ticking.GetMajorTicksAsVariant();
            }

            if (!_suppressedLabels.IsEmpty)
            {
                var filteredTicks        = new List <AltaxoVariant>();
                var filteredRelPositions = new List <double>();

                for (int i = 0; i < ticks.Length; i++)
                {
                    if (_suppressedLabels.ByValues.Contains(ticks[i]))
                    {
                        continue;
                    }
                    if (_suppressedLabels.ByNumbers.Contains(i))
                    {
                        continue;
                    }
                    if (_suppressedLabels.ByNumbers.Contains(i - ticks.Length))
                    {
                        continue;
                    }

                    filteredTicks.Add(ticks[i]);
                    filteredRelPositions.Add(relpositions[i]);
                }
                ticks        = filteredTicks.ToArray();
                relpositions = filteredRelPositions.ToArray();
            }

            IMeasuredLabelItem[] labels = _labelFormatting.GetMeasuredItems(g, _font, ticks);

            double     emSize        = _font.Size;
            CSAxisSide labelSide     = null != _labelSide ? _labelSide.Value : styleInfo.PreferredLabelSide;
            var        labelOutlines = new RectangularObjectOutline[ticks.Length];

            for (int i = 0; i < ticks.Length; i++)
            {
                double r = relpositions[i];

                if (!Altaxo.Calc.RMath.IsInIntervalCC(r, -1000, 1000))
                {
                    continue;
                }

                outer = coordSyst.GetLogicalDirection(styleID.ParallelAxisNumber, labelSide);
                PointD3D tickorg = coordSyst.GetPositionAndNormalizedDirection(r0, r1, r, outer, out var outVector);
                PointD3D tickend = tickorg + outVector * outerDistance;

                var msize = labels[i].Size;
                var morg  = tickend;

                if (_automaticRotationShift)
                {
                    // if this option is choosen, we have to find a shift value that shifts the center of the text outwards so that the bounding box of the text will not cross the plane that is
                    // defined by the tickend point and the normal vector outVector

                    // Assume that the text is now centered x, y, and z around the point tickend (but here we use origin instead tickend)
                    math = Matrix4x3.NewRotation(_rotationX, _rotationY, _rotationZ);
                    // we have to find all points with negative distance to the plane spanned by tickend and the vector outVector (but again instead of tickend we use origin)
                    var msizePad = msize + new VectorD3D(
                        (_font.Size * 1) / 3,                                            // whereas above and below text no padding is neccessary, it is optically nicer to have left and right padding of the string by 1/6 of font size.
                        0,
                        (_font.Size * 1) / 3                                             // same padding applies to z
                        );
                    var crect = new RectangleD3D((PointD3D)(-0.5 * msizePad), msizePad); // our text centered around origin

                    double shift = 0;
                    foreach (PointD3D p in crect.Vertices)
                    {
                        PointD3D ps       = math.Transform(p);
                        double   distance = Math3D.GetDistancePointToPlane(ps, PointD3D.Empty, outVector);
                        if (-distance > shift)
                        {
                            shift = -distance; // only negative distances will count here
                        }
                    }
                    morg += outVector * shift;
                }
                else
                {
                    morg = morg.WithXPlus(outVector.X * _font.Size / 3);
                }

                var mrect = new RectangleD3D(morg, msize);
                if (_automaticRotationShift)
                {
                    mrect = AdjustRectangle(mrect, Alignment.Center, Alignment.Center, Alignment.Center);
                }
                else
                {
                    mrect = AdjustRectangle(mrect, _alignmentX, _alignmentY, _alignmentZ);
                }

                math = Matrix4x3.Identity;
                math.TranslatePrepend(morg.X, morg.Y, morg.Z);

                if (_rotationZ != 0)
                {
                    math.RotationZDegreePrepend(_rotationZ);
                }
                if (_rotationY != 0)
                {
                    math.RotationYDegreePrepend(_rotationY);
                }
                if (_rotationX != 0)
                {
                    math.RotationXDegreePrepend(_rotationX);
                }

                math.TranslatePrepend((mrect.X - morg.X + emSize * _offsetX), (mrect.Y - morg.Y + emSize * _offsetY), (mrect.Z - morg.Z + emSize * _offsetZ));

                var gs = g.SaveGraphicsState();
                g.PrependTransform(math);

                if (_backgroundStyle != null)
                {
                    var itemRectangle = new RectangleD3D(PointD3D.Empty, msize);
                    _backgroundStyle.Measure(itemRectangle);
                    _backgroundStyle.Draw(g, itemRectangle);
                }

                labels[i].Draw(g, _brush, PointD3D.Empty);
                labelOutlines[i] = new RectangularObjectOutline(new RectangleD3D(PointD3D.Empty, msize), math);
                g.RestoreGraphicsState(gs); // Restore the graphics state
            }

            _cachedLabelOutlines = labelOutlines;
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Paints the axis style labels.
		/// </summary>
		/// <param name="g">Graphics environment.</param>
		/// <param name="coordSyst">The coordinate system. Used to get the path along the axis.</param>
		/// <param name="scale">Scale.</param>
		/// <param name="tickSpacing">If not <c>null</c>, this parameter provides a custom tick spacing that is used instead of the default tick spacing of the scale.</param>
		/// <param name="styleInfo">Information about begin of axis, end of axis.</param>
		/// <param name="outerDistance">Distance between axis and labels.</param>
		/// <param name="useMinorTicks">If true, minor ticks are shown.</param>
		public virtual void Paint(IGraphicsContext3D g, G3DCoordinateSystem coordSyst, Scale scale, TickSpacing tickSpacing, CSAxisInformation styleInfo, double outerDistance, bool useMinorTicks)
		{
			_cachedAxisStyleInfo = styleInfo;
			CSLineID styleID = styleInfo.Identifier;
			Scale raxis = scale;
			TickSpacing ticking = tickSpacing;

			var math = Matrix4x3.Identity;

			Logical3D r0 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisOrg);
			Logical3D r1 = styleID.GetLogicalPoint(styleInfo.LogicalValueAxisEnd);

			VectorD3D outVector;
			Logical3D outer;

			double[] relpositions;
			AltaxoVariant[] ticks;
			if (useMinorTicks)
			{
				relpositions = ticking.GetMinorTicksNormal(raxis);
				ticks = ticking.GetMinorTicksAsVariant();
			}
			else
			{
				relpositions = ticking.GetMajorTicksNormal(raxis);
				ticks = ticking.GetMajorTicksAsVariant();
			}

			if (!_suppressedLabels.IsEmpty)
			{
				List<AltaxoVariant> filteredTicks = new List<AltaxoVariant>();
				List<double> filteredRelPositions = new List<double>();

				for (int i = 0; i < ticks.Length; i++)
				{
					if (_suppressedLabels.ByValues.Contains(ticks[i]))
						continue;
					if (_suppressedLabels.ByNumbers.Contains(i))
						continue;
					if (_suppressedLabels.ByNumbers.Contains(i - ticks.Length))
						continue;

					filteredTicks.Add(ticks[i]);
					filteredRelPositions.Add(relpositions[i]);
				}
				ticks = filteredTicks.ToArray();
				relpositions = filteredRelPositions.ToArray();
			}

			IMeasuredLabelItem[] labels = _labelFormatting.GetMeasuredItems(g, _font, ticks);

			double emSize = _font.Size;
			CSAxisSide labelSide = null != _labelSide ? _labelSide.Value : styleInfo.PreferredLabelSide;
			var labelOutlines = new RectangularObjectOutline[ticks.Length];
			for (int i = 0; i < ticks.Length; i++)
			{
				double r = relpositions[i];

				if (!Altaxo.Calc.RMath.IsInIntervalCC(r, -1000, 1000))
					continue;

				outer = coordSyst.GetLogicalDirection(styleID.ParallelAxisNumber, labelSide);
				PointD3D tickorg = coordSyst.GetPositionAndNormalizedDirection(r0, r1, r, outer, out outVector);
				PointD3D tickend = tickorg + outVector * outerDistance;

				var msize = labels[i].Size;
				var morg = tickend;

				if (_automaticRotationShift)
				{
					// if this option is choosen, we have to find a shift value that shifts the center of the text outwards so that the bounding box of the text will not cross the plane that is
					// defined by the tickend point and the normal vector outVector

					// Assume that the text is now centered x, y, and z around the point tickend (but here we use origin instead tickend)
					math = Matrix4x3.NewRotation(_rotationX, _rotationY, _rotationZ);
					// we have to find all points with negative distance to the plane spanned by tickend and the vector outVector (but again instead of tickend we use origin)
					var msizePad = msize + new VectorD3D(
					(_font.Size * 1) / 3, // whereas above and below text no padding is neccessary, it is optically nicer to have left and right padding of the string by 1/6 of font size.
					0,
					(_font.Size * 1) / 3 // same padding applies to z
					);
					var crect = new RectangleD3D((PointD3D)(-0.5 * msizePad), msizePad); // our text centered around origin

					double shift = 0;
					foreach (PointD3D p in crect.Vertices)
					{
						PointD3D ps = math.Transform(p);
						double distance = Math3D.GetDistancePointToPlane(ps, PointD3D.Empty, outVector);
						if (-distance > shift)
							shift = -distance; // only negative distances will count here
					}
					morg += outVector * shift;
				}
				else
				{
					morg = morg.WithXPlus(outVector.X * _font.Size / 3);
				}

				var mrect = new RectangleD3D(morg, msize);
				if (_automaticRotationShift)
					mrect = AdjustRectangle(mrect, Alignment.Center, Alignment.Center, Alignment.Center);
				else
					mrect = AdjustRectangle(mrect, _alignmentX, _alignmentY, _alignmentZ);

				math = Matrix4x3.Identity;
				math.TranslatePrepend(morg.X, morg.Y, morg.Z);

				if (this._rotationZ != 0)
					math.RotationZDegreePrepend(this._rotationZ);
				if (this._rotationY != 0)
					math.RotationYDegreePrepend(this._rotationY);
				if (this._rotationX != 0)
					math.RotationXDegreePrepend(this._rotationX);

				math.TranslatePrepend((mrect.X - morg.X + emSize * _offsetX), (mrect.Y - morg.Y + emSize * _offsetY), (mrect.Z - morg.Z + emSize * _offsetZ));

				var gs = g.SaveGraphicsState();
				g.PrependTransform(math);

				if (this._backgroundStyle != null)
				{
					var itemRectangle = new RectangleD3D(PointD3D.Empty, msize);
					_backgroundStyle.Measure(itemRectangle);
					_backgroundStyle.Draw(g, itemRectangle);
				}

				labels[i].Draw(g, _brush, PointD3D.Empty);
				labelOutlines[i] = new RectangularObjectOutline(new RectangleD3D(PointD3D.Empty, msize), math);
				g.RestoreGraphicsState(gs); // Restore the graphics state
			}

			_cachedLabelOutlines = labelOutlines;
		}
Ejemplo n.º 7
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());
        }