Package com.esri.core.geometry

Examples of com.esri.core.geometry.Envelope2D


  SpatialReference spatialReference;
  QuadTree quadTree;
  QuadTreeIterator quadTreeIter;
 
  private void buildQuadTree(){
    quadTree = new QuadTree(new Envelope2D(-180, -90, 180, 90), 8);
   
    Envelope envelope = new Envelope();
    for (int i=0;i<featureClass.features.length;i++){
      featureClass.features[i].geometry.queryEnvelope(envelope);
      quadTree.insert(i, new Envelope2D(envelope.getXMin(), envelope.getYMin(), envelope.getXMax(), envelope.getYMax()));
    }
   
    quadTreeIter = quadTree.getIterator();
  }
View Full Code Here


      envIn.queryCorners(fan);
      fillConvexPolygon(rasterizer, fan, 4);
      return;
    }*/

    Envelope2D env = new Envelope2D(0, 0, m_width, m_width);
    if (!env.intersect(envIn))
      return;

    int x0 = (int) Math.round(env.xmin);
    int x = (int) Math.round(env.xmax);

View Full Code Here

    Point2D vecB = new Point2D();

    // TODO check this Java workaroung
    Point2D ptStart = new Point2D();
    Point2D ptEnd = new Point2D();
    Envelope2D segEnv = new Envelope2D();
    Point2D ptOld = new Point2D();
    while (segIter.nextPath()) {
      boolean hasFan = false;
      boolean first = true;
      ptOld.setCoords(0, 0);
      while (segIter.hasNextSegment()) {
        Segment seg = segIter.nextSegment();
        ptStart.x = seg.getStartX();
        ptStart.y = seg.getStartY();// Point2D ptStart =
        // seg.getStartXY();
        ptEnd.x = seg.getEndX();
        ptEnd.y = seg.getEndY();// Point2D ptEnd = seg.getEndXY();
        segEnv.setEmpty();
        segEnv.merge(ptStart.x, ptStart.y);
        segEnv.mergeNE(ptEnd.x, ptEnd.y);
        if (!m_geomEnv.isIntersectingNE(segEnv)) {
          if (hasFan) {
            fillConvexPolygon(rasterizer, fan, 4);
            hasFan = false;
          }
View Full Code Here

  void init(MultiVertexGeometryImpl geom, double toleranceXY,
      int rasterSizeBytes) {
    // _ASSERT(CanUseAccelerator(geom));
    m_width = Math.max((int) (Math.sqrt(rasterSizeBytes) * 2 + 0.5), 64);
    m_scanLineSize = (m_width * 2 + 31) / 32; // 2 bits per pixel
    m_geomEnv = new Envelope2D();

    m_toleranceXY = toleranceXY;

    // calculate bitmap size
    int size = 0;
    int width = m_width;
    int scanLineSize = m_scanLineSize;
    while (width >= 8) {
      size += width * scanLineSize;
      width /= 2;
      scanLineSize = (width * 2 + 31) / 32;
    }

    // allocate the bitmap, that contains the base and the mip-levels
    m_bitmap = new int[size];
    for (int i = 0; i < size; i++)
      m_bitmap[i] = 0;

    m_rasterizer = new SimpleRasterizer();
    ScanCallbackImpl callback = new ScanCallbackImpl(m_bitmap,
        m_scanLineSize);
    m_callback = callback;
    m_rasterizer.setup(m_width, m_width, callback);
    geom.queryEnvelope2D(m_geomEnv);
    if (m_geomEnv.getWidth() > m_width * m_geomEnv.getHeight()
        || m_geomEnv.getHeight() > m_geomEnv.getWidth() * m_width) {
      // the geometry is thin and the rasterizer is not needed.
    }
    m_geomEnv.inflate(toleranceXY, toleranceXY);
    Envelope2D worldEnv = new Envelope2D();

    Envelope2D pixEnv = Envelope2D
        .construct(1, 1, m_width - 2, m_width - 2);

    double minWidth = toleranceXY * pixEnv.getWidth(); // min width is such
    // that the size of
    // one pixel is
    // equal to the
    // tolerance
    double minHeight = toleranceXY * pixEnv.getHeight();

    worldEnv.setCoords(m_geomEnv.getCenter(),
        Math.max(minWidth, m_geomEnv.getWidth()),
        Math.max(minHeight, m_geomEnv.getHeight()));

    m_stroke_half_widthX_pix = worldEnv.getWidth() / pixEnv.getWidth();
    m_stroke_half_widthY_pix = worldEnv.getHeight() / pixEnv.getHeight();

    // The stroke half width. Later it will be inflated to account for
    // pixels size.
    m_stroke_half_width = m_toleranceXY;

View Full Code Here

  boolean tryRenderAsSmallEnvelope_(Envelope2D env) {
    if (!env.isIntersecting(m_geomEnv))
      return true;

    Envelope2D envPix = new Envelope2D();
    envPix.setCoords(env);
    m_transform.transform(env);
    double strokeHalfWidthPixX = m_stroke_half_widthX_pix;
    double strokeHalfWidthPixY = m_stroke_half_widthY_pix;
    if (envPix.getWidth() > 2 * strokeHalfWidthPixX + 1
        || envPix.getHeight() > 2 * strokeHalfWidthPixY + 1)
      return false;

    // This envelope is too narrow/small, so that it can be just drawn as a
    // rectangle using only boundary color.

    envPix.inflate(strokeHalfWidthPixX, strokeHalfWidthPixY);
    envPix.xmax += 1.0;
    envPix.ymax += 1.0;// take into account that it does not draw right and
    // bottom edges.

    m_callback.setColor(m_rasterizer, 2);
View Full Code Here

TOP

Related Classes of com.esri.core.geometry.Envelope2D

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.