public class Camera extends Object
Modifier and Type | Field and Description |
---|---|
double |
altitude
Altitude of observation (controls zoom factor).
|
static float |
DEFAULT_FOCAL |
protected double |
dx |
protected double |
dy |
protected double |
dz |
double |
focal
Focal distance.
|
double |
vx
Coordinates in virtual space.
|
double |
vy
Coordinates in virtual space.
|
protected boolean |
zile |
protected double |
zilX |
protected double |
zilY |
Modifier and Type | Method and Description |
---|---|
void |
addListener(CameraListener listener)
Registers a CameraListener for this Camera
|
void |
altitudeOffset(double a)
Set camera altitude (relative value).
|
void |
altitudeOffset(double a,
boolean repaint)
Set camera altitude (relative value).
|
void |
enableCustomZoomInvariantLocation(boolean b)
Use a specific zoom-invariant point or use the camera's (x,y) coords are used (default).
|
double |
getAltitude()
Get camera's altitude.
|
double[] |
getBounds()
Gets the horizontal bounds for this Camera.
|
double |
getFocal()
Get camera focal distance.
|
int |
getIndex()
Get camera index.
|
boolean |
getLaziness()
get camera repaint mode (eager or lazy)
|
Location |
getLocation()
Get camera location.
|
VirtualSpace |
getOwningSpace()
Get virtual space owning this camera.
|
View |
getOwningView()
Get view owning this camera.
|
Camera[] |
getStickedCameraArray()
Get the list of cameras sticked to this camera.
|
Glyph[] |
getStickedGlyphArray()
Get the list of glyphs sticked to this camera.
|
double |
getXspeed()
Get the camera's horizontal speed.
|
double |
getYspeed()
Get the camera's vertical speed
|
double |
getZilX()
Get zoom-invariant point's x-coordinate in virtual space.
|
double |
getZilY()
Get zoom-invariant point's y-coordinate in virtual space.
|
double |
getZoomCeiling()
Get the zoom-out limit/minimum magnification.
|
double |
getZoomFloor()
Get the zoom-in limit/maximum magnification.
|
double |
getZspeed()
Get the camera's zooming speed
|
boolean |
isCustomZoomInvariantLocationEnabled()
Tells whether a specific zoom-invariant point is being used or if the camera's (x,y) coords are used (default).
|
boolean |
isEnabled()
Tells whether the camera is enabled or disabled.
|
void |
move(double x,
double y)
Camera relative translation.
|
void |
moveTo(double x,
double y)
Camera absolute translation.
|
protected void |
notifyMoved()
Sends a notification to camera listeners currently
observing this Camera instance of a camera movement
|
void |
propagateAltitudeChange(double alt)
Propagate this camera's altitude change to all cameras attached to it.
|
void |
propagateMove(double x,
double y)
Propagate this camera's movement to all glyphs and cameras attached to it.
|
void |
removeListener(CameraListener listener)
Un-registers a CameraListener for this Camera
|
void |
repaint()
the content seen through this camera will be repainted in the next owning view's paint loop
|
void |
setAltitude(double a)
Set camera altitude (absolute value).
|
void |
setAltitude(double a,
boolean repaint)
Set camera altitude (absolute value).
|
void |
setBounds(double[] wnes)
Sets the horizontal bounds for this Camera.
|
void |
setEnabled(boolean b)
Enable or disable camera.
|
void |
setFocal(double f)
Set camera focal distance (absolute value).
|
void |
setLaziness(boolean b)
set eager or lazy mode
|
void |
setLocation(Location l)
Set camera location.
|
protected void |
setOwningSpace(VirtualSpace vs)
Set virtual space owning this camera.
|
void |
setOwningView(View vi)
set view owning this camera.
|
void |
setXspeed(double dx)
Sets the camera's horizontal speed
|
void |
setYspeed(double dy)
Sets the camera's vertical speed
|
void |
setZoomCeiling(double a)
Set a zoom-out limit/minimum magnification (like a ceiling the camera cannot go through)
. |
void |
setZoomFloor(double a)
set a zoom-in limit/maximum magnification (like a floor the camera cannot go through)
value 0 means that, at maximum magnification, the size of observed glyphs corresponds to their real size (e.g. |
void |
setZoomInvariantLocation(double x,
double y)
Set zoom-invariant point's coordinates in virtual space.
|
void |
setZspeed(double dz)
Sets the camera's zooming speed
|
protected boolean |
shouldRepaint() |
void |
stick(Camera c)
Attach a camera to this camera.
|
void |
stick(Camera c,
boolean stickAlt)
Attach a camera to this camera.
|
void |
stick(Glyph g)
attach glyph to this camera
|
static void |
stickToCamera(Glyph g,
Camera c)
Stick glyph g to camera c.
|
String |
toString()
returns a String with ID, position, altitude and focal distance
|
void |
unstick(Camera c)
detach camera from this camera
|
void |
unstick(Glyph g)
detach glyph from this camera
|
void |
unstickAllCameras()
detach all cameras attached to this camera
|
void |
unstickAllGlyphs()
detach all glyphs attached to this camera
|
static void |
unstickAllGlyphs(Camera c)
Unstick all glyphs sticked from Camera c.
|
public static final float DEFAULT_FOCAL
public double vx
public double vy
public double altitude
public double focal
protected volatile double dx
protected volatile double dy
protected volatile double dz
protected volatile boolean zile
protected volatile double zilX
protected volatile double zilY
public void setZoomFloor(double a)
a
- the altitude of the floor - the default value is 0 (put a negative value if you want to be able to magnify objects beyond their normal size)public double getZoomFloor()
public void setZoomCeiling(double a)
a
- the altitude of the ceiling - the default value is Double.MAX_VALUEpublic double getZoomCeiling()
public void setBounds(double[] wnes)
wnes
- the bounds (west, north, east , south)public double[] getBounds()
public void move(double x, double y)
x
- relative x-displacement.y
- relative y-displacement.public void moveTo(double x, double y)
x
- new x-coordinate.y
- new y-coordinate.public void setAltitude(double a)
a
- new altitude valuepublic void altitudeOffset(double a)
a
- offset valuepublic void setAltitude(double a, boolean repaint)
a
- new altitude valuerepaint
- refresh the associated view or notpublic void altitudeOffset(double a, boolean repaint)
a
- offset valuerepaint
- refresh the associated view or notpublic double getAltitude()
public void setLocation(Location l)
l
- the location at which to position this camera.public Location getLocation()
public void setXspeed(double dx)
dx
- camera's x-axis speedsetYspeed(double dy)
,
setZspeed(double dz)
,
getXspeed()
,
getYspeed()
,
getZspeed()
public void setYspeed(double dy)
dy
- camera's y-axis speedsetXspeed(double dx)
,
setZspeed(double dz)
,
getXspeed()
,
getYspeed()
,
getZspeed()
public void setZspeed(double dz)
dz
- camera's z-axis speedsetXspeed(double dx)
,
setYspeed(double dy)
,
getXspeed()
,
getYspeed()
,
getZspeed()
public void setZoomInvariantLocation(double x, double y)
x
- x-coordinate of zoom-invariant point in VirtualSpace.y
- y-coordinate of zoom-invariant point in VirtualSpace.enableCustomZoomInvariantLocation(boolean b)
,
isCustomZoomInvariantLocationEnabled()
,
getZilX()
,
getZilY()
public void enableCustomZoomInvariantLocation(boolean b)
b
- true to enable it, false to diable it.setZoomInvariantLocation(double x, double y)
,
isCustomZoomInvariantLocationEnabled()
,
getZilX()
,
getZilY()
public double getZilX()
setZoomInvariantLocation(double x, double y)
,
enableCustomZoomInvariantLocation(boolean b)
,
isCustomZoomInvariantLocationEnabled()
,
getZilY()
public double getZilY()
setZoomInvariantLocation(double x, double y)
,
enableCustomZoomInvariantLocation(boolean b)
,
isCustomZoomInvariantLocationEnabled()
,
getZilX()
public boolean isCustomZoomInvariantLocationEnabled()
setZoomInvariantLocation(double x, double y)
,
enableCustomZoomInvariantLocation(boolean b)
,
getZilX()
,
getZilY()
public double getXspeed()
setXspeed(double dx)
,
setYspeed(double dy)
,
setZspeed(double dz)
,
getYspeed()
,
getZspeed()
public double getYspeed()
setXspeed(double dx)
,
setYspeed(double dy)
,
setZspeed(double dz)
,
getXspeed()
,
getZspeed()
public double getZspeed()
setXspeed(double dx)
,
setYspeed(double dy)
,
setZspeed(double dz)
,
getXspeed()
,
getYspeed()
public void addListener(CameraListener listener)
listener
- instance implementing the callback.public void removeListener(CameraListener listener)
listener
- instance implementing the callback.protected void notifyMoved()
public void setFocal(double f)
f
- the focal distance.public double getFocal()
public void propagateMove(double x, double y)
x
- relative horizontal displacement.y
- relative vettical displacement.public void propagateAltitudeChange(double alt)
alt
- new altitude.public int getIndex()
protected void setOwningSpace(VirtualSpace vs)
vs
- the owning VirtualSpace.public VirtualSpace getOwningSpace()
public void setOwningView(View vi)
vi
- the owning View.public View getOwningView()
public void stick(Glyph g)
g
- glyph to be attached to this cameraunstick(Glyph g)
,
unstickAllGlyphs()
public void unstick(Glyph g)
g
- glyph to be detachedstick(Glyph g)
,
unstickAllGlyphs()
public void unstickAllGlyphs()
unstick(Glyph g)
,
stick(Glyph g)
public Glyph[] getStickedGlyphArray()
public void stick(Camera c)
c
- camera to be attached to this cameraunstick(Camera c)
,
unstickAllCameras()
public void stick(Camera c, boolean stickAlt)
c
- camera to be attached to this camera.stickAlt
- also propagate altitude changes, in addition to translations.unstick(Camera c)
,
unstickAllCameras()
public void unstick(Camera c)
c
- camera to be detachedstick(Camera c)
,
unstickAllCameras()
public void unstickAllCameras()
unstick(Camera c)
,
stick(Camera c)
public Camera[] getStickedCameraArray()
public void setEnabled(boolean b)
b
- pass true to enable, false to disable.isEnabled()
public boolean isEnabled()
setEnabled(boolean b)
public void setLaziness(boolean b)
b
- true=lazy, false=eagerpublic boolean getLaziness()
public void repaint()
protected boolean shouldRepaint()
public String toString()
public static void stickToCamera(Glyph g, Camera c)
g
- glyph to be sticked.c
- camera to which the glyph will be sticked.public static void unstickAllGlyphs(Camera c)
c
- the Camera from which to unstick glyphs.Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2015 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.