Salome HOME
Implementation of task "3.1. Ability to export the PartSet to GEOM"
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <ExchangePlugin_ExportFeature.h>
21
22 #include <algorithm>
23 #include <iterator>
24 #include <string>
25 #ifdef _DEBUG
26 #include <iostream>
27 #include <ostream>
28 #endif
29
30 #include <Config_Common.h>
31 #include <Config_PropManager.h>
32
33 #include <GeomAlgoAPI_BREPExport.h>
34 #include <GeomAlgoAPI_CompoundBuilder.h>
35 #include <GeomAlgoAPI_IGESExport.h>
36 #include <GeomAlgoAPI_STEPExport.h>
37 #include <GeomAlgoAPI_Tools.h>
38 #include <GeomAlgoAPI_XAOExport.h>
39
40 #include <GeomAPI_Shape.h>
41
42 #include <ModelAPI_AttributeSelectionList.h>
43 #include <ModelAPI_AttributeString.h>
44 #include <ModelAPI_AttributeStringArray.h>
45 #include <ModelAPI_AttributeIntArray.h>
46 #include <ModelAPI_AttributeTables.h>
47 #include <ModelAPI_Data.h>
48 #include <ModelAPI_Document.h>
49 #include <ModelAPI_Object.h>
50 #include <ModelAPI_ResultBody.h>
51 #include <ModelAPI_ResultPart.h>
52 #include <ModelAPI_ResultGroup.h>
53 #include <ModelAPI_ResultField.h>
54 #include <ModelAPI_Session.h>
55 #include <ModelAPI_Validator.h>
56 #include <ModelAPI_Tools.h>
57
58 #include <Events_InfoMessage.h>
59
60 #include <XAO_Group.hxx>
61 #include <XAO_Field.hxx>
62 #include <XAO_Xao.hxx>
63 #include <XAO_Geometry.hxx>
64
65 #include <ExchangePlugin_Tools.h>
66
67 ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
68 {
69 }
70
71 ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature()
72 {
73   // TODO Auto-generated destructor stub
74 }
75
76 /*
77  * Request for initialization of data model of the feature: adding all attributes
78  */
79 void ExchangePlugin_ExportFeature::initAttributes()
80 {
81   data()->addAttribute(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
82     ModelAPI_AttributeString::typeId());
83   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(),
84     ModelAPI_AttributeString::typeId());
85   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
86     ModelAPI_AttributeString::typeId());
87   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
88     ModelAPI_AttributeString::typeId());
89   data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
90     ModelAPI_AttributeSelectionList::typeId());
91   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
92     ModelAPI_AttributeString::typeId());
93   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
94     ModelAPI_AttributeString::typeId());
95
96   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
97     ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID());
98   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
99     ExchangePlugin_ExportFeature::XAO_AUTHOR_ID());
100   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
101     ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID());
102 }
103
104 void ExchangePlugin_ExportFeature::attributeChanged(const std::string& theID)
105 {
106   if (theID == XAO_FILE_PATH_ID()) {
107     string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
108       string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value());
109   }
110 }
111
112 /*
113  * Computes or recomputes the results
114  */
115 void ExchangePlugin_ExportFeature::execute()
116 {
117   AttributeStringPtr aFormatAttr =
118       this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
119   std::string aFormat = aFormatAttr->value();
120
121   AttributeStringPtr aFilePathAttr =
122       this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
123   std::string aFilePath = aFilePathAttr->value();
124   if (aFilePath.empty())
125     return;
126
127   exportFile(aFilePath, aFormat);
128 }
129
130 void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName,
131                                               const std::string& theFormat)
132 {
133   std::string aFormatName = theFormat;
134
135   if (aFormatName.empty()) { // get default format for the extension
136     // ".brep" -> "BREP"
137     std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName);
138     if (anExtension == "BREP" || anExtension == "BRP") {
139       aFormatName = "BREP";
140     } else if (anExtension == "STEP" || anExtension == "STP") {
141       aFormatName = "STEP";
142     } else if (anExtension == "IGES" || anExtension == "IGS") {
143       aFormatName = "IGES-5.1";
144     } else if (anExtension == "XAO") {
145       aFormatName = "XAO";
146     } else {
147       aFormatName = anExtension;
148     }
149   }
150
151   if (aFormatName == "XAO") {
152     exportXAO(theFileName);
153     return;
154   }
155
156   // make shape for export from selected shapes
157   AttributeSelectionListPtr aSelectionListAttr =
158       this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
159   std::list<GeomShapePtr> aShapes;
160   for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; ++i) {
161     AttributeSelectionPtr anAttrSelection = aSelectionListAttr->value(i);
162     std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
163     if (aCurShape.get() == NULL)
164       aCurShape = anAttrSelection->context()->shape();
165     if (aCurShape.get() != NULL)
166       aShapes.push_back(aCurShape);
167   }
168
169   // Store compound if we have more than one shape.
170   std::shared_ptr<GeomAPI_Shape> aShape;
171   if(aShapes.size() == 1) {
172     aShape = aShapes.front();
173   } else {
174     aShape = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
175   }
176
177   // Perform the export
178   std::string anError;
179   bool aResult = false;
180   if (aFormatName == "BREP") {
181     aResult = BREPExport(theFileName, aFormatName, aShape, anError);
182   } else if (aFormatName == "STEP") {
183     aResult = STEPExport(theFileName, aFormatName, aShape, anError);
184   } else if (aFormatName.substr(0, 4) == "IGES") {
185     aResult = IGESExport(theFileName, aFormatName, aShape, anError);
186   } else {
187     anError = "Unsupported format: " + aFormatName;
188   }
189
190   if (!anError.empty()) {
191     setError("An error occurred while exporting " + theFileName + ": " + anError);
192     return;
193   }
194 }
195
196 /// Returns XAO string by the value from the table
197 static std::string valToString(const ModelAPI_AttributeTables::Value& theVal,
198   const ModelAPI_AttributeTables::ValueType& theType) {
199   std::ostringstream aStr; // the resulting string value
200   switch(theType) {
201   case ModelAPI_AttributeTables::BOOLEAN:
202     aStr<<(theVal.myBool ? "true" : "false");
203     break;
204   case ModelAPI_AttributeTables::INTEGER:
205     aStr<<theVal.myInt;
206     break;
207   case ModelAPI_AttributeTables::DOUBLE:
208     aStr<<theVal.myDouble;
209     break;
210   case ModelAPI_AttributeTables::STRING:
211     aStr<<theVal.myStr;
212     break;
213   }
214   return aStr.str();
215 }
216
217 /// Returns true if something in selection is presented in the results list
218 static bool isInResults(AttributeSelectionListPtr theSelection,
219                         const std::list<ResultPtr>& theResults,
220                         std::set<ResultPtr>& theCashedResults)
221 {
222   // collect all results into a cashed set
223   if (theCashedResults.empty()) {
224     std::list<ResultPtr> aResults;
225     std::list<ResultPtr>::const_iterator aRes = theResults.cbegin();
226     for(; aRes != theResults.cend(); aRes++) {
227       if (theCashedResults.count(*aRes))
228         continue;
229       else
230         theCashedResults.insert(*aRes);
231       if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) {
232         ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
233         std::list<ResultPtr> aResults;
234         ModelAPI_Tools::allSubs(aResBody, aResults, false);
235         for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
236           theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
237         }
238       } else if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { // all results of the part
239         ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
240         DocumentPtr aPartDoc = aResPart->partDoc();
241         if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
242           return false;
243         }
244         int aBodyCount = aPartDoc->size(ModelAPI_ResultBody::group());
245         for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
246           ResultBodyPtr aResBody =
247             std::dynamic_pointer_cast<ModelAPI_ResultBody>(
248               aPartDoc->object(ModelAPI_ResultBody::group(), aBodyIndex));
249           if (aResBody.get()) {
250             theCashedResults.insert(aResBody);
251             std::list<ResultPtr> aResults;
252             ModelAPI_Tools::allSubs(aResBody, aResults, false);
253             for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
254               theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
255             }
256           }
257         }
258       }
259     }
260   }
261   // if context is in results, return true
262   for(int a = 0; a < theSelection->size(); a++) {
263     AttributeSelectionPtr anAttr = theSelection->value(a);
264     ResultBodyPtr aSelected= std::dynamic_pointer_cast<ModelAPI_ResultBody>(anAttr->context());
265     if (aSelected.get() && theCashedResults.count(aSelected))
266       return true;
267   }
268   return false;
269 }
270
271 void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
272 {
273   try {
274
275   std::string anError;
276   XAO::Xao aXao;
277
278   // author
279
280   std::string anAuthor = string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value();
281   aXao.setAuthor(anAuthor);
282
283   // make shape for export from all results
284   std::list<GeomShapePtr> aShapes;
285   std::list<ResultPtr> aResults;
286   std::list<DocumentPtr> aDocuments; /// documents of Parts selected and used in export
287
288   AttributeSelectionListPtr aSelection = selectionList(SELECTION_LIST_ID());
289   bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0;
290   if (aIsSelection) { // a mode for export to geom result by result
291     for(int a = 0; a < aSelection->size(); a++) {
292       AttributeSelectionPtr anAttr = aSelection->value(a);
293       ResultPtr aBodyContext =
294         std::dynamic_pointer_cast<ModelAPI_Result>(anAttr->context());
295       if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get()) {
296         aResults.push_back(aBodyContext);
297         GeomShapePtr aShape = anAttr->value();
298         if (!aShape.get())
299           aShape = aBodyContext->shape();
300         aShapes.push_back(aShape);
301         if (aBodyContext->groupName() == ModelAPI_ResultPart::group()) {
302           ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aBodyContext);
303           DocumentPtr aPartDoc = aResPart->partDoc();
304           if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
305             std::string msg = "Can not export XAO for not loaded part";
306             Events_InfoMessage("ExportFeature", msg, this).send();
307             return;
308           } else {
309             aDocuments.push_back(aPartDoc);
310           }
311         }
312       }
313     }
314   } else {
315     int aBodyCount = document()->size(ModelAPI_ResultBody::group());
316     for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
317       ResultBodyPtr aResultBody =
318           std::dynamic_pointer_cast<ModelAPI_ResultBody>(
319               document()->object(ModelAPI_ResultBody::group(), aBodyIndex));
320       if (!aResultBody.get())
321         continue;
322       aShapes.push_back(aResultBody->shape());
323       aResults.push_back(aResultBody);
324     }
325   }
326   if (aShapes.empty()) {
327     setError("No shapes to export");
328     return;
329   }
330
331
332   GeomShapePtr aShape = (aShapes.size() == 1)
333       ? *aShapes.begin()
334       : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
335
336   SetShapeToXAO(aShape, &aXao, anError);
337
338   if (!anError.empty()) {
339     setError("An error occurred while exporting " + theFileName + ": " + anError);
340     return;
341   }
342
343   // geometry name
344   std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
345   if (aGeometryName.empty() && aResults.size() == 1) {
346     // get the name from the first result
347     ResultPtr aResultBody = *aResults.begin();
348     aGeometryName = aResultBody->data()->name();
349   }
350
351   aXao.getGeometry()->setName(aGeometryName);
352
353   std::set<ResultPtr> allResultsCashed; // cash to speed up searching in all results selected
354
355   // iterate all documents used
356   if (aDocuments.empty())
357     aDocuments.push_back(document());
358   std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
359   for(; aDoc != aDocuments.end(); aDoc++) {
360     // groups
361     int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
362     for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) {
363       ResultGroupPtr aResultGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(
364           (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex));
365
366       FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup);
367
368       AttributeSelectionListPtr aSelectionList =
369           aGroupFeature->selectionList("group_list");
370       if (!isInResults(aSelectionList, aResults, allResultsCashed))// skip group not used in result
371         continue;
372
373       // conversion of dimension
374       std::string aSelectionType = aSelectionList->selectionType();
375       std::string aDimensionString =
376         ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
377       XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
378
379       XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension,
380                                             aResultGroup->data()->name());
381
382       try {
383         for (int aSelectionIndex = 0; aSelectionIndex < aSelectionList->size(); ++aSelectionIndex){
384           AttributeSelectionPtr aSelection = aSelectionList->value(aSelectionIndex);
385
386           // complex conversion of reference id to element index
387           // gives bad id in case the selection is done from python script
388           // => using GeomAlgoAPI_CompoundBuilder::id instead
389           // int aReferenceID_old = aSelection->Id();
390
391           int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
392
393           if (aReferenceID == 0) // selected value does not found in the exported shape
394             continue;
395
396           std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
397           int anElementID =
398             aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString);
399
400           aXaoGroup->add(anElementID);
401         }
402       } catch (XAO::XAO_Exception& e) {
403         // LCOV_EXCL_START
404         std::string msg = "An error occurred while exporting group " +
405           aResultGroup->data()->name();
406         msg += ".\n";
407         msg += e.what();
408         msg += "\n";
409         msg += "=> skipping this group from XAO export.";
410         Events_InfoMessage("ExportFeature", msg, this).send();
411         aXao.removeGroup(aXaoGroup);
412         // LCOV_EXCL_STOP
413       }
414     }
415
416     // fields
417     int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group());
418     for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) {
419       ResultFieldPtr aResultField = std::dynamic_pointer_cast<ModelAPI_ResultField>(
420         (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex));
421
422       FeaturePtr aFieldFeature = (*aDoc)->feature(aResultField);
423
424       AttributeSelectionListPtr aSelectionList =
425           aFieldFeature->selectionList("selected");
426       std::string aSelectionType = aSelectionList->selectionType();
427       bool isWholePart = aSelectionType == "part";
428       // skip field not used in results
429       if (!isWholePart && !isInResults(aSelectionList, aResults, allResultsCashed))
430         continue;
431
432       // conversion of dimension
433       std::string aDimensionString =
434         ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
435       XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
436       // get tables and their type
437       std::shared_ptr<ModelAPI_AttributeTables> aTables = aFieldFeature->tables("values");
438       std::string aTypeString = ExchangePlugin_Tools::valuesType2xaoType(aTables->type());
439       XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString);
440
441       XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(),
442                                             aResultField->data()->name());
443
444
445       try {
446         // set components names
447         AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names");
448         for(int aComp = 0; aComp < aComponents->size(); aComp++) {
449           std::string aName = aComponents->value(aComp);
450           aXaoField->setComponentName(aComp, aName);
451         }
452
453         AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps");
454         for (int aStepIndex = 0; aStepIndex < aTables->tables(); aStepIndex++) {
455           XAO::Step* aStep = aXaoField->addNewStep(aStepIndex);
456           aStep->setStep(aStepIndex);
457           int aStampIndex = aStamps->value(aStepIndex);
458           aStep->setStamp(aStampIndex);
459           int aNumElements = isWholePart ? aXaoField->countElements() : aTables->rows();
460           int aNumComps = aTables->columns();
461           std::set<int> aFilledIDs; // to fill the rest by defaults
462           // omit default values first row
463           for(int aRow = isWholePart ? 0 : 1; aRow < aNumElements; aRow++) {
464             for(int aCol = 0; aCol < aNumComps; aCol++) {
465               int anElementID = 0;
466               if (!isWholePart) {
467                 // element index actually is the ID of the selection
468                 AttributeSelectionPtr aSelection = aSelectionList->value(aRow - 1);
469                 int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
470                 if (aReferenceID == 0) // selected value does not found in the exported shape
471                   continue;
472
473                 std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
474                 anElementID = aXao.getGeometry()->
475                   getElementIndexByReference(aFieldDimension, aReferenceString);
476               }
477
478               ModelAPI_AttributeTables::Value aVal = aTables->value(
479                 isWholePart ? 0 : aRow, aCol, aStepIndex);
480               std::string aStrVal = valToString(aVal, aTables->type());
481               aStep->setStringValue(isWholePart ? aRow : anElementID, aCol, aStrVal);
482               aFilledIDs.insert(anElementID);
483             }
484           }
485           if (!isWholePart) { // fill the rest values by default ones
486             XAO::GeometricElementList::iterator allElem =
487               aXao.getGeometry()->begin(aFieldDimension);
488             for(; allElem != aXao.getGeometry()->end(aFieldDimension); allElem++) {
489               if (aFilledIDs.find(allElem->first) != aFilledIDs.end())
490                 continue;
491               for(int aCol = 0; aCol < aNumComps; aCol++) {
492                 // default value
493                 ModelAPI_AttributeTables::Value aVal = aTables->value(0, aCol, aStepIndex);
494                 std::string aStrVal = valToString(aVal, aTables->type());
495                 aStep->setStringValue(allElem->first, aCol, aStrVal);
496               }
497             }
498           }
499         }
500       } catch (XAO::XAO_Exception& e) {
501         // LCOV_EXCL_START
502         std::string msg = "An error occurred while exporting field " +
503           aResultField->data()->name();
504         msg += ".\n";
505         msg += e.what();
506         msg += "\n";
507         msg += "=> skipping this field from XAO export.";
508         Events_InfoMessage("ExportFeature", msg, this).send();
509         aXao.removeField(aXaoField);
510         // LCOV_EXCL_STOP
511       }
512     }
513   }
514
515   // exporting
516   XAOExport(theFileName, &aXao, anError);
517
518   if (!anError.empty()) {
519     setError("An error occurred while exporting " + theFileName + ": " + anError);
520     return;
521   }
522
523 // LCOV_EXCL_START
524   } catch (XAO::XAO_Exception& e) {
525     std::string anError = e.what();
526     setError("An error occurred while exporting " + theFileName + ": " + anError);
527     return;
528   }
529 // LCOV_EXCL_STOP
530 }
531
532 bool ExchangePlugin_ExportFeature::isMacro() const
533 {
534   if (!data().get() || !data()->isValid())
535     return false;
536   ExchangePlugin_ExportFeature* aThis = ((ExchangePlugin_ExportFeature*)(this));
537   AttributeStringPtr aFormatAttr = aThis->string(FILE_FORMAT_ID());
538   if (!aFormatAttr.get())
539     return false;
540   std::string aFormat = aFormatAttr->value();
541
542   if (aFormat.empty()) { // get default format for the extension
543     AttributeStringPtr aFilePathAttr = aThis->string(FILE_PATH_ID());
544     std::string aFilePath = aFilePathAttr->value();
545     if (!aFilePath.empty()) {
546       std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath);
547       if (anExtension == "XAO") {
548         aFormat = "XAO";
549       }
550     }
551   }
552
553   if (aFormat == "XAO") { // on export to GEOm the selection attribute is filled - this is
554                           // an exceptional case where export to XAO feature must be kept
555     AttributeSelectionListPtr aList = aThis->selectionList(SELECTION_LIST_ID());
556     return !aList->isInitialized() || aList->size() == 0;
557   }
558   return true;
559 }