/** * renders one point to the submitted graphic context considering the also submitted projection * * @param g * @param point * @param projection * @param image * @param dis displacement */ private void drawPoint( Graphics2D g, Point point, GeoTransform projection, Image image, double[] dis) { Envelope destSize = projection.getDestRect(); Position source = point.getPosition(); int x = (int) Math.round(projection.getDestX(source.getX()) + 0.5 + dis[0]); int y = (int) Math.round(projection.getDestY(source.getY()) + 0.5 + dis[1]); int x_ = x - (image.getWidth(null) >> 1); int y_ = y - (image.getHeight(null) >> 1); int dx = Math.min(image.getWidth(null), (int) destSize.getWidth() - x_); int dy = Math.min(image.getHeight(null), (int) destSize.getHeight() - y_); int tx = Math.min((int) destSize.getWidth(), x_ + image.getWidth(null)); int ty = Math.min((int) destSize.getHeight(), y_ + image.getHeight(null)); g.drawImage(image, x_, y_, tx, ty, 0, 0, dx, dy, null); }
/** * returns the minimum coordinate of the envelope of the geometry encoded by the passed node as a * double array * * @param node * @return the minimum coordinate of the envelope of the geometry encoded by the passed node as a * double array * @throws GeometryException */ public static String getMaxAsArray(Node node) throws GeometryException { if (node == null) { return ""; } Geometry geometry = GMLGeometryAdapter.wrap((Element) node, null); if (geometry instanceof Point) { return ""; } Envelope env = geometry.getEnvelope(); StringBuffer sb = new StringBuffer(100); Position pos = env.getMax(); int dim = pos.getCoordinateDimension(); double[] d = pos.getAsArray(); for (int i = 0; i < dim - 1; i++) { sb.append(Double.toString(d[i])).append(' '); } sb.append(Double.toString(d[dim - 1])); return sb.toString(); }