Exemplo n.º 1
0
//---------------------------------------------------------
bool			SG_File_Set_Extension(CSG_String &File_Name, const CSG_String &Extension)
{
	if( File_Name.Length() > 0 && Extension.Length() > 0 )
	{
		wxFileName	fn(File_Name.w_str());

		fn.SetExt(Extension.w_str());

		File_Name	= fn.GetFullPath().wc_str();

		return( true );
	}

	return( false );
}
Exemplo n.º 2
0
//---------------------------------------------------------
bool CWKSP_Project::_Save_Data(CSG_MetaData &Entry, const wxString &ProjectDir, CSG_Data_Object *pDataObject, CSG_Parameters *pParameters)
{
	if( !pDataObject || !pDataObject->Get_File_Name(false) || SG_STR_LEN(pDataObject->Get_File_Name(false)) == 0 )
	{
		return( false );
	}

	CSG_MetaData	*pEntry	= Entry.Add_Child("DATASET");

	switch( pDataObject->Get_ObjectType() )
	{
	default:	return( false );
	case SG_DATAOBJECT_TYPE_Grid      :	pEntry->Add_Property("type", "GRID"  );	break;
	case SG_DATAOBJECT_TYPE_Grids     :	pEntry->Add_Property("type", "GRIDS" );	break;
	case SG_DATAOBJECT_TYPE_Table     :	pEntry->Add_Property("type", "TABLE" );	break;
	case SG_DATAOBJECT_TYPE_Shapes    :	pEntry->Add_Property("type", "SHAPES");	break;
	case SG_DATAOBJECT_TYPE_TIN       :	pEntry->Add_Property("type", "TIN"   );	break;
	case SG_DATAOBJECT_TYPE_PointCloud:	pEntry->Add_Property("type", "POINTS");	break;
	}

	if( wxFileExists(pDataObject->Get_File_Name(false)) )
	{
		pEntry->Add_Child("FILE", SG_File_Get_Path_Relative(&ProjectDir, pDataObject->Get_File_Name(false)));
	}
	else if( pDataObject->Get_MetaData_DB().Get_Children_Count() > 0 )
	{
		pEntry->Add_Child("FILE", pDataObject->Get_File_Name(false));
	}
	else
	{
		return( false );
	}

	if( pParameters )
	{
		pParameters->DataObjects_Check(true);

		pParameters->Serialize(*pEntry->Add_Child("PARAMETERS"), true);

		//-------------------------------------------------
		pEntry	= pEntry->Get_Child("PARAMETERS");

		for(int i=0; i<pEntry->Get_Children_Count(); i++)
		{
			if( !pEntry->Get_Child(i)->Get_Name().CmpNoCase("DATA") )
			{
				CSG_String	File	= pEntry->Get_Child(i)->Get_Content();

				if( File.BeforeFirst(':').CmpNoCase("PGSQL") && SG_File_Exists(File) )
				{
					pEntry->Get_Child(i)->Set_Content(SG_File_Get_Path_Relative(&ProjectDir, File.w_str()));
				}
			}
		}
	}

	return( true );
}
Exemplo n.º 3
0
//---------------------------------------------------------
bool			SG_Get_Environment(const CSG_String &Variable, CSG_String *Value)
{
	if( Value == NULL)
	{
		return( wxGetEnv(Variable.w_str(), NULL) );
	}

	wxString	s;

	if( wxGetEnv(Variable.w_str(), &s) )
	{
		*Value	= s.wc_str();

		return( true );
	}

	return( false );
}
Exemplo n.º 4
0
//---------------------------------------------------------
bool			SG_Set_Environment(const CSG_String &Variable, const CSG_String &Value)
{
	return( wxSetEnv(Variable.w_str(), Value.w_str()) );
}