Package com.esri.gpt.framework.geometry

Examples of com.esri.gpt.framework.geometry.Envelope


          String minx = (String) xPath.evaluate("bbox/minx", root, XPathConstants.STRING);
          String miny = (String) xPath.evaluate("bbox/miny", root, XPathConstants.STRING);
          String maxx = (String) xPath.evaluate("bbox/maxx", root, XPathConstants.STRING);
          String maxy = (String) xPath.evaluate("bbox/maxy", root, XPathConstants.STRING);
          try {
            Envelope bbox = new Envelope();
            bbox.setMinX(Double.parseDouble(minx));
            bbox.setMinY(Double.parseDouble(miny));
            bbox.setMaxX(Double.parseDouble(maxx));
            bbox.setMaxY(Double.parseDouble(maxy));
            crt.setBBox(bbox);
          } catch (NumberFormatException ex) {
          }
        }
View Full Code Here


    Object value = null;
    if ((getValues() != null) && (getValues().length == 1)) {
      value = getValues()[0];
    }
    if ((value != null) && (value instanceof Envelope)) {
      Envelope envelope = (Envelope)value;
      if ((envelope != null) && !envelope.isEmpty()) {
       
        // initialize values
        ArrayList<Fieldable> alFields = new ArrayList<Fieldable>();
        double dMinX = envelope.getMinX();
        double dMinY = envelope.getMinY();
        double dMaxX = envelope.getMaxX();
        double dMaxY = envelope.getMaxY();
        double dArea = Math.abs(dMaxX - dMinX) * Math.abs(dMaxY - dMinY);
        boolean bCrossedDateLine = (dMinX > dMaxX);
        if (bCrossedDateLine) {
          dArea = Math.abs(dMaxX + 360.0 - dMinX) * Math.abs(dMaxY - dMinY);
        }
View Full Code Here

    String sMinX = document.get("envelope.minx");
    String sMinY = document.get("envelope.miny");
    String sMaxX = document.get("envelope.maxx");
    String sMaxY = document.get("envelope.maxy");
    if ((sMinX != null) && (sMinY != null) && (sMaxX != null) && (sMaxY != null)) {
      Envelope envelope = new Envelope();
      envelope.put(sMinX,sMinY,sMaxX,sMaxY);
      if (!envelope.isEmpty()) {
        return envelope;
      }
    }
    return null;
  }
View Full Code Here

   * @param envelope the bounding envelope
   */
  public void setEnvelope(Envelope envelope) {
    _envelope = envelope;
    if (_envelope == null) {
      _envelope = new Envelope();
    }
  }
View Full Code Here

    }
   
    // spatial filter
    ISearchFilterSpatialObj fSpatial = criteria.getSearchFilterSpatial();
    if (fSpatial != null) {
      Envelope env = fSpatial.getEnvelope();
      if ((env != null) && env.isValid()) {
        String sSpatialRel = "";
        SearchFilterSpatial.OptionsBounds bounds = fSpatial.getSelectedBoundsAsEnum();
        switch (bounds) {
          case useGeogExtent:
            sSpatialRel = "esriSpatialRelOverlaps";
            break;
          case dataWithinExtent:
            sSpatialRel = "esriSpatialRelWithin";
            break;
        }
        if (sSpatialRel.length() > 0) {
          String sEnv = env.getMinX()+","+env.getMinY()+","+env.getMaxX()+","+env.getMaxY();
          this.appendParam(sb,"bbox",sEnv);
          if (sSpatialRel.equals("esriSpatialRelWithin")) {
            this.appendParam(sb,"spatialRel",sSpatialRel);
          }
        }
View Full Code Here

    tmp.setMinY(DEFAULT_MINY);
    tmp.setMinX(DEFAULT_MINX);
    LOG.warning("Search Default envelope missing.  Setting envelope " +
        "to " + tmp.toString());
    return tmp;*/
    return new Envelope();
  }

  return defaultEnvelope;
}
View Full Code Here

   * @param spatialClause the spatial clause to append
   */
  private void appendSpatialClause(Element parent, SpatialClause spatialClause) {
   
    // check the envelope
    Envelope envelope = spatialClause.getBoundingEnvelope();
    if ((envelope == null) || envelope.isEmpty()) {
      // TODO: throw Exception
      //String sErr = "The SpatialClause.boundingEnvelope is empty.";
      //throw new DiscoveryException(sErr);
    }
   
    String opName= "";
    if (spatialClause instanceof SpatialClause.GeometryBBOXIntersects) {
      opName = "BBOX";
    } else if (spatialClause instanceof SpatialClause.GeometryContains) {
      opName = "Contains";
    } else if (spatialClause instanceof SpatialClause.GeometryIntersects) {
      opName = "Intersects";
    } else if (spatialClause instanceof SpatialClause.GeometryIsDisjointTo) {
      opName = "Disjoint";
    } else if (spatialClause instanceof SpatialClause.GeometryIsEqualTo) {
      opName = "Equal";
    } else if (spatialClause instanceof SpatialClause.GeometryIsWithin) {
      opName = "Within"
    } else if (spatialClause instanceof SpatialClause.GeometryOverlaps) {
      opName = "Overlaps";
    } else {
      // TODO: throw Exception
      //sErr = "Unrecognized spatial clause type: ";
      //throw new DiscoveryException(sErr+spatialClause.getClass().getName());
    }
   
    // make and append the spatial clause
    Element elClause = getDom().createElementNS(CswNamespaces.URI_OGC,"ogc:"+opName);
   
    String sName = spatialClause.getTarget().getMeaning().getDcElement().getElementName();
    Element elName = getDom().createElementNS(CswNamespaces.URI_OGC,"ogc:PropertyName");
    elName.setTextContent(sName);
    elClause.appendChild(elName);

    Element elEnv = getDom().createElementNS(CswNamespaces.URI_GML,"gml:Envelope");
    Element elLower = getDom().createElementNS(CswNamespaces.URI_GML,"gml:lowerCorner");
    Element elUpper = getDom().createElementNS(CswNamespaces.URI_GML,"gml:upperCorner");
    elLower.setTextContent(envelope.getMinX()+" "+envelope.getMinY());
    elUpper.setTextContent(envelope.getMaxX()+" "+envelope.getMaxY());
    elEnv.appendChild(elLower);
    elEnv.appendChild(elUpper);
    elClause.appendChild(elEnv);
    parent.appendChild(elClause);

View Full Code Here

    String sWest  = select(Meaning.MEANINGTYPE_ENVELOPE_WEST);
    String sEast  = select(Meaning.MEANINGTYPE_ENVELOPE_EAST);
    String sSouth = select(Meaning.MEANINGTYPE_ENVELOPE_SOUTH);
    String sNorth = select(Meaning.MEANINGTYPE_ENVELOPE_NORTH);
   
    return new Envelope(Val.chkDbl(sWest, -180), Val.chkDbl(sSouth, -90), Val.chkDbl(sEast, 180), Val.chkDbl(sNorth, 90));
  }
View Full Code Here

      sb.append("},");
        addSpaces(sb,5);
        sb.append("\"criteria\": {");
        addSpaces(sb,6);     
        Criteria criteria = eu.getCriteria();
        Envelope envelope = criteria.getBBox();
        OptionsBounds options = criteria.getBBoxOption();
        AimsContentTypes ct = criteria.getContentType();
        statWriter.writeElement("fromDate",String.valueOf(criteria.getFromDate()),true,false);
        addSpaces(sb,6);
        statWriter.writeElement("toDate",String.valueOf(criteria.getToDate()),true,false);
View Full Code Here

    double xmin = geom.getDouble("xmin");
    double ymin = geom.getDouble("ymin");
    double xmax = geom.getDouble("xmax");
    double ymax = geom.getDouble("ymax");
   
    Envelope env = new Envelope(xmin, ymin, xmax, ymax);
   
    if (geom.has("spatialReference")) {
      JSONObject sr = geom.getJSONObject("spatialReference");
      String wkid = sr.getString("wkid");
      env.setWkid(wkid);
    }
   
    return env;
  }
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.geometry.Envelope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.