|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnodebox.graphics.AbstractTransformable
nodebox.graphics.AbstractGeometry
nodebox.graphics.Geometry
public class Geometry
| Field Summary |
|---|
| Fields inherited from interface nodebox.graphics.IGeometry |
|---|
DEFAULT_POINT_AMOUNT |
| Constructor Summary | |
|---|---|
Geometry()
|
|
Geometry(Geometry other)
|
|
| Method Summary | |
|---|---|
void |
add(Geometry geometry)
Convenience function that extends the current geometry with the given geometry. |
void |
add(Path path)
Add geometry to the group. |
void |
addPoint(double x,
double y)
Add a new point to the geometry specified by its x and y coordinates. |
void |
addPoint(Point pt)
Add the given point to the geometry. |
void |
clear()
|
Geometry |
clone()
Clone the geometry, returning a new copy that is totally independent from the original. |
boolean |
contains(double x,
double y)
|
boolean |
contains(Point pt)
|
boolean |
contains(Rect r)
|
void |
draw(Graphics2D g)
|
void |
extend(Geometry g)
Create copies of all paths in the given group and append them to myself. |
void |
flatten()
Flatten the geometry. |
IGeometry |
flattened()
Make a flattened copy of the geometry. |
Rect |
getBounds()
Returns the bounding box of all elements in the group. |
double |
getLength()
Calculate the length of the path. |
List<Path> |
getPaths()
Get the subshapes of a geometry object. |
int |
getPointCount()
|
List<Point> |
getPoints()
Get the points for this geometry. |
boolean |
intersects(Geometry g2)
|
boolean |
intersects(Path p)
|
void |
invalidate()
Invalidates the cache. |
boolean |
isClosed()
Check if the last path in this group is closed. |
boolean |
isEmpty()
Check if the group contains any paths. |
Point[] |
makePoints(int amount,
boolean perContour)
Make new points along the contours of the existing path. |
AbstractGeometry |
mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
Change all points in the geometry and return a mutated copy. |
Point |
pointAt(double t)
Returns coordinates for point at t on the group. |
Geometry |
resampleByAmount(int amount,
boolean perContour)
Generate new geometry with the given amount of points along the shape of the original geometry. |
Geometry |
resampleByLength(double segmentLength)
Generate new geometry with points along the shape of the original geometry, spaced at the given length. |
void |
setFill(Color c)
|
void |
setFillColor(Color fillColor)
|
void |
setStroke(Color c)
|
void |
setStrokeColor(Color strokeColor)
|
void |
setStrokeWidth(double strokeWidth)
|
int |
size()
|
String |
toString()
|
void |
transform(Transform t)
|
| Methods inherited from class nodebox.graphics.AbstractGeometry |
|---|
extend, extend, makePoints, makePoints, pointDelta |
| Methods inherited from class nodebox.graphics.AbstractTransformable |
|---|
getTransformDelegate, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, translate |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface nodebox.graphics.Grob |
|---|
getTransformDelegate, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, translate |
| Constructor Detail |
|---|
public Geometry()
public Geometry(Geometry other)
| Method Detail |
|---|
public List<Path> getPaths()
public void add(Path path)
path - the geometry to add.public void add(Geometry geometry)
geometry - the geometry to add.extend(Geometry)public int size()
public boolean isEmpty()
isEmpty in interface Grobpublic void clear()
public void extend(Geometry g)
g - the group whose paths are appended.public boolean isClosed()
public void setFillColor(Color fillColor)
setFillColor in interface Colorizablepublic void setFill(Color c)
setFill in interface Colorizablepublic void setStrokeColor(Color strokeColor)
setStrokeColor in interface Colorizablepublic void setStroke(Color c)
setStroke in interface Colorizablepublic void setStrokeWidth(double strokeWidth)
setStrokeWidth in interface Colorizablepublic int getPointCount()
getPointCount in interface IGeometrypublic List<Point> getPoints()
getPoints in interface IGeometrypublic void addPoint(Point pt)
IGeometry
addPoint in interface IGeometrypt - the point to add.
public void addPoint(double x,
double y)
IGeometry
addPoint in interface IGeometryx - the X coordinate.y - the Y coordinate.public void invalidate()
public Rect getBounds()
getBounds in interface Grobpublic double getLength()
public Point pointAt(double t)
pointAt in class AbstractGeometryt - relative coordinate of the point (between 0.0 and 1.0).
Results outside of this range are undefined.
public boolean contains(Point pt)
public boolean contains(double x,
double y)
public boolean contains(Rect r)
public boolean intersects(Geometry g2)
public boolean intersects(Path p)
public Point[] makePoints(int amount,
boolean perContour)
IGeometry
makePoints in interface IGeometryamount - the amount of points to distribute.perContour - if true, the points are distributed per contour. The amount of points returned will then be
number of contours * amount.
public Geometry resampleByAmount(int amount,
boolean perContour)
IGeometry
resampleByAmount in interface IGeometryamount - the number of points to generate.perContour - whether the given points are per contour, or for the entire geometry.
public Geometry resampleByLength(double segmentLength)
IGeometry
resampleByLength in interface IGeometrysegmentLength - the maximum length of each resampled segment.
public void transform(Transform t)
transform in interface Grobpublic void draw(Graphics2D g)
draw in interface Drawablepublic void flatten()
IGeometry
flatten in interface IGeometrypublic IGeometry flattened()
IGeometry
flattened in interface IGeometrypublic AbstractGeometry mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
AbstractGeometry
mapPoints in class AbstractGeometrypointFunction - The function to apply to each point.
public Geometry clone()
IGeometry
clone in interface Colorizableclone in interface Grobclone in interface IGeometryclone in class AbstractGeometrypublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||