From: lareina s. (JIRA) <ji...@co...> - 2011-08-11 17:12:49
|
Request feature to get transform method on all the classes implementing the interface CoordinateOperation --------------------------------------------------------------------------------------------------------- Key: GEOT-3783 URL: https://jira.codehaus.org/browse/GEOT-3783 Project: GeoTools Issue Type: New Feature Components: api Affects Versions: 2.6.5 Environment: CentOS 5; Java 1.6+ Reporter: lareina sun We are using Geotools v2.6.5 to perform coordinate transformation operations. We need to display to our users the details of the transform method that will be used during the conversion but we can't find a method on the CoordinateOperation interface that tells us what transform method(s) it uses. We can only get the detailed description by calling toString() on CoordinateOperation but this has too much detail (we want a short one-line description.) We noticed that some concrete classes implementing CoordinateOperation interface have a getMethod() method which returns an OperationMethod object which we can call getName().getCode() which returns a good description but this relies on casting and isn't available for all CoordinateOperations. Is there an alternative way to get a brief description of the transform method? The following is the code we used: CoordinateOperationFactory coFactory = CRS.getCoordinateOperationFactory(true); CoordinateReferenceSystem srcCrs = CRS.decode("EPSG:4267"); CoordinateReferenceSystem toCrs = CRS.decode("EPSG:4269"); CoordinateOperation coorOperation = coFactory.createOperation(srcCrs, toCrs); List<SingleOperation> ops = ((DefaultConcatenatedOperation)coorOperation).getOperations(); String methods = ""; for (SingleOperation op : ops) { methods += op.getName().getCode() + "->"; } if (methods.endsWith("->")) { methods = methods.substring(0, methods.lastIndexOf("->")); } In this example the output is "Geocentric transform->Datum shift->Geocentric transform" but this only works for cases where the transform operations is a DefaultConcatenatedOperation. Can we have all the classes implemented the interface "CoordinateOperation" to implement getMethod() feature? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |