Package org.apache.sanselan.common

Examples of org.apache.sanselan.common.RationalNumber


                    && gpsLongitudeRefField != null
                    && gpsLongitudeField != null)
            {
                // all of these values are strings.
                String gpsLatitudeRef = (String) gpsLatitudeRefField.getValue();
                RationalNumber gpsLatitude[] = (RationalNumber[]) (gpsLatitudeField
                        .getValue());
                String gpsLongitudeRef = (String) gpsLongitudeRefField
                        .getValue();
                RationalNumber gpsLongitude[] = (RationalNumber[]) gpsLongitudeField
                        .getValue();

                RationalNumber gpsLatitudeDegrees = gpsLatitude[0];
                RationalNumber gpsLatitudeMinutes = gpsLatitude[1];
                RationalNumber gpsLatitudeSeconds = gpsLatitude[2];

                RationalNumber gpsLongitudeDegrees = gpsLongitude[0];
                RationalNumber gpsLongitudeMinutes = gpsLongitude[1];
                RationalNumber gpsLongitudeSeconds = gpsLongitude[2];

                // This will format the gps info like so:
                //
                // gpsLatitude: 8 degrees, 40 minutes, 42.2 seconds S
                // gpsLongitude: 115 degrees, 26 minutes, 21.8 seconds E

                System.out.println("    " + "GPS Latitude: "
                        + gpsLatitudeDegrees.toDisplayString() + " degrees, "
                        + gpsLatitudeMinutes.toDisplayString() + " minutes, "
                        + gpsLatitudeSeconds.toDisplayString() + " seconds "
                        + gpsLatitudeRef);
                System.out.println("    " + "GPS Longitude: "
                        + gpsLongitudeDegrees.toDisplayString() + " degrees, "
                        + gpsLongitudeMinutes.toDisplayString() + " minutes, "
                        + gpsLongitudeSeconds.toDisplayString() + " seconds "
                        + gpsLongitudeRef);

            }

            System.out.println();
View Full Code Here


                || longitudeRefField == null || longitudeField == null)
            return null;

        // all of these values are strings.
        String latitudeRef = latitudeRefField.getStringValue();
        RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue();
        String longitudeRef = longitudeRefField.getStringValue();
        RationalNumber longitude[] = (RationalNumber[]) longitudeField
                .getValue();

        if (latitude.length != 3 || longitude.length != 3)
            throw new ImageReadException(
                    "Expected three values for latitude and longitude.");

        RationalNumber latitudeDegrees = latitude[0];
        RationalNumber latitudeMinutes = latitude[1];
        RationalNumber latitudeSeconds = latitude[2];

        RationalNumber longitudeDegrees = longitude[0];
        RationalNumber longitudeMinutes = longitude[1];
        RationalNumber longitudeSeconds = longitude[2];

        return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
                latitudeMinutes, latitudeSeconds, longitudeDegrees,
                longitudeMinutes, longitudeSeconds);
    }
View Full Code Here

    if (value != null) {
      if (value instanceof Number) {
        return value.toString();
      }
      if (value instanceof RationalNumber) {
        RationalNumber rn = (RationalNumber) value;
        return rn.toDisplayString();
      }
      if (value instanceof String) {
        if (field.getFieldTypeName().equals(TiffFieldTypeConstants.FIELD_TYPE_UNDEFINED.name)) {
          byte[] bytes = ((String) value).getBytes();
          return ArrayUtils.toString(bytes);
View Full Code Here

          && gpsLongitudeRefField != null
          && gpsLongitudeField != null)
      {
        // all of these values are strings.
        String gpsLatitudeRef = (String) gpsLatitudeRefField.getValue();
        RationalNumber gpsLatitude[] = (RationalNumber[]) (gpsLatitudeField
            .getValue());
        String gpsLongitudeRef = (String) gpsLongitudeRefField
            .getValue();
        RationalNumber gpsLongitude[] = (RationalNumber[]) gpsLongitudeField
            .getValue();

        RationalNumber gpsLatitudeDegrees = gpsLatitude[0];
        RationalNumber gpsLatitudeMinutes = gpsLatitude[1];
        RationalNumber gpsLatitudeSeconds = gpsLatitude[2];

        RationalNumber gpsLongitudeDegrees = gpsLongitude[0];
        RationalNumber gpsLongitudeMinutes = gpsLongitude[1];
        RationalNumber gpsLongitudeSeconds = gpsLongitude[2];

        // This will format the gps info like so:
        //
        // gpsLatitude: 8 degrees, 40 minutes, 42.2 seconds S
        // gpsLongitude: 115 degrees, 26 minutes, 21.8 seconds E

        System.out.println("  " + "GPS Latitude: "
            + gpsLatitudeDegrees.toDisplayString() + " degrees, "
            + gpsLatitudeMinutes.toDisplayString() + " minutes, "
            + gpsLatitudeSeconds.toDisplayString() + " seconds "
            + gpsLatitudeRef);
        System.out.println("  " + "GPS Longitude: "
            + gpsLongitudeDegrees.toDisplayString() + " degrees, "
            + gpsLongitudeMinutes.toDisplayString() + " minutes, "
            + gpsLongitudeSeconds.toDisplayString() + " seconds "
            + gpsLongitudeRef);

      }

      System.out.println();
View Full Code Here

          byteOrder);
    }
    else if (o instanceof Number)
    {
      Number number = (Number) o;
      RationalNumber rationalNumber = RationalNumberUtilities
          .getRationalNumber(number.doubleValue());
      return convertRationalToByteArray(rationalNumber, byteOrder);
    }
    else if (o instanceof Number[])
    {
      Number numbers[] = (Number[]) o;
      RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
      for (int i = 0; i < numbers.length; i++)
      {
        Number number = numbers[i];
        rationalNumbers[i] = RationalNumberUtilities
            .getRationalNumber(number.doubleValue());
      }
      return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
    }
    else if (o instanceof double[])
    {
      double numbers[] = (double[]) o;
      RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
      for (int i = 0; i < numbers.length; i++)
      {
        double number = numbers[i];
        rationalNumbers[i] = RationalNumberUtilities
            .getRationalNumber(number);
View Full Code Here

        || longitudeRefField == null || longitudeField == null)
      return null;

    // all of these values are strings.
    String latitudeRef = latitudeRefField.getStringValue();
    RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue();
    String longitudeRef = longitudeRefField.getStringValue();
    RationalNumber longitude[] = (RationalNumber[]) longitudeField
        .getValue();

    if (latitude.length != 3 || longitude.length != 3)
      throw new ImageReadException(
          "Expected three values for latitude and longitude.");

    RationalNumber latitudeDegrees = latitude[0];
    RationalNumber latitudeMinutes = latitude[1];
    RationalNumber latitudeSeconds = latitude[2];

    RationalNumber longitudeDegrees = longitude[0];
    RationalNumber longitudeMinutes = longitude[1];
    RationalNumber longitudeSeconds = longitude[2];

    return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
        latitudeMinutes, latitudeSeconds, longitudeDegrees,
        longitudeMinutes, longitudeSeconds);
  }
