#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_AttributeDouble.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();
+
AttributeDoublePtr aToleranceAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>
(attributTolerance());
- GeomShapePtr aShape = ancompSolidAttr->value();
- if (aShape.get() && ancompSolidAttr->context().get() && aToleranceAttr.get()) {
+ AttributeBooleanPtr anIsCompute =
+ std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attributIsCompute());
+ if (!anIsCompute->value()) {
+ myShape = aShape;
+ anIsCompute->setValue(true);
+ }
+ if (aShape.get() && ancompSolidAttr->context().get()
+ && aToleranceAttr.get() && !aShape->isEqual(myShape)) {
+
+ if (aFacesListAttr->isInitialized())
+ aFacesListAttr->clear();
aShape = ancompSolidAttr->context()->shape();
if (aShape) {
anError))
setError("Error in duplicated faces calculation :" + anError);
+ myShape = aShape;
aFacesListAttr->setSelectionType("face");
ListOfShape::const_iterator anIt = aFaces.cbegin();
aFacesListAttr->append(ancompSolidAttr->context(), aFacePtr);
}
std::stringstream alabel;
- alabel << "Number of duplicated faces : " << aFacesListAttr->size();
+ alabel << aFacesListAttr->size();
AttributeStringPtr aNumberFacesAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeString>
(attributNumberFaces());
/// Return Attribut values of tolerance.
virtual AttributePtr attributTolerance() = 0;
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute() = 0;
+
protected:
FeaturesPlugin_CommonDuplicatedFaces() {}
// Update the list of faces
void updateFaces();
+ // the shape studied
+ GeomShapePtr myShape;
+
};
#endif
data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::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_DuplicatedFaces::attributIsCompute()
+{
+ return attribute(COMPUTE_ID());
+}
//=================================================================================================
AttributePtr FeaturesPlugin_DuplicatedFaces::attributObject()
//=================================================================================================
void FeaturesPlugin_DuplicatedFaces::updateGroup()
{
+ myCreateGroupFeature->
+ boolean(FeaturesPlugin_GroupDuplicatedFaces::COMPUTE_ID())->setValue(false);
myCreateGroupFeature->string(FeaturesPlugin_GroupDuplicatedFaces::GROUP_NAME_ID())
->setValue(string(GROUP_NAME_ID())->value());
->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_GroupDuplicatedFaces::TRANSPARENCY_ID())
->setValue(integer(TRANSPARENCY_ID())->value());
->setValue(real(TOLERANCE_ID())->value());
myCreateGroupFeature->execute();
+ myCreateGroupFeature
+ ->boolean(FeaturesPlugin_GroupDuplicatedFaces::COMPUTE_ID())->setValue(true);
}
\ No newline at end of file
return MY_NUMBER_FACES_ID;
}
- /// Attribute name for list of faces.
+ /// Attribute name for z coodinate.
inline static const std::string& LIST_FACES_ID()
{
static const std::string MY_LIST_FACES_ID("group_list");
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 tolerance.
virtual AttributePtr attributTolerance();
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute();
+
/// Create group
void createGroup();
data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId());
data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::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(), 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_GroupDuplicatedFaces::attributIsCompute()
+{
+ return attribute(COMPUTE_ID());
+}
+
//=================================================================================================
AttributePtr FeaturesPlugin_GroupDuplicatedFaces::attributListFaces()
{
if(integer(TRANSPARENCY_ID())->isInitialized()){
double aTranparency = integer(TRANSPARENCY_ID())->value()/100.0;
ModelAPI_Tools::setTransparency(aResult, aTranparency);
-
+
ResultBodyPtr aResultBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
std::list<ResultPtr> allRes;
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 tolerance.
virtual AttributePtr attributTolerance();
+ /// Return Attribut values of IsCompute.
+ virtual AttributePtr attributIsCompute();
+
};
#endif
<source>Rotation</source>
<translation>Rotation</translation>
</message>
+ <message>
+ <source>Check duplicated faces</source>
+ <translation>Vérifier les faces dupliquées</translation>
+ </message>
<message>
<source>Symmetry</source>
<translation>Symétrie</translation>
</message>
</context>
+ <!-- Check duplicated faces -->
+ <context>
+ <name>Duplicated_faces_macro</name>
+ <message>
+ <source>Check duplicated faces</source>
+ <translation>Vérifier les faces dupliquées</translation>
+ </message>
+ <message>
+ <source>Duplicated faces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ <message>
+ <source>Number of duplicated faces : </source>
+ <translation>Nombre de faces dupliquées : </translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:create_group</name>
+ <message>
+ <source>Create group</source>
+ <translation>Créer un groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:group_name</name>
+ <message>
+ <source>Group name</source>
+ <translation>Nom du groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:main_object</name>
+ <message>
+ <source>Object</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>Duplicated faces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:group_list</name>
+ <message>
+ <source>Duplicated faces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ <message>
+ <source>List of faces :</source>
+ <translation>Liste des faces :</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:transparency</name>
+ <message>
+ <source>Transparency</source>
+ <translation>Transparence</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces_macro:tolerance</name>
+ <message>
+ <source>Tolerance</source>
+ <translation>Tolérance</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces</name>
+ <message>
+ <source>Check duplicated faces</source>
+ <translation>Vérifier les faces dupliquées</translation>
+ </message>
+ <message>
+ <source>Duplicated faces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ <message>
+ <source>Number of duplicated faces : </source>
+ <translation>Nombre de faces dupliquées : </translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:create_group</name>
+ <message>
+ <source>Create group</source>
+ <translation>Créer un groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:group_name</name>
+ <message>
+ <source>Group name</source>
+ <translation>Nom du groupe</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:main_object</name>
+ <message>
+ <source>Object</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>Duplicated faces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:group_list</name>
+ <message>
+ <source>Duplicatedfaces</source>
+ <translation>Faces dupliquées</translation>
+ </message>
+ <message>
+ <source>List of faces :</source>
+ <translation>Liste des faces :</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:transparency</name>
+ <message>
+ <source>Transparency</source>
+ <translation>Transparence</translation>
+ </message>
+ </context>
+ <context>
+ <name>Duplicated_faces:tolerance</name>
+ <message>
+ <source>Tolerance</source>
+ <translation>Tolérance</translation>
+ </message>
+ </context>
+
<!-- Symmetry -->
<context>
<name>Symmetry</name>
<validator id="GeomValidators_ShapeType" parameters="compsolid,compound"/>
</shape_selector>
<groupbox title="Duplicated faces">
- <label id="number_duplicated_faces"/>
+ <label id="number_duplicated_faces" label="Number of duplicated faces : " />
<multi_selector id="group_list"
label="List of faces :"
icon=""
default="1e-7">
</doublevalue>
<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="Duplicated faces">
- <label id="number_duplicated_faces"/>
+ <label id="number_duplicated_faces" label="Number of duplicated faces : "/>
<multi_selector id="group_list"
label="List of faces :"
icon=""
step="0.00001"
default="1e-7">
</doublevalue>
- <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