Toponaming/Part: trasnfer in getElementName
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <App/GeoFeaturePy.h>
|
||||
|
||||
#include "ComplexGeoData.h"
|
||||
#include "GeoFeature.h"
|
||||
#include "GeoFeatureGroupExtension.h"
|
||||
#include "ElementNamingUtils.h"
|
||||
@@ -78,17 +79,46 @@ PyObject* GeoFeature::getPyObject()
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
|
||||
std::pair<std::string,std::string> GeoFeature::getElementName(
|
||||
const char *name, ElementNameType type) const
|
||||
std::pair<std::string,std::string>
|
||||
GeoFeature::getElementName(const char *name, ElementNameType type) const
|
||||
{
|
||||
(void)type;
|
||||
|
||||
std::pair<std::string,std::string> ret;
|
||||
if(!name)
|
||||
return ret;
|
||||
auto prop = getPropertyOfGeometry();
|
||||
if(!prop) return std::make_pair("", name);
|
||||
|
||||
ret.second = name;
|
||||
auto geo = prop->getComplexData();
|
||||
if(!geo) return std::make_pair("", name);
|
||||
|
||||
return _getElementName(name, geo->getElementName(name));
|
||||
}
|
||||
|
||||
std::pair<std::string,std::string>
|
||||
GeoFeature::_getElementName(const char *name, const Data::MappedElement &mapped) const
|
||||
{
|
||||
std::pair<std::string,std::string> ret;
|
||||
if (mapped.index && mapped.name) {
|
||||
std::ostringstream ss;
|
||||
ss << Data::ComplexGeoData::elementMapPrefix()
|
||||
<< mapped.name << '.' << mapped.index;
|
||||
ret.first = ss.str();
|
||||
mapped.index.toString(ret.second);
|
||||
} else if (mapped.name) {
|
||||
// FC_TRACE("element mapped name " << name << " not found in " << getFullName());
|
||||
ret.first = name;
|
||||
const char *dot = strrchr(name,'.');
|
||||
if(dot) {
|
||||
// deliberately mangle the old style element name to signal a
|
||||
// missing reference
|
||||
ret.second = Data::MISSING_PREFIX;
|
||||
ret.second += dot+1;
|
||||
}
|
||||
} else {
|
||||
mapped.index.toString(ret.second);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user