public DispatcherResult killDispatcherExecution(final String execId) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); params.put("id", execId); params.put("xmlreq", "true"); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_KILL_JOB_PATH, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } final Envelope envelope = validateResponse(response); final boolean result = envelope.isSuccessResult(); final StringBuffer sb = envelope.successMessages(); return new DispatcherResult() { public boolean isSuccessful() { return result; } public String getMessage() { return sb.toString(); } }; }
public static double diagonalSize(Envelope env) { if (env.isNull()) return 0.0; double width = env.getWidth(); double hgt = env.getHeight(); return Math.sqrt(width * width + hgt * hgt); }
/** * Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. The * innermost enclosing ring is the <i>smallest</i> enclosing ring. The algorithm used depends on * the fact that: <br> * ring A contains ring B iff envelope(ring A) contains envelope(ring B) <br> * This routine is only safe to use if the chosen point of the hole is known to be properly * contained in a shell (which is guaranteed to be the case if the hole does not touch its shell) * * @return containing EdgeRing, if there is one or null if no containing EdgeRing is found */ public static EdgeRing findEdgeRingContaining(EdgeRing testEr, List shellList) { LinearRing testRing = testEr.getRing(); Envelope testEnv = testRing.getEnvelopeInternal(); Coordinate testPt = testRing.getCoordinateN(0); EdgeRing minShell = null; Envelope minShellEnv = null; for (Iterator it = shellList.iterator(); it.hasNext(); ) { EdgeRing tryShell = (EdgeRing) it.next(); LinearRing tryShellRing = tryShell.getRing(); Envelope tryShellEnv = tryShellRing.getEnvelopeInternal(); // the hole envelope cannot equal the shell envelope // (also guards against testing rings against themselves) if (tryShellEnv.equals(testEnv)) continue; // hole must be contained in shell if (!tryShellEnv.contains(testEnv)) continue; testPt = CoordinateArrays.ptNotInList(testRing.getCoordinates(), tryShellRing.getCoordinates()); boolean isContained = false; if (CGAlgorithms.isPointInRing(testPt, tryShellRing.getCoordinates())) isContained = true; // check if this new containing ring is smaller than the current minimum ring if (isContained) { if (minShell == null || minShellEnv.contains(tryShellEnv)) { minShell = tryShell; minShellEnv = minShell.getRing().getEnvelopeInternal(); } } } return minShell; }
/** * Fits screen to specified geometry bounds. * * @param aArea A geometry in geo coordinates space. * @throws Exception */ public void fit(Geometry aArea) throws Exception { Geometry bounds = aArea.getBoundary(); Envelope envBounds = bounds.getEnvelopeInternal(); Point2D.Double leftUpCorner = new Point2D.Double(envBounds.getMinX(), envBounds.getMinY()); Point2D.Double rightBottomCorner = new Point2D.Double(envBounds.getMaxX(), envBounds.getMaxY()); Point2D.Double cartlu = geo2Cartesian(leftUpCorner); Point2D.Double cartrb = geo2Cartesian(rightBottomCorner); double destWidth = Math.abs(cartrb.getX() - cartlu.getX()); double destHeight = Math.abs(cartrb.getY() - cartlu.getY()); Coordinate centre = new Coordinate((cartrb.getX() + cartlu.getX()) / 2, (cartrb.getY() + cartlu.getY()) / 2); Dimension size = getSize(); Point2D.Double screenLT = awtScreen2Cartesian(new Point(0, 0)); Point2D.Double screenBR = awtScreen2Cartesian(new Point(size.width, size.height)); double srcWidth = screenBR.x - screenLT.x; double srcHeight = screenBR.y - screenLT.y; double sx = srcWidth / destWidth; double sy = srcHeight / destHeight; double coef = Math.min(sx, sy); coef = snapScale(coef); scaleView(coef, coef, false); Point2D.Double projectedScreenCenter = screen2Cartesian(new Point(0, 0)); translateView(projectedScreenCenter.x - centre.x, projectedScreenCenter.y - centre.y, true); repaint(); }
/** * Sends a message envelope on this socket * * @param envelope The message envelope * @return This socket instance * @throws IOException Thrown if the message cannot be sent */ public Socket push(final Envelope envelope) throws IOException { LOG.log(Level.FINE, "Pushing envelope: {0}", envelope); final ObjectNode node = objectMapper.createObjectNode(); node.put("topic", envelope.getTopic()); node.put("event", envelope.getEvent()); node.put("ref", envelope.getRef()); node.set( "payload", envelope.getPayload() == null ? objectMapper.createObjectNode() : envelope.getPayload()); final String json = objectMapper.writeValueAsString(node); LOG.log(Level.FINE, "Sending JSON: {0}", json); RequestBody body = RequestBody.create(WebSocket.TEXT, json); if (this.isConnected()) { try { webSocket.sendMessage(body); } catch (IllegalStateException e) { LOG.log(Level.SEVERE, "Attempted to send push when socket is not open", e); } } else { this.sendBuffer.add(body); } return this; }
public DispatcherResult killDispatcherExecution(final String execId) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); final String rundeckApiKillJobPath = substitutePathVariable(RUNDECK_API_KILL_JOB_PATH, "id", execId); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(rundeckApiKillJobPath, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } final Envelope envelope = validateResponse(response); final Node result1 = envelope.doc.selectSingleNode("result"); final String abortStatus = result1.selectSingleNode("abort/@status").getStringValue(); final boolean result = !"failed".equals(abortStatus); final StringBuffer sb = envelope.successMessages(); return new DispatcherResult() { public boolean isSuccessful() { return result; } public String getMessage() { return sb.toString(); } }; }
public MCIndexedPointInAreaLocator(Geometry g) { areaGeom = g; if (!(g instanceof Polygonal)) throw new IllegalArgumentException("Argument must be Polygonal"); buildIndex(g); Envelope env = g.getEnvelopeInternal(); maxXExtent = env.getMaxX() + 1.0; }
/** * Creates a elliptical arc, as a LineString. * * @return an elliptical arc */ public LineString createArc(double startAng, double endAng) { Envelope env = dim.getEnvelope(); double xRadius = env.getWidth() / 2.0; double yRadius = env.getHeight() / 2.0; double centreX = env.getMinX() + xRadius; double centreY = env.getMinY() + yRadius; double angSize = (endAng - startAng); if (angSize <= 0.0 || angSize > 2 * Math.PI) angSize = 2 * Math.PI; double angInc = angSize / nPts; Coordinate[] pts = new Coordinate[nPts]; int iPt = 0; for (int i = 0; i < nPts; i++) { double ang = startAng + i * angInc; double x = xRadius * Math.cos(ang) + centreX; double y = yRadius * Math.sin(ang) + centreY; Coordinate pt = new Coordinate(x, y); geomFact.getPrecisionModel().makePrecise(pt); pts[iPt++] = pt; } LineString line = geomFact.createLineString(pts); return line; }
private double getAreaEnlargement(Node indexNode, Node geomRootNode) { Envelope before = getIndexNodeEnvelope(indexNode); Envelope after = getLeafNodeEnvelope(geomRootNode); after.expandToInclude(before); return getArea(after) - getArea(before); }
/** Compute the parameters need to create each cells */ private void initParameters() { this.minX = envelope.getMinX(); this.minY = envelope.getMinY(); double cellWidth = envelope.getWidth(); double cellHeight = envelope.getHeight(); this.maxI = (int) Math.ceil(cellWidth / deltaX); this.maxJ = (int) Math.ceil(cellHeight / deltaY); }
private boolean addChild(Node parent, RelationshipType type, Node newChild) { Envelope childEnvelope = getChildNodeEnvelope(newChild, type); double[] childBBox = new double[] { childEnvelope.getMinX(), childEnvelope.getMinY(), childEnvelope.getMaxX(), childEnvelope.getMaxY() }; parent.createRelationshipTo(newChild, type); return expandParentBoundingBoxAfterNewChild(parent, childBBox); }
@Test @Ignore public void encodeCoordTransform() throws IOException { final ByteArrayOutputStream stream = new ByteArrayOutputStream(); final SWFEncoder encoder = new SWFEncoder(stream); final Context context = new Context(); // fixture = new Envelope(identifier, layer, transform); assertEquals(encoded.length, fixture.prepareToEncode(context)); fixture.encode(encoder, context); }
public double measure(Geometry g1, Geometry g2) { double distance = DiscreteHausdorffDistance.distance(g1, g2, DENSIFY_FRACTION); Envelope env = new Envelope(g1.getEnvelopeInternal()); env.expandToInclude(g2.getEnvelopeInternal()); double envSize = diagonalSize(env); // normalize so that more similarity produces a measure closer to 1 double measure = 1 - distance / envSize; // System.out.println("Hausdorff distance = " + distance + ", measure = " + measure); return measure; }
public String getFingerprint() { try { Envelope e = new Envelope("GETFPRINT"); e.addObject(nonce); nonce++; byte[] messageBytes = Envelope.toByteArray(e); // send message to request host key's hash output.writeObject(messageBytes); // receive host key hash e = Envelope.getEnvelopefromBytes((byte[]) input.readObject()); if (e.getMessage().equals("OK") && (Integer) e.getObjContents().get(2) == nonce) { nonce++; // check publicKey File for server and fingerprint match // TODO pubKey = (PublicKey) e.getObjContents().get(0); return (String) e.getObjContents().get(1); } else { System.out.println("Nonce FAIL GETFPRINT"); disconnect(); return null; } } catch (ClassNotFoundException ex) { Logger.getLogger(FileClient.class.getName()).log(Level.SEVERE, null, ex); return null; } catch (IOException ex) { Logger.getLogger(FileClient.class.getName()).log(Level.SEVERE, null, ex); return null; } }
public void disconnect() { if (isConnected()) { try { Envelope message = new Envelope("DISCONNECT"); message.addObject(messageIndex); output.writeObject(encryptCipher.doFinal(message.getBytes())); sock.close(); sock = null; } catch (Exception e) { System.err.println("Error: " + e.getMessage()); e.printStackTrace(System.err); } } }
public boolean shareAESkey() { try { Envelope message = null, e = null; // Generate AES key KeyGenerator keyGen = KeyGenerator.getInstance("AES"); AESkey = keyGen.generateKey(); keyGen = KeyGenerator.getInstance("HmacSHA1"); HMACkey = keyGen.generateKey(); byte[] keyBytes = AESkey.getEncoded(); byte[] hashBytes = HMACkey.getEncoded(); System.out.println("AES key generated"); System.out.println("HMAC key generated"); System.out.println("Begin Encryption..."); // Encrypt message w/ provided public key Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherBytes = cipher.doFinal(keyBytes); byte[] cipherBytes1 = cipher.doFinal(hashBytes); System.out.println("Encryption Complete"); message = new Envelope("SKEY"); message.addObject(cipherBytes); // Add AESkey to message message.addObject(cipherBytes1); message.addObject(nonce); nonce++; byte[] messageBytes = Envelope.toByteArray(message); output.writeObject(messageBytes); byte[] inCipherBytes = (byte[]) input.readObject(); // Decrypt response cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, AESkey); byte[] responseBytes = cipher.doFinal(inCipherBytes); Envelope response = Envelope.getEnvelopefromBytes(responseBytes); // If server indicates success, return the member list if (response.getMessage().equals("OK") && (Integer) response.getObjContents().get(0) == nonce) { return true; } else { return false; } } catch (Exception e) { System.err.println("Error: " + e.getMessage()); e.printStackTrace(System.err); return false; } }
/* */ public InputStream getContentAsStream() throws IOException /* */ { /* 272 */ if (this.source != null) { /* 273 */ InputStream is = null; /* */ /* 276 */ if (((this.source instanceof StreamSource)) && (!isFastInfoset())) { /* 277 */ is = ((StreamSource) this.source).getInputStream(); /* */ } /* 279 */ else if ((FastInfosetReflection.isFastInfosetSource(this.source)) && (isFastInfoset())) /* */ { /* */ try /* */ { /* 284 */ is = FastInfosetReflection.FastInfosetSource_getInputStream(this.source); /* */ } /* */ catch (Exception e) { /* 287 */ throw new IOException(e.toString()); /* */ } /* */ } /* */ /* 291 */ if (is != null) { /* 292 */ if (lazyContentLength) { /* 293 */ return is; /* */ } /* 295 */ if (!(is instanceof ByteInputStream)) { /* 296 */ log.severe("SAAJ0546.soap.stream.incorrect.type"); /* 297 */ throw new IOException("Internal error: stream not of the right type"); /* */ } /* 299 */ return (ByteInputStream) is; /* */ } /* */ /* */ } /* */ /* 305 */ ByteOutputStream b = new ByteOutputStream(); /* */ /* 307 */ Envelope env = null; /* */ try /* */ { /* 310 */ env = (Envelope) getEnvelope(); /* 311 */ env.output(b, isFastInfoset()); /* */ } /* */ catch (SOAPException soapException) { /* 314 */ log.severe("SAAJ0547.soap.cannot.externalize"); /* 315 */ throw new SOAPIOException( "SOAP exception while trying to externalize: ", soapException); /* */ } /* */ /* 320 */ return b.newInputStream(); /* */ }
private Envelope.GridFile findFile(String path, Envelope env) { for (Envelope.GridFile file : env.getFiles()) { if (path.equals(file.getLfn())) { return file; } } return null; }
@Override public void init(final Envelope env) { super.init(env); if (env instanceof Envelope3D) { this.minz = ((Envelope3D) env).getMinZ(); this.maxz = ((Envelope3D) env).getMaxZ(); } }
/** * Validate the response is in expected envlope form with <result> content. * * @param response response * @return Envelope if format is correct and there is no error * @throws CentralDispatcherException if the format is incorrect, or the Envelope indicates an * error response. */ private Envelope validateResponse(final WebserviceResponse response) throws CentralDispatcherException { if (null == response) { throw new CentralDispatcherServerRequestException("Response was null"); } if (null != response.getResponseMessage()) { logger.info("Response: " + response.getResponseMessage()); } final Document resultDoc = response.getResultDoc(); if (null == resultDoc) { throw new CentralDispatcherServerRequestException( "Response content unexpectedly empty. " + (response.getResponseMessage() != null ? response.getResponseMessage() : "")); } try { logger.debug(serialize(resultDoc)); } catch (IOException e) { logger.debug("ioexception serializing result doc", e); } if (!"result".equals(resultDoc.getRootElement().getName())) { throw new CentralDispatcherServerRequestException( "Response had unexpected content: " + resultDoc); } final Envelope envelope = new Envelope(response.getResultDoc()); if (envelope.isErrorResult()) { final StringBuffer sb = new StringBuffer(); final StringBuffer buffer = envelope.errorMessages(); if (sb.length() > 0) { sb.append(buffer); } else { sb.append("Server reported an error"); if (null != response.getResponseMessage()) { sb.append(": ").append(response.getResponseMessage()); } } if (null != response.getResponseMessage()) { logger.error("Server reported an error: " + response.getResponseMessage()); } else { logger.error("Server reported an error."); } throw new CentralDispatcherFailureResponseException(sb.toString()); } return envelope; }
/** * Tests if the <code>Envelope other</code> lies wholely inside this <code>Envelope</code> * (inclusive of the boundary). * * @param other the <code>Envelope</code> to check * @return true if this <code>Envelope</code> covers the <code>other</code> */ @Override public boolean covers(final Envelope other) { if (isNull() || other.isNull()) { return false; } if (!super.covers(other)) { return false; } return getMinZOf(other) >= minz && getMaxZOf(other) <= maxz; }
public void fit() throws Exception { MapContent generalMapContext = getGeneralMapContext(); Dimension size = getSize(); Envelope projectedBounds = generalMapContext.getMaxBounds(); double destWidth = projectedBounds.getWidth(); double destHeight = projectedBounds.getHeight(); Coordinate centre = projectedBounds.centre(); Point2D.Double screenLT = awtScreen2Cartesian(new Point(0, 0)); Point2D.Double screenBR = awtScreen2Cartesian(new Point(size.width, size.height)); double srcWidth = screenBR.x - screenLT.x; double srcHeight = screenBR.y - screenLT.y; double sx = srcWidth / destWidth; double sy = srcHeight / destHeight; double coef = Math.min(sx, sy); coef = snapScale(coef); scaleView(coef, coef, false); Point2D.Double projectedScreenCenter = screen2Cartesian(new Point(0, 0)); translateView(projectedScreenCenter.x - centre.x, projectedScreenCenter.y - centre.y, true); repaint(); }
/** * This version is used internally by ServerChannel to call send using a temporory mailAddress * that is unowned. * * @param env the message to send * @throws IllegateStateException if the address is not in the open state, or if the caller is not * the "owner" of this MailboxAddress. */ void send0(Envelope env) throws AddressClosedException { if (state == CLOSED) { throw new AddressClosedException(this); } else if (!mailbox.isOpen()) { closeLocalState(); throw new AddressClosedException(this); } env.setAddresses(this); mailbox.handleMessage(env); }
/** * Enlarges this <code>Envelope</code> so that it contains the <code>other</code> Envelope. Has no * effect if <code>other</code> is wholly on or within the envelope. * * @param other the <code>Envelope</code> to expand to include */ @Override public void expandToInclude(final Envelope other) { if (other.isNull()) { return; } double otherMinZ = getMinZOf(other); double otherMaxZ = getMaxZOf(other); if (isNull()) { super.expandToInclude(other); minz = otherMinZ; maxz = otherMaxZ; } else { super.expandToInclude(other); if (otherMinZ < minz) { minz = otherMinZ; } if (otherMaxZ > maxz) { maxz = otherMaxZ; } } }
private int computeCollinearIntersection( Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2) { boolean p1q1p2 = Envelope.intersects(p1, p2, q1); boolean p1q2p2 = Envelope.intersects(p1, p2, q2); boolean q1p1q2 = Envelope.intersects(q1, q2, p1); boolean q1p2q2 = Envelope.intersects(q1, q2, p2); if (p1q1p2 && p1q2p2) { intPt[0] = q1; intPt[1] = q2; return COLLINEAR_INTERSECTION; } if (q1p1q2 && q1p2q2) { intPt[0] = p1; intPt[1] = p2; return COLLINEAR_INTERSECTION; } if (p1q1p2 && q1p1q2) { intPt[0] = q1; intPt[1] = p1; return q1.equals(p1) && !p1q2p2 && !q1p2q2 ? POINT_INTERSECTION : COLLINEAR_INTERSECTION; } if (p1q1p2 && q1p2q2) { intPt[0] = q1; intPt[1] = p2; return q1.equals(p2) && !p1q2p2 && !q1p1q2 ? POINT_INTERSECTION : COLLINEAR_INTERSECTION; } if (p1q2p2 && q1p1q2) { intPt[0] = q2; intPt[1] = p1; return q2.equals(p1) && !p1q1p2 && !q1p2q2 ? POINT_INTERSECTION : COLLINEAR_INTERSECTION; } if (p1q2p2 && q1p2q2) { intPt[0] = q2; intPt[1] = p2; return q2.equals(p2) && !p1q1p2 && !q1p1q2 ? POINT_INTERSECTION : COLLINEAR_INTERSECTION; } return NO_INTERSECTION; }
/** * Fix an IndexNode bounding box after a child has been removed * * @param indexNode * @return true if something has changed */ private boolean adjustParentBoundingBox(Node indexNode, RelationshipType relationshipType) { double[] old = null; if (indexNode.hasProperty(INDEX_PROP_BBOX)) { old = (double[]) indexNode.getProperty(INDEX_PROP_BBOX); } Envelope bbox = null; Iterator<Relationship> iterator = indexNode.getRelationships(relationshipType, Direction.OUTGOING).iterator(); while (iterator.hasNext()) { Node childNode = iterator.next().getEndNode(); if (bbox == null) { bbox = new Envelope(getChildNodeEnvelope(childNode, relationshipType)); } else { bbox.expandToInclude(getChildNodeEnvelope(childNode, relationshipType)); } } if (bbox == null) { // this could happen in an empty tree bbox = new Envelope(0, 0, 0, 0); } if (old.length != 4 || bbox.getMinX() != old[0] || bbox.getMinY() != old[1] || bbox.getMaxX() != old[2] || bbox.getMaxY() != old[3]) { indexNode.setProperty( INDEX_PROP_BBOX, new double[] {bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY()}); return true; } else { return false; } }
@Override public void onMessage(final ResponseBody payload) throws IOException { LOG.log(Level.FINE, "Envelope received: {0}", payload); try { if (payload.contentType() == WebSocket.TEXT) { final Envelope envelope = objectMapper.readValue(payload.byteStream(), Envelope.class); for (final Channel channel : channels) { if (channel.isMember(envelope.getTopic())) { channel.trigger(envelope.getEvent(), envelope); } } for (final IMessageCallback callback : messageCallbacks) { callback.onMessage(envelope); } } } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to read message payload", e); } finally { payload.close(); } }
private List<IMessageContext> generateMockMessageContext(int start, int count, Customer cust) throws Exception { final String indexFilePrefix = "INDEX"; final String contentFilePrefix = "CONTENT"; int time = (int) new Date().getTime(); List<IMessageContext> arr = new ArrayList<IMessageContext>(); for (int x = 0; x < count; x++) { File indexFile = new File(m_tmpDir, indexFilePrefix + x + ".ftp"); File contentFile = new File(m_tmpDir, contentFilePrefix + x + ".ftp"); if (!indexFile.exists()) { assertTrue("Failed to create index file.", indexFile.createNewFile()); } if (!contentFile.exists()) { assertTrue("Failed to create content file.", contentFile.createNewFile()); } IMessageContext mock = new MessageContext(indexFile, contentFile); Envelope lope = new Envelope(); lope.setMessageID("booga" + x + new Date().getTime()); lope.setReceivedDate(new Date()); lope.setSentDate(new Date()); lope.setSize(10); lope.setCompressedSize(5); lope.setSubject("Test"); lope.setRecipients("bleh"); lope.setSftpTimeMS(100); lope.setSender("test2"); mock.setEnvelope(lope); mock.setResolvedRecipients(new ArrayList<ReplicatedRecipient>()); mock.setCustomer(cust); mock.setPartition(m_part); mock.setInternalId(start + 1 + x); arr.add(mock); } return arr; }
/** * Creates a circular {@link Polygon}. * * @return a circle */ public Polygon createCircle() { Envelope env = dim.getEnvelope(); double xRadius = env.getWidth() / 2.0; double yRadius = env.getHeight() / 2.0; double centreX = env.getMinX() + xRadius; double centreY = env.getMinY() + yRadius; Coordinate[] pts = new Coordinate[nPts + 1]; int iPt = 0; for (int i = 0; i < nPts; i++) { double ang = i * (2 * Math.PI / nPts); double x = xRadius * Math.cos(ang) + centreX; double y = yRadius * Math.sin(ang) + centreY; Coordinate pt = new Coordinate(x, y); pts[iPt++] = pt; } pts[iPt] = pts[0]; LinearRing ring = geomFact.createLinearRing(pts); Polygon poly = geomFact.createPolygon(ring, null); return poly; }
/** * Computes the list of envelopes (from 2 to 4, possibily 0 if env covers this) resulting from the * extrusion of env from this. Only in 2D for the moment. Does not return null envelopes. */ public List<Envelope> extrusion(final Envelope env) { List<Envelope> list = new ArrayList(); double x1 = getMinX(); double x2 = getMaxX(); double y1 = getMinY(); double y2 = getMaxY(); double xx1 = env.getMinX(); double xx2 = env.getMaxX(); double yy1 = env.getMinY(); double yy2 = env.getMaxY(); if (x2 >= x1 && yy1 >= y1) { list.add(new Envelope(x1, x2, y1, yy1)); } if (xx1 >= x1 && y2 >= yy1) { list.add(new Envelope(x1, xx1, yy1, y2)); } if (x2 >= xx1 && y2 >= yy2) { list.add(new Envelope(xx1, x2, yy2, y2)); } if (x2 >= xx2 && yy2 >= yy1) { list.add(new Envelope(xx2, x2, yy1, yy2)); } return list; }