public class SurfaceMapper extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
altDown |
static int |
CMD |
protected boolean |
ctrlDown |
protected boolean |
disableSelectionTool |
protected boolean |
grouping |
protected boolean |
isDragging |
int |
MODE |
static int |
MODE_CALIBRATE |
static int |
MODE_RENDER |
protected processing.core.PVector |
prevMouse |
protected ArrayList<SuperSurface> |
selectedSurfaces |
protected Rectangle |
selectionTool |
protected boolean |
snap |
protected processing.core.PVector |
startPos |
protected ArrayList<SuperSurface> |
surfaces |
String |
VERSION |
Constructor and Description |
---|
SurfaceMapper(processing.core.PApplet parent,
int width,
int height)
Create instance of IxKeystone
|
Modifier and Type | Method and Description |
---|---|
void |
addEventHandler(Object object,
String methodName) |
void |
addSelectedSurface(SuperSurface cps)
Add a surface to selected surfaces
|
SuperSurface |
addSurface(SuperSurface superSurface)
Add a surface to surfaceMapper
|
void |
bringSurfaceToFront(int index)
Places the surface last in the surfaces array, i.e.
|
void |
clearSelectedSurfaces()
Clears the arraylist of selected surfaces.
|
void |
clearSurfaces()
Remove all surfaces
|
SuperSurface |
createBezierSurface(int res)
Creates a Bezier surface with perspective transform.
|
SuperSurface |
createBezierSurface(int res,
int x,
int y)
Creates a Bezier surface at X/Y with perspective transform.
|
SuperSurface |
createQuadSurface(int res)
Creates a Quad surface with perspective transform.
|
SuperSurface |
createQuadSurface(int res,
int x,
int y)
Creates a Quad surface at X/Y with perspective transform.
|
void |
disableMouseEvents()
Unregisters Mouse Event listener for the SurfaceMapper
|
void |
enableMouseEvents()
Registers Mouse Event listener for the SurfaceMapper
|
boolean |
findActiveBezierSurface(float mX,
float mY)
Check if coordinates is inside any of the bezier surfaces.
|
boolean |
findActiveQuadSurface(float mX,
float mY)
Check if coordinates is inside any of the quad surfaces.
|
boolean |
findActiveSurface(float mX,
float mY)
Check if coordinates is inside any of the surfaces.
|
void |
fireEvent(int id)
Fire event to object
|
int[] |
getColor()
Returns the array of colors used in calibration mode for coloring the surfaces.
|
boolean |
getDebug()
See if debug mode is on.
|
boolean |
getDisableSelectionTool()
Is the selection tool disabled?
|
processing.core.PFont |
getIdFont()
Get font for drawing text
|
int |
getMode()
Check which mode is enabled (render or calibrate)
|
int |
getNumAddedSurfaces() |
processing.core.PVector |
getPrevMouse()
Get previous mouse position
|
ArrayList<SuperSurface> |
getSelectedSurfaces()
Get the selected surfaces
|
int |
getSelectionDistance()
Get current max distance for an object to be selected
|
int |
getSelectionMouseColor() |
Rectangle |
getSelectionTool()
Returns the rectangle used for selecting surfaces
|
List<Sketch> |
getSketchList() |
boolean |
getSnap()
See if snap mode is used
|
int |
getSnapDistance()
See the snap distance
|
SuperSurface |
getSurfaceById(int id)
Get surface by Id.
|
ArrayList<SuperSurface> |
getSurfaces()
Get all surfaces
|
boolean |
isAllowUserInput()
Check if any user event is allowed
|
boolean |
isAltDown()
Is ALT pressed?
|
boolean |
isCtrlDown()
Is CTRL pressed?
|
boolean |
isDragging() |
boolean |
isEnableSelectionMouse() |
boolean |
isGrouping()
Check if multiple surfaces are being manipulated
|
boolean |
isUsingBackground()
Boolean used to know if the background image should be rendered in calibration mode.
|
void |
keyEvent(processing.event.KeyEvent k)
KeyEvent method
|
void |
ksMouseEvent(processing.event.MouseEvent e)
MouseEvent method.
|
void |
load(File file)
Load projection map from file
|
void |
mouseEvent(processing.event.MouseEvent e)
MouseEvent method.
|
void |
movePoint(SuperSurface ss,
int x,
int y)
Move a point of a surface
|
static <T> void |
removeDuplicates(ArrayList<T> list) |
void |
removeSelectedSurfaces()
Delete the selected surfaces
|
void |
render(processing.core.PGraphics glos)
Render method used when calibrating.
|
void |
save(File file)
Save all projection mapping data to file
|
void |
save(processing.data.XML root)
Puts all projection mapping data in the XMLElement
|
void |
selectSurfaces(int mX,
int mY) |
void |
setAllowUserInput(boolean allowUserInput)
Set if any user event is allowed
|
void |
setBackground(processing.core.PImage tex)
Optionally set a background image in calibration mode.
|
void |
setColor(int[] ccolor)
Set the array of colors used in calibration mode for coloring the surfaces.
|
void |
setCtrlDown(boolean pressed)
Set CTRL pressed
|
void |
setDebug(boolean debug)
Manually set debug mode.
|
void |
setDisableSelectionTool(boolean disableSelectionTool)
Enable/disable selection tool
|
void |
setEnableSelectionMouse(boolean enableSelectionMouse) |
void |
setGrouping(boolean grouping)
Set if multiple surfaces are being manipulated
|
void |
setIsDragging(boolean isDragging) |
void |
setModeCalibrate()
Set mode to calibrate
|
void |
setModeRender()
Set mode to render
|
void |
setNumAddedSurfaces(int numAddedSurfaces) |
void |
setPrevMouse(float x,
float y)
Set previous mouse position
|
void |
setSelectedSurface(SuperSurface cps)
Select the surface.
|
void |
setSelectionDistance(int selectionDistance)
Set the max distance for an object to be selected
|
void |
setSelectionMouseColor(int selectionMouseColor) |
void |
setSelectionTool(int x,
int y,
int width,
int height)
Set the selection tool
|
void |
setSelectionTool(Rectangle r)
Set the selection tool
|
void |
setShakeAll(int strength,
int speed,
int fallOfSpeed)
Shake all surfaces with max Z-displacement strength, vibration-speed speed, and shake decline fallOfSpeed.
|
void |
setSketchList(List<Sketch> sketchList) |
void |
setSnap(boolean snap)
Manually set corner snap mode
|
void |
setSnapDistance(int snapDistance)
Set corner snap distance
|
void |
setUsingBackground(boolean val)
Set if background image should rendered in calibration mode
|
void |
shake()
Update shaking for all surfaces
|
void |
toggleCalibration()
Toggle the mode
|
void |
toggleSnap()
Toggle if corner snapping is used
|
String |
version() |
public static final int MODE_RENDER
public static final int MODE_CALIBRATE
public static final int CMD
public final String VERSION
public int MODE
protected ArrayList<SuperSurface> surfaces
protected ArrayList<SuperSurface> selectedSurfaces
protected boolean snap
protected processing.core.PVector prevMouse
protected boolean ctrlDown
protected boolean altDown
protected boolean grouping
protected Rectangle selectionTool
protected processing.core.PVector startPos
protected boolean isDragging
protected boolean disableSelectionTool
public SurfaceMapper(processing.core.PApplet parent, int width, int height)
parent
- width
- height
- public static <T> void removeDuplicates(ArrayList<T> list)
public void addSelectedSurface(SuperSurface cps)
cps
- public SuperSurface addSurface(SuperSurface superSurface)
superSurface
- public void bringSurfaceToFront(int index)
index
- public void clearSelectedSurfaces()
public void clearSurfaces()
public SuperSurface createBezierSurface(int res)
res
- public SuperSurface createBezierSurface(int res, int x, int y)
res
- x
- y
- public SuperSurface createQuadSurface(int res)
res
- public SuperSurface createQuadSurface(int res, int x, int y)
res
- x
- y
- public void disableMouseEvents()
public void enableMouseEvents()
public boolean findActiveBezierSurface(float mX, float mY)
mX
- mY
- public boolean findActiveQuadSurface(float mX, float mY)
mX
- mY
- public boolean findActiveSurface(float mX, float mY)
mX
- mY
- public void fireEvent(int id)
public int[] getColor()
public boolean getDebug()
public boolean getDisableSelectionTool()
public processing.core.PFont getIdFont()
public int getMode()
public int getNumAddedSurfaces()
public processing.core.PVector getPrevMouse()
public ArrayList<SuperSurface> getSelectedSurfaces()
public int getSelectionDistance()
public int getSelectionMouseColor()
public Rectangle getSelectionTool()
public boolean getSnap()
public int getSnapDistance()
public SuperSurface getSurfaceById(int id)
id
- public ArrayList<SuperSurface> getSurfaces()
public boolean isAllowUserInput()
public boolean isAltDown()
public boolean isCtrlDown()
public boolean isDragging()
public boolean isEnableSelectionMouse()
public boolean isGrouping()
public boolean isUsingBackground()
public void keyEvent(processing.event.KeyEvent k)
k
- public void ksMouseEvent(processing.event.MouseEvent e)
e
- public void load(File file)
file
- public void mouseEvent(processing.event.MouseEvent e)
e
- public void movePoint(SuperSurface ss, int x, int y)
ss
- x
- y
- public void removeSelectedSurfaces()
public void render(processing.core.PGraphics glos)
glos
- public void save(processing.data.XML root)
root
- public void save(File file)
file
- public void selectSurfaces(int mX, int mY)
public void setAllowUserInput(boolean allowUserInput)
allowUserInput
- public void setBackground(processing.core.PImage tex)
tex
- public void setColor(int[] ccolor)
ccolor
- public void setCtrlDown(boolean pressed)
pressed
- public void setDebug(boolean debug)
debug
- public void setDisableSelectionTool(boolean disableSelectionTool)
disableSelectionTool
- public void setEnableSelectionMouse(boolean enableSelectionMouse)
public void setGrouping(boolean grouping)
grouping
- public void setIsDragging(boolean isDragging)
isDragging
- public void setModeCalibrate()
public void setModeRender()
public void setNumAddedSurfaces(int numAddedSurfaces)
public void setPrevMouse(float x, float y)
x
- y
- public void setSelectedSurface(SuperSurface cps)
cps
- public void setSelectionDistance(int selectionDistance)
selectionDistance
- public void setSelectionMouseColor(int selectionMouseColor)
public void setSelectionTool(Rectangle r)
r
- public void setSelectionTool(int x, int y, int width, int height)
x
- y
- width
- height
- public void setShakeAll(int strength, int speed, int fallOfSpeed)
strength
- speed
- fallOfSpeed
- public void setSnap(boolean snap)
snap
- public void setSnapDistance(int snapDistance)
snapDistance
- public void setUsingBackground(boolean val)
val
- public void shake()
public void toggleCalibration()
public void toggleSnap()
public String version()
Copyright © 2017. All rights reserved.