Examples of BBOX


Examples of jpbrt.core.BBox

    }

    @Override
    public BBox objectBound()
    {
        BBox bbox = new BBox();
        for (Point pt : p)
            bbox.unionLocal( worldToObject.transform(pt) );
        return bbox;
    }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

    Assert.assertTrue(geometry.isEmpty());
  }

  @Test
  public void transformBboxTest() throws Exception {
    Bbox bbox = new Bbox(50, 50, 100, 10);
    Bbox transformed = geoService.transform(bbox, LONLAT, LAMBERT72);
    Assert.assertEquals(2574604.73895413, transformed.getX(), DELTA);
    Assert.assertEquals(1050557.6016714368, transformed.getY(), DELTA);
    Assert.assertEquals(5261856.632877763, transformed.getMaxX(), DELTA);
    Assert.assertEquals(4226349.363675014, transformed.getMaxY(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

    Assert.assertEquals(4226349.363675014, transformed.getMaxY(), DELTA);
  }

  @Test
  public void transformBboxOutsideAreaTest() throws Exception {
    Bbox bbox = new Bbox(120, 50, 10, 10);
    Bbox transformed = geoService.transform(bbox, LONLAT, LAMBERT72);
    Assert.assertEquals(0.0, transformed.getX(), DELTA);
    Assert.assertEquals(0.0, transformed.getY(), DELTA);
    Assert.assertEquals(0.0, transformed.getMaxX(), DELTA);
    Assert.assertEquals(0.0, transformed.getMaxY(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

  @Autowired
  private DtoConverterService converterService;

  @Test
  public void testToInternal() {
    Bbox bbox = new Bbox(10, 20, 30, 40);
    Envelope envelope = converterService.toInternal(bbox);
    Assert.assertEquals(10, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(20, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(40, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(60, envelope.getMaxY(), ALLOWANCE);
View Full Code Here

Examples of org.geomajas.geometry.Bbox

  }

  @Test
  public void testToDto() {
    Envelope envelope = new Envelope(10, 20, 30, 40);
    Bbox bbox = converterService.toDto(envelope);
    Assert.assertEquals(10, bbox.getX(), ALLOWANCE);
    Assert.assertEquals(30, bbox.getY(), ALLOWANCE);
    Assert.assertEquals(20, bbox.getMaxX(), ALLOWANCE);
    Assert.assertEquals(40, bbox.getMaxY(), ALLOWANCE);
  }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

        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>();
      response.setAlternatives(altList);
      for (GetLocationResult[] altArr : alternatives) {
        for (GetLocationResult alt : altArr) {
          if (maxAlternatives > 0 && maxAlternatives <= altList.size()) {
            break;
          }
          GetLocationForStringAlternative one = new GetLocationForStringAlternative();

          String matchedLocation = location;
          List<String> matchedStrings = alt.getCanonicalStrings();
          if (null != matchedStrings) {
            matchedLocation = splitGeocoderStringService.combine(matchedStrings);
          }
          one.setCanonicalLocation(matchedLocation);

          // set additional info data
          one.setGeocoderName(alt.getGeocoderName());
          one.setUserData(alt.getUserData());

          // combine location envelopes
          Bbox bbox = dtoConverterService.toDto(alt.getEnvelope());
          one.setBbox(bbox);
          one.setCenter(
              new Coordinate(bbox.getX() + bbox.getWidth() / 2, bbox.getY() + bbox.getHeight() / 2));

          altList.add(one);
        }
      }
    }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

      double south = Double.parseDouble(area.getChildText("south"));
      double east = Double.parseDouble(area.getChildText("east"));
      double west = Double.parseDouble(area.getChildText("west"));
      if (Math.abs(north - south) > DELTA || Math.abs(east - west) > DELTA) {
        // return point when bbox is a point
        Bbox bbox = new Bbox(west, south, east - west, north - south);
        location.setEnvelope(dtoConverterService.toInternal(bbox));
      }
    }

    location.setCoordinate(new Coordinate(Double.parseDouble(locationElement.getChildText("longitude")),
View Full Code Here

Examples of org.geomajas.geometry.Bbox

*/
public class BboxWriter implements GraphicsWriter {

  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("rect", asChild);
    Bbox env = (Bbox) o;
    document.writeAttribute("x", env.getX());
    document.writeAttribute("y", env.getY());
    document.writeAttribute("width", env.getWidth());
    document.writeAttribute("height", env.getHeight());
    document.writeAttribute("style", "fill-opacity:0;stroke:#FF0000;stroke-width:5;stroke-opacity:1;");
  }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

  private static final double DELTA = 1e-20;

  @Test
  public void testTransformBounds() throws Exception {
    TransformGeometryRequest request = new TransformGeometryRequest();
    Bbox origin = new Bbox(10, 30, 10, 10);
    request.setBounds(origin);
    request.setSourceCrs(MERCATOR);
    request.setTargetCrs(LONLAT);
    // execute
    TransformGeometryResponse response = (TransformGeometryResponse) dispatcher.execute(
        TransformGeometryRequest.COMMAND, request, null, "en");
    Bbox transformed = response.getBounds();
    Assert.assertEquals(8.983152841195215E-5, transformed.getX(), DELTA);
    Assert.assertEquals(2.6949458522981454E-4, transformed.getY(), DELTA);
    Assert.assertEquals(1.796630568239043E-4, transformed.getMaxX(), DELTA);
    Assert.assertEquals(3.593261136397527E-4, transformed.getMaxY(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.geometry.Bbox

  @Test
  public void transformBboxCrsTest() throws Exception {
    Crs source = geoService.getCrs2(MERCATOR);
    Crs target = geoService.getCrs2(LONLAT);
    Bbox bbox = new Bbox(10, 30, 10, 10);
    Bbox transformed = geoService.transform(bbox, source, target);
    Assert.assertEquals(8.983152841195215E-5, transformed.getX(), DELTA);
    Assert.assertEquals(2.6949458522981454E-4, transformed.getY(), DELTA);
    Assert.assertEquals(1.796630568239043E-4, transformed.getMaxX(), DELTA);
    Assert.assertEquals(3.593261136397527E-4, transformed.getMaxY(), DELTA);

    Assert.assertEquals(bbox, geoService.transform(bbox, source, source));
  }
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.