-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <GEOMUtils.hxx>
+#ifndef DISABLE_PLOT2DVIEWER
+#include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewManager.h>
myBusy(false),
myIsShapeType(false),
myIsHiddenMain(false),
- myWasHiddenMain(true)
+ myWasHiddenMain(true),
+ myIsAccept(false)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
+#endif
QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
filterLayout->addWidget(myLessFilterCheck, 0, 0);
filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
filterLayout->addWidget(myGreaterFilterSpin, 1, 2);
filterLayout->addWidget(myApplyFilterButton, 0, 3);
+#ifndef DISABLE_PLOT2DVIEWER
+ filterLayout->addWidget(myPlotDistributionButton, 1, 3);
+#endif
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
{
GEOM_Displayer* aDisplayer = getDisplayer();
- if (myWasHiddenMain) {
- aDisplayer->Erase(myMainObj);
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ bool isHideObjects = resMgr->booleanValue( "Geometry", "hide_input_object", true);
+ if (myWasHiddenMain || ( isHideObjects && myIsAccept ) ) {
myIsHiddenMain = true;
- } else {
+ }
+ else {
aDisplayer->Display(myMainObj);
myIsHiddenMain = false;
}
connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
connect(myApplyFilterButton, SIGNAL(clicked()), this, SLOT(ClickOnOkFilter()));
+#ifndef DISABLE_PLOT2DVIEWER
+ connect(myPlotDistributionButton, SIGNAL(clicked()), this, SLOT(ClickOnPlot()));
+#endif
connect(myLessFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
connect(myGreaterFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
setIsDisplayResult( false );
}
- if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
+ myIsAccept = onAccept(myMode == CreateGroup, true, isApplyAndClose());
+ if (!myIsAccept)
return false;
if(!isApplyAndClose()) {
//=================================================================================
void GroupGUI_GroupDlg::SetEditCurrentArgument()
{
- QPushButton* send = (QPushButton*)sender();
+ QPushButton* send = qobject_cast<QPushButton*>( sender() );
if (send == mySelBtn) {
myEditCurrentArgument = myMainName;
myShape2Name->setText("");
+ mySelBtn->setDown(true);
+ mySelBtn2->setDown(false);
}
else if (send == mySelBtn2 || sender() == myRestrictGroup) {
setInPlaceObj(GEOM::GEOM_Object::_nil());
myShape2Name->setText("");
- if (subSelectionWay() != ALL_SUBSHAPES) {
+ if ( send == mySelBtn2 ) {
+ mySelBtn2->setDown(true);
+ mySelBtn->setDown(false);
+ }
+ if (subSelectionWay() != ALL_SUBSHAPES) {
myEditCurrentArgument = myShape2Name;
}
else {
}
}
- activateSelection();
+ // activateSelection();
+ if(myEditCurrentArgument) {
+ myEditCurrentArgument->setFocus();
+ if ( send )
+ send->setDown(true);
+ }
updateState();
}
{
if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) {
onGetInPlace();
+ if( !myInPlaceObj->_is_nil() ) {
+ mySelBtn2->setDown(false);
+ }
return;
}
}
myMainObj = anObj;
if (!CORBA::is_nil(myMainObj)) {
+ mySelBtn->setDown(false);
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aGeomObj, aShape)) {
if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
+ if (subSelectionWay() != ALL_SUBSHAPES &&
+ GEOMBase::GetName(aGeomObj) == myShape2Name->text()) {
+ // Skip selected in place object.
+ continue;
+ }
+
TopTools_IndexedMapOfShape aMainMap;
TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopExp::MapShapes(aMainShape, aMainMap);
int index = aSubShapesMap.FindIndex(aSubShape);
QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
Handle(SALOME_InteractiveObject) io =
- new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
+ new SALOME_InteractiveObject(anEntry.toLatin1(), "GEOM", "TEMP_IO");
if ( myGroupIdList.contains( index ) ) {
aDisplayer->SetColor( aCol );
}
subSelectionWay() == ALL_SUBSHAPES &&
myIsShapeType &&
getShapeType() != TopAbs_VERTEX);
+ // manage of 'Plot' button access
+ GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ GEOM::ListOfLong_var aSubShapes = aShOp->SubShapeAllIDs( myMainObj, getShapeType(), false );
+ bool hasCurrentEntities = aSubShapes->length() > 0;
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+ myIsShapeType &&
+ ( getShapeType() == TopAbs_EDGE ||
+ getShapeType() == TopAbs_FACE ||
+ getShapeType() == TopAbs_SOLID ) &&
+ hasCurrentEntities );
+#endif
if (subSelectionWay() == ALL_SUBSHAPES)
setInPlaceObj(GEOM::GEOM_Object::_nil());
}
updateState(true);
}
+#ifndef DISABLE_PLOT2DVIEWER
+//=================================================================================
+// function : ClickOnPlot()
+// purpose : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution.
+//=================================================================================
+void GroupGUI_GroupDlg::ClickOnPlot()
+{
+ TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ QDialog* dlg = new MeasureGUI_ShapeStatisticsDlg( this, aMainShape, getShapeType() );
+ if ( dlg ) {
+ dlg->show();
+ }
+}
+#endif
+
void GroupGUI_GroupDlg::MeasureToggled()
{
myLessFilterSpin->setEnabled(myLessFilterCheck->isChecked());
myGreaterFilterCombo->setEnabled(myGreaterFilterCheck->isChecked());
myApplyFilterButton->setEnabled(myLessFilterCheck->isChecked() || myGreaterFilterCheck->isChecked());
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GroupGUI_GroupDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::GeomObjPtr aGeomObjPtr1(myMainObj), aGeomObjPtr2(myInPlaceObj);
+ res << aGeomObjPtr1 << aGeomObjPtr2;
+ return res;
+}