Revision 10632 trunk/libraries/libDwg/src/com/iver/cit/jdwglib/util/FMapUtil.java
FMapUtil.java | ||
---|---|---|
4 | 4 |
*/ |
5 | 5 |
package com.iver.cit.jdwglib.util; |
6 | 6 |
|
7 |
import java.awt.geom.Point2D;
|
|
7 |
import java.util.List;
|
|
8 | 8 |
|
9 | 9 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
10 | 10 |
import com.iver.cit.gvsig.fmap.core.FPolyline3D; |
... | ... | |
26 | 26 |
* @return FPolyline3D This FPolyline3D is build using the array of Point3D |
27 | 27 |
* that is the argument of the method |
28 | 28 |
*/ |
29 |
public static FPolyline3D points3DToFPolyline3D(double[][] pts) {
|
|
29 |
public static FPolyline3D points3DToFPolyline3D(List pts) {
|
|
30 | 30 |
GeneralPathX genPathX = new GeneralPathX(); |
31 |
genPathX.moveTo(pts[0][0], pts[0][1]); |
|
32 |
for (int i = 1; i < pts.length; i++) { |
|
33 |
genPathX.lineTo(pts[i][0], pts[i][1]); |
|
31 |
genPathX.moveTo(((double[])pts.get(0))[0], |
|
32 |
((double[])pts.get(0))[1]); |
|
33 |
for (int i = 1; i < pts.size(); i++) { |
|
34 |
genPathX.lineTo(((double[])pts.get(i))[0], |
|
35 |
((double[])pts.get(i))[1]); |
|
34 | 36 |
} |
35 |
double[] elevations = new double[pts.length];
|
|
36 |
for (int i = 0; i < pts.length; i++) {
|
|
37 |
elevations[i] = pts[i][2];
|
|
37 |
double[] elevations = new double[pts.size()];
|
|
38 |
for (int i = 0; i < pts.size(); i++) {
|
|
39 |
elevations[i] = ((double[])pts.get(i))[2];
|
|
38 | 40 |
} |
39 | 41 |
return new FPolyline3D(genPathX, elevations); |
40 | 42 |
} |
... | ... | |
49 | 51 |
* @return FPolyline2D This FPolyline2D is build using the array of Point2D |
50 | 52 |
* that is the argument of the method |
51 | 53 |
*/ |
52 |
public static FPolyline2D points2DToFPolyline2D(Point2D[] pts) {
|
|
54 |
public static FPolyline2D points2DToFPolyline2D(List pts) {
|
|
53 | 55 |
GeneralPathX genPathX = new GeneralPathX(); |
54 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
55 |
for (int i = 1; i < pts.length; i++) { |
|
56 |
genPathX.lineTo(pts[i].getX(), pts[i].getY()); |
|
56 |
genPathX.moveTo(((double[])pts.get(0))[0], ((double[])pts.get(0))[1]); |
|
57 |
for (int i = 1; i < pts.size(); i++) { |
|
58 |
genPathX.lineTo(((double[])pts.get(i))[0], |
|
59 |
((double[])pts.get(i))[1]); |
|
57 | 60 |
} |
58 | 61 |
return new FPolyline2D(genPathX); |
59 | 62 |
} |
Also available in: Unified diff