WRAPPER_API int FindByEPSG(const BmgChar* epsgCode, vector<const Serializable*>& matchingObjects) const
Retrieves a list of objects with the specified EPSG code (EPSG codes are not unique across all object types).
void DataSource_FindByEPSG(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();
}