8.5.6 Sticking
Less common and more difficult to implement and manage are physical attachments
that are flexible or non-rigid. In this form of attachment, which is called sticking, the
geometry of the attachment is not fully constrained. The simplest form of sticking
involves two snap points where the position of the attachment is constrained but not
its rotation. The result is like a ball-and-socket joint. Using different forms of snap
elements intuitively suggests different forms of sticking attachment. For example,
sticking two snap edges together forces the object edges to be colinear but the user
can still rotate the objects about the colinear edges like an axis. Similarly, sticking two
faces together assures that the two are flush but the user can still slide and possibly
rotate the objects along their coplanar faces.
Philosophical problems can arise when we consider what happens when objects
that are only stuck together are pulled. In general, the objects involved would behave
as in a physical simulation of a dynamic system, with flexing, sliding, and rotation
occurring at the joints according to distributed forces and simulated friction. This is
overkill for most applications. An easy and effective alternative is to allow only the
dragged object to move, and only if its attachments would mutually allow such a
movement. For example, given a door in a doorframe connected with two hinge
attachments, dragging on the door would swing the door open while the doorframe
remains stationary. If, however, a third hinge were added to the door opposite the first
two hinges, then the door would be prevented from swinging. Does this now mean
that tugging on the door moves the house to which the doorframe is glued? This problem
will be discussed a later.
8.5.7 Linking
Many aspects of logical attachment, or linking, have already been discussed. The big
difference between physical and logical attachment is that in logical attachment the
snap elements do not have to touch, so the participating objects can stay where they
are. If the user tugs on a linked object, then the object moves and the links stretch
accordingly. More sophisticated linking schemes might allow the nodes to automatically
rearrange themselves to minimize connection crossings or to improve the layout.
Linking is useful in design and control applications where connections must be
established or modified between objects representing nodes in a network, such as for
telecommunications, transportation, and utilities. Often in such networks only the
topology is important, not the actual spatial geometry. For example, in a telecommunications
application, the nodes might represent company offices or, at a lower level
of abstraction, computer equipment. The links might represent physical communication
connections or logical data circuits, or both. Snap point typing by protocol or
physical medium could constrain how nodes are connected. The links themselves
could be "dumb" lines or arrows that form straight-line connections, or they could
be "smart" ones that bend around intervening objects automatically or with some
manual intervention.
8.5.8 Anchoring
In the real world you don't have to worry about moving the whole house if you try to
open a locked door. In the virtual world, where the laws of physics do not naturally
apply, such matters are not as clear-cut. Maybe the house should move and maybe it
shouldn't. One simple way to address this problem is with anchoring, which is a special
form of attachment between an object and the world. When an object is
anchored, it is held rigidly in place relative to the world. In the door example, it
would be wise to anchor the house, or at least some foundation component of the
house, such as its floor. That way the floor and all the rest of house's components
glued to it remain firmly in place, no matter how the user manipulates the house's
sticky attachments, such as the door. Anchoring can also be useful when logical
attachments are involved, such as in the case where linked nodes rearrange automatically
to minimize crossings. In this case, anchoring allows key nodes to remain fixed
in place.
The simplest way to perform anchoring is to select one or more objects to be
anchored and to command them to be anchored. Anchoring may sound like overkill,
and often it is. If an application allows only gluing, then anchoring might be needed
only as a convenience, to keep a layout from being accidentally altered. If sticking is
allowed, then anchoring can become a serious issue, unless you don't mind the house
moving when you try to open its door.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|