Package org.earth3d.jearth.math

Examples of org.earth3d.jearth.math.Rect2D


   
    // ensure that there is a root node
    MapTile mt0 = null;
    if (file0.exists()) {
      mt0 = new MapTile(outputDir, filename0, BufferedImage.TYPE_3BYTE_BGR);
      mt0.setCoordinates(new Rect2D(new Point2D(0,0), new Point2D(1,1)));
    }
    else {
      mt0 = new MapTile(BufferedImage.TYPE_3BYTE_BGR);
      mt0.setCoordinates(new Rect2D(new Point2D(0,0), new Point2D(1,1)));
      mt0.setFilename(filename0);
      mt0.setDirectory(outputDir);
      mt0.setPos(0);
    }
   
View Full Code Here


   
    // ensure that there is a root node
    MapTile mt0 = null;
    if (file0.exists()) {
      mt0 = new MapTile(outputDir, filename0, BufferedImage.TYPE_USHORT_GRAY);
      mt0.setCoordinates(new Rect2D(new Point2D(0,0), new Point2D(1,1)));
    }
    else {
      mt0 = new MapTile(BufferedImage.TYPE_USHORT_GRAY);
      mt0.setCoordinates(new Rect2D(new Point2D(0,0), new Point2D(1,1)));
      mt0.setFilename(filename0);
      mt0.setDirectory(outputDir);
      mt0.setPos(0);
     
      if (maps.size() == 0) {
View Full Code Here

  protected Rect2D getSubRegion(Rect2D coordinates, SubmaptilePos childpos) {
    Point2D newsize = new Point2D(coordinates.size.x/2., coordinates.size.y/2.);

    switch(childpos) {
    case LEFT_UP:
      return new Rect2D(coordinates.p, newsize);
    case LEFT_DOWN:
      return new Rect2D(coordinates.p.add(new Point2D(0, newsize.y)), newsize);
    case RIGHT_UP:
      return new Rect2D(coordinates.p.add(new Point2D(newsize.x, 0)), newsize);
    case RIGHT_DOWN:
      return new Rect2D(coordinates.p.add(new Point2D(newsize.x, newsize.y)), newsize);
    }

    return null;
  }
View Full Code Here

   *
   * @param map
   * @throws IOException
   */
  public void insertMapRegion(MapEntry map, boolean allowSmallerTiles) throws IOException {
    Rect2D localcoordinates = getCoordinates();
    Rect2D mapcoordinates = map.getCoordinates();
   
    double mapPixelPerUnitX = map.getImage().getWidth() / mapcoordinates.size.x;
    double mapPixelPerUnitY = map.getImage().getHeight() / mapcoordinates.size.y;
   
    BufferedImage img = getImg();
View Full Code Here

   *
   * @param elemMap
   */
  public MapEntry(String directory, Element elemMap) {
    filename = new File(directory, elemMap.getAttribute("filename"));
    coordinates = new Rect2D();
    coordinates.p.x = Double.parseDouble(elemMap.getAttribute("x"));
    coordinates.p.y = Double.parseDouble(elemMap.getAttribute("y"));
    coordinates.size.x = Double.parseDouble(elemMap.getAttribute("width"));
    coordinates.size.y = Double.parseDouble(elemMap.getAttribute("height"));
  }
View Full Code Here

      /* create vertexbackuparray */
      vertexbackuparray = new Point3D[vertexinterpolationarraysize];

      System.arraycopy(vertexarray, 0, vertexbackuparray, 0,
          vertexinterpolationarraysize);
      vertexbackuparraydatarect = new Rect2D(vertexarraydatarect);
    }

    dirty = true;
    dirtyBorders = true;
    innerGenerated = false;
View Full Code Here

    int endy = (width[1] > getWidth() - 3) ? getHeight() - 1
        : getHeight() - 2;
    int beginx = (width[2] == getHeight()) ? 0 : 1;
    int endx = (width[0] > getHeight() - 3) ? getWidth() : getWidth() - 1;

    vertexarraydatarect = new Rect2D(new Point2D(beginx, beginy),
        new Point2D(endx - beginx, endy - beginy));

    stripsize = (endx - beginx) * 2;

    if (vertexarraysize < stripsize * (getHeight() - 1)) {
View Full Code Here

    try {
      if (!userInteraction) { // do not change the geometry or load data while moving
        System.out.println("new geometry");
        /* start selecting the nodes */
        checkNode(currentNode, selectedNodes, viewer, virtualviewer, new Rect2D(new Point2D(0,0), new Point2D(1,1)), projmodelmatrix, modelview, 0, (float) distsurface, direction, windowSize);

      } else {
        // when the user moves the map, display the old geometry
        for(MapTileTreeNode node : wasSelectedNodes) {
          selectNode(node, selectedNodes, true);
View Full Code Here

            /* create the node. Use nodeRect for calculation of coordinates */
            MapTileTreeNode newNode = new MapTileTreeNode(currentNode);
            newNode.depth = depth;

            Rect2D newNodeRect = getChildRect(childnr, nodeRect);

            /* create texture core */
            TextureTreeNodeCore newTextureCore = createTextureCore(currentNode.getMapTileTree(), currentNode, childnr, newNodeRect);

            /* insert core */
            newNode.setCore(0, newTextureCore);

            /* create heightfield core */
            HeightfieldTreeNodeCore newHeightfieldCore = createHeightfieldCore(currentNode, childnr, newNodeRect, newTextureCore.vertex, htree);

            /* insert core */
            newNode.setCore(1, newHeightfieldCore);

            /* generate bounding sphere */
            newNode.generateBoundingSphere();

            // insert into parent node
            currentNode.setChild(childnr, newNode);
//            newNode.informNeighborNodes();

            // request the nodes
            if (newTextureCore.getRequestID()!=null) {
              request(newTextureCore);
            }
            else {
              newTextureCore.setGenerated(false);
              newTextureCore.setDownloaded(true);
            }
            requestHeightfield(newHeightfieldCore);

            // select currentNode for drawing or generate deeper node from known data
            selectNode(newNode, selectedNodes, visible);

            /* set interpolation value for the new node */
            float newDistance = (float) getDistance(viewer, ((HeightfieldTreeNodeCore)(newNode.getCore(1))).getRect());
            float newEdgeSize = (float) getMaxEdgeSize(viewer, ((TextureTreeNodeCore)(newNode.getCore(0))).vertex, newDistance);
            if (newEdgeSize>Global.MAXTILESIZE_2) {
              newNode.setInterpolationCounter(1-(newEdgeSize-Global.MAXTILESIZE_2)/Global.MAXTILESIZE_2);
            }
            else {
              newNode.setInterpolationCounter(1);
            }
          }
          else {
            //     printf("CHECKNODE FOUND CHILD\n");
            /* the tile cannot be yet requested because the download of the parent
           tile is not finished. The parent needs to be drawn */
            selectNode(currentNode, selectedNodes, visible);

            if (edgeSize>Global.MAXTILESIZE_2) {
              currentNode.setInterpolationCounter(1-(edgeSize-Global.MAXTILESIZE_2)/Global.MAXTILESIZE_2);
            }
            else {
              currentNode.setInterpolationCounter(1);
            }
          }
        }
        else {
          /* Calculate angle rectangle of child node */
          Rect2D newNodeRect = getChildRect(childnr, nodeRect);

          /* Check this node */
          checkNode(child, selectedNodes, viewer, virtualviewer, newNodeRect, projmodelmatrix, modelviewmatrix,  depth+1, distsurface, direction, windowSize);
        }
      }
View Full Code Here

      }
    }
  }

  Rect2D getChildRect(int childnr, Rect2D nodeRect) {
    Rect2D newNodeRect = null;
    try {
      newNodeRect = (Rect2D) nodeRect.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.earth3d.jearth.math.Rect2D

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.