//--------------------------------------------------------- void CDLG_List_Shapes::_Set_Data(void) { CWKSP_Shapes_Manager *pManager = g_pData->Get_Shapes(); if( m_Shape_Type == SHAPE_TYPE_Undefined ) { if( pManager ) { for(int i=0; i<pManager->Get_Count(); i++) { Set_Data((CWKSP_Shapes_Type *)pManager->Get_Item(i)); } } Set_Data(g_pData->Get_PointClouds()); } else { if( pManager ) { Set_Data(pManager->Get_Shapes_Type(m_Shape_Type)); } if( m_Shape_Type == SHAPE_TYPE_Point ) { Set_Data(g_pData->Get_PointClouds()); } } }
//--------------------------------------------------------- bool CWKSP_Project::_Save(const wxString &FileName, bool bSaveModified, bool bUpdateMenu) { int i, j; wxString ProjectDir, oldFileName(m_File_Name); CSG_MetaData Project, *pNode; CWKSP_Table_Manager *pTables; CWKSP_Shapes_Manager *pShapes; CWKSP_TIN_Manager *pTINs; CWKSP_PointCloud_Manager *pPointClouds; CWKSP_Grid_Manager *pGrids; //----------------------------------------------------- m_File_Name = FileName; if( bSaveModified && !g_pData->Save_Modified() ) { m_File_Name = oldFileName; return( false ); } //----------------------------------------------------- ProjectDir = SG_File_Get_Path(&FileName).w_str(); Project.Set_Name ("SAGA_PROJECT"); Project.Add_Property("VERSION", SAGA_VERSION); //----------------------------------------------------- pNode = Project.Add_Child("DATA"); if( (pTables = g_pData->Get_Tables()) != NULL ) { for(i=0; i<pTables->Get_Count(); i++) { _Save_Data(*pNode, ProjectDir, pTables->Get_Data(i)->Get_Object(), pTables->Get_Data(i)->Get_Parameters() ); } } if( (pTINs = g_pData->Get_TINs()) != NULL ) { for(i=0; i<pTINs->Get_Count(); i++) { _Save_Data(*pNode, ProjectDir, pTINs->Get_Data(i)->Get_Object(), pTINs->Get_Data(i)->Get_Parameters() ); } } if( (pPointClouds = g_pData->Get_PointClouds()) != NULL ) { for(i=0; i<pPointClouds->Get_Count(); i++) { _Save_Data(*pNode, ProjectDir, pPointClouds->Get_Data(i)->Get_Object(), pPointClouds->Get_Data(i)->Get_Parameters() ); } } if( (pShapes = g_pData->Get_Shapes()) != NULL ) { for(j=0; j<pShapes->Get_Count(); j++) { for(i=0; i<pShapes->Get_Shapes_Type(j)->Get_Count(); i++) { _Save_Data(*pNode, ProjectDir, pShapes->Get_Shapes_Type(j)->Get_Data(i)->Get_Object(), pShapes->Get_Shapes_Type(j)->Get_Data(i)->Get_Parameters() ); } } } if( (pGrids = g_pData->Get_Grids()) != NULL ) { for(j=0; j<pGrids->Get_Count(); j++) { for(i=0; i<pGrids->Get_System(j)->Get_Count(); i++) { _Save_Data(*pNode, ProjectDir, ((CWKSP_Data_Item *)pGrids->Get_System(j)->Get_Item(i))->Get_Object(), ((CWKSP_Data_Item *)pGrids->Get_System(j)->Get_Item(i))->Get_Parameters() ); } } } //----------------------------------------------------- if( g_pMaps->Get_Count() > 0 ) { pNode = Project.Add_Child("MAPS"); for(i=0; i<g_pMaps->Get_Count(); i++) { _Save_Map(*pNode, ProjectDir, g_pMaps->Get_Map(i)); } } //----------------------------------------------------- if( Project.Save(&FileName) ) { m_File_Name = FileName; if( bUpdateMenu ) g_pData->Get_Menu_Files()->Recent_Add(SG_DATAOBJECT_TYPE_Undefined, FileName); MSG_General_Add(_TL("Project has been saved."), true, true, SG_UI_MSG_STYLE_SUCCESS); _Set_Project_Name(); PROGRESSBAR_Set_Position(0); return( true ); } m_File_Name.Clear(); if( bUpdateMenu ) g_pData->Get_Menu_Files()->Recent_Del(SG_DATAOBJECT_TYPE_Undefined, FileName); MSG_General_Add(_TL("Could not save project."), true, true, SG_UI_MSG_STYLE_FAILURE); PROGRESSBAR_Set_Position(0); return( false ); }