Ejemplo n.º 1
0
 public void DrawPseudoRelation(EdgePlacement placement, bool isSelfEdge, RelationDrawerStyle style)
 {
     if (isSelfEdge)
     {
         float   circleRadius = MinCircleRadius;
         Vector2 circleCenter = GetCircleCenter(placement.endPos, placement.startPos, circleRadius);
         Handles.color = style.highlightEdgeColor;
         Handles.DrawWireDisc(circleCenter, Vector3.forward, circleRadius);
         Handles.color = Color.white;
     }
     else
     {
         Handles.color = style.highlightEdgeColor;
         int lineWidth = style.highlightEdgeWidth;
         Handles.DrawAAPolyLine(lineWidth, placement.startPos, placement.endPos);
         Handles.color = Color.white;
     }
 }
Ejemplo n.º 2
0
        protected virtual Dictionary <Relation <T, P>, Rect> DrawRegularRelation(IEnumerable <Relation <T, P> > toEdges, IEnumerable <Relation <T, P> > fromEdges, EdgePlacement placement, bool highlight, bool includeMarker, RelationDrawerStyle style, System.Func <P, Color> GetMarkerColor)
        {
            Handles.color = highlight ? style.highlightEdgeColor : style.regularEdgeColor;
            int lineWidth = highlight ? style.highlightEdgeWidth : style.regularEdgeWidth;

            Handles.DrawAAPolyLine(lineWidth, placement.startPos, placement.endPos);
            Handles.color = Color.white;

            if (includeMarker)
            {
                return(DrawMarkers(toEdges, fromEdges, placement.startPos, placement.endPos, style.markerSize, style.markerImage, GetMarkerColor));
            }

            return(new Dictionary <Relation <T, P>, Rect>());
        }
Ejemplo n.º 3
0
 public virtual Dictionary <Relation <T, P>, Rect> DrawRelation(IEnumerable <Relation <T, P> > toEdges, IEnumerable <Relation <T, P> > fromEdges, EdgePlacement placement, bool isSelfEdge, bool highlight, bool includeMarker, RelationDrawerStyle style, System.Func <P, Color> GetMarkerColor)
 {
     if (isSelfEdge)
     {
         return(DrawSelfRelation(toEdges, fromEdges, placement, highlight, includeMarker, style, GetMarkerColor));
     }
     else
     {
         return(DrawRegularRelation(toEdges, fromEdges, placement, highlight, includeMarker, style, GetMarkerColor));
     }
 }
Ejemplo n.º 4
0
        protected virtual Dictionary <Relation <T, P>, Rect> DrawSelfRelation(IEnumerable <Relation <T, P> > toEdges, IEnumerable <Relation <T, P> > fromEdges, EdgePlacement placement, bool highlight, bool includeMarker, RelationDrawerStyle style, System.Func <P, Color> GetMarkerColor)
        {
            var   edges           = toEdges;    // self edges are stored in both: toEdges and fromEdges. so we pass only one set.
            float markerArcLength = Mathf.PI * 1.5f;
            float circleRadius    = GetRadiusForFittingCircle(edges.Count(), markerArcLength, style.markerSize.x, style.markerSize.x / 4);

            circleRadius = Mathf.Max(circleRadius, MinCircleRadius);
            Vector2 circleCenter = GetCircleCenter(placement.startPos, placement.endPos, circleRadius);

            Handles.color = highlight ? style.highlightEdgeColor : style.regularEdgeColor;
            Handles.DrawWireDisc(circleCenter, Vector3.forward, circleRadius);
            Handles.color = Color.white;

            if (includeMarker)
            {
                float startAngle = -Mathf.PI * 1.5f;
                return(DrawSelfMarkers(toEdges, circleCenter, circleRadius, startAngle, markerArcLength, style.markerSize, style.markerImage, GetMarkerColor));
            }
            return(new Dictionary <Relation <T, P>, Rect>());
        }