|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface provides the input protocol for objects which are the targets of snapping. Normally these objects are stationary while snap_draggable objects are dragged. Where the right conditions occur, feedback is produced which snaps the objects together in some way (typically by pulling the dragged object to the target object). Snapping is considered to be "from" snap_draggable objects (called the "drag" objects) "to" snap_targetable objects (called the "target" objects). Both this protocol and the snap_draggable protocol are managed and delivered by the snap_drag_agent.
Snapping requires a two part test. The first part is geometric. In this part we determine if a feature point of the drag object is close enough geometrically to snap to the target. If this test passes, then a second semantic test is performed to determine if the two objects are semantically compatible (this second test by snap_from_ok() may involve type tests and/or exchange of information between the drag and target objects). If both snapping tests succeed, and the snap is the closest candidate snap, the snap will occur.
If their are no suitable snaps, but some snaps pass the geometric test (i.e., are close enough) then "anti-snaps" will be considered. An anti-snap is designed to provide feedback about a negative condition -- it is typically used to produce a kind of dynamic "error message" that indicates why a geometrically possible snap is not semantically suitable. Anti-snaps must pass a second semantic test (performed by anti_snap_from_ok()) before they are activated.
snap_draggable
,
snap_drag_agent
Fields inherited from class sub_arctic.constraints.std_constraint_consts |
FIRST_CHILD,
LAST_CHILD,
MAX_CHILD,
MIN_CHILD,
NEXT_SIBLING,
NO_CONSTRAINT,
OTHER,
PARENT,
PREV_SIBLING,
SELF,
ZERO |
Method Summary | |
boolean |
anti_snap_feedback(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object anti_snap_info,
java.lang.Object user_info)
Perform feedback while an anti-snap is active. |
java.lang.Object |
anti_snap_from_ok(java.awt.Point pt,
snap_draggable drag_obj,
int feature_pt_indx)
Determine if a geometrically accepted snap which has been semantically rejected (by snap_from_obj()) should provide anti-snap feedback. |
boolean |
anti_snap_from(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object anti_snap_info,
java.lang.Object user_info)
Do anti-snap feedback corresponding to an anti-snap from the given drag object. |
boolean |
point_snaps(java.awt.Point pt,
int_holder return_dist2,
java.awt.Point return_snap_pt)
Determine if the given point (in local coordinates) is close enough to snap to this object (and return the square of its distance, and the point snapped to). |
boolean |
snap_feedback(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object user_info)
Perform feedback while a snap is active. |
boolean |
snap_from_ok(java.awt.Point pt,
snap_draggable drag_obj,
int feature_pt_indx)
Determine if a geometrically accepted snap should be semantically accepted. |
boolean |
snap_from(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object user_info)
Do the feedback corresponding to a snap from the given drag object. |
boolean |
unanti_snap_from(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object anti_snap_info,
java.lang.Object user_info)
Remove anti-snap feedback for an anti-snap that is now being broken. |
boolean |
unsnap_from(event evt,
java.awt.Point orig_pt,
java.awt.Point snap_pt,
snap_draggable drag_obj,
int feature_pt_indx,
java.lang.Object user_info)
Remove feedback for a snap that is now being broken. |
Method Detail |
public boolean point_snaps(java.awt.Point pt, int_holder return_dist2, java.awt.Point return_snap_pt)
pt
- the point being tested (in local coordinates).return_dist2
- to be modified to contain the square of the distance
to the point (ignored if false is returned).return_snap_pt
- to be modified to contain the final snap target
point in local coordinates (ignored if false is
returned).public boolean snap_from_ok(java.awt.Point pt, snap_draggable drag_obj, int feature_pt_indx)
pt
- the pre-snap location of the feature point being
tested.drag_obj
- the drag object being tested.feature_pt_indx
- the index of the feature point (within drag_obj)
being tested.public java.lang.Object anti_snap_from_ok(java.awt.Point pt, snap_draggable drag_obj, int feature_pt_indx)
If no anti-snap is to be applied, null is returned. Otherwise an object with information about the reason for the anti-snap is returned. This object will then be passed to various anti-snap calls.
pt
- the pre-snap location of the feature point being
tested.drag_obj
- the drag object being tested.feature_pt_indx
- the index of the feature point (within drag_obj)
being tested.public boolean snap_from(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object user_info)
event
- evt the event "causing" the snap.Point
- orig_pt where the dragged object would be
without the snap.Point
- snap_pt the snap point.snap_draggable
- drag_obj the dragged object we are snapping
from.int
- feature_pt_indx the feature point of that object
that we are snapping with.Object
- user_info the user info for this input.public boolean snap_feedback(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object user_info)
event
- evt the event "causing" the snap.Point
- orig_pt where the dragged object would be
without the snap.Point
- snap_pt the snap point.snap_draggable
- drag_obj the dragged object we are snapping
from.int
- feature_pt_indx the feature point of that object
that we are snapping with.Object
- user_info the user info for this input.public boolean unsnap_from(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object user_info)
event
- evt the event "causing" the unsnap.Point
- orig_pt where the dragged object would be
without the snap.Point
- snap_pt the snap point.snap_draggable
- drag_obj the dragged object we are
unsnapping from.int
- feature_pt_indx the feature point of that object
that we are unsnapping with.Object
- user_info the user info for this input.public boolean anti_snap_from(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object anti_snap_info, java.lang.Object user_info)
event
- evt the event "causing" the anti-snap.Point
- orig_pt where the dragged object would be
without the anti-snap.Point
- snap_pt the anti-snap point.snap_draggable
- drag_obj the dragged object we are
anti-snapping from.int
- feature_pt_indx the feature point of that object
that we are anti-snapping with.Object
- user_info the user info for this input.public boolean anti_snap_feedback(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object anti_snap_info, java.lang.Object user_info)
event
- evt the event "causing" the anti-snap.Point
- orig_pt where the dragged object would be
without the anti-snap.Point
- snap_pt the anti-snap point.snap_draggable
- drag_obj the dragged object we are
anti-snapping from.int
- feature_pt_indx the feature point of that object
that we are anti-snapping with.Object
- user_info the user info for this input.public boolean unanti_snap_from(event evt, java.awt.Point orig_pt, java.awt.Point snap_pt, snap_draggable drag_obj, int feature_pt_indx, java.lang.Object anti_snap_info, java.lang.Object user_info)
event
- evt the event "causing" the unanti-snap.Point
- orig_pt where the dragged object would be
without the anti-snap.Point
- snap_pt the anti-snap point.snap_draggable
- drag_obj the dragged object we are
unanti-snapping from.int
- feature_pt_indx the feature point of that object
that we are unanti-snapping with.Object
- user_info the user info for this input.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |