use of org.opengis.referencing.datum.Datum in project sis by apache.
the class Formatter method appendForSubtypes.
/**
* Appends the anchor, scope and domain of validity of the given object. Those information are available
* only for {@link ReferenceSystem}, {@link Datum} and {@link CoordinateOperation} objects.
*/
private void appendForSubtypes(final IdentifiedObject object) {
final InternationalString anchor, scope;
final Extent area;
if (object instanceof ReferenceSystem) {
anchor = null;
scope = ((ReferenceSystem) object).getScope();
area = ((ReferenceSystem) object).getDomainOfValidity();
} else if (object instanceof Datum) {
anchor = ((Datum) object).getAnchorPoint();
scope = ((Datum) object).getScope();
area = ((Datum) object).getDomainOfValidity();
} else if (object instanceof CoordinateOperation) {
anchor = null;
scope = ((CoordinateOperation) object).getScope();
area = ((CoordinateOperation) object).getDomainOfValidity();
} else {
return;
}
appendOnNewLine(WKTKeywords.Anchor, anchor, null);
appendOnNewLine(WKTKeywords.Scope, scope, ElementKind.SCOPE);
if (area != null) {
appendOnNewLine(WKTKeywords.Area, area.getDescription(), ElementKind.EXTENT);
append(Extents.getGeographicBoundingBox(area), BBOX_ACCURACY);
appendVerticalExtent(Extents.getVerticalRange(area));
appendTemporalExtent(Extents.getTimeRange(area));
}
}
use of org.opengis.referencing.datum.Datum in project sis by apache.
the class DefinitionVerifier method diffCode.
/**
* Returns a code indicating in which part the two given CRS differ. The given iterators usually iterate over
* exactly one element, but may iterate over more elements if the CRS were instance of {@code CompoundCRS}.
* The returned value is one of {@link #METHOD}, {@link #CONVERSION}, {@link #CS}, {@link #DATUM},
* {@link #PRIME_MERIDIAN} or {@link #OTHER} constants.
*/
private static int diffCode(final Iterator<SingleCRS> authoritative, final Iterator<SingleCRS> given) {
while (authoritative.hasNext() && given.hasNext()) {
final SingleCRS crsA = authoritative.next();
final SingleCRS crsG = given.next();
if (!Utilities.equalsApproximatively(crsA, crsG)) {
if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS) {
final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase();
final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase();
if (!Utilities.equalsApproximatively(cnvA, cnvG)) {
return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod()) ? CONVERSION : METHOD;
}
}
if (!Utilities.equalsApproximatively(crsA.getCoordinateSystem(), crsG.getCoordinateSystem())) {
return CS;
}
final Datum datumA = crsA.getDatum();
final Datum datumG = crsG.getDatum();
if (!Utilities.equalsApproximatively(datumA, datumG)) {
if ((datumA instanceof GeodeticDatum) && (datumG instanceof GeodeticDatum) && !Utilities.equalsApproximatively(((GeodeticDatum) datumA).getPrimeMeridian(), ((GeodeticDatum) datumG).getPrimeMeridian())) {
return PRIME_MERIDIAN;
}
return DATUM;
}
break;
}
}
return OTHER;
}
use of org.opengis.referencing.datum.Datum in project collect by openforis.
the class GeoToolsCoordinateOperations method getDescription.
/**
* It returns a concatenation of datum, aliases and scope
*/
private String getDescription(CoordinateReferenceSystem crs) {
List<String> parts = new ArrayList<String>();
// datum
if (crs instanceof AbstractSingleCRS) {
Datum datum = ((AbstractSingleCRS) crs).getDatum();
String datumName = datum.getName().toString();
parts.add(datumName);
}
// aliases
for (GenericName genericName : crs.getAlias()) {
parts.add(genericName.toString());
}
// scope
InternationalString scope = crs.getScope();
if (scope != null && StringUtils.isNotBlank(scope)) {
parts.add(scope.toString());
}
String result = StringUtils.join(parts, "\n");
return result;
}
Aggregations