@Override
 public Boolean mustStoreNode(Node node) {
   Boolean result = true;
   if (!GuiOptionsHelper.getOptions().isSinglePass()) {
     result = GeomUtils.compareCoordinates(currentTile, node);
   }
   return result;
 }
  /**
   * Write streetlight objects in dsf file.
   *
   * @param osmPolygon osm road polygon
   */
  public void writeStreetLightToDsf(OsmPolygon osmPolygon) {
    // init d'un entier pour modulo densité street lights
    Integer densityIndex = 0;
    if (XplaneOptionsHelper.getOptions().getLightsDensity() == 0) {
      densityIndex = 10;
    } else {
      if (XplaneOptionsHelper.getOptions().getLightsDensity() == 1) {
        densityIndex = 5;
      } else {
        if (XplaneOptionsHelper.getOptions().getLightsDensity() == 2) densityIndex = 3;
      }
    }
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < osmPolygon.getPolygon().getVertices().size(); i++) {
      if ((i % densityIndex) == 0) {
        Point2D lightLoc = osmPolygon.getPolygon().getVertex(i);
        lightLoc.x = lightLoc.x + 0.0001;
        lightLoc.y = lightLoc.y + 0.0001;
        if (GeomUtils.compareCoordinates(lightLoc, currentTile)) {
          Random randomGenerator = new Random();
          int orientation = randomGenerator.nextInt(360);
          sb.append(
              "OBJECT "
                  + dsfObjectsProvider.getRandomStreetLightObject()
                  + " "
                  + (lightLoc.y)
                  + " "
                  + (lightLoc.x)
                  + " "
                  + orientation);
          sb.append(System.getProperty("line.separator"));
          // stats
          StatsHelper.addStreetLight(stats);
        }
      }
    }

    writer.write(sb.toString());
  }
 @Override
 public void processNode(Node node) throws Osm2xpBusinessException {
   // process the node if we're on a single pass mode.
   // if not on single pass, only process if the node is on the current
   // lat/long tile
   if (XplaneOptionsHelper.getOptions().isGenerateObj()) {
     if ((!GuiOptionsHelper.getOptions().isSinglePass()
             && GeomUtils.compareCoordinates(currentTile, node))
         || GuiOptionsHelper.getOptions().isSinglePass()) {
       // write a 3D object in the dsf file if this node is in an
       // object
       // rule
       XplaneDsf3DObject object =
           dsfObjectsProvider.getRandomDsfObjectIndexAndAngle(node.getTag(), node.getId());
       if (object != null) {
         List<Node> nodes = new ArrayList<Node>();
         nodes.add(node);
         object.setPolygon(new OsmPolygon(node.getId(), node.getTag(), nodes));
         writeObjectToDsf(object);
       }
     }
   }
 }