public static ActivityFacilitiesImpl createGridLayerByGridSizeByShapeFileV2(Geometry boundary,double gridSize){
  log.info("Setting statring points for accessibility measure ...");
  int skippedPoints=0;
  int setPoints=0;
  GeometryFactory factory=new GeometryFactory();
  ActivityFacilitiesImpl measuringPoints=new ActivityFacilitiesImpl("accessibility measuring points");
  Envelope env=boundary.getEnvelopeInternal();
  for (double x=env.getMinX(); x < env.getMaxX(); x+=gridSize) {
    for (double y=env.getMinY(); y < env.getMaxY(); y+=gridSize) {
      double centerX=x + (gridSize / 2);
      double centerY=y + (gridSize / 2);
      Point centroid=factory.createPoint(new Coordinate(centerX,centerY));
      if (boundary.contains(centroid)) {
        Coord center=new Coord(centerX,centerY);
        measuringPoints.createAndAddFacility(Id.create(setPoints,ActivityFacility.class),center);
        setPoints++;
      }
 else       skippedPoints++;
    }
  }
  log.info("Having " + setPoints + " inside the shape file boundary (and "+ skippedPoints+ " outside).");
  log.info("Done with setting starting points!");
  return measuringPoints;
}

public static ActivityFacilitiesImpl createGridLayerByGridSizeByShapeFileV2 ( Geometry boundary , double gridSize ) { log . info ( "Setting statring points for accessibility measure ..." ) ; int skippedPoints = 0 ; int setPoints = 0 ; GeometryFactory factory = new GeometryFactory ( ) ; ActivityFacilitiesImpl measuringPoints = new ActivityFacilitiesImpl ( "accessibility measuring points" ) ; Envelope env = boundary . getEnvelopeInternal ( ) ; for ( double x = env . getMinX ( ) ; x < env . getMaxX ( ) ; x += gridSize ) { for ( double y = env . getMinY ( ) ; y < env . getMaxY ( ) ; y += gridSize ) { double centerX = x + ( gridSize / 2 ) ; double centerY = y + ( gridSize / 2 ) ; Point centroid = factory . createPoint ( new Coordinate ( centerX , centerY ) ) ; if ( boundary . contains ( centroid ) ) { Coord center = new Coord ( centerX , centerY ) ; measuringPoints . createAndAddFacility ( Id . create ( setPoints , ActivityFacility . class ) , center ) ; setPoints ++ ; } else skippedPoints ++ ; } } log . info ( "Having " + setPoints + " inside the shape file boundary (and " + skippedPoints + " outside)." ) ; log . info ( "Done with setting starting points!" ) ; return measuringPoints ; }
creates measuring points for accessibility computation
