@Override
  public String toString() // TODO: Complete this method
      {
    StringBuilder sb = new StringBuilder(super.toString());

    sb.append("LAYERS\n");

    for (WMSLayerCapabilities layerCaps : this.getNamedLayers()) {
      sb.append(layerCaps.toString()).append("\n");
    }

    return sb.toString();
  }
Ejemplo n.º 2
0
  /**
   * Indicates the text of this label.
   *
   * @return The label's text.
   */
  public String getText() {
    if (this.lines != null) {
      StringBuilder sb = new StringBuilder();

      for (int i = 0; i < this.lines.length - 1; i++) {
        sb.append(this.lines[i]).append("\n");
      }
      sb.append(this.lines[this.lines.length - 1]);

      return sb.toString();
    }

    return null;
  }
Ejemplo n.º 3
0
    @SuppressWarnings({"StringEquality"})
    public void characters(char ch[], int start, int length) {
      if (!this.inBeginEndPair) return;

      // Top of QName stack is an interned string,
      // so we can use pointer comparison.
      String internedTopQName = this.internedQNameStack.getFirst();

      StringBuilder sb = null;
      if (TOPP_LATITUDE == internedTopQName) sb = this.latBuffer;
      else if (TOPP_LONGITUDE == internedTopQName) sb = this.lonBuffer;
      else if (TOPP_FULL_NAME_ND == internedTopQName) sb = this.textArray;

      if (sb != null) sb.append(ch, start, length);
    }
 /**
  * Converts tile XY coordinates into a QuadKey at a specified level of detail.
  *
  * @param tileX Tile X coordinate
  * @param tileY Tile X coordinate
  * @param levelOfDetail Level of detail, from 1 (lowest detail) to 23 (highest detail)
  * @return A string containing the QuadKey
  */
 public static String TileXYToQuadKey(int tileX, int tileY, int levelOfDetail) {
   StringBuilder quadKey = new StringBuilder();
   for (int i = levelOfDetail; i > 0; i--) {
     char digit = '0';
     int mask = 1 << (i - 1);
     if ((tileX & mask) != 0) {
       digit++;
     }
     if ((tileY & mask) != 0) {
       digit++;
       digit++;
     }
     quadKey.append(digit);
   }
   return quadKey.toString();
 }
  protected static String getPrimitiveTablePath(
      VPFCoverage coverage, VPFTile tile, String tableName) {
    // Start with the coverage directory.
    StringBuilder sb = new StringBuilder(coverage.getFilePath());
    sb.append(File.separator);

    // If the tile is non-null then append the tile's path.
    if (tile != null) {
      sb.append(tile.getName());
      sb.append(File.separator);
    }

    // Append the primitive table name.
    sb.append(tableName);

    return sb.toString();
  }
