예제 #1
0
        /// <summary>
        /// Override of BinaryLinkShape.ExcludeFromClipRegion to support moving the link
        /// decorator and properly rotating it.
        /// </summary>
        public override void ExcludeFromClipRegion(Graphics g, Matrix matrix, GraphicsPath perimeter)
        {
            ObliqueBinaryLinkShapeGeometry geometry = this.ShapeGeometry as ObliqueBinaryLinkShapeGeometry;
            Pen linePen = this.StyleSet.GetPen(DiagramPens.ConnectionLine);
            EdgePointCollection edgePoints = this.EdgePoints;
            int edgePointCount             = edgePoints.Count;

            if ((geometry != null) && (linePen != null))
            {
                for (int i = 1; i < edgePointCount; ++i)
                {
                    if (edgePoints[i].Flag == VGPointType.JumpEnd)
                    {
                        GraphicsPath excludePath = this.ExcludePath;
                        geometry.AddLineArcPath(excludePath, edgePoints[i - 1].Point, edgePoints[i].Point);
                        g.SetClip(excludePath, CombineMode.Exclude);
                    }
                    else
                    {
                        RectangleD excludeRect = GeometryHelpers.RectangleDFrom2Pts(edgePoints[i - 1].Point, edgePoints[i].Point);
                        double     inflateBy   = linePen.Width / 2f;
                        excludeRect.Inflate(inflateBy, inflateBy);
                        g.SetClip(RectangleD.ToRectangleF(excludeRect), CombineMode.Exclude);
                    }
                }
                if (edgePointCount > 1)
                {
                    LinkDecorator decorator;
#if VISUALSTUDIO_10_0
                    IBinaryLinkGeometryData geometryData = (IBinaryLinkGeometryData)this;
#endif
                    if (null != (decorator = DecoratorFrom))
                    {
                        ExcludeDecorator(g, geometry, decorator, edgePoints[0].Point, edgePoints[1].Point
#if VISUALSTUDIO_10_0
                                         , geometryData.GeometryDecoratorFromSize
#endif
                                         );
                    }
                    if (null != (decorator = DecoratorTo))
                    {
                        ExcludeDecorator(g, geometry, decorator, edgePoints[edgePointCount - 1].Point, edgePoints[edgePointCount - 2].Point
#if VISUALSTUDIO_10_0
                                         , geometryData.GeometryDecoratorToSize
#endif
                                         );
                    }
                }
            }
        }
예제 #2
0
        private static void ExcludeDecorator(Graphics g, ObliqueBinaryLinkShapeGeometry geometry, LinkDecorator decorator, PointD fromPoint, PointD toPoint)
        {
            SizeD size = LinkShapeGeometry.SizeDecorator;
#endif
            ILinkDecoratorSettings settings = decorator as ILinkDecoratorSettings;
            double offsetBy = double.NaN;
            if (settings != null)
            {
                size     = settings.DecoratorSize;
                offsetBy = settings.OffsetBy;
                if (VGConstants.FuzzZero(offsetBy, VGConstants.FuzzDistance))
                {
                    offsetBy = double.NaN;
                }
            }
            RectangleD bounds        = new RectangleD(fromPoint.X - size.Width, fromPoint.Y - (size.Height / 2), size.Width, size.Height);
            float      rotationAngle = geometry.CalculateRotationAngle(fromPoint, toPoint);
            ExcludeDecorator(g, bounds, rotationAngle, offsetBy, fromPoint);
        }
		private static void ExcludeDecorator(Graphics g, ObliqueBinaryLinkShapeGeometry geometry, LinkDecorator decorator, PointD fromPoint, PointD toPoint)
		{
			SizeD size = LinkShapeGeometry.SizeDecorator;
#endif
			ILinkDecoratorSettings settings = decorator as ILinkDecoratorSettings;
			double offsetBy = double.NaN;
			if (settings != null)
			{
				size = settings.DecoratorSize;
				offsetBy = settings.OffsetBy;
				if (VGConstants.FuzzZero(offsetBy, VGConstants.FuzzDistance))
				{
					offsetBy = double.NaN;
				}
			}
			RectangleD bounds = new RectangleD(fromPoint.X - size.Width, fromPoint.Y - (size.Height / 2), size.Width, size.Height);
			float rotationAngle = geometry.CalculateRotationAngle(fromPoint, toPoint);
			ExcludeDecorator(g, bounds, rotationAngle, offsetBy, fromPoint);
		}
예제 #4
0
 private static void ExcludeDecorator(Graphics g, ObliqueBinaryLinkShapeGeometry geometry, LinkDecorator decorator, PointD fromPoint, PointD toPoint, SizeD size)
 {
		private static void ExcludeDecorator(Graphics g, ObliqueBinaryLinkShapeGeometry geometry, LinkDecorator decorator, PointD fromPoint, PointD toPoint, SizeD size)
		{