コード例 #1
0
ファイル: gvproperties.c プロジェクト: midendian/openev2
void gv_properties_remove( GvProperties *properties, const char * key )

{
    int   prop_index = CSLFindString( *properties, key );
    char  **targets;

    if( prop_index >= 0 )
    {
        *properties = CSLRemoveStrings( *properties, prop_index, 1, 
                                        &targets );
        CSLDestroy( targets );
    }
}
コード例 #2
0
ファイル: gxwebconnfactory.cpp プロジェクト: Mileslee/wxgis
bool wxGxWebConnectionFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
    wxGxCatalogBase* pCatalog = GetGxCatalog();
    for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
    {
        CPLString szExt = CPLGetExtension(pFileNames[i]);
		if(wxGISEQUAL(szExt, "wconn"))
		{
            if( m_bHasDriver )
            {
    			wxGxObject* pObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i]); 
                if(pObj)
                    pChildrenIds.Add(pObj->GetId());
            }
            pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
		}
    }
	return true;
}
コード例 #3
0
// Finds, extracts, and returns the highest resolution request string from a list, starting at item i
CPLString GDALWMSMiniDriver_TiledWMS::GetLowestScale(char **& list,int i)
{
    CPLString req;
    double scale=-1;
    int position=-1;
    while (NULL!=list[i])
    {
        double tscale=Scale(list[i]);
        if (tscale>=scale)
        {
            scale=tscale;
            position=i;
        }
        i++;
    }
    if (position>-1)
    {
        req=list[position];
        list = CSLRemoveStrings(list,position,1,NULL);
    }
    return req;
}
コード例 #4
0
bool wxGxLocalDBFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
    wxGxCatalogBase* pCatalog = GetGxCatalog();
    bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT;
    for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
    {
        VSIStatBufL BufL;
        int ret = VSIStatL(pFileNames[i], &BufL);
        if(ret == 0)
        {
            if (VSI_ISDIR(BufL.st_mode) && wxGISEQUAL(CPLGetExtension(pFileNames[i]), "gdb"))
            {
                wxGxObject* pObj = GetGxObject(pParent, wxString(CPLGetFilename(pFileNames[i]), wxConvUTF8), pFileNames[i], enumContGDBFolder, bCheckNames);
                if(pObj)
                    pChildrenIds.Add(pObj->GetId());
                pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
            }
            //TODO: mdb, sqlite, db extensions
        }
    }
    return true;
}
コード例 #5
0
ファイル: gdal_mdreader.cpp プロジェクト: AbdelghaniDr/mirror
static int GDAL_IMD_AA2R( char ***ppapszIMD )

{
    char **papszIMD = *ppapszIMD;

/* -------------------------------------------------------------------- */
/*      Verify that we have a new format file.                          */
/* -------------------------------------------------------------------- */
    const char *pszValue = CSLFetchNameValue( papszIMD, "version" );

    if( pszValue == NULL )
        return FALSE;

    if( EQUAL(pszValue,"\"R\"") )
        return TRUE;

    if( !EQUAL(pszValue,"\"AA\"") )
    {
        CPLDebug( "IMD", "The file is not the expected 'version = \"AA\"' format.\nProceeding, but file may be corrupted." );
    }

/* -------------------------------------------------------------------- */
/*      Fix the version line.                                           */
/* -------------------------------------------------------------------- */
    papszIMD = CSLSetNameValue( papszIMD, "version", "\"R\"" );

/* -------------------------------------------------------------------- */
/*      remove a bunch of fields.                                       */
/* -------------------------------------------------------------------- */
    int iKey;

    static const char *apszToRemove[] = {
        "productCatalogId",
        "childCatalogId",
        "productType",
        "numberOfLooks",
        "effectiveBandwidth",
        "mode",
        "scanDirection",
        "cloudCover",
        "productGSD",
        NULL };

    for( iKey = 0; apszToRemove[iKey] != NULL; iKey++ )
    {
        int iTarget = CSLFindName( papszIMD, apszToRemove[iKey] );
        if( iTarget != -1 )
            papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL );
    }

