@@ -350,17 +350,20 @@ private static void updateEllipsoid(ProjParams params,
350350 } else {
351351
352352 params .setA (convert (ellipsoid .getSemiMajorAxis (),
353- ellipsoid .getUnit (), Units .METRE ));
353+ ellipsoid .getSemiMajorAxisText (), ellipsoid .getUnit (),
354+ Units .METRE ));
354355
355356 switch (ellipsoid .getType ()) {
356357 case OBLATE :
357358 params .setB (convert (ellipsoid .getPoleRadius (),
358- ellipsoid .getUnit (), Units .METRE ));
359+ ellipsoid .getPoleRadiusText (), ellipsoid .getUnit (),
360+ Units .METRE ));
359361 break ;
360362 case TRIAXIAL :
361363 TriaxialEllipsoid triaxial = (TriaxialEllipsoid ) ellipsoid ;
362364 params .setB (convert (triaxial .getSemiMinorAxis (),
363- ellipsoid .getUnit (), Units .METRE ));
365+ triaxial .getSemiMinorAxisText (), ellipsoid .getUnit (),
366+ Units .METRE ));
364367 break ;
365368 default :
366369 throw new CRSException (
@@ -396,7 +399,7 @@ private static void updateSphericalEllipsoid(ProjParams params,
396399 private static void updateDatumTransform (ProjParams params , CRS crs ) {
397400 Object toWGS84 = crs .getExtra (CRSKeyword .TOWGS84 .name ());
398401 if (toWGS84 != null ) {
399- updateDatumTransform (params , (double []) toWGS84 );
402+ updateDatumTransform (params , (String []) toWGS84 );
400403 }
401404 }
402405
@@ -409,7 +412,7 @@ private static void updateDatumTransform(ProjParams params, CRS crs) {
409412 * to WGS84 double array
410413 */
411414 private static void updateDatumTransform (ProjParams params ,
412- double [] toWGS84 ) {
415+ String [] toWGS84 ) {
413416 if (toWGS84 .length >= 3 ) {
414417 params .setXTranslation (toWGS84 [0 ]);
415418 params .setYTranslation (toWGS84 [1 ]);
@@ -499,6 +502,7 @@ private static void updatePrimeMeridian(ProjParams params,
499502 }
500503 } else {
501504 params .setPm (convert (primeMeridian .getLongitude (),
505+ primeMeridian .getLongitudeText (),
502506 primeMeridian .getLongitudeUnit (), Units .DEGREE ));
503507 }
504508 }
@@ -836,9 +840,8 @@ private static void updateParams(ProjParams params, OperationMethod method,
836840 case POLAR_STEREOGRAPHIC_A :
837841 case POLAR_STEREOGRAPHIC_B :
838842 case POLAR_STEREOGRAPHIC_C :
839- double latTs = value (parameter , Units .DEGREE );
840- params .setLatTs (latTs );
841- if (latTs >= 0 ) {
843+ params .setLatTs (value (parameter , Units .DEGREE ));
844+ if (Double .valueOf (params .getLatTs ()) >= 0 ) {
842845 params .setLat0 ("90" );
843846 } else {
844847 params .setLat0 ("-90" );
@@ -1022,7 +1025,7 @@ private static String convertAxes(List<Axis> axes) {
10221025 * in unit
10231026 * @return converted value
10241027 */
1025- private static double value (OperationParameter parameter , Unit unit ,
1028+ private static String value (OperationParameter parameter , Unit unit ,
10261029 Units inUnit ) {
10271030 return value (parameter , unit , inUnit .createUnit ());
10281031 }
@@ -1038,13 +1041,14 @@ private static double value(OperationParameter parameter, Unit unit,
10381041 * in unit
10391042 * @return converted value
10401043 */
1041- private static double value (OperationParameter parameter , Unit unit ,
1044+ private static String value (OperationParameter parameter , Unit unit ,
10421045 Unit inUnit ) {
10431046 Unit parameterUnit = parameter .getUnit ();
10441047 if (parameterUnit == null ) {
10451048 parameterUnit = unit ;
10461049 }
1047- return convert (parameter .getValue (), parameterUnit , inUnit );
1050+ return convert (parameter .getValue (), parameter .getValueText (),
1051+ parameterUnit , inUnit );
10481052 }
10491053
10501054 /**
@@ -1056,7 +1060,7 @@ private static double value(OperationParameter parameter, Unit unit,
10561060 * unit
10571061 * @return converted value
10581062 */
1059- private static double value (OperationParameter parameter , Units unit ) {
1063+ private static String value (OperationParameter parameter , Units unit ) {
10601064 return value (parameter , unit .createUnit ());
10611065 }
10621066
@@ -1069,47 +1073,56 @@ private static double value(OperationParameter parameter, Units unit) {
10691073 * unit
10701074 * @return converted value
10711075 */
1072- private static double value (OperationParameter parameter , Unit unit ) {
1073- return convert (parameter .getValue (), parameter .getUnit (), unit );
1076+ private static String value (OperationParameter parameter , Unit unit ) {
1077+ return convert (parameter .getValue (), parameter .getValueText (),
1078+ parameter .getUnit (), unit );
10741079 }
10751080
10761081 /**
10771082 * Convert the value
10781083 *
10791084 * @param value
10801085 * value
1086+ * @param textValue
1087+ * text value
10811088 * @param fromUnit
10821089 * from unit
10831090 * @param toUnit
10841091 * to unit
10851092 * @return converted value
10861093 */
1087- private static double convert (double value , Unit fromUnit , Units toUnit ) {
1088- return convert (value , fromUnit , toUnit .createUnit ());
1094+ private static String convert (double value , String textValue , Unit fromUnit ,
1095+ Units toUnit ) {
1096+ return convert (value , textValue , fromUnit , toUnit .createUnit ());
10891097 }
10901098
10911099 /**
10921100 * Convert the value
10931101 *
10941102 * @param value
10951103 * value
1104+ * @param textValue
1105+ * text value
10961106 * @param fromUnit
10971107 * from unit
10981108 * @param toUnit
10991109 * to unit
11001110 * @return converted value
11011111 */
1102- private static double convert (double value , Unit fromUnit , Unit toUnit ) {
1112+ private static String convert (double value , String textValue , Unit fromUnit ,
1113+ Unit toUnit ) {
11031114
11041115 if (fromUnit == null ) {
11051116 fromUnit = Units .createDefaultUnit (toUnit .getType ());
11061117 }
11071118
1108- if (Units .canConvert (fromUnit , toUnit )) {
1119+ if (Units .canConvert (fromUnit , toUnit )
1120+ && !fromUnit .equalsName (toUnit )) {
11091121 value = Units .convert (value , fromUnit , toUnit );
1122+ textValue = String .valueOf (value );
11101123 }
11111124
1112- return value ;
1125+ return textValue ;
11131126 }
11141127
11151128 /**
0 commit comments