Package org.geotools.data.collection

Examples of org.geotools.data.collection.ListFeatureCollection


    protected ListFeatureCollection createFeatureCollectionForMapInfoDriver() throws Exception {
       
        SimpleFeatureType type =buildFeatureTypeForMapInfo();
     
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
        ListFeatureCollection features = new ListFeatureCollection(type);
        for (int i = 0, ii = 20; i < ii; i++) {
            features.add(
              fb.buildFeature(null,
                new Object[] {
                      new GeometryFactory().createPoint(new Coordinate(1, -1)),
                      //new Byte((byte) i),
                      //new Short((short) i),
View Full Code Here


    protected static ListFeatureCollection createFeatureCollectionForMapInfoDriver() throws Exception {
       
        SimpleFeatureType type =buildFeatureTypeForMapInfo();
     
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
        ListFeatureCollection features = new ListFeatureCollection(type);
        for (int i = 0, ii = 20; i < ii; i++) {
            features.add(
              fb.buildFeature(null,
                new Object[] {
                      new GeometryFactory().createPoint(new Coordinate(1, -1)),
                      //new Byte((byte) i),
                      //new Short((short) i),
View Full Code Here

        tbuilder.add("j", Long.class);
        tbuilder.add("k", BigDecimal.class);
        tbuilder.add("l", BigInteger.class);
        SimpleFeatureType type = tbuilder.buildFeatureType();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
        ListFeatureCollection features = new ListFeatureCollection(type);
        for (int i = 0, ii = 20; i < ii; i++) {
            features.add(fb.buildFeature(null, new Object[] {
                    new GeometryFactory().createPoint(new Coordinate(1, -1)), new Byte((byte) i),
                    new Short((short) i), new Double(i), new Float(i), new String(i + " "),
                    new Date(i), new Boolean(true), new Integer(22),
                    new Long(1234567890123456789L),
                    new BigDecimal(new BigInteger("12345678901234567890123456789"), 2),
View Full Code Here

    GeometryBuilder geom = new GeometryBuilder();
   
    List<SimpleFeature> list = new ArrayList<SimpleFeature>();
    list.add( build.buildFeature("fid1", new Object[]{ geom.point(1,1), "hello" } ) );
    list.add( build.buildFeature("fid2", new Object[]{ geom.point(2,3), "martin" } ) );
    SimpleFeatureCollection collection = new ListFeatureCollection(featureType, list);

    Transaction transaction = new DefaultTransaction("Add Example");
    store.setTransaction( transaction );
    try {
        store.addFeatures( collection );
View Full Code Here

        final SimpleFeatureType TYPE = typeBuilder.buildFeatureType();

        SimpleFeature feature = SimpleFeatureBuilder.build(
                TYPE, new Object[]{JTS.toGeometry(env), "a rectangle"}, null);

        SimpleFeatureCollection fc = new ListFeatureCollection(TYPE, Arrays.asList(feature));
        ReferencedEnvelope bounds = fc.getBounds();
        return fc;
    }
View Full Code Here

        SimpleFeatureCollection fcLine = fsLine.getFeatures();
        SimpleFeatureIterator fLine = fcLine.features();
       
        SimpleFeatureSource fsPoly = (SimpleFeatureSource) layers.get(getRestrictedPolygonTypeRef());
       
        ListFeatureCollection fcPoly = new ListFeatureCollection( fsPoly.getFeatures() );
               
        while(fLine.hasNext()){
          SimpleFeature line = fLine.next();
          SimpleFeatureIterator fPoly = fcPoly.features();
          Geometry lineGeom = (Geometry) line.getDefaultGeometry();
          if(envelope.contains(lineGeom.getEnvelopeInternal())){
            //   check for valid comparison
            if(LineString.class.isAssignableFrom(lineGeom.getClass())){
              while(fPoly.hasNext()){
                SimpleFeature poly = fPoly.next();
                Geometry polyGeom = (Geometry) poly.getDefaultGeometry();
                if(envelope.contains(polyGeom.getEnvelopeInternal())){
                  if(Polygon.class.isAssignableFrom(polyGeom.getClass())){
                    if(!polyGeom.contains(lineGeom)){
                      results.error(poly,"Polygon does not contain the specified Line.");
                      r = false;
                    }
                        // do next.
                  }else{
                    fcPoly.remove(poly);
                    results.warning(poly,"Invalid type: this feature is not a derivative of a Polygon");
                  }
                }else{
                  fcPoly.remove(poly);
                }
              }
            }else{
              results.warning(line,"Invalid type: this feature is not a derivative of a LineString");
            }
View Full Code Here

        SimpleFeatureCollection fcLine = fsLine.getFeatures();
        SimpleFeatureIterator fLine = fcLine.features();
       
        SimpleFeatureSource fsRLine = (SimpleFeatureSource) layers.get(getRestrictedLineTypeRef());
       
        ListFeatureCollection fcRLine = new ListFeatureCollection( fsRLine.getFeatures() );
               
        while(fLine.hasNext()){
          SimpleFeature line = fLine.next();
          SimpleFeatureIterator fRLine = fcRLine.features();
          Geometry lineGeom = (Geometry) line.getDefaultGeometry();
          if(envelope.contains(lineGeom.getEnvelopeInternal())){
            //   check for valid comparison
            if(LineString.class.isAssignableFrom(lineGeom.getClass())){
              while(fRLine.hasNext()){
                SimpleFeature rLine = fRLine.next();
                Geometry rLineGeom = (Geometry) rLine.getDefaultGeometry();
                if(envelope.contains(rLineGeom.getEnvelopeInternal())){
                  if(LineString.class.isAssignableFrom(rLineGeom.getClass())){
                  if(lineGeom.intersects(rLineGeom)){
                    if(!hasPair(((LineString)lineGeom).getCoordinateSequence(),((LineString)rLineGeom).getCoordinateSequence())){
                      results.error(rLine,"Line does not intersect line at node covered by the specified Line.");
                      r = false;
                    }
                  }else{
                        results.warning(rLine,"Does not intersect the LineString")
                  }
                        // do next.
                  }else{
                    fcRLine.remove(rLine);
                    results.warning(rLine,"Invalid type: this feature is not a derivative of a LineString");
                  }
                }else{
                  fcRLine.remove(rLine);
                }
              }
            }else{
              results.warning(line,"Invalid type: this feature is not a derivative of a LineString");
            }
View Full Code Here

        SimpleFeatureCollection fcLine = fsLine.getFeatures();
        SimpleFeatureIterator fLine = fcLine.features();
       
        SimpleFeatureSource fsRLine = (SimpleFeatureSource) layers.get(getRestrictedLineTypeRef());
       
        ListFeatureCollection fcRLine = new ListFeatureCollection( fsRLine.getFeatures() );
               
        while(fLine.hasNext()){
          SimpleFeature line = fLine.next();
          SimpleFeatureIterator fRLine = fcRLine.features();
          Geometry lineGeom = (Geometry) line.getDefaultGeometry();
          if(envelope.contains(lineGeom.getEnvelopeInternal())){
            //   check for valid comparison
            if(LineString.class.isAssignableFrom(lineGeom.getClass())){
              while(fRLine.hasNext()){
                SimpleFeature rLine = fRLine.next();
                Geometry rLineGeom = (Geometry) rLine.getDefaultGeometry();
                if(envelope.contains(rLineGeom.getEnvelopeInternal())){
                  if(LineString.class.isAssignableFrom(rLineGeom.getClass())){
                    Point p1 = ((LineString)rLineGeom).getEndPoint();
                    //Point p2 = ((LineString)rLineGeom).getStartPoint(); //include this?
                    if(!lineGeom.contains(p1)){
                      //if(!(lineGeom.contains(p1) || lineGeom.contains(p2))){
                      results.error(rLine,"Line End Point not covered by the specified Line.");
                      r = false;
                    }
                        // do next.
                  }else{
                    fcRLine.remove(rLine);
                    results.warning(rLine,"Invalid type: this feature is not a derivative of a LineString");
                  }
                }else{
                  fcRLine.remove(rLine);
                }
              }
            }else{
              results.warning(line,"Invalid type: this feature is not a derivative of a LineString");
            }
View Full Code Here

        }
       
        Filter filter = q.getFilter();
        q.setFilter(filter);
        List<CoverageSlice> granules = innerCatalog.getGranules(q);
        SimpleFeatureCollection collection = new ListFeatureCollection(innerCatalog.getSchema(typeName));
        for (CoverageSlice granule: granules) {
            ((ListFeatureCollection)collection).add(granule.getOriginator());
        }
        return collection;
    }
View Full Code Here

      ReferencedEnvelope requestedBBox=extractAndCombineBBox(filter);
     
      // load what we need to load
      checkIndex(lock);
      final List<GranuleDescriptor> features= index.query(requestedBBox);     
      final ListFeatureCollection retVal= new ListFeatureCollection(wrappedCatalogue.getType(typeName));
      final int maxGranules= q.getMaxFeatures();
      int numGranules=0;
      for(GranuleDescriptor g :features)
      {      
              // check how many tiles we are returning
              if(maxGranules>0&&numGranules>=maxGranules)
                  break;
        final SimpleFeature originator = g.getOriginator();
        if(originator!=null&&filter.evaluate(originator))
          retVal.add(originator);
      }
      return retVal;
    }finally{
      lock.unlock();
   
View Full Code Here

TOP

Related Classes of org.geotools.data.collection.ListFeatureCollection

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.