Ejemplo n.º 6
0
  public static String readDelimitedText(ByteBuffer buffer, char delim) {
    if (buffer == null) {
      String message = Logging.getMessage("nullValue.BufferIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    StringBuilder sb = new StringBuilder();
    int remain = buffer.remaining();

    int i;
    for (i = 0; i < remain; i++) {
      byte b = buffer.get();
      if (delim == (char) b) break;

      sb.append((char) b);
    }

    return (i < remain) ? sb.toString().trim() : null;
  }
Ejemplo n.º 7
0
    @Override
    protected ByteBuffer handleXMLContent() throws IOException {
      // Check for an exception report
      String s = WWIO.byteBufferToString(this.getRetriever().getBuffer(), 1024, null);
      if (s.contains("<ExceptionReport>")) {
        // TODO: Parse the xml and include only the message text in the log message.

        StringBuilder sb = new StringBuilder(this.getRetriever().getName());

        sb.append("\n");
        sb.append(WWIO.byteBufferToString(this.getRetriever().getBuffer(), 2048, null));
        Logging.logger().warning(sb.toString());

        return null;
      }

      this.saveBuffer();

      return this.getRetriever().getBuffer();
    }
Ejemplo n.º 8
0
 protected double parseDouble(StringBuilder sb) {
   double value = 0;
   try {
     value = Double.parseDouble(sb.toString());
   } catch (NumberFormatException e) {
     Logging.logger()
         .log(
             Level.FINE,
             Logging.getMessage("layers.PlaceNameLayer.ExceptionAttemptingToReadFile", ""),
             e);
   }
   return value;
 }
Ejemplo n.º 9
0
  protected String formatMeasurements(Position pos) {
    StringBuilder sb = new StringBuilder();

    /*
     //sb.append(this.unitsFormat.areaNL(this.getLabel(AREA_LABEL), this.getArea()));
     sb.append(this.unitsFormat.lengthNL(this.getLabel(PERIMETER_LABEL), this.getLength()));
    */

    // sb.append(this.unitsFormat.lengthNL(this.getLabel(WIDTH_LABEL),
    // this.shape.getEastWestRadius() * 2));
    // sb.append(this.unitsFormat.lengthNL(this.getLabel(LENGTH_LABEL),
    // this.shape.getNorthSouthRadius() * 2));
    // sb.append(this.unitsFormat.lengthNL(this.getLabel(HEIGHT_LABEL),
    // this.shape.getVerticalRadius() * 2));

    // sb.append(this.unitsFormat.angleNL(this.getLabel(HEADING_LABEL), this.shape.getHeading()));

    // if "activeControlPoint" is in fact one of the control points
    if (!this.arePositionsRedundant(pos, this.polygon.getReferencePosition())) {
      sb.append(this.unitsFormat.angleNL(this.getLabel(LATITUDE_LABEL), pos.getLatitude()));
      sb.append(this.unitsFormat.angleNL(this.getLabel(LONGITUDE_LABEL), pos.getLongitude()));
      sb.append(this.unitsFormat.lengthNL(this.getLabel(ALTITUDE_LABEL), pos.getAltitude()));
    }

    // if "activeControlPoint" is the shape itself
    if (this.polygon.getReferencePosition() != null) {
      sb.append(
          this.unitsFormat.angleNL(
              this.getLabel(CENTER_LATITUDE_LABEL),
              this.polygon.getReferencePosition().getLatitude()));
      sb.append(
          this.unitsFormat.angleNL(
              this.getLabel(CENTER_LONGITUDE_LABEL),
              this.polygon.getReferencePosition().getLongitude()));
      sb.append(
          this.unitsFormat.lengthNL(
              this.getLabel(CENTER_ALTITUDE_LABEL),
              this.polygon.getReferencePosition().getAltitude()));
    }

    return sb.toString();
  }
Ejemplo n.º 10
0
  protected String validateMetadata(Object source, AVList params) {
    StringBuilder sb = new StringBuilder();

    String message = super.validateMetadata(source, params);
    if (message != null) sb.append(message);

    Object o = (params != null) ? params.getValue(AVKey.BYTE_ORDER) : null;
    if (o == null || !(o instanceof String))
      sb.append(sb.length() > 0 ? ", " : "")
          .append(Logging.getMessage("WorldFile.NoByteOrderSpecified", source));

    o = (params != null) ? params.getValue(AVKey.PIXEL_FORMAT) : null;
    if (o == null) {
      sb.append(sb.length() > 0 ? ", " : "")
          .append(Logging.getMessage("WorldFile.NoPixelFormatSpecified", source));
    } else if (!AVKey.ELEVATION.equals(o)) {
      sb.append(sb.length() > 0 ? ", " : "")
          .append(Logging.getMessage("WorldFile.InvalidPixelFormat", source));
    }

    o = (params != null) ? params.getValue(AVKey.PIXEL_TYPE) : null;
    if (o == null) {
      o = (params != null) ? params.getValue(AVKey.DATA_TYPE) : null;
      if (o == null) {
        sb.append(sb.length() > 0 ? ", " : "")
            .append(Logging.getMessage("WorldFile.NoPixelTypeSpecified", source));
      }
    }

    if (sb.length() == 0) return null;

    return sb.toString();
  }