本文整理匯總了Java中java.awt.geom.GeneralPath.getPathIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralPath.getPathIterator方法的具體用法?Java GeneralPath.getPathIterator怎麽用?Java GeneralPath.getPathIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.GeneralPath
的用法示例。
在下文中一共展示了GeneralPath.getPathIterator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addGeneralPath
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
private void addGeneralPath(GeneralPath path) {
PathIterator itr = path.getPathIterator(null, 0.1);
ArrayList<Point2D.Float> pathList = new ArrayList();
Point2D.Float pathStart = null, lastPoint = null;
boolean closed = false;
while (!itr.isDone()) {
float[] coords = new float[6];
int segtype = itr.currentSegment(coords);
switch (segtype) {
case PathIterator.SEG_MOVETO:
pathStart = new Point2D.Float(coords[0], coords[1]); // save start point
case PathIterator.SEG_LINETO:
case PathIterator.SEG_QUADTO:
case PathIterator.SEG_CUBICTO:
pathList.add((lastPoint = new Point2D.Float(coords[0], coords[1]))); // TODO store quads/cubes as well as linesSVG
break;
case PathIterator.SEG_CLOSE:
closed = true;
// if (pathStart != null) {
// pathList.add(pathStart);
// }
break;
default:
log.info("found other element " + segtype);
}
itr.next();
}
if (closed && lastPoint != null) {
pathList.remove(lastPoint);
}
if (pathList.size() > longestPath) {
ballPathSVG = pathList;
longestPath = ballPathSVG.size();
}
pathsSVG.add(pathList);
}
示例2: appendGlyphOutline
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
void appendGlyphOutline(int glyphID, GeneralPath result, float x, float y) {
// !!! fontStrike needs a method for this. For that matter, GeneralPath does.
GeneralPath gp = null;
if (sgv.invdtx == null) {
gp = strike.getGlyphOutline(glyphID, x + dx, y + dy);
} else {
gp = strike.getGlyphOutline(glyphID, 0, 0);
gp.transform(sgv.invdtx);
gp.transform(AffineTransform.getTranslateInstance(x + dx, y + dy));
}
PathIterator iterator = gp.getPathIterator(null);
result.append(iterator, false);
}
示例3: setCurrentSegment
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
protected void setCurrentSegment(GeneralPath path) {
if (currentSegment != null)
trackLayer.removeRenderable( currentSegment );
if (path == null)
{
currentSegment = null;
return;
}
PathIterator pi =
path.getPathIterator(new AffineTransform());
List<LatLon> pos = new LinkedList<LatLon>();
float [] coords = new float[6];
int t = pi.currentSegment(coords);
pos.add( LatLon.fromDegrees(coords[1], coords[0]));
while (!pi.isDone())
{
t = pi.currentSegment(coords);
if (t == PathIterator.SEG_LINETO &&
!(coords[1] == 0 && coords[0]==0))
pos.add( LatLon.fromDegrees(coords[1], coords[0]));
pi.next();
}
Polyline line = new Polyline(pos, 0);
line.setLineWidth(4);
line.setFollowTerrain(true);
line.setColor( Color.red );
trackLayer.addRenderable(line);
currentSegment = line;
}