示例#1
0
  /**
   * Get an OMText label for a segments between the given lat/lon points whose given distance and
   * cumulative distance is specified.
   */
  public OMText createLabel(
      Geo g1, Geo g2, double dist, double cumulativeDist, Length distanceUnits) {
    Geo mid;
    switch (getLineType()) {
      case LINETYPE_STRAIGHT:
        double lat = (g1.getLatitude() + g2.getLatitude()) / 2.0;
        double lon = (g1.getLongitude() + g2.getLongitude()) / 2.0;
        mid = new Geo(lat, lon);
        break;
      case LINETYPE_RHUMB:
        System.err.println("Rhumb distance calculation not implemented.");
      case LINETYPE_GREATCIRCLE:
      case LINETYPE_UNKNOWN:
      default:
        mid = g1.midPoint(g2);
    }

    // String text = ((int)dist) + " (" + ((int)cumulativeDist) +
    // ")";

    String text =
        (df.format(distanceUnits.fromRadians(dist)))
            + " ("
            + (df.format(distanceUnits.fromRadians(cumulativeDist)))
            + ") "
            + distanceUnits.getAbbr();
    OMText omtext = new OMText(mid.getLatitude(), mid.getLongitude(), text, OMText.JUSTIFY_LEFT);
    // omtext.setLinePaint(new Color(200, 200, 255));
    return omtext;
  }
示例#2
0
  /**
   * Set the axis lengths of the ellipse.
   *
   * @param majorAxis x direction of ellipse.
   * @param minorAxis y direction of ellipse.
   * @param units com.bbn.openmap.proj.Length object describing units of axis values.
   */
  public void setAxis(double majorAxis, double minorAxis, Length units) {
    if (units == null) {
      units = Length.RADIAN;
    }

    this.majorAxisSpan = units.toRadians(majorAxis);
    this.minorAxisSpan = units.toRadians(minorAxis);
    rawllpts = null;
    setNeedToRegenerate(true);
  }
示例#3
0
 private void readObject(java.io.ObjectInputStream stream)
     throws java.io.IOException, ClassNotFoundException {
   stream.defaultReadObject();
   distUnits = Length.get((String) stream.readObject());
 }
示例#4
0
 private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException {
   stream.defaultWriteObject();
   stream.writeObject(distUnits.getAbbr());
 }