Examples of GeometryType


Examples of org.opengis.feature.type.GeometryType

            return false;
        }
        if (!super.equals(other)) {
            return false;
        }
        GeometryType o = (GeometryType) other;
        if (CRS == null) {
            return o.getCoordinateReferenceSystem() == null;
        }
        if (o.getCoordinateReferenceSystem() == null) {
            return false;
        }
        return org.geotools.referencing.CRS.equalsIgnoreMetadata(CRS,
                o.getCoordinateReferenceSystem());
    }
View Full Code Here

Examples of org.opengis.feature.type.GeometryType

        assertEquals(4, features.size());

        SimpleFeature feature;
        Geometry geom;
        Property prop;
        GeometryType geomType;
        SimpleFeatureIterator iterator = features.features();
        while (iterator.hasNext()) {
            feature = iterator.next();
            prop = feature.getProperty("geom");
            assertTrue(prop.getType() instanceof GeometryType);
            geomType = (GeometryType) prop.getType();

            Object val = prop.getValue();
            assertTrue(val != null && val instanceof Geometry);
            geom = (Geometry) val;

            Object userData = geom.getUserData();
            assertTrue(userData != null && userData instanceof CoordinateReferenceSystem);
            // ensure the same CRS is passed on to userData for encoding
            assertEquals(userData, geomType.getCoordinateReferenceSystem());
        }
    }
View Full Code Here

Examples of org.opengis.feature.type.GeometryType

  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

Examples of org.opengis.feature.type.GeometryType

        build.setName(Classes.getShortName(geometryClass));
        build.setNillable(true);
        build.setCRS(crs);
        build.setBinding(geometryClass);

        GeometryType geometryType = build.buildGeometryType();

        List<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>();
        attributes.add(build.buildDescriptor(BasicFeatureTypes.GEOMETRY_ATTRIBUTE_NAME, geometryType));

        if (extraPropertyNames != null) {
View Full Code Here

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

Examples of org.opengis.feature.type.GeometryType

    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

Examples of org.opengis.feature.type.GeometryType

  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

Examples of org.opengis.feature.type.GeometryType

        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

Examples of org.opengis.feature.type.GeometryType

        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

Examples of org.opengis.feature.type.GeometryType

        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
TOP
Copyright © 2018 www.massapi.com. 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.