sub_arctic.lib
Class point_snap_target

java.lang.Object
  |
  +--sub_arctic.lib.min_interactor
        |
        +--sub_arctic.lib.base_interactor
              |
              +--sub_arctic.lib.point_snap_target

public class point_snap_target
extends base_interactor
implements snap_targetable

This Class implements a point snap target. The target point is defined to lie in the center of the object. It does no drawing nor does it limit the class of drag objects that snap to it, or do anything when the snap occurs (all these additional behaviors would normally be added in a subclass). See the documentation in the snap-drag agent for full details of how snapping works.

See Also:
snap_drag_agent

Fields inherited from class sub_arctic.lib.base_interactor
_child_index, _child_list, _clip_bounds, _constraint_flags, _enabled_constraint, _flags, _h, _h_constraint, _parent, _part_a_constraint, _part_b_constraint, _user_data, _visible_constraint, _w, _w_constraint, _x, _x_constraint, _y, _y_constraint, default_child_hint
 
Constructor Summary
point_snap_target(int x, int y)
          Constructor.
 
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)
           
 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 the point (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)
          Do 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.
 
Methods inherited from class sub_arctic.lib.base_interactor
active_constraints, add_child, add_user_datum, attach_dependent, bound, callback_obj, child_index, child, clear_child_list, clear_constraint_flag_bit, clear_flag_bit, configure, constraint_flag_is_set, constraint_flag_string, constraint_on, custom_fun1, custom_fun2, damage_fixed, damage_from_child, damage_self, damage_self, damage_self, damage_self, damage_self, detach_dependent, do_action, do_action, do_callback, do_callback, drag_feature_point, draw_children, draw_self_local, draw_self, enabled_constraint, enabled, enter_local_coordinates, eval_enabled, eval_h, eval_part_a, eval_part_b, eval_visible, eval_w, eval_x, eval_y, eval, exit_local_coords, feature_point_enabled, feature_point, filter_pt, find_child, first_callback_num, fixed_children, flag_is_set, flag_string, focus_set_enter, focus_set_exit, get_awt_component, get_external_constraint, get_part, get_top_level, get_value, global_to_local, global_to_local, h_constraint, h, handle_cycle, inform_ood, insert_child, inside_bounds, into_local, into_local, into_parent, into_parent, intrinsic_constraints, is_constrained, last_callback_num, local_to_global, local_to_global, mark_all_ood, mark_enabled_ood, mark_h_ood, mark_ood, mark_part_a_ood, mark_part_b_ood, mark_reparented_ood, mark_visible_ood, mark_w_ood, mark_x_ood, mark_y_ood, marked_ood, move_child_downward, move_child_downward, move_child_to_bottom, move_child_to_bottom, move_child_to_top, move_child_to_top, move_child_upward, move_child_upward, move_downward, move_to_bottom, move_to_top, move_upward, new_look_configure, next_sibling, num_actions, num_children, num_feature_points, ood_inform_all, parent, part_a_constraint, part_a, part_b_constraint, part_b, pick_within_children, pick, picked_by, pos, prev_sibling, register_resource_names, remove_child, remove_child, remove_user_datum, restyle_look_resources, restyle, set_callback_obj, set_child_index, set_child, set_constraint_flag_bit, set_constraint_flag_bit, set_constraint, set_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled, set_flag_bit, set_flag_bit, set_h_constraint, set_h_constraint, set_h_constraint, set_h, set_intrinsic_h, set_intrinsic_size, set_intrinsic_w, set_parent, set_part_a_constraint, set_part_a_constraint, set_part_a_constraint, set_part_a, set_part_b_constraint, set_part_b_constraint, set_part_b_constraint, set_part_b, set_pos, set_pos, set_raw_enabled, set_raw_h, set_raw_part_a, set_raw_part_b, set_raw_visible, set_raw_w, set_raw_x, set_raw_y, set_size, set_style_lock, set_user_info, set_visible_constraint, set_visible_constraint, set_visible_constraint, set_visible, set_w_constraint, set_w_constraint, set_w_constraint, set_w, set_x_constraint, set_x_constraint, set_x_constraint, set_x, set_y_constraint, set_y_constraint, set_y_constraint, set_y, setup_for_children, setup_for_children, setup_for_fixed_children, size, style_change_local, style_change, supports_children, tag_str, toString, traverse_and_collect_children, traverse_and_collect_parent, traverse_and_collect, trivial_reject, trivial_reject, user_data, user_info, value_ood, visible_constraint, visible, w_constraint, w, x_constraint, x_into_local, x_into_parent, x, y_constraint, y_into_local, y_into_parent, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

