//---------------------------------------------------------
bool CWKSP_Data_Item::Save(void)
{
	int	idDlg;

	switch( Get_Type() )
	{
	case WKSP_ITEM_Table     :	idDlg	= ID_DLG_TABLES_SAVE    ;	break;
	case WKSP_ITEM_TIN       :
	case WKSP_ITEM_Shapes    :	idDlg	= ID_DLG_SHAPES_SAVE    ;	break;
	case WKSP_ITEM_PointCloud:	idDlg	= ID_DLG_POINTCLOUD_SAVE;	break;
	case WKSP_ITEM_Grid      :	idDlg	= ID_DLG_GRIDS_SAVE     ;	break;

	default:	return( false );
	}

	wxString	FileName	= m_pObject->Get_File_Name() && *m_pObject->Get_File_Name()
		? m_pObject->Get_File_Name()
		: m_pObject->Get_Name();

	if( DLG_Save(FileName, idDlg) && m_pObject->Save(&FileName) )
	{
		return( true );
	}

	return( false );
}
//---------------------------------------------------------
void CDLG_Text::On_Save(wxCommandEvent &event)
{
	wxString	File_Path;

	if( DLG_Save(File_Path, ID_DLG_TEXT_SAVE) )
	{
		m_pControl->SaveFile(File_Path);
	}
}
//---------------------------------------------------------
bool CWKSP_Project::Copy(void)
{
	wxString	FileName;

	if( !DLG_Save(FileName, ID_DLG_PROJECT_SAVE) )
	{
		return( false );
	}

	wxFileName	Directory(FileName);

	Directory.AppendDir(Directory.GetFullName());

	if( !Directory.DirExists() )
	{
		Directory.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
	}

	size_t	i, j;

	for(j=0; j<SG_Get_Data_Manager().Grid_System_Count(); j++)
	{
		for(i=0; i<SG_Get_Data_Manager().Get_Grid_System(j)->Count(); i++)
		{
			_Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Grid_System(j)->Get(i)), Directory.GetFullPath());
		}
	}

	for(i=0; i<SG_Get_Data_Manager().Get_Point_Cloud()->Count(); i++)
	{
		_Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Point_Cloud()->Get(i)), Directory.GetFullPath());
	}

	for(i=0; i<SG_Get_Data_Manager().Get_Shapes()->Count(); i++)
	{
		_Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Shapes()->Get(i)), Directory.GetFullPath());
	}

	for(i=0; i<SG_Get_Data_Manager().Get_Table()->Count(); i++)
	{
		_Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Table()->Get(i)), Directory.GetFullPath());
	}

	for(i=0; i<SG_Get_Data_Manager().asTIN()->Count(); i++)
	{
		_Copy_To_File(g_pData->Get(SG_Get_Data_Manager().asTIN()->Get(i)), Directory.GetFullPath());
	}

	return( _Save(Directory.GetFullPath(), false, true) );
}
//---------------------------------------------------------
bool CParameters_Control::Save(void)
{
	wxString	File_Path;

	if( DLG_Save(File_Path, ID_DLG_PARAMETERS_SAVE) )
	{
		if( m_pParameters->Serialize(&File_Path, true) )
		{
			return( true );
		}

		DLG_Message_Show(_TL("Parameters file could not be exported."), _TL("Save Parameters"));
	}

	return( false );
}
Beispiel #5
0
//---------------------------------------------------------
void CACTIVE_History::On_SaveAs_Model(wxCommandEvent &event)
{
	const wxString	Filter	= wxString::Format("%s|*.xml|%s|*.*",
		_TL("XML Files"), _TL("All Files")
	);

	wxString	File;

	CSG_Data_Object	*pObject	= _Get_Object();

	if( pObject && pObject->Get_History().Get_Children_Count() > 0
	&&  DLG_Save(File, _TL("Save History as Model"), Filter)
	&&  pObject->Save_History_to_Model(&File) )
	{
		g_pTools->Open(File);
	}
}
Beispiel #6
0
bool		DLG_Save(wxString &File_Path, int ID_DLG)
{
	wxString	def_Dir, def_Name;

	def_Name	= SG_File_Get_Name(File_Path, true).w_str();
	def_Dir		= SG_File_Get_Path(File_Path).w_str();

	if( !wxDirExists(def_Dir) )
	{
		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(ID_DLG), def_Dir);
	}

	if( DLG_Save(File_Path, DLG_Get_FILE_Caption(ID_DLG), def_Dir, def_Name, DLG_Get_FILE_Filter(ID_DLG)) )
	{
		CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(ID_DLG), SG_File_Get_Path(File_Path).w_str());

		return( true );
	}

	return( false );
}
Beispiel #7
0
bool		DLG_Save(wxString &File_Path, const wxString &Caption, const wxString &Filter)
{
	return( DLG_Save(File_Path, Caption, SG_File_Get_Path(File_Path).w_str(), SG_File_Get_Name(File_Path, true).w_str(), Filter) );
}
Beispiel #8
0
bool		DLG_Save(wxString &File_Path, const wxChar *Caption, const wxChar *Filter)
{
    return( DLG_Save(File_Path, Caption, SG_File_Get_Path(File_Path), SG_File_Get_Name(File_Path, true), Filter) );
}
//---------------------------------------------------------
bool CWKSP_Project::Save(void)
{
	wxString	FileName;

	return( DLG_Save(FileName, ID_DLG_PROJECT_SAVE) && _Save(FileName, true, true) );
}