ExportToSupplementaryString

WRAPPER_API void ExportToSupplementaryString(const GEOCALC_NAMESPACE::CString& inString, bool loadAsCustom)

 

Description

This function will export the objects to the specified string. 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.

Example

void DataSource_ExportToSupplementaryString(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->ExportToSupplementaryString(objectsToExport);

 

// Import that file, adding any objects not already in the datasource to custom

m_DataSource->ImportFromSupplementaryFile(inString, 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();

}