本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.getMaxX方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.getMaxX方法的具体用法?Java ReferencedEnvelope.getMaxX怎么用?Java ReferencedEnvelope.getMaxX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.geometry.jts.ReferencedEnvelope
的用法示例。
在下文中一共展示了ReferencedEnvelope.getMaxX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageMosaicNwwLayer
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public ImageMosaicNwwLayer( File imageMosaicShpFile, Integer tileSize, GeneralParameterValue[] gp,
boolean removeSameColorImages ) throws Exception {
super(makeLevels(imageMosaicShpFile, getRenderer(imageMosaicShpFile, gp), tileSize, removeSameColorImages));
this.layerName = FileUtilities.getNameWithoutExtention(imageMosaicShpFile);
ReferencedEnvelope envelope = OmsVectorReader.readEnvelope(imageMosaicShpFile.getAbsolutePath());
ReferencedEnvelope envelopeLL = envelope.transform(DefaultGeographicCRS.WGS84, true);
double w = envelopeLL.getMinX();
double s = envelopeLL.getMinY();
double e = envelopeLL.getMaxX();
double n = envelopeLL.getMaxY();
double centerX = w + (e - w) / 2.0;
double centerY = s + (n - s) / 2.0;
centerCoordinate = new Coordinate(centerX, centerY);
this.setUseTransparentTextures(true);
}
示例2: exampleReferencedEnvelope
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void exampleReferencedEnvelope() throws Exception {
// exampleReferencedEnvelope start
ReferencedEnvelope envelope = new ReferencedEnvelope(0, 10, 0, 20, DefaultGeographicCRS.WGS84);
double xMin = envelope.getMinX();
double yMin = envelope.getMinY();
double xMax = envelope.getMaxX();
double yMax = envelope.getMaxY();
double width = envelope.getWidth();
double height = envelope.getHeight();
double xCenter = envelope.getMedian(0);
double yCenter = envelope.getMedian(1);
CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem();
int dimension = envelope.getDimension();
// Direct access to internal upper and lower positions
DirectPosition lower = envelope.getLowerCorner();
DirectPosition upper = envelope.getUpperCorner();
// expand to include 15, 30
envelope.include(15, 30);
envelope.isEmpty(); // check if storing width and height are 0
envelope.isNull(); // check if "null" (not storing anything)
envelope.setToNull();
// exampleReferencedEnvelope end
}
示例3: convertPolygonToWKT
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private static String convertPolygonToWKT(String text) {
String[] sep = text.split(" ");
String[] seperators = new String[TWO];
seperators[ZERO] = ",";
seperators[ONE] = ".";
//cleaning the strings if they have trailing or beginning , or .
for (int i = 0; i < sep.length; i++) {
String aSep = sep[i];
for (String seperator: seperators) {
if (aSep.contains(seperator)) {
if (aSep.lastIndexOf(seperator) == aSep.length() - 1) {
aSep = aSep.substring(ZERO,
aSep.lastIndexOf(seperator));
}
if (aSep.indexOf(seperator) == ZERO) {
aSep = aSep.substring(ONE, aSep.length());
}
}
}
sep[i] = aSep;
}
//Check for length. If Only Two Pairs are in there, calculate the Box
//of it.
if (sep.length == FOUR) {
ReferencedEnvelope ref = new ReferencedEnvelope();
ref.include(Double.parseDouble(sep[ZERO]),
Double.parseDouble(sep[ONE]));
ref.include(Double.parseDouble(sep[TWO]),
Double.parseDouble(sep[THREE]));
Double maxX = ref.getMaxX();
Double minX = ref.getMinX();
Double maxY = ref.getMaxY();
Double minY = ref.getMinY();
sep = new String[TEN];
//Upper Left
sep[ZERO] = String.valueOf(minX);
sep[ONE] = String.valueOf(maxY);
//Upper Right
sep[TWO] = String.valueOf(maxX);
sep[THREE] = String.valueOf(maxY);
//Lower Right
sep[FOUR] = String.valueOf(maxX);
sep[FIVE] = String.valueOf(minY);
//Lower Left
sep[SIX] = String.valueOf(minX);
sep[SEVEN] = String.valueOf(minY);
//Upper Right
sep[EIGHT] = sep[ZERO];
sep[NINE] = sep[ONE];
}
StringBuilder sb = new StringBuilder("POLYGON((");
for (int j = 0; j < sep.length; j += 2) {
if (j > 0) {
sb.append(", ");
}
sb.append(sep[j]).append(' ').append(sep[j + 1]);
}
return sb.append("))").toString();
}
示例4: testRequestParams
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
@Test
public void testRequestParams() throws Exception {
int x = 2196;
int y = 1427;
int z = 12;
int buffer = 10;
String requestSlippy = "slippymap/" + TEST_LINES.getPrefix() + ":" + TEST_LINES.getLocalPart() + "/" + z + "/"
+ x + "/" + y + ".pbf" + "?buffer=" + buffer + "&styles=" + STYLE_NAME + "&tileSize=256&gen_level=low";
MockHttpServletResponse responseSlippy = getAsServletResponse(requestSlippy);
Assert.assertEquals(200, responseSlippy.getStatus());
String forwardedUrl = responseSlippy.getForwardedUrl();
Assert.assertNotNull(forwardedUrl);
MockHttpServletResponse responseForwardedUrl = getAsServletResponse(forwardedUrl);
byte[] contentForwardedWms = responseForwardedUrl.getContentAsByteArray();
ReferencedEnvelope bbox = SlippyMapTileCalculator.tile2boundingBox(x, y, z,3857);
String bboxSb = "&bbox=" + bbox.getMinX() + ',' + bbox.getMinY() +
',' + bbox.getMaxX() + ',' + bbox.getMaxY();
String requestWms = "wms?request=getmap&service=wms&version=1.1.1" +
"&format=" + MVT.MIME_TYPE +
"&layers=" + TEST_LINES.getPrefix() + ":" + TEST_LINES.getLocalPart() +
"&styles=" + STYLE_NAME +
"&height=256&width=256" + bboxSb + "&srs=EPSG:3857&buffer=" + buffer;
MockHttpServletResponse responseWms = getAsServletResponse(requestWms);
byte[] contentWms = responseWms.getContentAsByteArray();
Assert.assertEquals(contentForwardedWms.length, contentWms.length);
Assert.assertArrayEquals(contentForwardedWms,contentWms);
}
示例5: process
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
@Execute
public void process() throws Exception {
checkNull(inROI, outFolder);
SimpleFeatureCollection boundsVector = OmsVectorReader.readVector(inROI);
ReferencedEnvelope bounds = boundsVector.getBounds();
// bounds.expandBy(50.0);
OmsTmsGenerator gen = new OmsTmsGenerator();
if (inRaster1 != null || inRaster2 != null) {
List<String> inRasters = new ArrayList<String>();
if (inRaster1 != null)
inRasters.add(inRaster1);
if (inRaster2 != null)
inRasters.add(inRaster2);
gen.inRasterFile = FileUtilities.stringListAsTmpFile(inRasters).getAbsolutePath();
}
if (inVector1 != null || inVector2 != null || inVector3 != null || inVector4 != null || inVector5 != null) {
List<String> inVectors = new ArrayList<String>();
if (inVector1 != null)
inVectors.add(inVector1);
if (inVector2 != null)
inVectors.add(inVector2);
if (inVector3 != null)
inVectors.add(inVector3);
if (inVector4 != null)
inVectors.add(inVector4);
if (inVector5 != null)
inVectors.add(inVector5);
gen.inVectorFile = FileUtilities.stringListAsTmpFile(inVectors).getAbsolutePath();
}
gen.pMinzoom = pMinZoom;
gen.pMaxzoom = pMaxZoom;
gen.pName = pName;
gen.inPath = outFolder;
gen.pWest = bounds.getMinX();
gen.pEast = bounds.getMaxX();
gen.pNorth = bounds.getMaxY();
gen.pSouth = bounds.getMinY();
// gen.pEpsg = "EPSG:32632";
gen.dataCrs = bounds.getCoordinateReferenceSystem();
gen.doMbtiles = true;
gen.inZoomLimitVector = inZoomLimitROI;
gen.pZoomLimit = pZoomLimit;
switch( pImageType ) {
case "jpg":
gen.pImagetype = 1;
break;
case "png":
default:
gen.pImagetype = 0;
break;
}
gen.pm = pm;
gen.process();
}
示例6: createGridLayer
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private Layer createGridLayer(Style style, ReferencedEnvelope gridBounds)
throws IOException {
double squareWidth = 20.0;
double extent = gridBounds.maxExtent();
double ll = Math.log10(extent);
if (ll > 0) {
// there are ll 10's across the map
while (ll-- > 4) {
squareWidth *= 10;
}
}
// max distance between vertices
double vertexSpacing = squareWidth / 20;
// grow to cover the whole map (and a bit).
double left = gridBounds.getMinX();
double bottom = gridBounds.getMinY();
if (left % squareWidth != 0) {
if (left > 0.0) { // east
left -= Math.abs(left % squareWidth);
} else { // west
left += Math.abs(left % squareWidth);
}
}
if (bottom % squareWidth != 0) {
if (bottom > 0.0) {
bottom -= Math.abs(bottom % squareWidth);
} else {
bottom += Math.abs(bottom % squareWidth);
}
}
gridBounds.expandToInclude(left, bottom);
double right = gridBounds.getMaxX();
double top = gridBounds.getMaxY();
if (right % squareWidth != 0) {
if (right > 0.0) { // east
right += Math.abs(right % squareWidth) + squareWidth;
} else { // west
right -= Math.abs(right % squareWidth) - squareWidth;
}
}
if (top % squareWidth != 0) {
if (top > 0.0) { // North
top += Math.abs(top % squareWidth) + squareWidth;
} else { // South
top -= Math.abs(top % squareWidth) - squareWidth;
}
}
gridBounds.expandToInclude(right, top);
SimpleFeatureSource grid = Grids.createSquareGrid(gridBounds, squareWidth,
vertexSpacing);
Layer gridLayer = new FeatureLayer(grid.getFeatures(), style);
return gridLayer;
}