예제 #1
0
파일: ogrct.cpp 프로젝트: nvdnkpr/node-srs
char *OCTProj4Normalize( const char *pszProj4Src )

{
    char        *pszNewProj4Def, *pszCopy;
    projPJ      psPJSource = NULL;

    CPLMutexHolderD( &hPROJMutex );

    if( !LoadProjLibrary() || pfn_pj_dalloc == NULL || pfn_pj_get_def == NULL )
        return CPLStrdup( pszProj4Src );

    psPJSource = pfn_pj_init_plus( pszProj4Src );

    if( psPJSource == NULL )
        return CPLStrdup( pszProj4Src );

    pszNewProj4Def = pfn_pj_get_def( psPJSource, 0 );

    pfn_pj_free( psPJSource );

    if( pszNewProj4Def == NULL )
        return CPLStrdup( pszProj4Src );

    pszCopy = CPLStrdup( pszNewProj4Def );
    pfn_pj_dalloc( pszNewProj4Def );

    return pszCopy;
}
예제 #2
0
파일: ogrct.cpp 프로젝트: nvdnkpr/node-srs
OGRProj4CT::~OGRProj4CT()

{
    if( poSRSSource != NULL )
    {
        if( poSRSSource->Dereference() <= 0 )
            delete poSRSSource;
    }

    if( poSRSTarget != NULL )
    {
        if( poSRSTarget->Dereference() <= 0 )
            delete poSRSTarget;
    }

    if (pjctx != NULL)
    {
        pfn_pj_ctx_free(pjctx);

        if( psPJSource != NULL )
            pfn_pj_free( psPJSource );

        if( psPJTarget != NULL )
            pfn_pj_free( psPJTarget );
    }
    else
    {
        CPLMutexHolderD( &hPROJMutex );

        if( psPJSource != NULL )
            pfn_pj_free( psPJSource );

        if( psPJTarget != NULL )
            pfn_pj_free( psPJTarget );
    }

    CPLFree(padfOriX);
    CPLFree(padfOriY);
    CPLFree(padfOriZ);
    CPLFree(padfTargetX);
    CPLFree(padfTargetY);
    CPLFree(padfTargetZ);
}
예제 #3
0
파일: ogrct.cpp 프로젝트: ryandavid/rotobox
/** This function is really just here since we already have all
 * the code to load libproj.so.  It is intended to "normalize"
 * a proj.4 definition, expanding +init= definitions and so
 * forth as possible.
 */
static char *OCTProj4NormalizeInternal( const char *pszProj4Src )
{
    char        *pszNewProj4Def, *pszCopy;
    projPJ      psPJSource = NULL;

    psPJSource = pfn_pj_init_plus( pszProj4Src );

    if( psPJSource == NULL )
        return CPLStrdup( pszProj4Src );

    pszNewProj4Def = pfn_pj_get_def( psPJSource, 0 );

    pfn_pj_free( psPJSource );

    if( pszNewProj4Def == NULL )
        return CPLStrdup( pszProj4Src );

    pszCopy = CPLStrdup( pszNewProj4Def );
    pfn_pj_dalloc( pszNewProj4Def );

    return pszCopy;
}