Exemplo n.º 1
0
CSG_String Get_Info(int i)
{
	switch( i )
	{
	case MLB_INFO_Name:	default:
		return( _TL("GDAL/OGR") );

	case MLB_INFO_Category:
		return( _TL("Import/Export") );

	case MLB_INFO_Author:
		return( _TL("SAGA User Group Associaton (c) 2008" ));

	case MLB_INFO_Description:
		return( CSG_String::Format(SG_T("%s\n%s %s\n%s: %s"),
			_TL("Interface to Frank Warmerdam's Geospatial Data Abstraction Library (GDAL)."),
			_TL("Version"), SG_Get_GDAL_Drivers().Get_Version().c_str(),
			_TL("Homepage"), SG_T("<a target=\"_blank\" href=\"http://www.gdal.org/\">www.gdal.org</a>\n")
		));

	case MLB_INFO_Version:
		return( SG_T("2.0") );

	case MLB_INFO_Menu_Path:
		return( _TL("File") );
	}
}
Exemplo n.º 2
0
CSG_Module *		Create_Module(int i)
{
	switch( i )
	{
	case  0:	return( new CGDAL_Import );
	case  1:	return( new CGDAL_Export );
	case  2:	return( new CGDAL_Export_GeoTIFF );

	case  7:	return( new CGDAL_Catalogue );
	case  8:	return( new CGDAL_Catalogues );

	case  3:	return( new COGR_Import );
	case  4:	return( new COGR_Export );

	case  5:	return( new COGR_Export_KML );

	case  6:	return( SG_Get_GDAL_Drivers().Get_Driver("netCDF") ? new CGDAL_Import_NetCDF : MLB_INTERFACE_SKIP_MODULE );

	case  9:	return( new CGDAL_Import_WMS );

	//-----------------------------------------------------
	case 10:	return( NULL );
	default:	return( MLB_INTERFACE_SKIP_MODULE );
	}

	return( NULL );
}
Exemplo n.º 3
0
//---------------------------------------------------------
CGDAL_Formats::CGDAL_Formats(void)
{
    //-----------------------------------------------------
    Set_Name	(_TL("GDAL Formats"));

    Set_Author	("O.Conrad (c) 2016");

    CSG_String	Description;

    Description	= _TW(
                      "This tool lists all (file) formats supported by the currently loaded GDAL library. "
                      "For more information have a look at the GDAL homepage:\n"
                      "  <a target=\"_blank\" href=\"http://www.gdal.org/\">"
                      "  http://www.gdal.org</a>\n"
                  );

    Description	+= CSG_String::Format("\nGDAL %s:%s\n\n", _TL("Version"), SG_Get_GDAL_Drivers().Get_Version().c_str());

    Set_Description(Description);

    //-----------------------------------------------------
    Parameters.Add_Table(NULL,
                         "FORMATS"	, _TL("GDAL Formats"),
                         _TL(""),
                         PARAMETER_OUTPUT
                        );

    Parameters.Add_Choice(NULL,
                          "TYPE"		, _TL("Type"),
                          _TL(""),
                          CSG_String::Format("%s|%s|%s|",
                                  _TL("raster"),
                                  _TL("vector"),
                                  _TL("all")
                                            ), 2
                         );

    Parameters.Add_Choice(NULL,
                          "ACCESS"	, _TL("Access"),
                          _TL(""),
                          CSG_String::Format("%s|%s|%s|",
                                  _TL("read"),
                                  _TL("write"),
                                  _TL("read or write")
                                            ), 2
                         );

    Parameters.Add_Bool(NULL,
                        "RECOGNIZED", _TL("All Recognized Files"),
                        _TL("Add an entry for all recognized files."),
                        true
                       );
}
Exemplo n.º 4
0
//---------------------------------------------------------
bool CGDAL_Formats::On_Execute(void)
{
    CSG_Table	*pFormats	= Parameters("FORMATS")->asTable();

    pFormats->Destroy();
    pFormats->Set_Name(_TL("GDAL Formats"));

    pFormats->Add_Field("ID"    , SG_DATATYPE_String);
    pFormats->Add_Field("NAME"  , SG_DATATYPE_String);
    pFormats->Add_Field("FILTER", SG_DATATYPE_String);
    pFormats->Add_Field("TYPE"  , SG_DATATYPE_String);
    pFormats->Add_Field("ACCESS", SG_DATATYPE_String);

    //-----------------------------------------------------
    int		Type	= Parameters("TYPE"  )->asInt();
    int		Access	= Parameters("ACCESS")->asInt();

    //-----------------------------------------------------
    if( Type != 1 )	// not vectors only
    {
        for(int i=0; i<SG_Get_GDAL_Drivers().Get_Count(); i++)
        {
            if( SG_Get_GDAL_Drivers().is_Raster(i) )
            {
                CSG_String	R(SG_Get_GDAL_Drivers().Can_Read (i) ? "R" : "");
                CSG_String	W(SG_Get_GDAL_Drivers().Can_Write(i) ? "W" : "");

                if( (Access != 0 || !R.is_Empty()) && (Access != 1 || !W.is_Empty()) )
                {
                    CSG_Table_Record	*pFormat	= pFormats->Add_Record();

                    pFormat->Set_Value(GDAL_LIST_FMT_ID    , SG_Get_GDAL_Drivers().Get_Description(i));
                    pFormat->Set_Value(GDAL_LIST_FMT_NAME  , SG_Get_GDAL_Drivers().Get_Name       (i));
                    pFormat->Set_Value(GDAL_LIST_FMT_FILTER, SG_Get_GDAL_Drivers().Get_Extension  (i));
                    pFormat->Set_Value(GDAL_LIST_FMT_TYPE  , "RASTER");
                    pFormat->Set_Value(GDAL_LIST_FMT_ACCESS, R + W);
                }
            }
        }
    }

    //-----------------------------------------------------
    if( Type != 0 )	// not rasters only
    {
        for(int i=0; i<SG_Get_OGR_Drivers().Get_Count(); i++)
        {
            if( SG_Get_OGR_Drivers().is_Vector(i) )
            {
                CSG_String	R(SG_Get_OGR_Drivers().Can_Read (i) ? "R" : "");
                CSG_String	W(SG_Get_OGR_Drivers().Can_Write(i) ? "W" : "");

                if( (Access != 0 || !R.is_Empty()) && (Access != 1 || !W.is_Empty()) )
                {
                    CSG_Table_Record	*pFormat	= pFormats->Add_Record();

                    pFormat->Set_Value(GDAL_LIST_FMT_ID    , SG_Get_OGR_Drivers().Get_Description(i));
                    pFormat->Set_Value(GDAL_LIST_FMT_NAME  , SG_Get_OGR_Drivers().Get_Name       (i));
                    pFormat->Set_Value(GDAL_LIST_FMT_FILTER, SG_Get_OGR_Drivers().Get_Extension  (i));
                    pFormat->Set_Value(GDAL_LIST_FMT_TYPE  , "VECTOR");
                    pFormat->Set_Value(GDAL_LIST_FMT_ACCESS, R + W);
                }
            }
        }
    }

    //-----------------------------------------------------
    if( Parameters("RECOGNIZED")->asBool() )
    {
        CSG_String	Filter_All;

        for(int i=0; i<pFormats->Get_Count(); i++)
        {
            CSG_String	Filter	= pFormats->Get_Record(i)->asString(GDAL_LIST_FMT_FILTER);

            if( !Filter.is_Empty() )
            {
                Filter.Replace("/", ";");

                Filter_All	+= (Filter_All.is_Empty() ? "*." : ";*.") + Filter;
            }
        }

        if( !Filter_All.is_Empty() )
        {
            CSG_Table_Record	*pFormat	= pFormats->Add_Record();

            pFormat->Set_Value(GDAL_LIST_FMT_NAME  , _TL("All Recognized Files"));
            pFormat->Set_Value(GDAL_LIST_FMT_FILTER, Filter_All);
            pFormat->Set_Value(GDAL_LIST_FMT_TYPE  , Type   == 0 ? "RASTER" : Type   == 1 ? "VECTOR" : "RASTER/VECTOR");
            pFormat->Set_Value(GDAL_LIST_FMT_ACCESS, Access == 0 ? "R"      : Access == 1 ? "W"      : "RW"           );
        }
    }

    //-----------------------------------------------------
    return( pFormats->Get_Count() > 0 );
}