- std::list<AttributePtr> anAttrs = aFeature->data()->attributes("");
- std::list<AttributePtr>::const_iterator anIt = anAttrs.begin(), aLast = anAttrs.end();
- QStringList aValues;
- for(; anIt != aLast; anIt++) {
- AttributePtr anAttr = *anIt;
- QString aValue = "not defined";
- std::string aType = anAttr->attributeType();
- if (aType == GeomDataAPI_Point2D::typeId()) {
- std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- anAttr);
- if (aPoint.get())
- aValue = QString("(%1, %2)").arg(aPoint->x()).arg(aPoint->y());
- }
- else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- }
+ std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes;
+ std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature,
+ anAttributes).c_str();
+ if (!aPointsInfo.empty())
+ aFeatureStr.append(QString(", attributes: %1")
+ .arg(aPointsInfo.c_str()).toStdString().c_str());
+ }
+ }
+
+ return aFeatureStr;
+}
+
+#ifdef DEBUG_SELECTION_INFO
+QString getShapeTypeInfo(const int theType)
+{
+ QString anInfo = "Undefined";
+ switch(theType) {
+ case TopAbs_COMPOUND: anInfo = "compound"; break;
+ case TopAbs_COMPSOLID: anInfo = "compsolid"; break;
+ case TopAbs_SOLID: anInfo = "solid"; break;
+ case TopAbs_SHELL: anInfo = "shell"; break;
+ case TopAbs_FACE: anInfo = "face"; break;
+ case TopAbs_WIRE: anInfo = "wire"; break;
+ case TopAbs_EDGE: anInfo = "edge"; break;
+ case TopAbs_VERTEX: anInfo = "vertex"; break;
+ case TopAbs_SHAPE: anInfo = "shape"; break;
+ case ModuleBase_ResultPrs::Sel_Result:
+ anInfo = "result_shape"; break;
+ default: break;
+ }
+ return anInfo;
+}
+
+QString getModeInfo(const int theMode)
+{
+ QString anInfo = "Undefined";
+ switch(theMode) {
+ case 0: anInfo = "SHAPE(0)"; break;
+ case 1: anInfo = "VERTEX(1)"; break;
+ case 2: anInfo = "EDGE(2)"; break;
+ case 3: anInfo = "WIRE(3)"; break;
+ case 4: anInfo = "FACE(4)"; break;
+ case 5: anInfo = "SHELL(5)"; break;
+ case 6: anInfo = "SOLID(6)"; break;
+ case 7: anInfo = "COMPSOLID(7)"; break;
+ case 8: anInfo = "COMPOUND(8)"; break;
+ case 100: anInfo = "Sel_Mode_First(100)"; break; //SketcherPrs_Tools
+ case 101: anInfo = "Sel_Constraint(101)"; break;
+ case 102: anInfo = "Sel_Dimension_All(102)"; break;
+ case 103: anInfo = "Sel_Dimension_Line(103)"; break;
+ case 104: anInfo = "Sel_Dimension_Text(104)"; break;
+ default: break;
+ }
+ return anInfo;
+}
+
+QString displayedInteractiveObjects(Handle(AIS_InteractiveContext)& theContext,
+ const bool theShapeInfoOnly = true)
+{
+ if (theContext.IsNull())
+ return "";
+ AIS_ListOfInteractive aListOfIO;
+ theContext->DisplayedObjects(aListOfIO, false);
+ QStringList anObjects;
+ AIS_ListIteratorOfListOfInteractive aIt;
+ for (aIt.Initialize(aListOfIO); aIt.More(); aIt.Next()) {
+ Handle(AIS_InteractiveObject) anAISIO = aIt.Value();
+ Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISIO);
+ if (theShapeInfoOnly && aShapePrs.IsNull())
+ continue;
+
+ QString anInfo = "IO";
+ std::ostringstream aPtrStr;
+ aPtrStr << "[" << anAISIO.Access() << "]";
+ anInfo += aPtrStr.str().c_str();