Package org.earth3d.jearth.model

Examples of org.earth3d.jearth.model.ConnectionList


              Node urlnode = nodes.item(i);
              if (urlnode.getNodeType() == Node.ELEMENT_NODE) {
                Element elem = (Element) urlnode;
                if (elem.getTagName().equalsIgnoreCase("submaptile")) {

                  ConnectionList cl = new ConnectionList();
                  cl.parse(elem);

                  String relpos = elem.getAttribute("relpos");
                  int submapchildnr = 0;
                 
                  if (relpos.equalsIgnoreCase("leftUp"))    submapchildnr = 2;
                  if (relpos.equalsIgnoreCase("rightUp"))   submapchildnr = 0;
                  if (relpos.equalsIgnoreCase("leftDown"))  submapchildnr = 3;
                  if (relpos.equalsIgnoreCase("rightDown")) submapchildnr = 1;

                  String relurl = ((ConnectionURL) cl.getConnections().get(0)).getUrl().toString();
                  String firsturl = new URL(source, relurl).toString();
                 
                    core.setChildRequestID(submapchildnr, firsturl);
                }
              }
View Full Code Here


   * @throws IOException
   */
  public MapTile getMapTileChild(int childnumber) throws IOException, SAXException, ParserConfigurationException {
    MapTile result = null;
   
    ConnectionList cl = getSubmaptile()[childnumber];

    if (cl != null) {
      // find the first file connection, ignore the rest
      try {
        result = new MapTile(getDirectory(), new File(new File(
            getFilename()).getParent(), ((ConnectionURL) cl
                .getConnections().get(0)).getUrl()).getPath(), defaultType);
        result.setDepth(getDepth()+1);
        result.setCoordinates(getSubRegion(getCoordinates(), MapTileXML.getSubmaptileConstant(childnumber)));
      } catch(IOException e) {
        // could not be loaded, create new tile
        result = null;
      }
    }
   
    if (result == null) {
      // generate a connection using an unused filename
      MapTile newMapTile = new MapTile(defaultType);
      newMapTile.setDirectory(getDirectory());
      File path = new File(getFilename()).getParentFile();
      String spath = null;
      if (path == null) {
        spath = "";
      } else {
        spath = path.getPath() + File.separator;
      }
      newMapTile.setFilename(spath + childnumber + File.separator + "0.mxml");
     
//      ConnectionList newSubmaptileList[] = new ConnectionList[4];
//      for(int i=0; i<4; i++) {
//        newSubmaptileList[i] = new ConnectionList();
//        newSubmaptileList[i].addConnection(new ConnectionURL(new File(newMapTile.getFilename()).getParentFile().getPath() + File.separator + i + File.separator + "0.mxml"));
//      }
//      newMapTile.setSubmaptile(newSubmaptileList);
     
      newMapTile.setCoordinates(getSubRegion(getCoordinates(), MapTileXML.getSubmaptileConstant(childnumber)));
      newMapTile.setDepth(getDepth()+1);
      getSubmaptile()[childnumber] = new ConnectionList();
      getSubmaptile()[childnumber].addConnection(new ConnectionURL(relativeFilename(getFilename(), newMapTile.getFilename())));
     
      // persist the new map tile
//      newMapTile.write(getDirectory());
     
View Full Code Here

  protected MapTileXML heightfield;

  enum DownloadType { TEXTURE, HEIGHTFIELD };
 
  public GeometryMapTree() {
    setTextureConnections(new ConnectionList());
    setHeightfieldConnections(new ConnectionList());
  }
View Full Code Here

    for(int i=0; i<nodes.getLength(); i++) {
      Node node = nodes.item(i);
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element e = (Element) node;
        if (e.getTagName().equalsIgnoreCase("texture")) {
          ConnectionList cl = new ConnectionList();
          cl.parse(e);
         
          setTextureConnections(cl);
        }
        if (e.getTagName().equalsIgnoreCase("heightfield")) {
          ConnectionList cl = new ConnectionList();
          cl.parse(e);
         
          setHeightfieldConnections(cl);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.earth3d.jearth.model.ConnectionList

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.