GetBounds() { AssertValid(); if (m_oEdge.IsSelfLoop) { Debug.Assert(false); throw new InvalidOperationException("Edge is self-loop."); } // Start with a rectangle that has the same dimensions as the edge, but // that starts at the origin and has an angle of zero. Point oVertex1Location = WpfGraphicsUtil.PointFToWpfPoint( m_oEdge.Vertex1.Location); Point oVertex2Location = WpfGraphicsUtil.PointFToWpfPoint( m_oEdge.Vertex2.Location); Double dLength = WpfGraphicsUtil.GetDistanceBetweenPoints( oVertex1Location, oVertex2Location); Double dAngleDegrees = MathUtil.RadiansToDegrees( WpfGraphicsUtil.GetAngleBetweenPointsRadians( oVertex1Location, oVertex2Location)); Double dHalfWidth = m_dWidth / 2.0; Point[] ao4BoundingPoints = new Point[4] { new Point(0, -dHalfWidth), new Point(dLength, -dHalfWidth), new Point(dLength, dHalfWidth), new Point(0, dHalfWidth), }; // Rotate the rectangle so it is at the same angle as the edge. TransformPoints(new RotateTransform(dAngleDegrees), ao4BoundingPoints); // Translate the rotated rectangle to the location of the edge's first // endpoint. TransformPoints( new TranslateTransform(oVertex1Location.X, oVertex1Location.Y), ao4BoundingPoints); // Create a PathGeometry from the bounding points. return(WpfPathGeometryUtil.GetPathGeometryFromPoints( ao4BoundingPoints[0], ao4BoundingPoints[1], ao4BoundingPoints[2], ao4BoundingPoints[3] )); }
GetBounds() { return(WpfPathGeometryUtil.GetRoundedX( this.VertexLocation, m_dHalfWidth)); }
DrawCombinedIntergroupEdge ( DrawingContext oDrawingContext, GraphDrawingContext oGraphDrawingContext, IntergroupEdgeInfo oCombinedIntergroupEdge, GroupLayoutDrawingInfo oGroupLayoutDrawingInfo ) { Debug.Assert(oDrawingContext != null); Debug.Assert(oGraphDrawingContext != null); Debug.Assert(oCombinedIntergroupEdge != null); Debug.Assert(oGroupLayoutDrawingInfo != null); AssertValid(); Rect oGroupRectangle1, oGroupRectangle2; if ( !TryGetGroupRectangle( oGroupLayoutDrawingInfo.GroupsToDraw[ oCombinedIntergroupEdge.Group1Index], out oGroupRectangle1) || !TryGetGroupRectangle( oGroupLayoutDrawingInfo.GroupsToDraw[ oCombinedIntergroupEdge.Group2Index], out oGroupRectangle2) ) { return; } Point oGroupRectangle1Center = WpfGraphicsUtil.GetRectCenter(oGroupRectangle1); Point oGroupRectangle2Center = WpfGraphicsUtil.GetRectCenter(oGroupRectangle2); Point oBezierControlPoint = GetBezierControlPoint(oGraphDrawingContext, oGroupRectangle1Center, oGroupRectangle2Center, CombinedIntergroupEdgeBezierDisplacementFactor ); PathGeometry oBezierCurve = WpfPathGeometryUtil.GetQuadraticBezierCurve(oGroupRectangle1Center, oGroupRectangle2Center, oBezierControlPoint); Color oColor = GetContrastingColor( oGraphDrawingContext, CombinedIntergroupEdgeAlpha, true); Pen oPen = CreateFrozenPen(CreateFrozenSolidColorBrush(oColor), GetCombinedIntergroupEdgePenWidth(oCombinedIntergroupEdge) * this.GraphScale, DashStyles.Solid, PenLineCap.Round); oDrawingContext.DrawGeometry(null, oPen, oBezierCurve); }
GetBounds() { return(WpfPathGeometryUtil.GetTaperedDiamond( this.VertexLocation, m_dHalfWidth)); }