Package org.geotools.feature

Examples of org.geotools.feature.FeatureType


        if (null == style) {
            style = layer.getDefaultStyle();
        }

    FeatureType type;
    try{
      type = layer.getFeatureType();
    }catch(IOException ioe){
      throw new RuntimeException("Error getting FeatureType, this should never happen!");
    }
View Full Code Here


        }

        List list = new ArrayList();

        try {
            FeatureType ftype = getFeatureType();
            AttributeType[] types = ftype.getAttributeTypes();
            list = new ArrayList(types.length);

            for (int i = 0; i < types.length; i++) {
                list.add(types[i].getName());
            }
View Full Code Here

            DataStore dataStore = data.getDataStoreInfo(dataStoreId)
                                      .getDataStore();

            try {
                FeatureType ftype = dataStore.getSchema(typeName);
                info.sync(ftype.getAttributeType(attributeName));
            } catch (IOException e) {
            }
        } else {
            // will need to generate from Schema
            DataStore dataStore = data.getDataStoreInfo(dataStoreId)
                                      .getDataStore();

            try {
                FeatureType ftype = dataStore.getSchema(typeName);
                info = new AttributeTypeInfo(ftype.getAttributeType(
                            attributeName));
            } catch (IOException e) {
            }
        }
View Full Code Here

        try {
            Filter finalLayerFilter;
            Query layerQuery;

            for (int i = 0; i < nLayers; i++) {
                FeatureType schema = layers[i].getFeatureType();

                finalLayerFilter = buildFilter(requestExtent, ffactory, schema);

                String[] props = guessProperties(layers[i], finalLayerFilter);
                layerQuery = new DefaultQuery(schema.getTypeName(),
                        finalLayerFilter, props);
                queries[i] = layerQuery;
            }
        } catch (IllegalFilterException ex) {
            throw new WmsException(ex,
View Full Code Here

     *       AttributeExpression's?). I think that the style should be taken
     *       in count too.
     */
    private String[] guessProperties(FeatureTypeInfo layer, Filter filter)
        throws java.io.IOException {
        FeatureType type = layer.getFeatureType();
        List atts = new ArrayList();
        String geom_name = type.getDefaultGeometry().getName();

        if (!atts.contains(geom_name)) {
            atts.add(geom_name);
        }

View Full Code Here

        System.out.println("rest based on schemaBase: " + type.getSchemaBase());

        // Generate ReadOnly list of Attributes
        //
        DataStoreConfig dataStoreConfig = config.getDataStore(dataStoreId);
        FeatureType featureType = null;

        try {
            DataStore dataStore = dataStoreConfig.findDataStore(getServlet()
                                                                    .getServletContext());
            featureType = dataStore.getSchema(typeName);
        } catch (IOException e) {
            // DataStore unavailable!
        }

        if (((type.getSchemaBase() == null)
                || "--".equals(type.getSchemaBase()))
                || (type.getSchemaAttributes() == null)) {
            //We are using the generated attributes
            this.schemaBase = "--";
            this.schemaName = typeName + "_Type";
            this.attributes = new LinkedList();

            // Generate ReadOnly list of Attributes
            //
            List generated = DataTransferObjectFactory.generateAttributes(featureType);
            this.attributes = attributesDisplayList(generated);
            addList = Collections.EMPTY_LIST;
        } else {
            this.schemaBase = type.getSchemaBase();
            this.schemaName = type.getSchemaName();
            this.attributes = new LinkedList();

            //
            // Need to add read only AttributeDisplay for each required attribute
            // defined by schemaBase
            //
            List schemaAttributes = DataTransferObjectFactory
                .generateRequiredAttributes(schemaBase);
            attributes.addAll(attributesDisplayList(schemaAttributes));
            attributes.addAll(attributesFormList(type.getSchemaAttributes(),
                    featureType));
            addList = new ArrayList(featureType.getAttributeCount());

            for (int i = 0; i < featureType.getAttributeCount(); i++) {
                String attributeName = featureType.getAttributeType(i).getName();

                if (lookUpAttribute(attributeName) == null) {
                    addList.add(attributeName);
                }
            }
View Full Code Here

   
    AttributeTypeFactory atf = AttributeTypeFactory.defaultInstance();
    FeatureTypeFactory ff = FeatureTypeFactory.newInstance("test");
   
    ff.addType(atf.newAttributeType("geom", Geometry.class));
    FeatureType type = ff.getFeatureType();
   
    Feature f1 = type.create(new Object[]{point});
    Feature f2 = type.create(new Object[]{line});
    Feature f3 = type.create(new Object[]{polygon});
   
    MemoryDataStore ds = new MemoryDataStore();
    ds.createSchema(type);
    ds.addFeatures(new Feature[]{f1,f2,f3});
   
View Full Code Here

     *         <code>citeTypeName</code>, getting its default test style, or
     *         asking the producer to generate the legend
     */
    private BufferedImage testProduceLegendGraphic(String citeTypeName,
        int ruleCount) throws Exception {
        FeatureType layer = getCiteDataStore().getSchema(citeTypeName);
        GetLegendGraphicRequest req = new GetLegendGraphicRequest();
        req.setLayer(layer);
        req.setStyle(getDefaultStyle(citeTypeName));

        final int HEIGHT_HINT = 30;
View Full Code Here

    public void writeFeatures(FeatureReader reader, String style)
        throws IOException, AbortedException {
        Feature ft;

        try {
            FeatureType featureType = reader.getFeatureType();
            Class gtype = featureType.getDefaultGeometry().getType();

            boolean doCollect = false;
            /*
            boolean doCollect = config.isCollectGeometries()
                && (gtype != Point.class) && (gtype != MultiPoint.class);
            */
            setGeometryType(gtype);

            setPointsAsCircles("#circle".equals(style));

            if ((style != null) && !"#circle".equals(style)
                    && style.startsWith("#")) {
                style = style.substring(1);
            } else {
                style = null;
            }

            setAttributeStyle(style);

            setUpWriterHandler(featureType, doCollect);

            if (doCollect) {
                write("<path ");
                write("d=\"");
            }

            while (reader.hasNext()) {
                ft = reader.next();
                writeFeature(ft);
                ft = null;
            }

            if (doCollect) {
                write("\"/>\n");
            }

            LOGGER.fine("encoded " + featureType.getTypeName());
        } catch (NoSuchElementException ex) {
            throw new DataSourceException(ex.getMessage(), ex);
        } catch (IllegalAttributeException ex) {
            throw new DataSourceException(ex.getMessage(), ex);
        }
View Full Code Here

         */
        public void startFeature(SVGFeatureWriter featureWriter, Feature ft)
            throws IOException {
            handler.startFeature(featureWriter, ft);

            FeatureType type = ft.getFeatureType();
            int numAtts = type.getAttributeCount();
            String name;
            Object value;

            for (int i = 0; i < numAtts; i++) {
                value = ft.getAttribute(i);

                if ((value != null) && !(value instanceof Geometry)) {
                    write(' ');
                    write(type.getAttributeType(i).getName());
                    write("=\"");
                    encodeAttribute(String.valueOf(value));
                    write('\"');
                }
            }
View Full Code Here

TOP

Related Classes of org.geotools.feature.FeatureType

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.