- // fields
- int aFieldCount = document()->size(ModelAPI_ResultField::group());
- for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) {
- ResultFieldPtr aResultField =
- std::dynamic_pointer_cast<ModelAPI_ResultField>(
- document()->object(ModelAPI_ResultField::group(), aFieldIndex));
-
- FeaturePtr aFieldFeature = document()->feature(aResultField);
-
- AttributeSelectionListPtr aSelectionList =
- aFieldFeature->selectionList("selected");
- std::string aSelectionType = aSelectionList->selectionType();
- bool isWholePart = aSelectionType == "part";
-
- if (!isWholePart &&
- !isInResults(aSelectionList, aResults, allResultsCashed))// skip field not used in results
- continue;
-
- // conversion of dimension
- std::string aDimensionString =
- ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
- XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
- // get tables and their type
- std::shared_ptr<ModelAPI_AttributeTables> aTables = aFieldFeature->tables("values");
- std::string aTypeString = ExchangePlugin_Tools::valuesType2xaoType(aTables->type());
- XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString);
-
- XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(),
- aResultField->data()->name());
-
-
- try {
- // set components names
- AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names");
- for(int aComp = 0; aComp < aComponents->size(); aComp++) {
- std::string aName = aComponents->value(aComp);
- aXaoField->setComponentName(aComp, aName);
- }
+ // fields
+ int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group());
+ for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) {
+ ResultFieldPtr aResultField = std::dynamic_pointer_cast<ModelAPI_ResultField>(
+ (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex));