コード例 #1
0
Coordinate ConventionalCoordinateSystem::coord2coord(const ICoordinateSystem &sourceCs, const Coordinate &crdSource) const
{
    //TODO isLatLon guard doesn't consider latlon cs other than WGS84!
    if (sourceCs->id() == id()) //  the 'real'isEqual test is too expensive here, as this method can be called 100000's of times (resample)
        return crdSource;
    LatLon ll = sourceCs->isLatLon() ? LatLon(crdSource.y,crdSource.x) : sourceCs->coord2latlon(crdSource);
    if ( ll.isValid()) {
        return isLatLon() ? ll : latlon2coord(ll);
    }
    return Coordinate();
}
コード例 #2
0
Coordinate ConventionalCoordinateSystem::coord2coord(const ICoordinateSystem &sourceCs, const Coordinate &crdSource) const
{
    //TODO isLatLon guard doesn't consider latlon cs other than WGS84!
    if (sourceCs->id() == id()) //  the 'real'isEqual test is too expensive here, as this method can be called 100000's of times (resample)
        return crdSource;
    LatLon ll = sourceCs->isLatLon() ? LatLon(crdSource.y,crdSource.x) : sourceCs->coord2latlon(crdSource);
    if (ll.isValid()) {
        if (hasType(sourceCs->ilwisType(), itCONVENTIONALCOORDSYSTEM)) {
            const IConventionalCoordinateSystem & srcCs = sourceCs.as<ConventionalCoordinateSystem>();
            if (srcCs->datum().get() && datum().get() && !srcCs->datum()->equal(*datum().get())) { // different datums given, datum shift needed
                ll = srcCs->datum()->llToWGS84(ll, *srcCs->ellipsoid().ptr());
                ll = datum()->llFromWGS84(ll, *ellipsoid().ptr());
            }
        }
        return isLatLon() ? ll : latlon2coord(ll);
    }

    return Coordinate();
}
コード例 #3
0
Coordinate BoundsOnlyCoordinateSystem::coord2coord(const ICoordinateSystem &sourceCs, const Coordinate &crdSource) const
{
    if ( sourceCs->id() == id())
        return crdSource;
    return Coordinate();
}