#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_Data.h>
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
(attributListFaces());
- if (aFacesListAttr->isInitialized())
- aFacesListAttr->clear();
-
GeomShapePtr aShape = ancompSolidAttr->value();
- if (aShape.get() && ancompSolidAttr->context().get()) {
+
+ AttributeBooleanPtr anIsCompute =
+ std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attributIsCompute());
+ if (!anIsCompute->value()) {
+ myShape = aShape;
+ anIsCompute->setValue(true);
+ }
+ if (aShape.get() && ancompSolidAttr->context().get() && !aShape->isEqual(myShape)) {
+
+ if (aFacesListAttr->isInitialized())
+ aFacesListAttr->clear();
aShape = ancompSolidAttr->context()->shape();
if (aShape) {
anError))
setError("Error in GetSharedFaces calculation :" + anError);
+ myShape = aShape;
aFacesListAttr->setSelectionType("face");
ListOfShape::const_iterator anIt = aFaces.cbegin();
aFacesListAttr->append( ancompSolidAttr->context(), aFacePtr);
}
std::stringstream alabel;
- alabel << "Number of shared faces : " << aFacesListAttr->size();
+ alabel << aFacesListAttr->size();
AttributeStringPtr aNumberFacesAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeString>
(attributNumberFaces());
/// Return Attribut values of result.
virtual AttributePtr attributNumberFaces() = 0;
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute() = 0;
+
protected:
FeaturesPlugin_CommonSharedFaces() {}
// Update the list of faces
void updateFaces();
+ // the shape studied
+ GeomShapePtr myShape;
+
};
#endif
data()->addAttribute(NUMBER_FACES_ID(), ModelAPI_AttributeString::typeId());
data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId());
data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TRANSPARENCY_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), NUMBER_FACES_ID());
+ data()->boolean(COMPUTE_ID())->setValue(true);
}
return attribute(OBJECT_ID());
}
+//=================================================================================================
+AttributePtr FeaturesPlugin_GroupSharedFaces::attributIsCompute()
+{
+ return attribute(COMPUTE_ID());
+}
+
//=================================================================================================
AttributePtr FeaturesPlugin_GroupSharedFaces::attributListFaces()
{
return MY_GROUP_NAME_ID;
}
+ /// Attribute name for indicate to launch the algo.
+ inline static const std::string& COMPUTE_ID()
+ {
+ static const std::string MY_COMPUTE_ID("compute");
+ return MY_COMPUTE_ID;
+ }
+
/// Performs the algorithm and stores results it in the data structure.
FEATURESPLUGIN_EXPORT virtual void execute();
/// Return Attribut values of number of faces.
virtual AttributePtr attributNumberFaces();
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute();
+
};
#endif
data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId());
data()->addAttribute(CREATE_GROUP_ID(), ModelAPI_AttributeBoolean::typeId());
data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), GROUP_NAME_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID());
+ data()->boolean(COMPUTE_ID())->setValue(true);
}
+//=================================================================================================
+AttributePtr FeaturesPlugin_SharedFaces::attributIsCompute()
+{
+ return attribute(COMPUTE_ID());
+}
//=================================================================================================
AttributePtr FeaturesPlugin_SharedFaces::attributObject()
//=================================================================================================
void FeaturesPlugin_SharedFaces::updateGroup()
{
+ myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID())->setValue(false);
myCreateGroupFeature->string(FeaturesPlugin_GroupSharedFaces::GROUP_NAME_ID())
->setValue( string(GROUP_NAME_ID())->value());
myCreateGroupFeature->selection(FeaturesPlugin_GroupSharedFaces::OBJECT_ID())
->setValue( selection(OBJECT_ID())->context() ,
selection(OBJECT_ID())->value() );
+ AttributeSelectionListPtr aFacesFeatures =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
+ (myCreateGroupFeature->attribute(LIST_FACES_ID()));
+ AttributeSelectionListPtr aFaces =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(attribute(LIST_FACES_ID()));
+
+ aFaces->copyTo(aFacesFeatures);
myCreateGroupFeature->integer(FeaturesPlugin_GroupSharedFaces::TRANSPARENCY_ID())
->setValue( integer(TRANSPARENCY_ID())->value());
myCreateGroupFeature->execute();
+ myCreateGroupFeature->boolean(FeaturesPlugin_GroupSharedFaces::COMPUTE_ID())->setValue(true);
}
\ No newline at end of file
return MY_CREATE_GROUP_ID;
}
+ /// Attribute name for indicate to launch the algo.
+ inline static const std::string& COMPUTE_ID()
+ {
+ static const std::string MY_COMPUTE_ID("compute");
+ return MY_COMPUTE_ID;
+ }
+
/// Attribute name for group name.
inline static const std::string& GROUP_NAME_ID()
{
/// Return Attribut values of number of faces.
virtual AttributePtr attributNumberFaces();
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute();
+
/// Create group
void createGroup();
<source>Rotation</source>
<translation>Rotation</translation>
</message>
+ <message>
+ <source>Check shared faces</source>
+ <translation>Vérifier les faces partagées</translation>
+ </message>
<message>
<source>Symmetry</source>
<translation>Symétrie</translation>
</message>
</context>
+ <!-- Check shared faces -->
+ <context>
+ <name>Shared_faces_macro</name>
+ <message>
+ <source>Check shared faces</source>
+ <translation>Vérifier les faces partagées</translation>
+ </message>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ <message>
+ <source>Number of shared faces : </source>
+ <translation>Nombre de face partagées : </translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces_macro:create_group</name>
+ <message>
+ <source>Create group</source>
+ <translation>Créer un groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces_macro:group_name</name>
+ <message>
+ <source>Group name</source>
+ <translation>Nom du groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces_macro:main_object</name>
+ <message>
+ <source>Object</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces_macro:group_list</name>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ <message>
+ <source>List of faces :</source>
+ <translation>Liste des faces :</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces_macro:transparency</name>
+ <message>
+ <source>Transparency</source>
+ <translation>Transparence</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces</name>
+ <message>
+ <source>Check shared faces</source>
+ <translation>Vérifier les faces partagées</translation>
+ </message>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ <message>
+ <source>Number of shared faces : </source>
+ <translation>Nombre de face partagées : </translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces:create_group</name>
+ <message>
+ <source>Create group</source>
+ <translation>Créer un groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces:group_name</name>
+ <message>
+ <source>Group name</source>
+ <translation>Nom du groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces:main_object</name>
+ <message>
+ <source>Object</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces:group_list</name>
+ <message>
+ <source>Shared faces</source>
+ <translation>Faces partagées</translation>
+ </message>
+ <message>
+ <source>List of faces :</source>
+ <translation>Liste des faces :</translation>
+ </message>
+ </context>
+ <context>
+ <name>Shared_faces:transparency</name>
+ <message>
+ <source>Transparency</source>
+ <translation>Transparence</translation>
+ </message>
+ </context>
+
<!-- Symmetry -->
<context>
<name>Symmetry</name>
<validator id="GeomValidators_ShapeType" parameters="compsolid,compound"/>
</shape_selector>
<groupbox title="Shared faces">
- <label id="number_shared_faces"/>
+ <label id="number_shared_faces" label="Number of shared faces : "/>
<multi_selector id="group_list"
- label="Liste of faces :"
+ label="List of faces :"
icon=""
shape_types="faces"
Block_selection = "true"
default="50">
</integervalue>
<optionalbox id="create_group" title="Create group" show_title="true">
- <stringvalue id="group_name" label="Group Name"/>
+ <stringvalue id="group_name" label="Group name"/>
<label/>
</optionalbox>
</source>
<validator id="GeomValidators_ShapeType" parameters="compsolid,compound"/>
</shape_selector>
<groupbox title="Shared faces">
- <label id="number_shared_faces"/>
+ <label id="number_shared_faces" label="Number of shared faces : "/>
<multi_selector id="group_list"
- label="Liste of faces :"
+ label="List of faces :"
icon=""
shape_types="faces"
Block_selection = "true"
step="10"
default="50">
</integervalue>
- <stringvalue id="group_name" label="Group Name"/>
+ <stringvalue id="group_name" label="Group name"/>
</source>
: ModuleBase_ModelWidget(theParent, theData)
{
QString aText = translate(theData->getProperty("title"));
+
+ myPrefix = theData->getProperty(ATTR_LABEL);
+
bool aIsHtml = theData->getBooleanAttribute(ATTR_HTML_STYLE, false);
QString aLabelIcon = QString::fromStdString(theData->getProperty("icon"));
aText = ModuleBase_Tools::translate(myFeature->getKind(), aMsg);
}
}
- myLabel->setText(aText);
+ if (myPrefix == "") {
+ myLabel->setText(aText);
+ } else {
+ myLabel->setText( ModuleBase_Tools::translate(myFeature->getKind(), myPrefix) + aText);
+ }
}
return true;
}
/// A label control
QLabel* myLabel;
+ /// prefix for label
+ std::string myPrefix;
};
#endif