public class Junction
extends java.lang.Object
implements processing.core.PConstants
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_RETINA_PIXELS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_RETINA_PIXELS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
Junction(float bw,
float bh,
float x,
float y,
float w,
float h)
Constructs a new Junction with the specified values for box width, box height, center x, center y, width, and height.
|
Modifier and Type | Method and Description |
---|---|
void |
addContact(long id,
float x,
float y)
Adds a contact to this Junction.
|
void |
addJunction(Junction j)
Adds a junction to this Junction.
|
void |
allowRecording(boolean r)
Determines whether interactions with this Junction will be recorded by the Dispatcher.
|
void |
allowRotation(boolean r)
Determines whether rotation is allowed.
|
void |
allowRotation(boolean r1,
boolean r2)
Determines whether rotation is allowed by setting 1 and 2 Contact rotations separately.
|
void |
allowRotation(boolean r,
int c)
Determines whether rotation is allowed and how many Contacts are used.
|
void |
allowScaling(boolean s)
Determines whether scaling is allowed.
|
void |
allowScalingHeight(boolean sh)
Determines whether height scaling is allowed.
|
void |
allowScalingWidth(boolean sw)
Determines whether width scaling is allowed.
|
void |
allowTranslation(boolean t)
Allows translation with 1 or 2 Contacts.
|
void |
allowTranslation(boolean t,
int c)
Allows translation with the specified number of Contacts.
|
void |
allowTranslation(boolean t,
int min,
int max)
Allows translation with Contacts in the specified range.
|
void |
allowTranslationX(boolean tx)
Determines whether x translation is allowed.
|
void |
allowTranslationY(boolean ty)
Determines whether y translation is allowed.
|
void |
beLive(boolean live)
Sets the live status for this Junction.
|
void |
changeAngle(float da)
Changes the angle of this Junction.
|
void |
changeCenter(float dx,
float dy)
Changes the x and y coordinates for the center point of this Junction.
|
void |
changeCenterX(float dx)
Change the x coordinate for the center of this Junction by adding or subtracting the specified amount.
|
void |
changeCenterY(float dy)
Change the x coordinate for the center of this Junction by adding or subtracting the specified amount.
|
void |
changeHeight(float dh)
Change the height by adding the specified amount.
|
void |
changeScale(float dw,
float dh)
Changes the width and height of this Junction with a single method.
|
void |
changeWidth(float dw)
Change the width by adding the specified amount.
|
void |
clearContacts()
Removes all Contacts contained in this Junction.
|
float |
getAngle()
Returns the current angle.
|
float |
getCenterX()
Returns the x coordinate of the current center point.
|
float |
getCenterY()
Returns the y coordinate of the current center point.
|
int |
getContactCount()
Returns the number of Contacts currently associated with this Junction.
|
Contact[] |
getContacts()
Returns a list that is a copy of the current contact map values.
|
float |
getHeight()
Returns the current height.
|
int |
getJunctionCount()
Returns the number of subjunctions contained in this Junction.
|
Junction[] |
getJunctions()
Gets an array of any Junctions associated with this Junction.
|
java.lang.String |
getLabel()
Gets the label for this Junction.
|
float |
getMaxScalingHeight()
Returns the maximum height allowed for scaling.
|
float |
getMaxScalingWidth()
Returns the maximum width allowed for scaling.
|
float |
getMaxTranslationX()
Returns the maximum value set for translation in the x direction.
|
float |
getMaxTranslationY()
Returns the maximum value set for translation in the y direction.
|
float |
getMinScalingHeight()
Returns the minimum height allowed for scaling.
|
float |
getMinScalingWidth()
Returns the minimum width allowed for scaling.
|
float |
getMinTranslationX()
Returns the minimum value set for translation in the x direction.
|
float |
getMinTranslationY()
Returns the minimum value set for translation in the y direction.
|
int |
getRotationCount()
Returns the number of rotations that this Junction has undergone.
|
int |
getShape()
Returns the shape of this Junction as an integer.
|
boolean |
getToggle()
Returns the current state of a boolean.
|
float |
getWidth()
Returns the current width.
|
boolean |
isActive()
Returns true if this Junction has any Contacts.
|
boolean |
isLive()
Returns the live status of this Junction.
|
boolean |
isRecordable()
Returns true if recording should happen and false otherwise.
|
void |
limitRotation(float min,
float max)
Sets a minimum and maximum value for the rotation angle of this Junctions.
|
void |
limitScalingHeight(float min,
float max)
Sets minimum and maximum vales for scaling height.
|
void |
limitScalingWidth(float min,
float max)
Sets minimum and maximum vales for scaling width.
|
void |
limitTranslationX(float min,
float max)
Sets minimum and maximum vales for translation in the x direction.
|
void |
limitTranslationY(float min,
float max)
Sets minimum and maximum values for translation in the y direction.
|
void |
mapMessage(Action action,
java.lang.String message)
Maps the specified Action to the specified OSC message.
|
void |
removeContact(long id)
Removes the specified contact from this Junction.
|
void |
removeJunction(Junction j)
Removes the specified junction from this Junction.
|
void |
setAngle(float a)
Sets the angle of this Junction.
|
void |
setCenter(float x,
float y)
Sets the x and y coordinates for the center point of this Junction.
|
void |
setCenterX(float x)
Sets the x coordinate for the center point of this Junction.
|
void |
setCenterY(float y)
Sets the y coordinate for the center point of this Junction.
|
void |
setHeight(float h)
Sets the height of this Junction.
|
void |
setLabel(java.lang.String l)
Sets the label for this Junction.
|
void |
setScale(float w,
float h)
Sets the width and height of this Junction with a single method.
|
void |
setShape(int shape)
Sets the shape for this Junction.
|
void |
setTarget(Relay r)
Sets the target to the specified Relay.
|
void |
setTarget(java.lang.String address,
int port)
Sets the target for messages sent from this Junction.
|
void |
setToggle(boolean toggle)
Sets the current state of the toggle boolean.
|
void |
setWidth(float w)
Sets the width of this Junction.
|
void |
unmapMessage(Action action,
java.lang.String message)
Removes the mapping of the specified Action to the specified OSC message.
|
void |
updateContact(long id,
float x,
float y)
Updates the specified contact.
|
public Junction(float bw, float bh, float x, float y, float w, float h)
bw
- the box widthbh
- the box heightx
- the x coordinate of the center pointy
- the y coordinate of the center pointw
- the widthh
- the heightpublic void allowRotation(boolean r)
r
- true to allow rotation, false otherwisepublic void allowRotation(boolean r1, boolean r2)
r1
- r2
- public void allowRotation(boolean r, int c)
r
- true to allow rotation, false otherwisec
- either 1 or 2public void allowScaling(boolean s)
s
- true to allow scaling, false otherwisepublic void allowScalingWidth(boolean sw)
sw
- public void allowScalingHeight(boolean sh)
sh
- public void allowTranslation(boolean t)
t
- true to allow translation, false otherwisepublic void allowTranslation(boolean t, int c)
t
- true to allow translation, false otherwisec
- the number of Contacts to translatepublic void allowTranslation(boolean t, int min, int max)
t
- true to allow translation, false otherwisemin
- the minimum number of Contacts for translationmax
- the maximum number of Contacts for translationpublic void allowTranslationX(boolean tx)
tx
- true to allow x translation, false otherwisepublic void allowTranslationY(boolean ty)
ty
- true to allow y translation, false otherwisepublic void beLive(boolean live)
live
- public boolean isLive()
public void setShape(int shape)
shape
- the shape of the Junctionpublic int getShape()
public void setLabel(java.lang.String l)
l
- the label Stringpublic java.lang.String getLabel()
public void setTarget(java.lang.String address, int port)
address
- the IP address of the targetport
- the port number of the targetpublic void setTarget(Relay r)
r
- the Relay to use for the targetpublic void setCenter(float x, float y)
x
- the x coordinatey
- the y coordinatepublic void changeCenter(float dx, float dy)
dx
- the amount to change xdy
- the amount to change ypublic void setCenterX(float x)
x
- the value of xpublic void changeCenterX(float dx)
dx
- the amount to be added or subtracted from the center x valuepublic void setCenterY(float y)
y
- the value of ypublic void changeCenterY(float dy)
dy
- the amount to be added or subtracted from the center y valuepublic void setWidth(float w)
w
- the width valuepublic void changeWidth(float dw)
dw
- the amount to add to the widthpublic void setHeight(float h)
h
- the height valuepublic void changeHeight(float dh)
dh
- the amount to add to the heightpublic void setScale(float w, float h)
w
- the new widthh
- the new heightpublic void changeScale(float dw, float dh)
dw
- the amount to add to the widthdh
- the amount to add to the heightpublic void setAngle(float a)
a
- the angle valuepublic void changeAngle(float da)
da
- the amount to change the angle in radianspublic void setToggle(boolean toggle)
toggle
- a boolean representing the current toggle statepublic void limitScalingWidth(float min, float max)
min
- the minimum value for width scalingmax
- the maximum value for width scalingpublic void limitScalingHeight(float min, float max)
min
- the minimum value for height scalingmax
- the maximum value for height scalingpublic void limitTranslationX(float min, float max)
min
- the minimum value for x translationmax
- the maximum value for x translationpublic void limitTranslationY(float min, float max)
min
- the minimum value for y translationmax
- the maximum value for y translationpublic void limitRotation(float min, float max)
min
- the minimum anglemax
- the maximum anglepublic float getCenterX()
public float getCenterY()
public float getWidth()
public float getHeight()
public float getAngle()
public int getRotationCount()
public float getMinScalingWidth()
public float getMaxScalingWidth()
public float getMinScalingHeight()
public float getMaxScalingHeight()
public float getMinTranslationX()
public float getMaxTranslationX()
public float getMinTranslationY()
public float getMaxTranslationY()
public boolean getToggle()
public void addJunction(Junction j)
j
- junction to be addedpublic void removeJunction(Junction j)
j
- junction to be removedpublic Junction[] getJunctions()
public int getJunctionCount()
public void addContact(long id, float x, float y)
id
- the unique identifier for the Contactx
- the center x valuey
- the center y valuepublic void updateContact(long id, float x, float y)
id
- the unique identifier for the Contactx
- an updated center x valuey
- an updated center y valuepublic void removeContact(long id)
id
- the unique identifier for the Contactpublic void clearContacts()
public int getContactCount()
public Contact[] getContacts()
public void allowRecording(boolean r)
r
- true to allow recording, false otherwisepublic boolean isRecordable()
public void mapMessage(Action action, java.lang.String message)
action
- the Action to be associated with the messagemessage
- the message to send for the specifed Actionpublic void unmapMessage(Action action, java.lang.String message)
action
- the Action to unmapmessage
- the message to unmappublic boolean isActive()