Ejemplo n.º 1
0
  private void makeLinks() {

    PolylineFeatureFactory pl =
        new PolylineFeatureFactory.Builder()
            .setName("Link")
            .setCrs(MGC.getCRS("EPSG:32632"))
            .addAttribute("nr_veh", Integer.class)
            .addAttribute("flow", Double.class)
            .addAttribute("angle", Double.class)
            .create();
    Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
    for (LinkInfo li : this.lis) {
      Link l = li.getLink();
      Coordinate[] coords =
          new Coordinate[] {
            MGC.coord2Coordinate(l.getFromNode().getCoord()),
            MGC.coord2Coordinate(l.getToNode().getCoord())
          };
      SimpleFeature ft =
          pl.createPolyline(
              coords,
              new Object[] {li.getVeh().size(), li.getFlow(), li.getAngle()},
              li.getLink().getId().toString());
      features.add(ft);
    }
    ShapeFileWriter.writeGeometries(features, this.debugDir + "/links.shp");
  }
Ejemplo n.º 2
0
 private void makeVeh() {
   PointFeatureFactory pf =
       new PointFeatureFactory.Builder()
           .setName("vehicle")
           .setCrs(MGC.getCRS("EPSG:32632"))
           .addAttribute("angle", Double.class)
           .addAttribute("speed", Double.class)
           .create();
   Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
   int id = 0;
   for (LinkInfo li : this.lis) {
     for (SensorDataVehicle veh : li.getVeh()) {
       SimpleFeature ft =
           pf.createPoint(
               new Coordinate(veh.getX(), veh.getY()),
               new Object[] {veh.getAngle(), veh.getSpeed()},
               id++ + "");
       features.add(ft);
     }
   }
   ShapeFileWriter.writeGeometries(features, this.debugDir + "/vehicles.shp");
 }