/// default deflection for a result body
inline static const std::string DEFAULT_DEFLECTION()
{
- return "0.001";
+ return "0.0001";
}
/// Iternal enumeration for storage the information of connected topology flag
/// default deflection for a result construction
inline static const std::string DEFAULT_DEFLECTION()
{
- return "0.0001";
+ return "0.00001";
}
/// Sets the result
#include <QWidget>
#include <QTableWidget>
#include <QHeaderView>
-#include <QToolButton>
+#include <QCheckBox>
+#include <QVBoxLayout>
const int DEFAULT_NAME_COLUMN_WIDTH = 200;
anAttributeList->clear();
int aSize1 = anAttributeList->size(false);
for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) {
- QToolButton* aButton = dynamic_cast<QToolButton*>(myView->cellWidget(i, 0));;
+ QCheckBox* aButton = dynamic_cast<QCheckBox*>(myView->cellWidget(i, 0)->findChild<QCheckBox*>());
if (aButton->isChecked())
anAttributeList->append(myConcealedResults[i]);
}
int aSize = anAttributeList->size();
for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) {
ResultPtr aResult = myConcealedResults[i];
- QToolButton* aButton = dynamic_cast<QToolButton*>(myView->cellWidget(i, 0));
+ QCheckBox* aButton = dynamic_cast<QCheckBox*>(myView->cellWidget(i, 0)->findChild<QCheckBox*>());
bool isChecked = anAttributeList->isInList(aResult);
bool aBlocked = aButton->blockSignals(true);
aButton->setChecked(isChecked);
- this->updateItemIcon(aButton);
aButton->blockSignals(aBlocked);
}
return true;
int anId = myView->rowCount();
myView->setRowCount(anId+1);
- QToolButton* aVisibilityBtn = new QToolButton(this);
+ QWidget* aVisibilityWdg = new QWidget(this);
+ QVBoxLayout* aVisibilityLay = new QVBoxLayout(aVisibilityWdg);
+ aVisibilityLay->setContentsMargins(2, 2, 2, 2);
+ QCheckBox* aVisibilityBtn = new QCheckBox(aVisibilityWdg);
+ aVisibilityLay->addWidget(aVisibilityBtn, 0, Qt::AlignHCenter);
connect(aVisibilityBtn, SIGNAL(toggled(bool)), this, SLOT(onItemToggled(bool)));
- aVisibilityBtn->setCheckable(true);
aVisibilityBtn->setChecked(false);
- updateItemIcon(aVisibilityBtn);
- myView->setCellWidget(anId, 0, aVisibilityBtn);
+ myView->setCellWidget(anId, 0, aVisibilityWdg);
myView->setItem(anId, 1, new QTableWidgetItem(theResult->data()->name().c_str()));
if (anId == 1) {
updateObject(myFeature);
}
-void ModuleBase_WidgetConcealedObjects::updateItemIcon(QToolButton* theButton)
-{
- bool isChecked = theButton->isChecked();
- theButton->setIcon(isChecked ? QIcon(":icons/concealed_on.png")
- : QIcon(":icons/concealed_off.png"));
- theButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-}
class QWidget;
class QTableWidget;
-class QToolButton;
/**
* \ingroup GUI
/// \param theState a new state
void onItemToggled(bool theState);
-private:
- /// Updates icon of button
- /// \param theButton a button of the table
- void updateItemIcon(QToolButton* theButton);
-
private:
std::string myBaseShapeAttribute; ///< attribute of the base object
QTableWidget* myView; ///< table view of visibility states
/// Returns green color
static const std::string OPERATION_RESULT_COLOR() { return "0,225, 0"; }
/// Returns color between white and color of highlight
- /// highlight color is equal Quantity_Color(0.5,1,1) or QColor(122, 255,255) // 188
- static const std::string OPERATION_HIGHLIGHT_COLOR() { return "188, 255, 255"; }
+ static const std::string OPERATION_HIGHLIGHT_COLOR() { return "128, 0, 0"; }
public:
/// Constructor
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ /// check external line created on Trihedron Axis
+ /// selection of a point on external edge referenced to AIS_Trihedron axis
+ /// should be prohibited or point should be replaced to "Origin". The second
+ /// case is implemented because of not correct AIS_Trihedron origin point highlight
+ /// When AIS is corrected(exactly priority of origin and stayed vertex by highlight)
+ /// the next check should be moved to Partset 2d point widget in isValidSelectionCustom
+ bool isAxis = isAxisSelected(theObject);
+ if (isAxis)
+ aRes = ResultPtr(); // to rely on code below that found the Origin result
+
// if there is no object,
// it means that this is the origin point: search it in the module document
if (!aRes.get()) {
return ResultPtr();
}
+bool PartSet_Tools::isAxisSelected(const ObjectPtr& theObject)
+{
+ bool isAxis = false;
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aRes.get()) {
+ // check if result belongs to external feature
+ // in this case we should use as a result reference of external feature
+ FeaturePtr aResFeature = ModelAPI_Feature::feature(aRes);
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aResFeature);
+ if (aSPFeature.get() && aSPFeature->isExternal()) {
+ AttributeSelectionPtr aAttr = aResFeature->selection(
+ SketchPlugin_SketchEntity::EXTERNAL_ID());
+ if (aAttr) { /// check if the result is Axis
+ ResultPtr anExternalRes = std::dynamic_pointer_cast<ModelAPI_Result>(aAttr->context());
+ FeaturePtr aResFeature = ModelAPI_Feature::feature(anExternalRes);
+ isAxis = aResFeature->getKind() == "Axis"; //ConstructionPlugin_Axis::ID()
+ }
+ }
+ }
+ return isAxis;
+}
+
bool PartSet_Tools::isContainPresentation(const QList<ModuleBase_ViewerPrsPtr>& theSelected,
const ModuleBase_ViewerPrsPtr& thePrs)
{
CompositeFeaturePtr theSketch,
const bool theTemporary = false);
- /// Checks whether the list of selected presentations contains the given one
+
+ /// Checks if the shape is Origin, the conditions are the shape is a vertex and
+ /// selected feature is an external feature created on Axis
+ /// \param theObject a selected object in the viewer
+ /// \return boolean value
+ static bool isAxisSelected(const ObjectPtr& theObject);
+
+ /// Checks whether the list of selected presentations contains the given one
/// \param theSelected a list of presentations
/// \param thePrs a presentation to be found
/// \return - result of check, true if the list contains the prs
#include <SUIT_Desktop.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_DataBrowser.h>
#include <QtxPopupMgr.h>
#include <QtxActionMenuMgr.h>
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
myProxyViewer->activateViewer(true);
+
+ // Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser\r
+ connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),\r
+ this, SLOT(onScriptLoaded()));\r
return isDone;
}
aResMgr->setValue("Study", "store_positions", myIsStorePositions);
getApp()->setEditEnabled(myIsEditEnabled);
+ // Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser\r
+ disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),\r
+ this, SLOT(onScriptLoaded()));\r
+
return LightApp_Module::deactivateModule(theStudy);
}
myWorkshop->displayer()->redisplayObjects();
}
+//******************************************************
+void SHAPERGUI::onScriptLoaded()
+{
+ // this slot is called after processing of the LoadScriptId action of SalomeApp Application
+ // Each dumped script contains updateObjBrowser() that creates a new instance of Object
+ // Browser. When SHAPER module is active, this browser should not be used. It might be removed
+ // as hidden by means of updateWindows() of SalomeApp_Application or to remove
+ // it manually (because this method of application is protected)
+ SUIT_DataBrowser* aBrowser = getApp()->objectBrowser();
+ if (aBrowser)
+ delete aBrowser;
+}
+
//******************************************************
void SHAPERGUI::onUpdateCommandStatus()
{
/// Set preferences to default
void onDefaultPreferences();
+ /// Hide object browser if it was created during loading script
+ void onScriptLoaded();
+
/// Obtains the current application and updates its actions
void onUpdateCommandStatus();
Config_PropManager::registerProp("Visualization", "body_deflection",
"Body deflection coefficient",
Config_Prop::Double,
- ModelAPI_ResultBody::DEFAULT_DEFLECTION());//"0.001");
+ ModelAPI_ResultBody::DEFAULT_DEFLECTION());
Config_PropManager::registerProp("Visualization", "construction_deflection",
"Construction deflection coefficient",
Config_Prop::Double,
- ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());//"0.0001");
+ ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());
if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "face-selection", true))
myViewerSelMode.append(TopAbs_FACE);