public interface IViewport
| Modifier and Type | Method and Description |
|---|---|
void |
centerAt(double x,
double y)
Changes viewport center.
|
boolean |
contains(double plotX,
double plotY) |
boolean |
containsHorizontalCoord(double xCoord) |
boolean |
containsVerticalCoord(double yCoord) |
Point |
fromScreenCoords(double screenX,
double screenY)
Translate point from screen coordinates to plot coordinates.
|
double |
getBottom() |
double |
getHeight() |
double |
getLeft() |
double |
getRight() |
double |
getScale() |
double |
getTop() |
double |
getWidth() |
void |
moveBy(double deltaX,
double deltaY)
Moves viewport by a provided amount in both dimensions.
|
PlotPoint |
pointAtPlotCoords(double x,
double y,
double radius,
java.util.Collection<PlotPoint> points)
Returns a point closest to provided coordinates within provided radius.
|
void |
setScalePower(int power)
Set scale to an absolute value
|
Point |
toScreenCoords(double plotX,
double plotY)
Method opposite to
fromScreenCoords(double, double). |
Point |
toScreenCoords(PlotPoint point)
Convenience method that calls
toScreenCoords(double, double). |
java.util.Collection<PlotPoint> |
visiblePoints(java.util.Collection<PlotPoint> points)
Filters points by visibility.
|
void |
zoom(double factor)
Change viewport zoom.
|
double getScale()
double getLeft()
double getBottom()
double getWidth()
double getHeight()
double getRight()
double getTop()
void centerAt(double x,
double y)
x - new X coordinate of centery - new Y coordinate of centervoid moveBy(double deltaX,
double deltaY)
deltaX - amount to move rightdeltaY - amount to move upvoid zoom(double factor)
factor - to multiply scale byvoid setScalePower(int power)
power - Scale power. 0 is 1:1 scale, increasing by 1 doubles scale.boolean containsHorizontalCoord(double xCoord)
xCoord - X coordinateboolean containsVerticalCoord(double yCoord)
yCoord - Y coordinateboolean contains(double plotX,
double plotY)
plotX - X coordinateplotY - Y coordinatePoint fromScreenCoords(double screenX, double screenY)
Translate point from screen coordinates to plot coordinates.
Screen uses down-pointing Y axis and its (0,0) coordinate is in the top left corner. Plot, on the other hand, has up-pointing Y axis and its (0,0) point isn't fixed. This method converts screen coordinates (eg. coordinates of a mouse click) to plot coordinates.
screenX - X coordinate in screen coordinate systemscreenY - Y coordinate in screen coordinate systemPoint toScreenCoords(double plotX, double plotY)
fromScreenCoords(double, double). See fromScreenCoords(double, double)
for details.plotX - X coordinate in plot coordinate systemplotY - Y coordinate in plot coordinate systemPoint toScreenCoords(PlotPoint point)
toScreenCoords(double, double).point - a plot pointjava.util.Collection<PlotPoint> visiblePoints(java.util.Collection<PlotPoint> points)
points - a collection of pointsPlotPoint pointAtPlotCoords(double x, double y, double radius, java.util.Collection<PlotPoint> points)
Returns a point closest to provided coordinates within provided radius.
This method uses plot coordinates, use fromScreenCoords(double, double) to convert from screen
(mouse) coordinates.
x - X plot coordinate to look aty - Y plot coordinate to look atradius - maximum allowed distance from (x,y) pointpoints - Collection of points to searchPlotPoint from collection points closest to (x,y), or null if there are no points within radius