Package wolf.util

Examples of wolf.util.TextFileOutput


    LotFactory.makeLots(c, blocks);
  }

  public void save(String filepathBlocks, String filepathLots){
    {
      TextFileOutput tf = new TextFileOutput();
      for(CityBlock b:blocks){
        tf.data.add(b.shape.toText());
      }
      for(int i=0; i<tf.data.size(); i++){
        String s = tf.data.get(i);
        if(i!=0){
          s = s.replaceAll("POLYGON", ",");
        }else{
          s = s.replaceAll("POLYGON", "MULTIPOLYGON (");
        }
        tf.data.set(i, s);
      }
      tf.data.add(")");
      tf.save(filepathBlocks);
    }
    {
      TextFileOutput tf = new TextFileOutput();
      for(CityBlock b:blocks){
        if(b.lots != null){
          for(Lot i:b.lots){
            tf.data.add(i.shape.toText());
          }
        }
      }
      for(int i=0; i<tf.data.size(); i++){
        String s = tf.data.get(i);
        if(i!=0){
          s = s.replaceAll("POLYGON", ",");
        }else{
          s = s.replaceAll("POLYGON", "MULTIPOLYGON (");
        }
        tf.data.set(i, s);
      }
      tf.data.add(")");
      tf.save(filepathLots);
    }
  }
View Full Code Here


  }

  public void saveSTL(){
    c.log.log("Saving STL");
    if(buildings.size() > 0){
      TextFileOutput tf = new TextFileOutput();
      tf.data.add("solid buildings\n"); //file header

      for(int i=0; i<buildings.size(); i++){
        FakeBuilding b = buildings.get(i);
        //print status to console
        if(i%20==0){
          System.out.println((float)i/(float)buildings.size()*100f+"% Complete");
        }
        tf.data.add(b.toSTL());
      }
      //end file
      tf.data.add("endsolid buildings\n");

      tf.save("data/buildings.stl");
    }
  }
View Full Code Here

TOP

Related Classes of wolf.util.TextFileOutput

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.