Examples of Envelope


Examples of com.vividsolutions.jts.geom.Envelope

        if (null != result && result.length > 0) {
          for (GetLocationResult aResult : result) {
            aResult.setGeocoderName(geocoderService.getName());

            CoordinateReferenceSystem sourceCrs = geocoderService.getCrs();
            Envelope envelope = aResult.getEnvelope();

            // point locations needs to converted to an area based on configuration settings
            if (null == envelope) {
              envelope = geocoderUtilService.extendPoint(aResult.getCoordinate(), sourceCrs,
                  geocoderInfo.getPointDisplayWidth(), geocoderInfo.getPointDisplayHeight());
            }

            // result needs to be CRS transformed to request CRS
            aResult.setEnvelope(geocoderUtilService.transform(envelope, sourceCrs, crs));
          }
          if (result.length > 1) {
            alternatives.add(result);
          } else {
            results.add(result[0]);
          }
          if (!geocoderInfo.isLoopAllServices()) {
            break;
          }
        }
      }
    }

    response.setLocationFound(false);
    if (!results.isEmpty()) {
      response.setLocationFound(true);

      // combine match strings, default to search string unless we know we can do better
      String matchedLocation = location;
      String geocoderName = null;
      if (results.size() == 1) {
        List<String> matchedStrings = results.get(0).getCanonicalStrings();
        if (null != matchedStrings) {
          matchedLocation = splitGeocoderStringService.combine(matchedStrings);
        }
        geocoderName = results.get(0).getGeocoderName();
      }
      response.setCanonicalLocation(matchedLocation);
      response.setGeocoderName(geocoderName);

      // combine the user data, only when there is just one result
      if (results.size() == 1) {
        response.setUserData(results.get(0).getUserData());
      }

      // combine location envelopes
      Envelope resultEnvelope = combineResultService.combine(results);
      Bbox bbox = dtoConverterService.toDto(resultEnvelope);
      response.setBbox(bbox);
      response.setCenter(new Coordinate(bbox.getX() + bbox.getWidth() / 2, bbox.getY() + bbox.getHeight() / 2));
    } else {
      List<GetLocationForStringAlternative> altList = new ArrayList<GetLocationForStringAlternative>();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

*/
@Api
@Component
public class CombineUnionService implements CombineResultService {
  public Envelope combine(List<GetLocationResult> results) {
    Envelope result = null;
    for (GetLocationResult add : results) {
      Envelope envelope = add.getEnvelope();
      if (null == result) {
        result = envelope;
      } else {
        result.expandToInclude(envelope);
      }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

        halfCrsHeight = halfCrsHeight / deltaY * height / 2;
      } catch (TransformException te) {
        throw new GeomajasException(te, ExceptionCode.GEOMETRY_TRANSFORMATION_FAILED, crs);
      }
    }
    return new Envelope(x - halfCrsWidth, x + halfCrsWidth, y - halfCrsHeight, y + halfCrsHeight);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

*/
@Api
public class CombineIntersectionService implements CombineResultService {

  public Envelope combine(List<GetLocationResult> results) {
    Envelope result = null;
    for (GetLocationResult add : results) {
      Envelope envelope = add.getEnvelope();
      if (null == result) {
        result = envelope;
      } else {
        result = result.intersection(envelope);
      }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    }
  }

  @Test
  public void getBounds() throws Exception {
    Envelope bbox = layer.getBounds();
    Assert.assertEquals(-175.22, bbox.getMinX(), .01);
    Assert.assertEquals(179.21, bbox.getMaxX(), .01);
    Assert.assertEquals(-41.29, bbox.getMinY(), .01);
    Assert.assertEquals(64.15, bbox.getMaxY(), .01);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    Assert.assertEquals(64.15, bbox.getMaxY(), .01);
  }

  @Test
  public void getBoundsFilter() throws Exception {
    Envelope bbox = layer.getBounds(filter);
    Assert.assertEquals(-122.34, bbox.getMinX(), .01);
    Assert.assertEquals(151.18, bbox.getMaxX(), .01);
    Assert.assertEquals(-37.81, bbox.getMinY(), .01);
    Assert.assertEquals(55.75, bbox.getMaxY(), .01);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    Assert.assertEquals(1, t);
  }

  @Test
  public void testcreateBBoxFilter() throws Exception {
    Envelope bbox = new Envelope(-0.4d, -0.2d, -0.3d, 0.1d);
    Filter filter = filterCreator.createBboxFilter("EPSG:900913", bbox, "the_geom");
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    Assert.assertEquals(1, t);
  }

  @Test
  public void bboxFilter() throws LayerException {
    Envelope bbox = new Envelope(-0.4d, -0.2d, -0.3d, 0.1d);
    Filter filter = filterService.createBboxFilter("EPSG:4326", bbox, PARAM_GEOMETRY_ATTR);
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    Assert.assertTrue(true);
  }

  @Test
  public void testGetBounds() throws Exception {
    Envelope bbox = layer.getBounds();
    Assert.assertEquals(-175.22, bbox.getMinX(), .01);
    Assert.assertEquals(179.21, bbox.getMaxX(), .01);
    Assert.assertEquals(-41.29, bbox.getMinY(), .01);
    Assert.assertEquals(64.15, bbox.getMaxY(), .01);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Envelope

    Assert.assertEquals(64.15, bbox.getMaxY(), .01);
  }

  @Test
  public void testGetBoundsFilter() throws Exception {
    Envelope bbox = layer.getBounds(filter);
    Assert.assertEquals(-122.34, bbox.getMinX(), .01);
    Assert.assertEquals(151.18, bbox.getMaxX(), .01);
    Assert.assertEquals(-37.81, bbox.getMinY(), .01);
    Assert.assertEquals(55.75, bbox.getMaxY(), .01);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.