WRAPPER_API void ExportToSupplementaryFile(const BmgChar *fileName, std::list<GEOCALCPBW_NAMESPACE::Serializable*> objectsToExport)
WRAPPER_API void ExportToSupplementaryFile(const BmgChar *fileName, std::list<const GEOCALCPBW_NAMESPACE::Serializable*> objectsToExport);
This function will export the objects to the specified file. Any objects the specified objects rely upon will also be exported. Note that the objects passed in do not have to be in the DataSource currently.
void DataSource_ExportToSupplementaryFile(GEOCALCPBW_NAMESPACE::DataSource & data)
{
// Create a brand new AngularUnit and do not add it to the DataSource
AngularUnit* putAngularUnit = new AngularUnit();
putAngularUnit->set_Name(L"TESTING");
putAngularUnit->get_Identifiers().Add(L"GC", L"TESTING");
putAngularUnit->get_Identifiers().Add(L"EPSG", L"TESTING");
putAngularUnit->set_UnitsPerDegree(222);
// Export it to a file
std::list<GEOCALCPBW_NAMESPACE::Serializable*> objectsToExport;
objectsToExport.push_back(m_DataSource->GetAngularUnit(L"GC", L"DEGREES"));
objectsToExport.push_back(putAngularUnit);
m_DataSource->ExportToSupplementaryFile(suppFilePath, objectsToExport);
// Import that file, adding any objects not already in the datasource to custom
m_DataSource->ImportFromSupplementaryFile(suppFilePath, true);
// The new AngularUnit should now be in the DataSource
vector<const Serializable*> matchingObj = m_DataSource->FindByEPSG(L"TESTING");
vector<const Serializable*>::const_iterator iter;
for (iter = matchingObj.begin(); iter != matchingObj.end(); iter++)
{
const Serializable* thisObj = *iter;
const BmgChar* thisName = thisObj->get_Name(); // Should be TESTING
}
// Clean up
for (iter = matchingObj.begin(); iter != matchingObj.end(); iter++)
{
GEOCALCPBW_NAMESPACE::Disposal::Dispose(*iter);
}
matchingObj.clear();
}