/** * Takes the references of the other object and stores them in this CRSIdentifiable Object. * * @param other * identifiable object. */ public CRSIdentifiable( CRSResource other ) { this( other.getCodes(), other.getNames(), other.getVersions(), other.getDescriptions(), other.getAreasOfUse() ); }
public void addAreaOfUse( String areaOfUse ) { getReferencedObject().addAreaOfUse( areaOfUse ); }
private synchronized <V extends CRSResource> V addIdToCache( Map<CRSCodeType, CRSResource> cache, V identifiable, boolean update ) { if ( identifiable == null ) { return null; } for ( CRSCodeType idString : identifiable.getCodes() ) { // if ( idString != null && !"".equals( idString.trim() ) ) { if ( idString != null ) { if ( cache.containsKey( idString ) && cache.get( idString ) != null ) { if ( update ) { LOG.debug( "Updating cache with new identifiable: " + idString ); cache.put( idString, identifiable ); } } else { LOG.debug( "Adding new identifiable to cache: " + idString ); cache.put( idString, identifiable ); } } else { LOG.debug( "Not adding the null string id to the cache of identifiable: " + identifiable.getCode() ); } } return identifiable; }
public CRSCodeType[] getCodes() { return getReferencedObject().getCodes(); }
LOG.debug( "Parsing id of projection method resulted in: " + Arrays.toString( id.getCodes() ) ); IProjection result = getCachedIdentifiable( Projection.class, id.getCodes() ); if ( result == null ) { OMElement method = adapter.getRequiredElement( rootElement, new XPath( PRE + "method", nsContext ) ); CRSResource paramID = paramValue.first; if ( paramID != null ) { SupportedProjectionParameters paramType = SupportedProjectionParameters.fromCodes( paramID.getCodes() ); IUnit unit = second.first; case NOT_SUPPORTED: default: LOG.warn( "The projection parameter: " + paramID.getCodeAndName() + " could not be mapped to any projection and will not be used." ); break; SupportedProjections projection = fromCodes( conversionMethodID.getCodes() ); switch ( projection ) { case TRANSVERSE_MERCATOR: case NOT_SUPPORTED: default: LOG.error( "The conversion method (Projection): " + conversionMethodID.getCode() + " is currently not supported by the deegree crs package." );
CRSResource paramID = paramValue.first; if ( paramID != null ) { SupportedTransformationParameters paramType = SupportedTransformationParameters.fromCodes( paramID.getCodes() ); IUnit unit = second.first; break; default: LOG.warn( "The (helmert) transformation parameter: " + paramID.getCodeAndName() + " could not be mapped to a valid parameter and will not be used." ); break;
public String[] getDescriptions() { return getReferencedObject().getDescriptions(); }
public String[] getAreasOfUse() { return getReferencedObject().getAreasOfUse(); }
public String[] getNames() { return getReferencedObject().getNames(); }
public String[] getVersions() { return getReferencedObject().getVersions(); }
public String getAreaOfUse() { return getReferencedObject().getAreaOfUse(); }
public void addName( String name ) { getReferencedObject().addName( name ); }
public double[] getAreaOfUseBBox() { return getReferencedObject().getAreaOfUseBBox(); }
/** * The id are what they are, not trimming 'upcasing' or other modifications will be done in this method. * * @param expectedType * The class of type T which is expected. * @param <V> * the type to cast to if the casting fails, null will be returned. * @param ids * to search the cache for * @return the {@link CRSIdentifiable} of the first matching id or <code>null</code> if it was not found. */ public <V extends CRSResource> V getCachedIdentifiable( Class<V> expectedType, CRSResource ids ) { if ( ids == null ) { return null; } return getCachedIdentifiable( expectedType, ids.getCodes() ); }
throws XMLStreamException { CRSCodeType[] identifiers = identifiable.getCodes(); for ( CRSCodeType id : identifiers ) { if ( id != null ) { String[] names = identifiable.getNames(); if ( names != null && names.length > 0 ) { for ( String name : names ) { String[] versions = identifiable.getVersions(); if ( versions != null && versions.length > 0 ) { for ( String version : versions ) { String[] descriptions = identifiable.getDescriptions(); if ( descriptions != null && descriptions.length > 0 ) { for ( String description : descriptions ) { String[] areas = identifiable.getAreasOfUse(); if ( areas != null && areas.length > 0 ) { for ( String area : areas ) {
@Override public boolean equals( Object other ) { if ( other != null && other instanceof CRSIdentifiable ) { CRSResource that = ( (CRSResource) other ); CRSCodeType[] mId = getCodes(); CRSCodeType[] yId = that.getCodes(); CRSCodeType[] small = mId.length >= yId.length ? yId : mId; CRSCodeType[] large = mId.length < yId.length ? yId : mId; List<CRSCodeType> list = Arrays.asList( large ); boolean result = true; for ( int i = 0; result && ( i < small.length ); ++i ) { CRSCodeType id = small[i]; if ( id != null ) { result = list.contains( id ); } } return result; } return false; }
/** * Get a {@link CRSIdentifiable} (actually a type V that extends it) from the cache that corresponds to the a * {@link CRSCodeType}. * * @param <V> * @param id * a {@link CRSCodeType} * @return a {@link CRSIdentifiable}-extending object that corresponds to the given id */ @SuppressWarnings("unchecked") public <V extends CRSResource> V getCachedIdentifiable( CRSCodeType id ) { if ( id == null ) { return null; } V result = (V) cachedIdentifiables.get( id ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Searched for id: " + id + " resulted in: " + ( ( result == null ) ? "null" : result.getCode() ) ); } return result; }
throws XMLStreamException { CRSCodeType[] identifiers = identifiable.getCodes(); for ( CRSCodeType id : identifiers ) { if ( id != null ) { String[] names = identifiable.getNames(); if ( names != null && names.length > 0 ) { for ( String name : names ) { String[] versions = identifiable.getVersions(); if ( versions != null && versions.length > 0 ) { for ( String version : versions ) { String[] descriptions = identifiable.getDescriptions(); if ( descriptions != null && descriptions.length > 0 ) { for ( String description : descriptions ) { String[] areas = identifiable.getAreasOfUse(); if ( areas != null && areas.length > 0 ) { for ( String area : areas ) {
private int getEPSGCode( CRSResource crs ) { CRSCodeType[] pCodes = crs.getCodes(); int epsgCode = -1; for ( int i = 0; i < pCodes.length && epsgCode == -1; ++i ) { CRSCodeType pCode = pCodes[i]; if ( "EPSG".equalsIgnoreCase( pCode.getCodeSpace() ) ) { try { epsgCode = Integer.parseInt( pCode.getCode() ); } catch ( NumberFormatException e ) { LOG.warn( "Given epsg code is not an int, ignoring it: " + pCode.getCode() ); } } } return epsgCode; }