Example #1
0
 /**
  * @param geoclass
  * @return
  */
 protected Feature createBasicFeature(Class<? extends Geometry> geoclass) {
   Feature f = new Feature();
   count.incrementAndGet();
   f.setName("feature" + count);
   f.setDescription("feature description " + count);
   if (geoclass.isAssignableFrom(Point.class)) {
     Point p = new Point(new Geodetic2DPoint(random));
     f.setGeometry(p);
   } else if (geoclass.isAssignableFrom(Line.class)) {
     List<Point> pts = new ArrayList<Point>();
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     f.setGeometry(new Line(pts));
   } else if (geoclass.isAssignableFrom(LinearRing.class)) {
     List<Point> pts = new ArrayList<Point>();
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     f.setGeometry(new LinearRing(pts));
   } else if (geoclass.isAssignableFrom(Polygon.class)) {
     List<Point> pts = new ArrayList<Point>();
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     pts.add(new Point(new Geodetic2DPoint(random)));
     f.setGeometry(new Polygon(new LinearRing(pts)));
   }
   return f;
 }
Example #2
0
 private static Feature addFeature(Geometry g) {
   Feature f = new Feature();
   f.setName(Integer.toString(++id));
   /*
   String type = g.getClass().getName();
   int ind = type.lastIndexOf('.');
   if (ind > 0) type = type.substring(ind + 1);
   */
   f.setDescription(g.toString());
   f.setGeometry(g);
   return f;
 }