@Override
 protected String getGraphicLabel() {
   StringBuilder sb = new StringBuilder();
   if (this.mustShowHostileIndicator()) {
     sb.append(SymbologyConstants.HOSTILE_ENEMY);
     sb.append("\n");
   }
   return sb.toString();
 }
  /**
   * 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;
  }
    @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();
 }
    @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();
    }
 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;
 }
Beispiel #7
0
  @SuppressWarnings({"StringConcatenationInsideStringBufferAppend"})
  private static String formatMessage(Exception e, Object message, Object[] args) {
    StringBuilder sb = new StringBuilder();

    if (message != null) sb.append(message.toString());

    if (e != null) sb.append((sb.length() > 0 ? "\n" : "") + e.toString());

    for (Object o : args) {
      if (o != null) sb.append((sb.length() > 0 ? "\n" : "") + o.toString());
    }

    return sb.toString();
  }
  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();
  }
 public String toString() {
   StringBuilder sb = new StringBuilder();
   for (int i = 0; i < 5; i++) {
     sb.append("level ");
     sb.append(String.valueOf(i));
     sb.append(" : ");
     UTMExtremes levelExtremes = this.extremes[i];
     if (levelExtremes.minX < levelExtremes.maxX
         || !(levelExtremes.maxYHemisphere.equals(AVKey.SOUTH) && levelExtremes.maxY == 0)) {
       sb.append(levelExtremes.minX);
       sb.append(", ");
       sb.append(levelExtremes.maxX);
       sb.append(" - ");
       sb.append(levelExtremes.minY);
       sb.append(AVKey.NORTH.equals(levelExtremes.minYHemisphere) ? "N" : "S");
       sb.append(", ");
       sb.append(levelExtremes.maxY);
       sb.append(AVKey.NORTH.equals(levelExtremes.maxYHemisphere) ? "N" : "S");
     } else {
       sb.append("empty");
     }
     sb.append("\n");
   }
   return sb.toString();
 }
 public static String getNextName(String base) {
   StringBuilder sb = new StringBuilder();
   sb.append(base);
   sb.append(nextEntryNumber++);
   return sb.toString();
 }