Examples of VPFFile


Examples of org.geotools.data.vpf.file.VPFFile

        Map rows = new HashMap();
        rows.put(file, row);
        Iterator joinIter = featureType.getFeatureClass().getJoinList().iterator();
        while (joinIter.hasNext()) {
            ColumnPair columnPair = (ColumnPair) joinIter.next();
            VPFFile primaryFile = getVPFFile(columnPair.column1);
            VPFFile joinFile = null;
            joinFile = getVPFFile(columnPair.column2);
   
            if (!rows.containsKey(joinFile) && rows.containsKey(primaryFile)) {
                SimpleFeature joinRow = (SimpleFeature) rows.get(primaryFile);
   
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

     * row does not match -- hasNext is undefined because we must try again
     * @return Whether we need to read again
     */
    private boolean readNext() throws IOException {
        boolean result = true;
        VPFFile file = (VPFFile) featureType.getFeatureClass().getFileList().get(0);
        hasNext = false;
        SimpleFeature row = null;
        try {
            if(file.hasNext()){
                row = file.readFeature();
            }
        } catch (IOException exc1) {
            // TODO Auto-generated catch block
            exc1.printStackTrace();
        } catch (IllegalAttributeException exc1) {
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

            Short tileId = new Short(Short.parseShort(values.getAttribute("tile_id").toString()));
            tileDirectory = tileDirectory.concat(File.separator).concat(featureType.getFeatureClass().getCoverage().getLibrary().getTileMap().get(tileId).toString()).trim();
        }

        String nodeTableName = tileDirectory.concat(File.separator).concat(CONNECTED_NODE_PRIMITIVE);
        VPFFile nodeFile = VPFFileFactory.getInstance().getFile(nodeTableName);
        SimpleFeature row = nodeFile.getRowFromId("id", nodeId);
        result = (Geometry)row.getAttribute("coordinate");
        values.setDefaultGeometry(result);
    }
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

     * @param file the file
     * @param row the row
     *
     */
    private void retrieveObject(VPFFile file, SimpleFeature row) throws IOException{
        VPFFile secondFile = null;
        VPFColumn column = null;
        Map rows = generateFileRowMap(file, row);
        List<AttributeDescriptor> attributes = featureType.getFeatureClass().getAttributeDescriptors();
        Object[] values = new Object[featureType.getAttributeCount()];
        Object value = null;
        String featureId = null;
        // Pass 1 - identify the feature identifier
        for(int inx = 0; inx < attributes.size(); inx++){
            // I am thinking it is probably safer to look this up
            // by column name than by position, but if it breaks,
            // it is easy enough to change
            if (attributes.get(inx).getLocalName().equals("id")) {
                value = row.getAttribute(inx);
                if(value != null) {
                    featureId = value.toString();
                }
                break;
            }
        }
        try {
            currentFeature = SimpleFeatureBuilder.build(featureType,values, featureId);
        } catch (IllegalAttributeException exc) {
            // This shouldn't happen since everything should be nillable
            exc.printStackTrace();
        }
       
        // Pass 2 - get the attributes, including the geometry
        for(int inx = 0; inx < attributes.size(); inx++){
            try {
                if (attributes.get(inx).getLocalName().equals(AnnotationFeatureType.ANNOTATION_ATTRIBUTE_NAME)) {
                    try{
                        //TODO: are we sure this is the intended action? Hard-coding an attribute to "nam"?
                        currentFeature.setAttribute(inx, "nam");
                    } catch (IllegalAttributeException exc) {
                        exc.printStackTrace();
                    }
                    continue;
                }
                column = (VPFColumn) attributes.get(inx);
                value = null;
                secondFile = getVPFFile(column);
                SimpleFeature tempRow = (SimpleFeature) rows.get(secondFile);
                if(tempRow != null){
                    value = tempRow.getAttribute(column.getName());
                    if (column.isAttemptLookup()){
                        try {
                            // Attempt to perform a lookup and conversion
                            String featureClassName = getVPFFile(column).getFileName();
                            String intVdtFileName = featureType.getFeatureClass().getDirectoryName().concat(File.separator).concat("int.vdt");
                            VPFFile intVdtFile = VPFFileFactory.getInstance().getFile(intVdtFileName);
                            Iterator intVdtIter = intVdtFile.readAllRows().iterator();
                            while(intVdtIter.hasNext()){
                                SimpleFeature intVdtRow = (SimpleFeature)intVdtIter.next();
                                if(intVdtRow.getAttribute("table").toString().trim().equals(featureClassName) &&
                                        (Short.parseShort(intVdtRow.getAttribute("value").toString()) == Short.parseShort(value.toString()) &&
                                        (intVdtRow.getAttribute("attribute").toString().trim().equals(column.getName())))){
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

     * @param column the column to search for
     * @return the VPFFile that owns this column
     */
    private VPFFile getVPFFile(VPFColumn column){
        String columnName = column.getName();
        VPFFile result = null;
        VPFFile temp;
        Iterator<VPFFile> iter = featureType.getFeatureClass().getFileList().iterator();
        while(iter.hasNext()){
            temp = (VPFFile)iter.next();
            if((temp != null) && (temp.getColumn(columnName) != null)){
                result = temp;
                break;
            }
        }
        return result;
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

        Short tileId = new Short(Short.parseShort(values.getAttribute("tile_id").toString()));
            tileDirectory = tileDirectory.concat(File.separator).concat(featureType.getFeatureClass().getCoverage().getLibrary().getTileMap().get(tileId).toString()).trim();
        }

        String nodeTableName = tileDirectory.concat(File.separator).concat(ENTITY_NODE_PRIMITIVE);
        VPFFile nodeFile = VPFFileFactory.getInstance().getFile(nodeTableName);
        SimpleFeature row = nodeFile.getRowFromId("id", nodeId);
        result = (Geometry)row.getAttribute("coordinate");
        values.setDefaultGeometry(result);
    }
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

     * @param column the column to search for
     * @return the VPFFile that owns this column
     */
    private VPFFile getVPFFile(AttributeDescriptor column){
        Name columnName = column.getName();
        VPFFile result = null;
        VPFFile temp;
        Iterator<VPFFile> iter = featureType.getFeatureClass().getFileList().iterator();
        while(iter.hasNext()){
            temp = iter.next();
            if((temp != null) && (temp.getColumn(columnName.getLocalPart()) != null)){
                result = temp;
                break;
            }
        }
        return result;
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

     * Need to reset the stream for the next time Resets the iterator by
     * resetting the stream.
     *
     */
    public void reset(){
            VPFFile file = (VPFFile) featureType.getFeatureClass()
                    .getFileList().get(0);
            file.reset();
            VPFFileFactory.getInstance().reset();
    }
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

            tileDirectory = tileDirectory.concat(File.separator).concat(
                featureType.getFeatureClass().getCoverage().getLibrary().getTileMap().get(tileId).toString()).trim();
        }

        String textTableName = tileDirectory.concat(File.separator).concat(TEXT_PRIMITIVE);
        VPFFile textFile = VPFFileFactory.getInstance().getFile(textTableName);
        SimpleFeature row = textFile.getRowFromId("id", textId);
        result = (Geometry)row.getAttribute("shape_line");
       
        values.setDefaultGeometry(result);
    }
View Full Code Here

Examples of org.geotools.data.vpf.file.VPFFile

                                                            .toString()).trim();
        }

        // all edges from this tile that use the face
        String edgeTableName = tileDirectory.concat(File.separator).concat(EDGE_PRIMITIVE);
        VPFFile edgeFile = VPFFileFactory.getInstance().getFile(edgeTableName);

        // Get the rings
        String faceTableName = tileDirectory.concat(File.separator).concat(FACE_PRIMITIVE);
        VPFFile faceFile = VPFFileFactory.getInstance().getFile(faceTableName);
        faceFile.reset();

        String ringTableName = tileDirectory.concat(File.separator).concat(RING_TABLE);
        VPFFile ringFile = VPFFileFactory.getInstance().getFile(ringTableName);
        ringFile.reset();

        SimpleFeature faceFeature = faceFile.readFeature();

        while (faceFeature != null) {
            if (faceFeature.getAttribute("id").equals(new Integer(faceId))) {
                coordinates = new LinkedList();

                int ringId = Integer.parseInt(faceFeature.getAttribute(
                            "ring_ptr").toString());

                // Get the starting edge
                int startEdgeId = ((Number) ringFile.getRowFromId("id", ringId)
                                                    .getAttribute("start_edge"))
                    .intValue();
                int nextEdgeId = startEdgeId;
                int prevNodeId = -1;
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.