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 TextDataBuffer(String charsetName, int numRows, int elementsPerRow) { int stringLength = Math.Max(1, elementsPerRow); this.elementsPerRow = elementsPerRow; this.reader = new TextReader(charsetName); this.buffer = new CompoundStringBuilder(new StringBuilder((1 + numRows) * stringLength), 1 + numRows); // Insert an empty string so that the coordinate N cooresponds to row id N. this.buffer.append(""); }
public void setPrimitiveStrings(String name, CompoundStringBuilder strings) { this.primitiveStrings.put(name, strings); }