Revision 38067 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/GeneralPathX.java
GeneralPathX.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.fmap.geom.primitive; |
42 | 42 |
|
43 |
/** |
|
44 |
* @author FJP |
|
45 |
* |
|
46 |
*/ |
|
47 | 43 |
/* |
48 |
* @(#)GeneralPathX.java 1.58 03/01/23 |
|
49 |
* |
|
50 |
* Copyright 2003 Sun Microsystems, Inc. All rights reserved. |
|
51 |
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
|
44 |
* Based on portions of code from java.awt.geom.GeneralPath of the |
|
45 |
* OpenJDK project (Copyright (c) 1996, 2006, Oracle and/or its affiliates) |
|
52 | 46 |
*/ |
53 |
|
|
54 | 47 |
import java.awt.Shape; |
55 | 48 |
import java.awt.geom.AffineTransform; |
56 | 49 |
import java.awt.geom.FlatteningPathIterator; |
... | ... | |
293 | 286 |
addPoint(point); |
294 | 287 |
} |
295 | 288 |
|
289 |
public synchronized void addSegment(Point[] segment) { |
|
290 |
if (segment != null && segment.length > 0) { |
|
291 |
needRoom(segment.length, 2 * segment.length, true); |
|
292 |
for (int i = 0; i < segment.length; i++) { |
|
293 |
pointTypes.add(Byte.valueOf(SEG_LINETO)); |
|
294 |
addPoint(segment[i]); |
|
295 |
} |
|
296 |
} |
|
297 |
} |
|
298 |
|
|
296 | 299 |
private void addPoint(double x, double y) { |
297 | 300 |
try { |
298 | 301 |
pointCoords.add(geomManager.createPoint(x, y, |
... | ... | |
583 | 586 |
*/ |
584 | 587 |
public void transform(AffineTransform at) { |
585 | 588 |
for (int i = 0; i < getNumCoords(); i++) { |
586 |
double[] coordinates = getCoordinatesAt(i); |
|
587 |
at.transform(coordinates, 0, coordinates, 0, coordinates.length - 1); |
|
589 |
getPointAt(i).transform(at); |
|
588 | 590 |
} |
589 | 591 |
} |
590 | 592 |
|
591 | 593 |
public void reProject(ICoordTrans ct) { |
592 |
Point2D pt = new Point2D.Double(); |
|
593 | 594 |
for (int i = 0; i < getNumCoords(); i++) { |
594 |
double[] coordinates = getCoordinatesAt(i); |
|
595 |
pt.setLocation(coordinates[0], coordinates[1]); |
|
596 |
pt = ct.convert(pt, null); |
|
597 |
coordinates[0] = pt.getX(); |
|
598 |
coordinates[1] = pt.getY(); |
|
595 |
getPointAt(i).reProject(ct); |
|
599 | 596 |
} |
600 | 597 |
} |
601 | 598 |
|
Also available in: Unified diff