X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_IconFactory.cpp;h=1636a6ca234bf5c34ce2b8c8edeb4c3c7de0cea9;hb=383021cb51c4720904096ca851db5ee79255b402;hp=30fe5aa4b718a655791f955bfa6e2d6cd2db9f76;hpb=82d3fff7d0ed2c089da5aa6b106789be076081f3;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_IconFactory.cpp b/src/PartSet/PartSet_IconFactory.cpp index 30fe5aa4b..1636a6ca2 100644 --- a/src/PartSet/PartSet_IconFactory.cpp +++ b/src/PartSet/PartSet_IconFactory.cpp @@ -19,7 +19,6 @@ QMap PartSet_IconFactory::myIcons; PartSet_IconFactory::PartSet_IconFactory():ModuleBase_IconFactory() { - setFactory(this); Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT())); } @@ -29,6 +28,9 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) { QIcon anIcon; + if (!theObj.get()) + return anIcon; + FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); if (aFeature.get()) { std::string aKind = aFeature->getKind(); @@ -42,7 +44,7 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) switch(aState) { case ModelAPI_StateDone: case ModelAPI_StateNothing: { - anIcon = QIcon(anIconString); + anIcon = loadIcon(anIconString); } break; case ModelAPI_StateMustBeUpdated: { @@ -60,17 +62,40 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) break; default: break; } - } else { - std::string aGroup = theObj->groupName(); - if (aGroup == ModelAPI_ResultPart::group()) { - return QIcon(":pictures/part_ico.png"); - } else { - if (theObj && theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated) - return QIcon(":pictures/constr_object_modified.png"); - return QIcon(":pictures/constr_object.png"); + } + + if (theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated) + return QIcon(":pictures/constr_object_modified.png"); + + std::string aGroup = theObj->groupName(); + if (aGroup == ModelAPI_ResultPart::group()) + return QIcon(":pictures/part_ico.png"); + + if (aGroup == ModelAPI_ResultConstruction::group()) + return QIcon(":pictures/constr_object.png"); + + ResultPtr aResult = std::dynamic_pointer_cast(theObj); + if (aResult.get()) { + GeomShapePtr aShape = aResult->shape(); + if(aShape.get()) { + switch(aShape->shapeType()) { + case GeomAPI_Shape::COMPOUND: { + ResultBodyPtr aBody = std::dynamic_pointer_cast(aResult); + if (aBody.get() && aBody->isConnectedTopology()) + return QIcon(":pictures/compoundofsolids.png"); + return QIcon(":pictures/compound.png"); + } + case GeomAPI_Shape::COMPSOLID: return QIcon(":pictures/compsolid.png"); + case GeomAPI_Shape::SOLID: return QIcon(":pictures/solid.png"); + case GeomAPI_Shape::SHELL: return QIcon(":pictures/shell.png"); + case GeomAPI_Shape::FACE: return QIcon(":pictures/face.png"); + case GeomAPI_Shape::WIRE: return QIcon(":pictures/wire.png"); + case GeomAPI_Shape::EDGE: return QIcon(":pictures/edge.png"); + case GeomAPI_Shape::VERTEX: return QIcon(":pictures/vertex.png"); + } } } - return anIcon; + return anIcon; } void PartSet_IconFactory::processEvent(const std::shared_ptr& theMessage)