コード例 #1
0
        /// <summary>
        /// Generate a preview or a wire route from a joint to an end terminal.
        /// </summary>
        /// <param name="joint">The joint to start the preview.</param>
        /// <param name="userHint">The user hint for the direction they want the wire to route.</param>
        /// <param name="terminal">The end terminal of the wire.</param>
        /// <param name="isBranchingOperation"> Is the start joint a branch of already routed wire</param>
        /// <param name="retainPreviousRoute"> Indicates if the userHint's direction must be the enddirection.</param>
        public IList <DiagramPoint> PreviewRouteWireToTerminal(WireJoint joint, WireRouteHint userHint, WireableTerminal terminal, bool isBranchingOperation, bool retainPreviousRoute)
        {
            var     point = terminal.HotspotDiagramPoint;
            SMPoint p     = point.TransformTo(joint.Wire.Diagram).Point;
            double  dx    = p.X - joint.X;
            double  dy    = p.Y - joint.Y;

            // if the points are on top of each other do nothing
            if (WireJoint.JointEqual((float)dx, 0) && WireJoint.JointEqual((float)dy, 0))
            {
                return(new List <DiagramPoint>());
            }
            return(new List <DiagramPoint>(new[] { point }));
        }
コード例 #2
0
        /// <summary>
        /// Previews the route wire to point.
        /// </summary>
        /// <param name="joint">The joint.</param>
        /// <param name="userHint">The user hint.</param>
        /// <param name="endDirections">The end directions.</param>
        /// <param name="point">The point.</param>
        /// <param name="isBranchingOperation">if set to <c>true</c> [is branching operation].</param>
        /// <param name="retainPreviousRoute">if set to <c>true</c> [retain previous route].</param>
        /// <param name="forceLayout">if set to <c>true</c> [force layout].</param>
        /// <returns>List of Diagram Points</returns>
        public IList <DiagramPoint> PreviewRouteWireToPoint(WireJoint joint, WireRouteHint userHint, WireRouteDirections endDirections, DiagramPoint point, bool isBranchingOperation, bool retainPreviousRoute,
                                                            bool forceLayout)
        {
            SMPoint p  = point.TransformTo(joint.Wire.Diagram).Point;
            double  dx = p.X - joint.X;
            double  dy = p.Y - joint.Y;

            // if the points are on top of each other do nothing
            if (WireJoint.JointEqual((float)dx, 0) && WireJoint.JointEqual((float)dy, 0))
            {
                return(new List <DiagramPoint>());
            }
            return(new List <DiagramPoint>(new[] { point }));
        }
コード例 #3
0
 /// <summary>
 /// Get the initial user hint from two points specified by the user.
 /// </summary>
 /// <param name="startPoint"></param>
 /// <param name="endPoint"></param>
 /// <param name="previousHint"></param>
 /// <returns></returns>
 public WireRouteHint GetInitialUserHint(DiagramPoint startPoint, DiagramPoint endPoint, WireRouteHint previousHint)
 {
     return(new WireRouteHint(WireRouteDirections.East));
 }
コード例 #4
0
 /// <summary>
 /// Toggle the user's routing hint.
 /// </summary>
 /// <param name="currentUserHint">The current user <see cref="WireRouteHint"/></param>
 /// <returns>The toggled user hint.</returns>
 public WireRouteHint ToggleUserRouteHint(WireRouteHint currentUserHint)
 {
     return(new WireRouteHint(WireRouteDirections.East));
 }
コード例 #5
0
 /// <summary>
 /// Generate a preview or a wire route from a joint to an end segment on an existing wire.
 /// </summary>
 /// <param name="joint">The joint to start the preview.</param>
 /// <param name="userHint">The user hint for the direction they want the wire to route.</param>
 /// <param name="segment">The end segment of the wire.</param>
 /// <param name="point">The point.</param>
 /// <param name="isBranchingOperation">Is the start joint a branch of already routed wire</param>
 /// <param name="retainPreviousRoute">Indicates if the userHint's direction must be the enddirection.</param>
 /// <returns></returns>
 public IList <DiagramPoint> PreviewRouteWireToSegment(WireJoint joint, WireRouteHint userHint, WireSegment segment, DiagramPoint point, bool isBranchingOperation, bool retainPreviousRoute)
 {
     return(new List <DiagramPoint>());
 }
コード例 #6
0
 /// <summary>
 /// Generate a preview or a wire route from a joint to an end point.
 /// </summary>
 /// <param name="joint">The joint to start the preview.</param>
 /// <param name="userHint">The user hint for the direction they want the wire to route.</param>
 /// <param name="point">The end point of the wire.</param>
 /// <param name="isBranchingOperation"> Is the start joint a branch of already routed wire</param>
 /// <param name="retainPreviousRoute"> Indicates if the userHint's direction must be the enddirection.</param>
 public IList <DiagramPoint> PreviewRouteWireToPoint(WireJoint joint, WireRouteHint userHint, WireRouteDirections endDirections, DiagramPoint point, bool isBranchingOperation, bool retainPreviousRoute)
 {
     return(PreviewRouteWireToPoint(joint, userHint, endDirections, point, isBranchingOperation, retainPreviousRoute, false));
 }