Example #1
0
        protected void buildTextPrimitives(VPFCoverage coverage, VPFTile tile, VPFPrimitiveData primitiveData)
        {
            VPFBufferedRecordData textTable = this.createPrimitiveTable(coverage, tile, VPFConstants.TEXT_PRIMITIVE_TABLE);

            if (textTable == null || textTable.getNumRecords() == 0)
            {
                return;
            }

            int numText = textTable.getNumRecords();

            VPFPrimitiveData.BasicPrimitiveInfo[] textInfo = new VPFPrimitiveData.BasicPrimitiveInfo[numText];
            VecBufferSequence     coords  = (VecBufferSequence)textTable.getRecordData("shape_line").getBackingData();
            CompoundStringBuilder strings = (CompoundStringBuilder)textTable.getRecordData("string").getBackingData();

            foreach (VPFRecord row in textTable)
            {
                int id = row.getId();

                textInfo[VPFBufferedRecordData.indexFromId(id)] = new VPFPrimitiveData.BasicPrimitiveInfo(
                    VPFBoundingBox.fromVecBuffer(coords.subBuffer(id)));
            }

            primitiveData.setPrimitiveInfo(VPFConstants.TEXT_PRIMITIVE_TABLE, textInfo);
            primitiveData.setPrimitiveCoords(VPFConstants.TEXT_PRIMITIVE_TABLE, coords);
            primitiveData.setPrimitiveStrings(VPFConstants.TEXT_PRIMITIVE_TABLE, strings);
        }
        public VPFSurfaceLine(VPFFeature feature, VPFPrimitiveData primitiveData)
        {
            String primitiveName = feature.getFeatureClass().getPrimitiveTableName();

            int[] primitiveIds = feature.getPrimitiveIds();

            this.sector            = feature.getBounds().toSector();
            this.buffer            = (VecBufferSequence)primitiveData.getPrimitiveCoords(primitiveName).slice(primitiveIds);
            this.referenceLocation = feature.getBounds().toSector().getCentroid();
        }
Example #3
0
            public VecDataBuffer(VecReader reader, int coordsPerElem, BufferFactory bufferFactory, int numRows,
                                 int elementsPerRow)
            {
                int           bufferLength = Math.Max(1, elementsPerRow);
                BufferWrapper buffer       = bufferFactory.newBuffer((1 + numRows) * coordsPerElem * bufferLength);

                this.reader = reader;
                this.buffer = new VecBufferSequence(new VecBuffer(coordsPerElem, buffer), 1 + numRows);
                // Insert an empty coordinate so that the coordinate N cooresponds to row id N.
                this.buffer.append(VecBuffer.emptyVecBuffer(coordsPerElem));
            }
Example #4
0
        protected bool buildNodePrimitives(VPFBufferedRecordData table, String name, VPFPrimitiveData primitiveData)
        {
            int numNodes = table.getNumRecords();

            VPFPrimitiveData.BasicPrimitiveInfo[] nodeInfo = new VPFPrimitiveData.BasicPrimitiveInfo[numNodes];
            VecBufferSequence coords = (VecBufferSequence)table.getRecordData("coordinate").getBackingData();

            foreach (VPFRecord row in table)
            {
                int id = row.getId();

                nodeInfo[VPFBufferedRecordData.indexFromId(id)] = new VPFPrimitiveData.BasicPrimitiveInfo(
                    VPFBoundingBox.fromVecBuffer(coords.subBuffer(id)));
            }

            primitiveData.setPrimitiveInfo(name, nodeInfo);
            primitiveData.setPrimitiveCoords(name, coords);
            return(true);
        }
Example #5
0
        protected void buildEdgePrimitives(VPFCoverage coverage, VPFTile tile, VPFPrimitiveData primitiveData)
        {
            VPFBufferedRecordData edgeTable = this.createPrimitiveTable(coverage, tile, VPFConstants.EDGE_PRIMITIVE_TABLE);

            if (edgeTable == null || edgeTable.getNumRecords() == 0)
            {
                return;
            }

            VPFBufferedRecordData mbrTable = this.createPrimitiveTable(coverage, tile,
                                                                       VPFConstants.EDGE_BOUNDING_RECTANGLE_TABLE);

            if (mbrTable == null)
            {
                return;
            }

            int numEdges = edgeTable.getNumRecords();

            VPFPrimitiveData.EdgeInfo[] edgeInfo = new VPFPrimitiveData.EdgeInfo[numEdges];
            VecBufferSequence           coords   = (VecBufferSequence)edgeTable.getRecordData(
                "coordinates").getBackingData();

            foreach (VPFRecord row in edgeTable)
            {
                int       id     = row.getId();
                VPFRecord mbrRow = mbrTable.getRecord(id);

                edgeInfo[VPFBufferedRecordData.indexFromId(id)] = new VPFPrimitiveData.EdgeInfo(
                    getNumber(row.getValue("edge_type")),
                    getId(row.getValue("start_node")), getNumber(row.getValue("end_node")),
                    getId(row.getValue("left_face")), getId(row.getValue("right_face")),
                    getId(row.getValue("left_edge")), getId(row.getValue("right_edge")),
                    isEdgeOnTileBoundary(row),
                    VPFUtils.getExtent(mbrRow));
            }

            primitiveData.setPrimitiveInfo(VPFConstants.EDGE_PRIMITIVE_TABLE, edgeInfo);
            primitiveData.setPrimitiveCoords(VPFConstants.EDGE_PRIMITIVE_TABLE, coords);
        }
 public void setPrimitiveCoords(String name, VecBufferSequence coords)
 {
     this.primitiveCoords.put(name, coords);
 }