Package org.earth3d.jearth.draw.tree

Examples of org.earth3d.jearth.draw.tree.GeometryMapTree


    assertTrue(service.getGeometry() != null);
    assertEquals("sphere", ((GeometryMapTree) service.getGeometry()).getBase());
   
    // then download the first texture map tile and heightfield map tile
    GeometryMapTree geometry = (GeometryMapTree) service.getGeometry();
    geometry.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        synchronized(sl) {
          sl.notifyAll();
        }
      }
   
      public void downloadFailed(DownloadFinishedData dfd, Exception e) {
        InfoWindow.showError(e);

        synchronized(sl) {
          sl.notifyAll();
        }
      }
    });
    geometry.download();

    synchronized(sl) {
      sl.wait();
    }
   
    BufferedImage heightfieldImage = geometry.getHeightfield().getImg();
    assertEquals(BufferedImage.TYPE_USHORT_GRAY, geometry.getHeightfield().getImg().getType());
    assertEquals(63234, heightfieldImage.getData().getSample(50, 50, 0));
    assertEquals(256, geometry.getTexture().getImg().getWidth());
    assertEquals(256, geometry.getHeightfield().getImg().getWidth());
   
//    JFrame imgWindow = new JFrame();
//    JLabel label = new JLabel();
//    imgWindow.getContentPane().add(label);
//    label.setIcon(new ImageIcon(geometry.getHeightfield().getImg()));
View Full Code Here


    MapTileTree mtt = new MapTileTree();
    mtt.addMapTreeChangeListener(this);
   
    MapTileTreeNode rootNode = mtt.getRootNode();
   
    GeometryMapTree gmt = (GeometryMapTree) geometry;
    URL source = gmt.getSource();

    MapTileTreeNodeCore newCore;
    String url;
    HeightfieldTree htree = null;
   
    try {
      newCore = new TextureTreeNodeCore(mtt);
      url = ((ConnectionURL) gmt.getTextureConnections().getConnections().get(0)).getUrl();
      newCore.setRequestID(new URL(source, url).toString());
      rootNode.setCore(0, newCore);
    } catch (MalformedURLException e2) {
      e2.printStackTrace();
    }
    try {   
      Geometry2D3D gSphere = Geometry2D3DFactory.getFactory().getGeometry("sphere");

      url = ((ConnectionURL) gmt.getHeightfieldConnections().getConnections().get(0)).getUrl();
     
      /* create HeightfieldTree, it automatically downloads the root node */
      htree = new HeightfieldTree(new URL(source, url).toString(), gSphere, 6378140. / Global.heightfieldmultiplier);
      htree.addHeightfieldTreeChangeListener(this);

View Full Code Here

   * @param filename
   * @return
   * @throws IOException
   */
  protected Geometry createGeometryFile(String filename) throws IOException {
    GeometryMapTree gmt = new GeometryMapTree();
    gmt.getTextureConnections().addConnection(new ConnectionURL("textures/0.mxml"));
    gmt.getHeightfieldConnections().addConnection(new ConnectionURL("heightfield/0.mxml"));
    gmt.writeXML(filename, getMapName());
   
    return gmt;
  }
View Full Code Here

TOP

Related Classes of org.earth3d.jearth.draw.tree.GeometryMapTree

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.