当前位置: 首页>>代码示例>>Java>>正文


Java ReferencedEnvelope.getMinX方法代码示例

本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.getMinX方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.getMinX方法的具体用法?Java ReferencedEnvelope.getMinX怎么用?Java ReferencedEnvelope.getMinX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.geometry.jts.ReferencedEnvelope的用法示例。


在下文中一共展示了ReferencedEnvelope.getMinX方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawImage

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public void drawImage( Graphics2D g2d, ReferencedEnvelope ref, int imageWidth, int imageHeight, double buffer ) {
    checkMapContent();

    if (buffer > 0.0)
        ref.expandBy(buffer, buffer);

    Rectangle2D refRect = new Rectangle2D.Double(ref.getMinX(), ref.getMinY(), ref.getWidth(), ref.getHeight());
    Rectangle2D imageRect = new Rectangle2D.Double(0, 0, imageWidth, imageHeight);

    GeometryUtilities.scaleToRatio(imageRect, refRect, false);

    ReferencedEnvelope newRef = new ReferencedEnvelope(refRect, ref.getCoordinateReferenceSystem());

    Rectangle imageBounds = new Rectangle(0, 0, imageWidth, imageHeight);
    Color white = Color.white;
    g2d.setColor(new Color(white.getRed(), white.getGreen(), white.getBlue(), 0));
    g2d.fillRect(0, 0, imageWidth, imageHeight);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    synchronized (renderer) {
        content.getViewport().setBounds(newRef);
        renderer.paint(g2d, imageBounds, newRef);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:25,代码来源:ImageGenerator.java

示例2: FeatureLayer

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public FeatureLayer(LayerType layerType, final FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
                    PropertySet configuration) {
    super(layerType, configuration);
    crs = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
    if (crs == null) {
        // todo - check me! Why can this happen??? (nf)
        crs = DefaultGeographicCRS.WGS84;
    }
    final ReferencedEnvelope envelope = new ReferencedEnvelope(fc.getBounds(), crs);
    modelBounds = new Rectangle2D.Double(envelope.getMinX(), envelope.getMinY(),
                                         envelope.getWidth(), envelope.getHeight());
    mapContext = new DefaultMapContext(crs);
    final Style style = (Style) configuration.getValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE);
    mapContext.addLayer(fc, style);
    renderer = new StreamingRenderer();
    workaroundLabelCacheBug();
    style.accept(new RetrievingStyleVisitor());
    renderer.setContext(mapContext);

}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:21,代码来源:FeatureLayer.java

示例3: 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);

}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:22,代码来源:ImageMosaicNwwLayer.java

示例4: handleVectorMask

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private static Rectangle2D handleVectorMask(Mask mask) {
    VectorDataNode vectorData = Mask.VectorDataType.getVectorData(mask);
    ReferencedEnvelope envelope = vectorData.getEnvelope();
    if (!envelope.isEmpty()) {
        return new Rectangle2D.Double(envelope.getMinX(), envelope.getMinY(),
                                      envelope.getWidth(), envelope.getHeight());
    }
    return null;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:10,代码来源:MaskFormActions.java

示例5: 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
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:34,代码来源:APIExamples.java

示例6: 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();
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:61,代码来源:Atom.java

示例7: 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);
}
 
开发者ID:stefan0722,项目名称:gs-mvt,代码行数:35,代码来源:SlippyTilesControllerTest.java

示例8: computeMinLonOffset

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void computeMinLonOffset(ReferencedEnvelope env) {
    double minLon;
    if (env.getMinX() > 180) {
        minLon = env.getMinX() % 360;
    } else if (env.getMinX() < -180) {
        minLon = 360 - Math.abs(env.getMinX()) % 360;
    } else {
        minLon = env.getMinX() % 360;
    }
    if (minLon > 180) {
        minLon -= 360;
    }
    lonOffset = env.getMinX() - minLon;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:15,代码来源:GeoHashGrid.java

示例9: createTissotLayer

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * A method to create Tissot Indicatrices based on Whuber's answer to
 * http://gis
 * .stackexchange.com/questions/5068/how-to-create-an-accurate-tissot
 * -indicatrix
 *
 * @param style
 *          - the style to draw the circles with
 * @param gridBounds
 *          - the bounds of the map (may be increased in the method)
 * @return a layer of Tissot Indicatrices (scaled for visibility).
 */
private Layer createTissotLayer(Style style, ReferencedEnvelope gridBounds) {
	FeatureType type = createFeatureType(null,
			gridBounds.getCoordinateReferenceSystem());
	SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(
			(SimpleFeatureType) type);
	double step = 20.0;
	GeometryFactory geomFac = new GeometryFactory();
	double width = gridBounds.getWidth();
	double height = gridBounds.getHeight();
	int id = 0;
	final ListFeatureCollection fc = new ListFeatureCollection(
			(SimpleFeatureType) type);
	double y = gridBounds.getMinY();

	for (int iy = 0; iy < (height / step); iy++) {
		double x = gridBounds.getMinX();
		for (int ix = 0; ix < (width / step); ix++) {
			Point p = geomFac.createPoint(new Coordinate(x, y));

			sfb.set("the_geom", p);
			SimpleFeature f = sfb.buildFeature("tissot2" + id);
			fc.add(f);
			x += step;
		}
		y += step;
	}

	Layer layer = new FeatureLayer(fc, style);
	return layer;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:43,代码来源:Tissot.java

示例10: 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();

}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:60,代码来源:GeopaparazziMapsCreator.java

示例11: 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;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:60,代码来源:Tissot.java


注:本文中的org.geotools.geometry.jts.ReferencedEnvelope.getMinX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。