/* -------------------------------------------------------------------- */
/*      Replace various min/mean/max with just the mean.                */
/* -------------------------------------------------------------------- */
    static const char *keylist[] = {
        "CollectedRowGSD",
        "CollectedColGSD",
        "SunAz",
        "SunEl",
        "SatAz",
        "SatEl",
        "InTrackViewAngle",
        "CrossTrackViewAngle",
        "OffNadirViewAngle",
        NULL };

    for( iKey = 0; keylist[iKey] != NULL; iKey++ )
    {
        CPLString osTarget;
        int       iTarget;

        osTarget.Printf( "IMAGE_1.min%s", keylist[iKey] );
        iTarget = CSLFindName( papszIMD, osTarget );
        if( iTarget != -1 )
            papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL );

        osTarget.Printf( "IMAGE_1.max%s", keylist[iKey] );
        iTarget = CSLFindName( papszIMD, osTarget );
        if( iTarget != -1 )
            papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL );

        osTarget.Printf( "IMAGE_1.mean%s", keylist[iKey] );
        iTarget = CSLFindName( papszIMD, osTarget );
        if( iTarget != -1 )
        {
            CPLString osValue = CSLFetchNameValue( papszIMD, osTarget );
            CPLString osLine;

            osTarget.Printf( "IMAGE_1.%c%s",
                             tolower(keylist[iKey][0]),
                             keylist[iKey]+1 );

            osLine = osTarget + "=" + osValue;

            CPLFree( papszIMD[iTarget] );
            papszIMD[iTarget] = CPLStrdup(osLine);
        }
    }

    *ppapszIMD = papszIMD;
    return TRUE;
}
コード例 #6
0
bool wxGxPrjFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
    bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT;
    for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
    {
        CPLString szExt = CPLGetExtension(pFileNames[i]);

        wxGxObject* pGxObj = NULL;
 
        if(wxGISEQUAL(szExt, "prj"))
        {
            bool bAdd = true;
            for(int j = 0; prj_notadd_exts[j] != NULL; ++j )
            {
                if(CPLCheckForFile((char*)CPLResetExtension(pFileNames[i], prj_notadd_exts[j]), NULL))
                {
                    bAdd = false;
                    break;
                }
            }

            if(bAdd)
            {
                pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumESRIPrjFile, bCheckNames);
            }

            pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
        }
        else if(wxGISEQUAL(szExt, "qpj"))
        {
            bool bAdd = true;
            for(int j = 0; prj_notadd_exts[j] != NULL; ++j )
            {
                if(CPLCheckForFile((char*)CPLResetExtension(pFileNames[i], prj_notadd_exts[j]), NULL))
                {
                    bAdd = false;
                    break;
                }
            }

            if(bAdd)
            {
                pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumQPJfile, bCheckNames);
            }

            pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
        }
        else if(wxGISEQUAL(szExt, "spr"))
        {
            pGxObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i], enumSPRfile, bCheckNames);

            pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
        }

        if(pGxObj)
        {
            pChildrenIds.Add(pGxObj->GetId());
            pGxObj = NULL;
        }
    }
	return true;
}
コード例 #7
0
bool wxGxRasterFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
    bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT;
    for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
    {
        wxGxObject* pGxObj = NULL;
        CPLString szExt = CPLGetExtension(pFileNames[i]);
        CPLString szPath;
        bool bContinue(false);

        unsigned int j;
        for(j = 0; j < sizeof(raster_exts) / sizeof(raster_exts[0]); ++j)
        {
            if(wxGISEQUAL(szExt, raster_exts[j].sExt) )
		    {
                if(raster_exts[j].bAvailable)
                {
                    CPLString szPath(pFileNames[i]);
                    pGxObj = GetGxObject(pParent, GetConvName(szPath), szPath, raster_exts[j].eType, bCheckNames);
                    if(pGxObj != NULL)
                        pChildrenIds.Add(pGxObj->GetId());
                }
                pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
                bContinue = true;
                break;
		    }
        }

        if(bContinue)
            continue;


        if(wxGISEQUAL(szExt, "prj"))
        {
			if(pFileNames)
			{
                unsigned int j;
                for(j = 0; j < sizeof(raster_exts) / sizeof(raster_exts[0]); ++j)
                {
    				szPath = (char*)CPLResetExtension(pFileNames[i], raster_exts[j].sExt);
	    			if(CPLCheckForFile((char*)szPath.c_str(), NULL))
                    {
		    			pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
                        bContinue = true;
                        break;
                    }
                }
            }
        }

        if(bContinue)
            continue;
        
        for( j = 0; raster_add_exts[j] != NULL; ++j )
        {
            if(wxGISEQUAL(szExt, raster_add_exts[j]))
            {
                pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
                break;
            }
        }
    }
	return true;
}