point_snap_target

public point_snap_target(int x,
                         int y)
Constructor.
Parameters:
int - x the x coordinate of the snap target point.
int - y the y coordinate of the snap target point.
Method Detail

point_snaps

public 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 the point (and return the square of its distance, and the point snapped to). This is a geometric test only. It reports a snap if the square of the distance to the point is less than or equal to snap_drag_agent.snap_dist2(). The object return_dist2 object is modified so that it contains the square of the distance from the drag point to the target point. The return_snap_pt object is modified to return the position of the target point.
Specified by:
point_snaps in interface snap_targetable
Parameters:
pt - the point being tested (in local coordinates).
return_dist2 - modified to contain the square of the distance to the point.
return_snap_pt - modified to contain the snap target point location in local coordinates (i.e., 0,0).
Returns:
boolean indicating whether the snap is geometrically accepted.

snap_from_ok

public 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. In this case we accept all snaps.
Specified by:
snap_from_ok in interface snap_targetable
Parameters:
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.
Returns:
whether the snap is acceptable.

anti_snap_from_ok

public 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. In this case we never provide anti-snap feedback.
Specified by:
anti_snap_from_ok in interface snap_targetable
Parameters:
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.
Returns:
null for no anti-snap. if anti-snap feedback is desired a non-null object is returned (which is later passed to various anti-snap routines in the protocol).

snap_from

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)
Do the feedback corresponding to a snap from the given drag object. This class does no feedback, so this is accepted but ignored.
Specified by:
snap_from in interface snap_targetable
Parameters:
event - evt the event that "caused the snap".
Point - orig_pt the point the dragged object would nominally be at.
Point - snap_pt the point the dragged object snaps to.
snap_draggable - drag_obj the dragged object.
int - feature_pt_indx the feature point within dragged object that we are snapping with.
Object - user_info the information that was associated with the dragged object when it requested snap-drag focus.

snap_feedback

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)
Do feedback while a snap is active.
Specified by:
snap_feedback in interface snap_targetable
Parameters:
event - evt the event that "caused the snap".
Point - orig_pt the point the dragged object would nominally be at.
Point - snap_pt the point the dragged object snaps to.
snap_draggable - drag_obj the dragged object.
int - feature_pt_indx the feature point within dragged object that we are snapping with.
Object - user_info the information that was associated with the dragged object when it requested snap-drag focus.

unsnap_from

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)
Remove feedback for a snap that is now being broken. This class does no feedback, so this is accepted but ignored.
Specified by:
unsnap_from in interface snap_targetable
Parameters:
event - evt the event that "caused the snap".
Point - orig_pt the point the dragged object would nominally be at.
Point - snap_pt the point the dragged object snaps to.
snap_draggable - drag_obj the dragged object.
int - feature_pt_indx the feature point within dragged object that we are snapping with.
Object - user_info the information that was associated with the dragged object when it requested snap-drag focus.

anti_snap_from

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)
Do anti-snap feedback corresponding to an anti-snap from the given drag object. This class does not do anti-snaps, so this is accepted but ignored.
Specified by:
anti_snap_from in interface snap_targetable
Parameters:
event - evt the event that "caused the anti-snap".
Point - orig_pt the point the dragged object would nominally be at.
Point - snap_pt the point the dragged object anti-snaps to.
snap_draggable - drag_obj the dragged object.
int - feature_pt_indx the feature point within dragged object that we are anti-snapping with.
Object - user_info the information that was associated with the dragged object when it requested snap-drag focus.

anti_snap_feedback

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)
Specified by:
anti_snap_feedback in interface snap_targetable

unanti_snap_from

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)
Remove anti-snap feedback for an anti-snap that is now being broken. This class does not do anti-snaps, so this is accepted but ignored.
Specified by:
unanti_snap_from in interface snap_targetable
Parameters:
event - evt the event that "caused the anti-snap".
Point - orig_pt the point the dragged object would nominally be at.
Point - snap_pt the point the dragged object anti-snaps to.
snap_draggable - drag_obj the dragged object.
int - feature_pt_indx the feature point within dragged object that we are anti-snapping with.
Object - user_info the information that was associated with the dragged object when it requested snap-drag focus.