Exemplo n.º 1
0
        /// <summary>
        /// Create a new joint and add it to the wire's joint collection.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>
        /// The new joint.
        /// </returns>
        public override WireJoint MakeJoint(SMPoint point)
        {
            var joint = new SplineWireJoint(point);

            AddJoint(joint);
            return(joint);
        }
Exemplo n.º 2
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 }));
        }
Exemplo n.º 3
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 }));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the near wire children.
        /// </summary>
        /// <inheritdoc />
        public override IEnumerable <NearWireChild> GetNearWireChildren(DiagramPoint point, float threshold, bool considerOrthogonalSegmentsOnly)
        {
            if (Owner == null || !(Owner is Diagram))
            {
                throw new ArgumentException("Wire must be a child of a Diagram", "wire");
            }
            SMPoint position = point.TransformTo(Diagram).Point;

            foreach (var joint in Joints)
            {
                float distance = joint.GetDistance(position);
                if (distance <= Math.Max(threshold, WireJoint.JointPrecisionDigits))
                {
                    yield return(new NearWireChild(joint, point, distance));
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new joint and add it to the wire's joint collection and inserts it between between two joints.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <param name="joint1">the joint connected to joint2</param>
 /// <param name="joint2">the joint connected to joint1</param>
 /// <returns>
 /// the newly created and inserted joint or null if the joint could not be inserted
 /// </returns>
 public override WireJoint MakeJoint(SMPoint point, WireJoint joint1, WireJoint joint2)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new joint and adds it to the wire's joint collection.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <param name="existingJoint">The existing joint it should be connected to.</param>
 /// <returns>
 /// The new joint.
 /// </returns>
 public override WireJoint MakeJoint(SMPoint point, WireJoint existingJoint)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SplineWireJoint"/> class.
 /// </summary>
 /// <param name="p">The p.</param>
 internal SplineWireJoint(SMPoint p) : base(p)
 {
     _adjacentJoints = new List <SplineWireJoint>();
 }
Exemplo n.º 8
0
 /// <inheritdoc />
 protected override SMRect CalculateBoundsForJointChange(SMRect originalBounds, SMPoint modifiedJointPosition, bool jointAdded, out bool boundsModified, out bool needsBoundsCompute)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructs a new instance
 /// </summary>
 /// <param name="direction">Direction of the terminal</param>
 /// <param name="dataType">Initial data type of the terminal</param>
 /// <param name="identifier">Node specific terminal identifier</param>
 /// <param name="hotPoint">Location, relative to the node, of the hotspot of this terminal</param>
 public SplineWireTerminal(Direction direction, NIType dataType, string identifier, SMPoint hotPoint)
     : base(direction, dataType, identifier, hotPoint)
 {
     _wiringBehavior = new SplineWiringBehavior();
 }
Exemplo n.º 10
0
 public StructFieldAccessorTerminal(Direction direction, NIType type, string name, SMPoint hotPoint)
     : base(direction, type, name, hotPoint)
 {
 }