Revision 45943
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/AbstractGeometry.java | ||
---|---|---|
356 | 356 |
if (minx <= maxx && miny <= maxy && minz <= maxz) { |
357 | 357 |
Point min = new Point3D(minx, miny, minz); |
358 | 358 |
Point max = new Point3D(maxx, maxy, maxz); |
359 |
return new Envelope3D(min, max); |
|
359 |
return new Envelope3D(min, max, this.getProjection());
|
|
360 | 360 |
} |
361 |
return new Envelope3D(); |
|
361 |
return new Envelope3D(this.getProjection());
|
|
362 | 362 |
} else { |
363 | 363 |
com.vividsolutions.jts.geom.Envelope envelope = getJTS().getEnvelopeInternal(); |
364 |
return new Envelope2D(envelope); |
|
364 |
return new Envelope2D(envelope, this.getProjection());
|
|
365 | 365 |
} |
366 | 366 |
} |
367 | 367 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/point/AbstractPoint.java | ||
---|---|---|
307 | 307 |
} |
308 | 308 |
|
309 | 309 |
public Envelope getEnvelope() { |
310 |
return new Envelope2D(this.getX(), this.getY(), this.getX(), this.getY()); |
|
310 |
return new Envelope2D(this.getX(), this.getY(), this.getX(), this.getY(), this.getProjection());
|
|
311 | 311 |
} |
312 | 312 |
|
313 | 313 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java | ||
---|---|---|
91 | 91 |
isEmpty = true; |
92 | 92 |
} |
93 | 93 |
|
94 |
public DefaultEnvelope(Point min, Point max){ |
|
94 |
public DefaultEnvelope(IProjection projection){ |
|
95 |
this(); |
|
96 |
this.projection = projection; |
|
97 |
} |
|
98 |
|
|
99 |
public DefaultEnvelope(Point min, Point max, IProjection projection){ |
|
95 | 100 |
super(); |
96 | 101 |
this.min = min; |
97 | 102 |
this.max = max; |
98 | 103 |
isEmpty = false; |
104 |
this.projection = projection; |
|
99 | 105 |
} |
100 | 106 |
|
101 | 107 |
public String toString() { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope2D.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import org.cresques.cts.CoordTransRuntimeException; |
28 | 28 |
import org.cresques.cts.ICoordTrans; |
29 |
import org.cresques.cts.IProjection; |
|
29 | 30 |
import org.gvsig.fmap.geom.Geometry; |
30 | 31 |
import org.slf4j.Logger; |
31 | 32 |
import org.slf4j.LoggerFactory; |
... | ... | |
46 | 47 |
|
47 | 48 |
private static final Logger logger = LoggerFactory.getLogger(Envelope2D.class); |
48 | 49 |
|
49 |
public static final String PERSISTENCE_DEFINITION_NAME = "Envelope2Dimensions";
|
|
50 |
public static final String PERSISTENCE_DEFINITION_NAME = "Envelope2Dimensions";
|
|
50 | 51 |
|
51 |
public Envelope2D() {
|
|
52 |
super();
|
|
53 |
}
|
|
52 |
public Envelope2D() {
|
|
53 |
super();
|
|
54 |
}
|
|
54 | 55 |
|
55 |
public Envelope2D(Point min, Point max) {
|
|
56 |
super(min, max);
|
|
57 |
}
|
|
56 |
public Envelope2D(Point min, Point max, IProjection projection) {
|
|
57 |
super(min, max, projection);
|
|
58 |
}
|
|
58 | 59 |
|
59 |
public Envelope2D(double minX,double minY,double maxX, double maxY){
|
|
60 |
this(new Point2D(minX, minY), new Point2D(maxX, maxY));
|
|
61 |
}
|
|
60 |
public Envelope2D(double minX,double minY,double maxX, double maxY, IProjection projection){
|
|
61 |
this(new Point2D(minX, minY), new Point2D(maxX, maxY), projection);
|
|
62 |
}
|
|
62 | 63 |
|
63 |
/**
|
|
64 |
/**
|
|
64 | 65 |
* @param bounds |
65 | 66 |
*/ |
66 | 67 |
public Envelope2D(com.vividsolutions.jts.geom.Geometry bounds) { |
... | ... | |
73 | 74 |
/** |
74 | 75 |
* @param envelope |
75 | 76 |
*/ |
76 |
public Envelope2D(com.vividsolutions.jts.geom.Envelope envelope) { |
|
77 |
this(new Point2D(envelope.getMinX(),envelope.getMinY()), new Point2D(envelope.getMaxX(),envelope.getMaxY())); |
|
77 |
public Envelope2D(com.vividsolutions.jts.geom.Envelope envelope, IProjection projection) {
|
|
78 |
this(new Point2D(envelope.getMinX(),envelope.getMinY()), new Point2D(envelope.getMaxX(),envelope.getMaxY()), projection);
|
|
78 | 79 |
} |
79 | 80 |
|
80 | 81 |
/* (non-Javadoc) |
... | ... | |
96 | 97 |
|
97 | 98 |
if (trans == null) { |
98 | 99 |
// clone |
99 |
return new Envelope2D(this.getLowerCorner(), this.getUpperCorner()); |
|
100 |
return new Envelope2D(this.getLowerCorner(), this.getUpperCorner(), this.projection);
|
|
100 | 101 |
} |
101 | 102 |
|
102 | 103 |
if (this.getDimension() > 2) { |
... | ... | |
181 | 182 |
Point max = (Point) this.getUpperCorner().cloneGeometry(); |
182 | 183 |
min.reProject(trans); |
183 | 184 |
max.reProject(trans); |
184 |
return new Envelope2D(min,max); |
|
185 |
return new Envelope2D(min,max, trans.getPDest());
|
|
185 | 186 |
} |
186 | 187 |
|
187 | 188 |
return new Envelope2D( |
188 | 189 |
res_min.getX(), |
189 | 190 |
res_min.getY(), |
190 | 191 |
res_max.getX(), |
191 |
res_max.getY()); |
|
192 |
res_max.getY(), |
|
193 |
trans.getPDest()); |
|
192 | 194 |
} |
193 | 195 |
|
194 | 196 |
public static void registerPersistent() { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope3D.java | ||
---|---|---|
25 | 25 |
import com.vividsolutions.jts.geom.Coordinate; |
26 | 26 |
|
27 | 27 |
import org.cresques.cts.ICoordTrans; |
28 |
import org.cresques.cts.IProjection; |
|
28 | 29 |
|
29 | 30 |
import org.gvsig.fmap.geom.jts.primitive.point.Point3D; |
30 | 31 |
import org.gvsig.fmap.geom.primitive.Envelope; |
... | ... | |
48 | 49 |
super(); |
49 | 50 |
} |
50 | 51 |
|
51 |
public Envelope3D(Point min, Point max) {
|
|
52 |
super(min, max);
|
|
52 |
public Envelope3D(IProjection projection) {
|
|
53 |
super(projection);
|
|
53 | 54 |
} |
54 | 55 |
|
56 |
public Envelope3D(Point min, Point max, IProjection projection) { |
|
57 |
super(min, max, projection); |
|
58 |
} |
|
59 |
|
|
55 | 60 |
/** |
56 | 61 |
* @param coordinates |
57 | 62 |
*/ |
... | ... | |
113 | 118 |
|
114 | 119 |
if (trans == null) { |
115 | 120 |
// clone |
116 |
return new Envelope3D(this.getLowerCorner(), this.getUpperCorner()); |
|
121 |
return new Envelope3D(this.getLowerCorner(), this.getUpperCorner(), this.projection);
|
|
117 | 122 |
} |
118 | 123 |
|
119 | 124 |
// if (this.getDimension() > 2) { |
... | ... | |
191 | 196 |
return null; |
192 | 197 |
} |
193 | 198 |
|
194 |
return new Envelope3D(new Point3D(res_min.getX(), res_min.getY(), this.min.getCoordinateAt(2)), new Point3D( |
|
195 |
res_max.getX(), res_max.getY(), this.max.getCoordinateAt(2))); |
|
199 |
return new Envelope3D( |
|
200 |
new Point3D(res_min.getX(), res_min.getY(), this.min.getCoordinateAt(2)), |
|
201 |
new Point3D(res_max.getX(), res_max.getY(), this.max.getCoordinateAt(2)), |
|
202 |
trans.getPDest()); |
|
196 | 203 |
} |
197 | 204 |
|
198 | 205 |
public static void registerPersistent() { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/DefaultGeometryManager.java | ||
---|---|---|
506 | 506 |
case SUBTYPES.GEOM2DM: |
507 | 507 |
// Small optimization to directly create an Envelope2D |
508 | 508 |
// return new Envelope2D(minX, minY, maxX, maxY); |
509 |
return new Envelope2D(min, max); |
|
509 |
return new Envelope2D(min, max, null);
|
|
510 | 510 |
default: |
511 | 511 |
Envelope envelope = createEnvelope(subType); |
512 | 512 |
envelope.setLowerCorner(min); |
Also available in: Unified diff