|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjecttuioZones.TUIOzoneCollection
public class TUIOzoneCollection
The TUIOzoneCollection class provides a way to define zones that respond to TUIO events in unique ways. It handles the processing of TUIO events and provides methods to get data about each zone and related TUIO events.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
PImage b;
void setup(){
size(screen.width,screen.height);
// create a draggable, throwable, and scalable zone for a photo
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/2,height/2,400,300);
zones.setZoneParameter("zone1","DRAGGABLE",true);
zones.setZoneParameter("zone1","THROWABLE",true);
zones.setZoneParameter("zone1","SCALABLE",true);
b = loadImage("photo.jpg");
noFill();
smooth();
}
void draw(){
background(0);
// use the zone coordinates and size to display the image
image(b, zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
// outline photo when pressed
if (zones.isZonePressed("zone1")) {
stroke(200,200,0);
strokeWeight(4);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
}
// draw the touch trails for testing hardware calibration
/*int[][] coord=zones.getPoints();
stroke(100,100,100);
strokeWeight(1);
if (coord.length>0){
for (int i=0;i1){
for (int j=1;j | Field Summary |
|---|
| Fields inherited from interface processing.core.PConstants |
|---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
| Constructor Summary | |
|---|---|
TUIOzoneCollection(processing.core.PApplet theParent)
The Constructor initializes a collection of zones that respond to TUIO cursor actions. |
|
TUIOzoneCollection(processing.core.PApplet theParent,
int port)
The Constructor initializes a collection of zones that respond to TUIO cursor actions. |
|
| Method Summary | |
|---|---|
void |
applyZone3dMatrix(java.lang.String zNameIn)
Apply the zone's stored 3d Matrix Transformation. |
void |
assignZoneToGroup(java.lang.String zone,
java.lang.String group)
Assign a zone to a group. |
void |
attachZoneTo(java.lang.String child,
java.lang.String parent)
Attach a zone to another zone. |
void |
changeZoneName(java.lang.String zNameOld,
java.lang.String zNameNew)
Change zone name. |
void |
clicked(java.lang.String zName)
|
void |
drawCirc(java.lang.String zone)
Draw circle based on a zone's position and size. |
void |
drawImage(java.lang.String zone,
processing.core.PImage image)
Draw image based on a zone's position and size. |
void |
drawRect(java.lang.String zone)
Draw rectangle based on a zone's position and size. |
void |
drawText(java.lang.String zone,
java.lang.String text)
Draw text centered, horizontally and vertically, on a zone. |
float |
getGestureRotation(java.lang.String zNameIn)
Get an active gesture's rotation factor (0.0 to 1.0 for 360 degree sweep). |
float |
getGestureScale(java.lang.String zNameIn)
Get an active gesture's scale factor. |
float |
getGestureXtranslation(java.lang.String zNameIn)
Get an active gesture's x-axis translation. |
float |
getGestureYtranslation(java.lang.String zNameIn)
Get an active gesture's y-axis translation. |
int[][] |
getPoints()
Get coordinates and touch ID of all the touch points (TUIO cursors) on the screen. |
int[][] |
getTrail(int index)
Get a trail of points left by a touch. |
float[] |
getZone3dRotationMatrix(java.lang.String zNameIn)
Get the zones stored 3d Rotation Matrix. |
int |
getZoneCenterX(java.lang.String zNameIn)
Get the zone center y-coordinate. |
int |
getZoneCenterY(java.lang.String zNameIn)
Get the zone center y-coordinate. |
int[] |
getZoneData(java.lang.String zNameIn)
Get zone data. |
int |
getZoneHeight(java.lang.String zNameIn)
Get the zone height. |
float |
getZoneScale(java.lang.String zNameIn)
Get the zone scale factor. |
int |
getZoneWidth(java.lang.String zNameIn)
Get the zone width. |
int |
getZoneX(java.lang.String zNameIn)
Get the zone x-coordinate. |
int |
getZoneY(java.lang.String zNameIn)
Get the zone y-coordinate. |
boolean |
isZoneActive(java.lang.String zNameIn)
Determine if zone is active. |
boolean |
isZonePressed(java.lang.String zNameIn)
Determine if the zone is being touched. |
boolean |
isZoneToggleOn(java.lang.String zNameIn)
Determine the toggle state of the zone. |
void |
killZone(java.lang.String zNameIn)
Kill a zone. |
void |
makeHswipeEvent(java.lang.String zName)
|
void |
makeVswipeEvent(java.lang.String zName)
|
void |
pre()
|
void |
pullZoneToTop(java.lang.String zNameIn)
Pull a zone to the top layer. |
void |
setZone(java.lang.String zNameIn,
int xIn,
int yIn,
int rIn)
Define a new circular zone that will respond to TUIO events in a unique way. |
void |
setZone(java.lang.String zNameIn,
int xIn,
int yIn,
int wIn,
int hIn)
Define a new rectangular zone that will respond to TUIO events in a unique way. |
void |
setZoneActive(java.lang.String zNameIn,
boolean active)
Activate a zone so that it responds to touch. |
void |
setZoneChildrenActive(java.lang.String zNameIn,
boolean active)
Activate a zone so that it responds to touch. |
void |
setZoneData(java.lang.String zNameIn,
int xIn,
int yIn,
int rIn)
Modify circular zone primitive data. |
void |
setZoneData(java.lang.String zNameIn,
int xIn,
int yIn,
int wIn,
int hIn)
Modify rectangular zone primitive data. |
void |
setZoneDragLimits(java.lang.String zNameIn,
int xlow,
int xhigh,
int ylow,
int yhigh)
Set zone drag limits. |
void |
setZoneParameter(java.lang.String zNameIn,
java.lang.String paramName,
boolean bool)
Set zone parameters, like 'DRAGGABLE', 'SCALABLE', or 'HSWIPEABLE'. |
void |
setZoneScaleLimits(java.lang.String zNameIn,
float low,
float high)
Set zone scale limits. |
void |
setZoneScaleSensitivity(java.lang.String zNameIn,
float val)
Set zone scale sensitivity. |
void |
touchReleased(int index)
|
java.lang.String |
version()
return the version of the library. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TUIOzoneCollection(processing.core.PApplet theParent)
theParent -
public TUIOzoneCollection(processing.core.PApplet theParent,
int port)
theParent - port - the port where TUIO messages will be sent to. (for example,
3333)| Method Detail |
|---|
public java.lang.String version()
public void setZone(java.lang.String zNameIn,
int xIn,
int yIn,
int rIn)
zNameIn - a name for the zonexIn - the x-coordinate of the center of the circular zoneyIn - the y-coordinate of the center of the circular zonerIn - the radius of the circular zone
public void setZone(java.lang.String zNameIn,
int xIn,
int yIn,
int wIn,
int hIn)
zNameIn - a name for the zonexIn - the x-coordinate of the upper left corner of the zoneyIn - the y-coordinate of the upper left corner of the zonewIn - the width of the zonehIn - the height of the zone
public void setZoneData(java.lang.String zNameIn,
int xIn,
int yIn,
int wIn,
int hIn)
zNameIn - the name of the zone to be modifiedxIn - the x-coordinate of the upper left corner of the zoneyIn - the y-coordinate of the upper left corner of the zonewIn - the width of the zonehIn - the height of the zone
public void setZoneDragLimits(java.lang.String zNameIn,
int xlow,
int xhigh,
int ylow,
int yhigh)
zNameIn - the name of the zone to be modifiedxlow - the lower limit of drag x distanceylow - the lower limit of drag y distancexhigh - the upper limit of drag x distanceyhigh - the upper limit of drag y distance
public void setZoneScaleLimits(java.lang.String zNameIn,
float low,
float high)
zNameIn - the name of the zone to be modifiedlow - the lower limit of scale gesture (<=1)high - the upper limit of scale gesture (>=1)
public void setZoneScaleSensitivity(java.lang.String zNameIn,
float val)
zNameIn - the name of the zone to be modifiedval - the sensitivity of scale gesture (default=1.0)
public void setZoneData(java.lang.String zNameIn,
int xIn,
int yIn,
int rIn)
zNameIn - the name of the zone to be modifiedxIn - the x-coordinate of the upper left corner of the zoneyIn - the y-coordinate of the upper left corner of the zonerIn - the radius of the zone
public void changeZoneName(java.lang.String zNameOld,
java.lang.String zNameNew)
zNameOld - old name for the zonezNameNew - new name for the zone
public void setZoneParameter(java.lang.String zNameIn,
java.lang.String paramName,
boolean bool)
zNameIn - the name of the zone to be modifiedparamName - the name of the parameter to be set. Parameters names can be
'DRAGGABLE', 'SCALABLE', 'VSWIPEABLE', 'HSWIPEABLE', or
'WINDOW3D'. Note, 'HSWIPEABLE' and 'VSWIPEABLE' can only be
applied to rectangle zones. 'WINDOW3D' enables a one-finger
gesture for applying 3D rotations to an object.bool - Set the parameter to be true or false.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
void setup(){
size(screen.width,screen.height);
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/2,height/2,200,200);
zones.setZoneParameter("zone1","DRAGGABLE",true);
fill (150);
}
void draw(){
background(0);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
}
public void attachZoneTo(java.lang.String child,
java.lang.String parent)
child - the name of the child zone.parent - the name of the parent zone.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
void setup(){
size(screen.width,screen.height);
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/10,height/4,width/3,height/2);
zones.setZoneParameter("zone1","DRAGGABLE",true);
zones.setZoneParameter("zone1","SCALABLE",true);
zones.setZone("subZone1", width*6/10,height/4,width/3,height/2);
zones.setZoneParameter("subZone1","DRAGGABLE",true);
zones.setZoneParameter("subZone1","SCALABLE",true);
zones.attachZoneTo("subZone1","zone1");
}
void draw(){
background(0);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
fill (150);
rect(zones.getZoneX("subZone1"),zones.getZoneY("subZone1"),zones.getZoneWidth("subZone1"),zones.getZoneHeight("subZone1"));
}
public void assignZoneToGroup(java.lang.String zone,
java.lang.String group)
zone - the name of the zone to assign to a group.parent - the name of the group. Can be a new group or existing.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
void setup(){
size(screen.width,screen.height);
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/10,height/4,width/3,height/2);
zones.setZoneParameter("zone1","DRAGGABLE",true);
zones.setZoneParameter("zone1","SCALABLE",true);
zones.assignZoneToGroup("zone1","group1");
zones.setZone("zone2", width*6/10,height/4,width/3,height/2);
zones.setZoneParameter("zone2","DRAGGABLE",true);
zones.setZoneParameter("zone2","SCALABLE",true);
zones.assignZoneToGroup("zone2","group1");
}
void draw(){
background(0);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
fill (150);
rect(zones.getZoneX("zone2"),zones.getZoneY("zone2"),zones.getZoneWidth("zone2"),zones.getZoneHeight("zone2"));
}
public void pullZoneToTop(java.lang.String zNameIn)
zNameIn - the name of the zone to pull to the top layer.public void killZone(java.lang.String zNameIn)
zNameIn - the name of the zone to be killed.
public void setZoneActive(java.lang.String zNameIn,
boolean active)
zNameIn - the name of the zone to be activated.active - boolean to set active state. true for set active, false for
set not active
public void setZoneChildrenActive(java.lang.String zNameIn,
boolean active)
zNameIn - the name of the zone to be activated.active - boolean to set active state. true for set active, false for
set not activepublic void makeHswipeEvent(java.lang.String zName)
public void makeVswipeEvent(java.lang.String zName)
public void touchReleased(int index)
public void clicked(java.lang.String zName)
public int getZoneX(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int getZoneY(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int getZoneCenterX(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int getZoneCenterY(java.lang.String zNameIn)
zNameIn - the name of the zone.
public void applyZone3dMatrix(java.lang.String zNameIn)
zNameIn - the name of the zone.public float[] getZone3dRotationMatrix(java.lang.String zNameIn)
zNameIn - the name of the zone.
public float getZoneScale(java.lang.String zNameIn)
zNameIn - the name of the zone.
public float getGestureScale(java.lang.String zNameIn)
zNameIn - the name of the zone.
public float getGestureXtranslation(java.lang.String zNameIn)
zNameIn - the name of the zone.
public float getGestureYtranslation(java.lang.String zNameIn)
zNameIn - the name of the zone.
public float getGestureRotation(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int getZoneWidth(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int getZoneHeight(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int[] getZoneData(java.lang.String zNameIn)
0-the x-coordinate of the zone (upper left for rectangles and center for circles)
1-the x-coordinate of the zone (upper left for rectangles and center for circles)
2-the width of the zone (the radius if circle)
3-the height of the zone (the radius if circle)
4-the primary touch point x-coordinate (-999 if the zone is not being touched)
5-the primary touch point y-coordinate (-999 if the zone is not being touched)
6-the primary touch point index or ID (for use in getTrail method, -999 if none exist) 7-the second touch point x-coordinate (-999 if the zone is not being touched)
8-the second touch point y-coordinate (-999 if the zone is not being touched)
9-the second touch point index or ID (for use in getTrail method, -999 if none exist)
zNameIn - the name of the zone.
public void drawText(java.lang.String zone,
java.lang.String text)
zone - the name of the zone.text - the text to draw.public void drawCirc(java.lang.String zone)
zone - the name of the zone.public void drawRect(java.lang.String zone)
zone - the name of the zone.
public void drawImage(java.lang.String zone,
processing.core.PImage image)
zone - the name of the zone.image - the PImage to be drawn.public boolean isZonePressed(java.lang.String zNameIn)
zNameIn - the name of the zone.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
void setup(){
size(screen.width,screen.height);
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/2,height/2,200,200);
}
void draw(){
background(0);
if (zones.isZonePressed("zone1")) fill (255); //change brightness when zone is pressed
else fill (100);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
}
public boolean isZoneToggleOn(java.lang.String zNameIn)
zNameIn - the name of the zone.
import oscP5.*;
import netP5.*;
import tuioZones.*;
TUIOzoneCollection zones;
void setup(){
size(screen.width,screen.height);
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", width/2,height/2,200,200);
}
void draw(){
background(0);
if (zones.isZoneToggleOn("zone1")) fill (255); //change brightness when zone is toggled
else fill (100);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
}
public boolean isZoneActive(java.lang.String zNameIn)
zNameIn - the name of the zone.
public int[][] getPoints()
[i][0] - x coordinate
[i][1] - y coordinate
[i][2] - ID (Useful for getTrail method)
public int[][] getTrail(int index)
[i][0] - x coordinate
[i][1] - y coordinate
index - The index of the point trail.
public void pre()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||