WRAPPER_API void ImportFromSupplementaryString(const GEOCALC_NAMESPACE::CString&
inString, bool loadAsCustom)
Description
This function will import the object data from the specified string. If loadAsCustom is TRUE, the data will be added to the custom datasource (if no custom exists, and exception will be thrown). If loadAsCustom is FALSE, the data will be added to the base datasource. If an object being imported has a GC code that matches an object already in the DataSource, it will be skipped.
Example
void DataSource_ImportFromSupplementaryString(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 String
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 string, adding
any objects not already in the datasource to custom
m_DataSource->ImportFromSupplementaryString(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();
}
Comments
0 comments
Please sign in to leave a comment.