Package org.opengis.feature.type

Examples of org.opengis.feature.type.GeometryDescriptor


        for( ILayer iLayer : layers ) {
            final IGeoResource geoResource = iLayer.getGeoResource();
            if (geoResource.canResolve(FeatureSource.class)) {
                SimpleFeatureSource lineSource = (SimpleFeatureSource) geoResource.resolve(FeatureSource.class, monitor);
                SimpleFeatureCollection featureCollection = lineSource.getFeatures(iLayer.getFilter());
                GeometryDescriptor geometryDescriptor = featureCollection.getSchema().getGeometryDescriptor();
                if (!SLD.isLine(geometryDescriptor)) {
                    break;
                }
                SimpleFeatureIterator featureIterator = featureCollection.features();
                if (featureIterator.hasNext()) {
View Full Code Here


      // TODO Auto-generated method stub
      return next!=null;
    }

      private boolean intersects( SimpleFeature feature ) {
          GeometryDescriptor geomDescriptor = getGeometryAttDescriptor(feature.getFeatureType());
         
          Geometry bboxGeom = new GeometryFactory().toGeometry(bbox);

          Geometry geom = (Geometry) feature.getAttribute(geomDescriptor.getName());

          try{
              return geom.intersects(bboxGeom);
          }catch (Exception e) {
              // ok so exception happened during intersection.  This usually means geometry is a little crazy
View Full Code Here

        }
        Id filter = factory.id(ids);

        store.removeFeatures(filter);
        Geometry oldType = (Geometry) oldFeature.getDefaultGeometry();
    GeometryDescriptor newType = store.getSchema().getGeometryDescriptor();
    store.modifyFeatures(newType, oldType, factory.id(FeatureUtils.stringToId(factory, oldFeature.getID())));
        oldFeature.setDefaultGeometry(oldGeometry);
        newFids.clear();
    }
View Full Code Here

        Set<String> currFids = new HashSet<String>();
        FeatureIterator fi = null;
        try {
            // grab the features
            FeatureSource fs = featureType.getFeatureSource(null,null);
            GeometryDescriptor geom = fs.getSchema().getGeometryDescriptor();
            CoordinateReferenceSystem nativeCrs = geom
                    .getCoordinateReferenceSystem();

            ReferencedEnvelope nativeTileEnvelope = null;

            if (!CRS.equalsIgnoreMetadata(WGS84, nativeCrs)) {
View Full Code Here

     * @param layer DOCUMENT ME!
     *
     * @throws IOException DOCUMENT ME!
     */
    private void writeDefs(SimpleFeatureType layer) throws IOException {
        GeometryDescriptor gtype = layer.getGeometryDescriptor();
        Class geometryClass = gtype.getType().getBinding();

        if ((geometryClass == MultiPoint.class) || (geometryClass == Point.class)) {
            writePointDefs();
        }
    }
View Full Code Here

                FeatureCollection<SimpleFeatureType, SimpleFeature> features = null;
                try {
                    FeatureSource<SimpleFeatureType, SimpleFeature> source;
                    source = (FeatureSource<SimpleFeatureType, SimpleFeature>) layer.getFeatureSource();
                   
                    GeometryDescriptor gd = source.getSchema().getGeometryDescriptor();
                    if(gd == null) {
                        // geometryless layers...
                        features = source.getFeatures(query);
                    } else {
                        // make sure we are querying the source with the bbox in the right CRS, if
                        // not, reproject the bbox
                        ReferencedEnvelope env = new ReferencedEnvelope(mapArea);
                        CoordinateReferenceSystem sourceCRS = gd.getCoordinateReferenceSystem();
                        if(sourceCRS != null &&
                            !CRS.equalsIgnoreMetadata(mapArea.getCoordinateReferenceSystem(), sourceCRS)) {
                            env = env.transform(sourceCRS, true);
                        }
                       
                        // build the mixed query
                        Filter original = query.getFilter();
                        Filter bbox = ff.bbox(gd.getLocalName(), env.getMinX(), env.getMinY(), env.getMaxX(), env.getMaxY(), null);
                        query.setFilter(ff.and(original, bbox));

                        // query and eventually reproject
                        features = source.getFeatures(query);
                        if(sourceCRS != null && !CRS.equalsIgnoreMetadata(wgs84, sourceCRS)) {
View Full Code Here

            // with it just once
            ps = conn.prepareStatement("INSERT INTO "
                    + "FEATUREIDX(X, Y, FID, ORDER_FIELD) VALUES (?, ?, ?, ?)");

            // build an optimized query, loading only the necessary attributes
            GeometryDescriptor geom = fs.getSchema()
                    .getGeometryDescriptor();
            CoordinateReferenceSystem nativeCrs = geom
                    .getCoordinateReferenceSystem();
            DefaultQuery q = new DefaultQuery();
           
            if (geom.getLocalName().equals(attribute)) {
                q.setPropertyNames(new String[] { geom.getLocalName() });
            } else {
                q.setPropertyNames(new String[] { attribute, geom.getLocalName() });
            }
           
            // setup the eventual transform
            MathTransform tx = null;
            double[] coords = new double[2];
View Full Code Here

   
    String getTypeTooltip(LayerInfo layer) {
      try {
        String type = null;
        FeatureTypeInfo fti = (FeatureTypeInfo) layer.getResource();
          GeometryDescriptor gd = fti.getFeatureType().getGeometryDescriptor();
          if(gd != null) {
              type = gd.getType().getBinding().getSimpleName();
          }
          if(type != null)
            return new ParamResourceModel("geomtype." + type, ImportSummaryPage.this).getString();
          else
            return "geomtype.null";
View Full Code Here

        String colorName = ramp.getName();
        Color color = ramp.getColor();
        ramp.next();

        // geometryless, style it randomly
        GeometryDescriptor gd = featureType.getFeatureType().getGeometryDescriptor();
        if (gd == null)
            return catalog.getStyle(StyleInfo.DEFAULT_POINT);

        Class gtype = gd.getType().getBinding();
        GeometryType gt;
        if (LineString.class.isAssignableFrom(gtype)
                || MultiLineString.class.isAssignableFrom(gtype)) {
            gt = GeometryType.LINE;
        } else if (Polygon.class.isAssignableFrom(gtype)
View Full Code Here

        if (info.getType() == Type.RASTER) {
            return RASTER_ICON;
        } else if(info.getType() == Type.VECTOR) {
            try {
                FeatureTypeInfo fti = (FeatureTypeInfo) info.getResource();
                GeometryDescriptor gd = fti.getFeatureType().getGeometryDescriptor();
                return getVectoryIcon(gd);
            } catch(Exception e) {
                return GEOMETRY_ICON;
            }
        } else {
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.GeometryDescriptor

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.