コード例 #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();

    for (VPFRecord row : 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);
  }
コード例 #2
0
  protected boolean 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();

    for (VPFRecord row : 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;
  }