View Full Code Here

    if (value != null) {
      if (value instanceof Number) {
        return value.toString();
      }
      if (value instanceof RationalNumber) {
        RationalNumber rn = (RationalNumber) value;
        return rn.toDisplayString();
      }
      if (value instanceof String) {
        if (field.getFieldTypeName().equals(TiffFieldTypeConstants.FIELD_TYPE_UNDEFINED.name)) {
          byte[] bytes = ((String) value).getBytes();
          return ArrayUtils.toString(bytes);
View Full Code Here

                || longitudeRefField == null || longitudeField == null)
            return null;

        // all of these values are strings.
        String latitudeRef = latitudeRefField.getStringValue();
        RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue();
        String longitudeRef = longitudeRefField.getStringValue();
        RationalNumber longitude[] = (RationalNumber[]) longitudeField
                .getValue();

        if (latitude.length != 3 || longitude.length != 3)
            throw new ImageReadException(
                    "Expected three values for latitude and longitude.");

        RationalNumber latitudeDegrees = latitude[0];
        RationalNumber latitudeMinutes = latitude[1];
        RationalNumber latitudeSeconds = latitude[2];

        RationalNumber longitudeDegrees = longitude[0];
        RationalNumber longitudeMinutes = longitude[1];
        RationalNumber longitudeSeconds = longitude[2];

        return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
                latitudeMinutes, latitudeSeconds, longitudeDegrees,
                longitudeMinutes, longitudeSeconds);
    }
View Full Code Here

                    byteOrder);
        }
        else if (o instanceof Number)
        {
            Number number = (Number) o;
            RationalNumber rationalNumber = RationalNumberUtilities
                    .getRationalNumber(number.doubleValue());
            return convertRationalToByteArray(rationalNumber, byteOrder);
        }
        else if (o instanceof Number[])
        {
            Number numbers[] = (Number[]) o;
            RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
            for (int i = 0; i < numbers.length; i++)
            {
                Number number = numbers[i];
                rationalNumbers[i] = RationalNumberUtilities
                        .getRationalNumber(number.doubleValue());
            }
            return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
        }
        else if (o instanceof double[])
        {
            double numbers[] = (double[]) o;
            RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
            for (int i = 0; i < numbers.length; i++)
            {
                double number = numbers[i];
                rationalNumbers[i] = RationalNumberUtilities
                        .getRationalNumber(number);
View Full Code Here

                || longitudeRefField == null || longitudeField == null)
            return null;

        // all of these values are strings.
        String latitudeRef = latitudeRefField.getStringValue();
        RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue();
        String longitudeRef = longitudeRefField.getStringValue();
        RationalNumber longitude[] = (RationalNumber[]) longitudeField
                .getValue();

        if (latitude.length != 3 || longitude.length != 3)
            throw new ImageReadException(
                    "Expected three values for latitude and longitude.");

        RationalNumber latitudeDegrees = latitude[0];
        RationalNumber latitudeMinutes = latitude[1];
        RationalNumber latitudeSeconds = latitude[2];

        RationalNumber longitudeDegrees = longitude[0];
        RationalNumber longitudeMinutes = longitude[1];
        RationalNumber longitudeSeconds = longitude[2];

        return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
                latitudeMinutes, latitudeSeconds, longitudeDegrees,
                longitudeMinutes, longitudeSeconds);
    }
View Full Code Here

TOP

Related Classes of org.apache.sanselan.common.RationalNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.