Package org.opengis.feature.type

Examples of org.opengis.feature.type.GeometryType


     * Returns true if the schema has just one geometry and the geom type is known
     * @param schema
     * @return
     */
    private boolean isShapefileCompatible(SimpleFeatureType schema) {
        GeometryType gt = null;
        for (AttributeDescriptor at : schema.getAttributeDescriptors()) {
            if(at instanceof GeometryDescriptor) {
                if(gt == null)
                    gt = ((GeometryDescriptor) at).getType();
                else
                    // more than one geometry
                    return false;
            }
        }
       
        return gt != null && SHAPEFILE_GEOM_TYPES.contains(gt.getBinding());
    }
View Full Code Here


    GeometryDescriptor gd = delegate.getGeometryDescriptor();
    return wrapGeometryDescriptor(gd);
  }

  private GeometryDescriptor wrapGeometryDescriptor(GeometryDescriptor gd) {
    GeometryType type = gd.getType();
    Class<?> binding = type.getBinding();
        if (MultiLineString.class.isAssignableFrom(binding)) {
      GeometryType curvedType = new GeometryTypeImpl(type.getName(),
          MultiCurvedGeometry.class, type.getCoordinateReferenceSystem(),
          type.isIdentified(), type.isAbstract(),
          type.getRestrictions(), type.getSuper(),
          type.getDescription());
      return new GeometryDescriptorImpl(curvedType, gd.getName(),
          gd.getMinOccurs(), gd.getMaxOccurs(), gd.isNillable(),
          gd.getDefaultValue());
        } else if (LineString.class.isAssignableFrom(binding)) {
              GeometryType curvedType = new GeometryTypeImpl(type.getName(),
                      CurvedGeometry.class, type.getCoordinateReferenceSystem(),
                      type.isIdentified(), type.isAbstract(),
                      type.getRestrictions(), type.getSuper(),
                      type.getDescription());
              return new GeometryDescriptorImpl(curvedType, gd.getName(),
View Full Code Here

  private static GeometryDescriptor toGeometryAttribute(int shapeType,
      CoordinateReferenceSystem crs, AttributeTypeBuilder builder) {

    Class<?> s[] = { Point.class, MultiLineString.class, MultiPolygon.class };
    GeometryType buildGeometryType = builder.crs(crs).binding(s[shapeType]).buildGeometryType();
    return builder.buildDescriptor("geom", buildGeometryType);
  }
View Full Code Here

        builder.setName(schema.getName());
        builder.setCRS(schema.getCoordinateReferenceSystem());
        for (AttributeDescriptor desc : simpleFt.getAttributeDescriptors()) {
            if (isMixedGeometry(desc)) {
                GeometryDescriptor geomDescriptor = (GeometryDescriptor) desc;
                GeometryType geomType = geomDescriptor.getType();
   
                Class<?> geometryClass = getGeometryForDimensionality(dimensionality);
   
                GeometryType gt = new GeometryTypeImpl(geomType.getName(),
                        geometryClass, geomType.getCoordinateReferenceSystem(),
                        geomType.isIdentified(), geomType.isAbstract(),
                        geomType.getRestrictions(), geomType.getSuper(),
                        geomType.getDescription());
   
View Full Code Here

        assertTrue("result type", obj instanceof SimpleFeatureCollection);
        SimpleFeatureCollection features = (SimpleFeatureCollection) obj;
        assertEquals("result size", 2, features.size());
       
        SimpleFeatureType schema = features.getSchema();
        GeometryType geomType = schema.getGeometryDescriptor().getType();
        assertEquals("geometry type", MultiPolygon.class, geomType.getBinding());
       
        assertNotNull("distance attribute", schema.getDescriptor("distance"));
        assertNotNull("bearing attribute", schema.getDescriptor("bearing"));
   
    }
View Full Code Here

        AttributeType at = new AttributeTypeImpl(new NameImpl("ID"), String.class,
                false, false, Collections.EMPTY_LIST, null, null);
        builder.add(new AttributeDescriptorImpl(at, new NameImpl("ID"), 0, 1,
                false, null));
   
        GeometryType gt = new GeometryTypeImpl(new NameImpl("GEOMETRY"),
                Geometry.class, crs, false, false, Collections.EMPTY_LIST, null,
                null);
   
        builder.add(new GeometryDescriptorImpl(gt, new NameImpl("GEOMETRY"), 0, 1,
                false, null));
View Full Code Here

        Collections.sort(attrNames);
        assertEquals("Invalid property descriptor", "morx", attrNames.get(0));
        assertEquals("Invalid property descriptor", "quux", attrNames.get(1));

        GeometryDescriptor geometryDescriptor = featureType.getGeometryDescriptor();
        GeometryType geometryType = geometryDescriptor.getType();
        assertEquals("Invalid geometry name", "location", geometryType.getName().getLocalPart());
    }
View Full Code Here

     * Returns true if the schema has just one geometry and the geom type is known
     * @param schema
     * @return
     */
    private boolean isShapefileCompatible(SimpleFeatureType schema) {
        GeometryType gt = null;
        for (AttributeDescriptor at : schema.getAttributeDescriptors()) {
            if(at instanceof GeometryDescriptor) {
                if(gt == null)
                    gt = ((GeometryDescriptor) at).getType();
                else
                    // more than one geometry
                    return false;
            }
        }
       
        return gt != null && SHAPEFILE_GEOM_TYPES.contains(gt.getBinding());
    }
View Full Code Here

TOP

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

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.