public class RouteLens extends Object
Example of use, specifying that Lens l's position should stick to the route whose geometry is encoded by a DPath:
DPath route1 = ...; DPath route2 = ...; Lens l = ...; Camera c = ...; RouteLens rl = new RouteLens(l, c); rl.addRoute(route1); rl.addRoute(route2); ... public void mouseMoved(ViewPanel v,int jpx,int jpy, MouseEvent e){ rl.moveLens(jpx, jpy); }
Constructor and Description |
---|
RouteLens(Lens l,
Camera c) |
RouteLens(Lens l,
Camera c,
double mad,
int p) |
Modifier and Type | Method and Description |
---|---|
void |
addRoute(DPath route)
*@param route a route that should influence the lens' position.
|
static GeneralPath |
concatPath(GeneralPath path1,
GeneralPath path2) |
static ArrayList<GeneralPath> |
cutPath(GeneralPath path) |
static Point2D |
getClosestPoint(Point2D pt,
GeneralPath path,
double maxSegmentLength) |
static Point2D |
getLensPosition(ArrayList<GeneralPath> routeSegments,
Point2D C,
double delta,
int p) |
static Point2D |
getLensPosition(GeneralPath route,
Point2D C,
double delta,
int p) |
double |
getMad() |
int |
getP() |
static ArrayList<Point2D> |
getPoints(GeneralPath path,
double maxSegmentLength) |
boolean |
isEnabled()
Is RouteLens attraction enabled or disabled.
|
void |
moveLens(int x,
int y)
Move the lens to coordinates x,y, possibly adjusting its actual position depending on attraction forces exterted by the route.
|
void |
removeRoute(DPath route) |
static ArrayList<Point2D> |
resample(Point2D pt1,
Point2D pt2,
double maxSegmentLength) |
void |
setEnabled(boolean b)
Enabled/disable RouteLens attraction.
|
void |
setMad(double mad) |
void |
setP(int p) |
protected void |
updateGeneralPath() |
public RouteLens(Lens l, Camera c, double mad, int p)
l
- the lens whose position will be influenced by route dp.c
- the camera observing the route in the View that holds the lens.mad
- the maximum attraction distance, beyond which a route segment will not exert any influence on the lens.p
- power parameter used to fine-tune the attraction effect. Default is 2, typically in range [2,6].public static ArrayList<GeneralPath> cutPath(GeneralPath path)
public static GeneralPath concatPath(GeneralPath path1, GeneralPath path2)
public static Point2D getClosestPoint(Point2D pt, GeneralPath path, double maxSegmentLength)
public static ArrayList<Point2D> getPoints(GeneralPath path, double maxSegmentLength)
public static Point2D getLensPosition(GeneralPath route, Point2D C, double delta, int p)
public static Point2D getLensPosition(ArrayList<GeneralPath> routeSegments, Point2D C, double delta, int p)
public static ArrayList<Point2D> resample(Point2D pt1, Point2D pt2, double maxSegmentLength)
public void moveLens(int x, int y)
x
- x-coord of the default lens center position. Usually the mouse cursor's x-coord in screen space (JPanel coord sys).y
- y-coord of the default lens center position. Usually the mouse cursor's y-coord in screen space (JPanel coord sys).protected void updateGeneralPath()
public void addRoute(DPath route)
removeRoute(DPath route)
public void removeRoute(DPath route)
route
- a route that does not influence anymore the lens' position.addRoute(DPath route)
public void setEnabled(boolean b)
public boolean isEnabled()
public double getMad()
public void setMad(double mad)
mad
- the maximum attraction distance, beyond which a route segment will not exert any influence on the lens.public int getP()
public void setP(int p)
p
- power parameter used to fine-tune the attraction effect. Default is 2, typically in range [2,6].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.