ILMAB project. A dialog box for creating/editing the Field on Geometry implemented

This commit is contained in:
eap 2013-10-03 14:12:04 +00:00
parent ca07021429
commit 6c2ee27d45
15 changed files with 2434 additions and 40 deletions

View File

@ -234,6 +234,8 @@ SET( _res_files
subblock.png
group_new.png
group_edit.png
field_new.png
field_edit.png
glue.png
check_blocks_compound.png
get_non_blocks.png

BIN
resources/field_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
resources/field_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -110,6 +110,7 @@ SET(EntityGUI_HEADERS
# header files / to be processed by moc
SET(_moc_HEADERS
EntityGUI_Widgets.h
EntityGUI_FieldDlg.h
EntityGUI_SketcherDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_SubShapeDlg.h
@ -128,6 +129,7 @@ QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
SET(EntityGUI_SOURCES
EntityGUI.cxx
EntityGUI_Widgets.cxx
EntityGUI_FieldDlg.cxx
EntityGUI_SketcherDlg.cxx
EntityGUI_3DSketcherDlg.cxx
EntityGUI_SubShapeDlg.cxx

View File

@ -26,18 +26,21 @@
//
#include "EntityGUI.h"
#include <GeometryGUI.h>
#include "GeometryGUI.h"
#include "GeometryGUI_Operations.h"
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ViewWindow.h>
#include <OCCViewer_ViewModel.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewPort3d.h>
#include <SalomeApp_Study.h>
#include <OCCViewer_ViewWindow.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
#include <SUIT_ViewWindow.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
@ -53,6 +56,10 @@
#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection
#include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer
#include "EntityGUI_FieldDlg.h" // Create/Edit Field
#include "GEOMImpl_Types.hxx"
//=======================================================================
// function : EntityGUI()
@ -104,13 +111,85 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpPictureImport: // IMPORT PICTURE IN VIEWER
aDlg = new EntityGUI_PictureImportDlg( getGeometryGUI(), parent );
break;
case GEOMOp::OpCreateField: // CREATE FIELD
aDlg = new EntityGUI_FieldDlg (getGeometryGUI(), GEOM::GEOM_Field::_nil(), 0,
parent);
break;
case GEOMOp::OpEditField: // EDIT FIELD
case GEOMOp::OpEditFieldPopup:
{
SALOME_ListIO aList;
aList.Clear();
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if (aSelMgr)
aSelMgr->selectedObjects(aList);
SALOME_ListIteratorOfListIO anIter (aList);
GEOM::GEOM_Field_var field;
GEOM::GEOM_FieldStep_var step;
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( aList.Extent() > 0 && study ) {
for ( ; anIter.More(); anIter.Next() )
{
Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
if ( !anIObj.IsNull() && anIObj->hasEntry() )
if ( _PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() ))
{
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
GEOM::GEOM_BaseObject_var bo = GEOM::GEOM_BaseObject::_narrow( corbaObj );
GEOM::GEOM_Field_var f;
GEOM::GEOM_FieldStep_var s;
switch ( bo->GetType() ) {
case GEOM_FIELD:
f = GEOM::GEOM_Field::_narrow( corbaObj ); break;
case GEOM_FIELD_STEP:
step = GEOM::GEOM_FieldStep::_narrow( corbaObj );
if ( !step->_is_nil() )
f = step->GetField();
break;
default:
continue;
}
if ( !f->_is_nil() )
{
if ( !field->_is_nil() && !f->_is_equivalent( field ))
{
field = GEOM::GEOM_Field::_nil(); // several field selected
break;
}
field = f;
}
}
}
}
if ( !field->_is_nil()) {
int stepID;
if ( !step->_is_nil() ) {
stepID = step->GetID();
}
else {
GEOM::ListOfLong_var stepIDs = field->GetSteps();
if ( stepIDs->length() > 0 )
stepID = stepIDs[0];
else
stepID = 0;
}
aDlg = new EntityGUI_FieldDlg (getGeometryGUI(), field, stepID, parent);
break;
}
SUIT_MessageBox::warning(parent, tr("WRN_WARNING"), tr("NO_FIELD"));
break;
}
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break;
}
if ( aDlg )
aDlg->show();
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,136 @@
// Copyright (C) 2007-2013 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : EntityGUI_FieldDlg.h
#ifndef EntityGUI_FieldDlg_H
#define EntityGUI_FieldDlg_H
#include <GEOMBase_Skeleton.h>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <QMap>
#include <QSet>
#include <QVector>
class QGroupBox;
class QLineEdit;
class QPushButton;
class QComboBox;
class SalomeApp_IntSpinBox;
//=================================================================================
// class : EntityGUI_FieldDlg
// purpose :
//=================================================================================
class EntityGUI_FieldDlg : public GEOMBase_Skeleton
{
Q_OBJECT
class StepTable;
class IntSpinItem;
class DoubleSpinItem;
class CheckItem;
class Delegate;
public:
EntityGUI_FieldDlg (GeometryGUI* theGeometryGUI,
GEOM::GEOM_Field_ptr theField, int stepID=0,
QWidget* parent=0,
bool modal=false, Qt::WindowFlags fl=0);
~EntityGUI_FieldDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute ();
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void onPrevStep();
void onNextStep();
void onAddStep();
void onRmStep();
void onStampChange();
void onDimChange();
void onTypeChange();
void onNbCompsChange();
void showCurStep();
void highlightSubShapes();
private:
void Init();
void enterEvent (QEvent*);
void activateSelection();
TopAbs_ShapeEnum getShapeType(int* dim=0) const;
int getDim() const;
int getDataType() const;
int getCurStepID() const;
int getNbComps() const;
void updateShapeIDs();
void updateDims(int curDim=-1);
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& map);
private:
bool myIsCreation;
GEOM::GEOM_Field_var myField;
GEOM::GEOM_Object_var myShape;
QVector< int > myShapeIDs;
TopTools_IndexedMapOfShape myShapeMap;
int myCurStepID;
StepTable* myCurStepTable;
QMap< int, StepTable* > myStepTables;
QSet< int > myRemovedSteps;
int myDmMode;
bool myIsHiddenMain;
QPushButton* myShapeSelBtn;
QLineEdit* myShapeName;
QComboBox* myTypeCombo;
QComboBox* myDimCombo;
QPushButton* myPrevStepBtn;
QPushButton* myNextStepBtn;
QPushButton* myRmStepBtn;
SalomeApp_IntSpinBox* myNbCompsSpin;
QWidget* mySwitchTableWdg;
QComboBox* myStepsCombo;
SalomeApp_IntSpinBox* myStampSpin;
};
#endif

View File

@ -221,10 +221,12 @@ GEOM_BaseObject::~GEOM_BaseObject()
//=============================================================================
int GEOM_BaseObject::GetType()
{
int type = -1;
Handle(TDataStd_Integer) aType;
if(!_label.FindChild(TYPE_LABEL).FindAttribute(TDataStd_Integer::GetID(), aType)) return -1;
if(_label.FindChild(TYPE_LABEL).FindAttribute(TDataStd_Integer::GetID(), aType))
type = aType->Get();
return aType->Get();
return type;
}
//=============================================================================

View File

@ -120,7 +120,7 @@ void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* sel
_PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
if ( aSO ) {
CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
myObjects[idx] = GEOM::GEOM_Object::_narrow( varObj );
myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj );
}
}
}
@ -199,15 +199,19 @@ QString GEOMGUI_Selection::typeName( const int index ) const
static QString aGroup( "Group" );
static QString aShape( "Shape" );
static QString aField( "Field" );
static QString aFieldStep( "FieldStep" );
static QString anUnknown( "Unknown" );
GEOM::GEOM_Object_var anObj = getObject( index );
GEOM::GEOM_BaseObject_var anObj = getBaseObject( index );
if ( !CORBA::is_nil( anObj ) ) {
const int aGeomType = anObj->GetType();
if ( aGeomType == GEOM_GROUP )
return aGroup;
else
return aShape;
switch ( aGeomType ) {
case GEOM_GROUP : return aGroup;
case GEOM_FIELD : return aField;
case GEOM_FIELD_STEP: return aFieldStep;
default : return aShape;
}
}
return anUnknown;
}
@ -473,8 +477,8 @@ int GEOMGUI_Selection::nbChildren( const int index ) const
if ( study && !anEntry.isEmpty() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
if ( aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
_PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
for (it->Init(false); it->More(); it->Next()) nb++;
_PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
for (it->Init(false); it->More(); it->Next()) nb++;
}
}
}
@ -539,7 +543,15 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
{
GEOM::GEOM_Object_var o;
if ( 0 <= index && index < myObjects.size() )
o = GEOM::GEOM_Object::_duplicate( myObjects[index] );
o = GEOM::GEOM_Object::_narrow( myObjects[index] );
return o._retn();
}
GEOM::GEOM_BaseObject_ptr GEOMGUI_Selection::getBaseObject( const int index ) const
{
GEOM::GEOM_BaseObject_var o;
if ( 0 <= index && index < myObjects.size() )
o = GEOM::GEOM_BaseObject::_duplicate( myObjects[index] );
return o._retn();
}

View File

@ -79,6 +79,7 @@ private:
bool isComponent( const int ) const;
bool isFolder( const int ) const;
GEOM::GEOM_Object_ptr getObject( const int ) const;
GEOM::GEOM_BaseObject_ptr getBaseObject( const int ) const;
bool hasImported() const;
bool allImported() const;
@ -86,7 +87,7 @@ private:
QVariant visibleProperty( const QString&, const QString& ) const;
private:
typedef QVector<GEOM::GEOM_Object_var> GeomObjectVector;
typedef QVector<GEOM::GEOM_BaseObject_var> GeomObjectVector;
private:
GeomObjectVector myObjects;

View File

@ -963,6 +963,18 @@
<source>ICO_GROUP_EDIT</source>
<translation>group_edit.png</translation>
</message>
<message>
<source>ICO_FIELD_CREATE</source>
<translation>field_new.png</translation>
</message>
<message>
<source>ICO_FIELD_EDIT</source>
<translation>field_edit.png</translation>
</message>
<message>
<source>ICO_ADD_FIELD_STEP</source>
<translation>field_new.png</translation>
</message>
<message>
<source>ICO_HEX_SOLID</source>
<translation>box.png</translation>
@ -1079,6 +1091,10 @@
<source>ICO_POP_CREATE_GROUP</source>
<translation>group_new.png</translation>
</message>
<message>
<source>ICO_POP_EDIT_FIELD</source>
<translation>field_edit.png</translation>
</message>
<message>
<source>ICO_PROPAGATE</source>
<translation>propagate.png</translation>

View File

@ -2636,6 +2636,22 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_GROUP_CUT</source>
<translation>Cut Groups</translation>
</message>
<message>
<source>MEN_FIELD</source>
<translation>Field</translation>
</message>
<message>
<source>MEN_FIELD_CREATE</source>
<translation>Create Field</translation>
</message>
<message>
<source>MEN_FIELD_EDIT</source>
<translation>Edit Field</translation>
</message>
<message>
<source>MEN_ADD_FIELD_STEP</source>
<translation>Add Field Step</translation>
</message>
<message>
<source>MEN_RELOAD_IMPORTED</source>
<translation>Reload From Disk</translation>
@ -2756,6 +2772,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_POP_CREATE_GROUP</source>
<translation>Create Group</translation>
</message>
<message>
<source>MEN_POP_EDIT_FIELD</source>
<translation>Edit Field</translation>
</message>
<message>
<source>MEN_POP_DISCLOSE_CHILDREN</source>
<translation>Disclose child items</translation>
@ -3468,6 +3488,14 @@ Please, select face, shell or solid and try again</translation>
<source>STB_GROUP_CUT</source>
<translation>Cut Groups</translation>
</message>
<message>
<source>STB_FIELD_CREATE</source>
<translation>Create a Field</translation>
</message>
<message>
<source>STB_FIELD_EDIT</source>
<translation>Edit a Field</translation>
</message>
<message>
<source>STB_RELOAD_IMPORTED</source>
<translation>Reload imported shape from its original place on disk</translation>
@ -3576,6 +3604,10 @@ Please, select face, shell or solid and try again</translation>
<source>STB_POP_CREATE_GROUP</source>
<translation>Create Group</translation>
</message>
<message>
<source>STB_POP_EDIT_FIELD</source>
<translation>Edit Field</translation>
</message>
<message>
<source>STB_POP_UNPUBLISH_OBJ</source>
<translation>Unpublish object</translation>
@ -4100,6 +4132,14 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_GROUP_CUT</source>
<translation>Cut Groups</translation>
</message>
<message>
<source>TOP_FIELD_CREATE</source>
<translation>Create a Field</translation>
</message>
<message>
<source>TOP_FIELD_EDIT</source>
<translation>Edit a Field</translation>
</message>
<message>
<source>TOP_HEX_SOLID</source>
<translation>Hexahedral Solid</translation>
@ -4212,6 +4252,10 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_POP_CREATE_GROUP</source>
<translation>Create Group</translation>
</message>
<message>
<source>TOP_POP_EDIT_FIELD</source>
<translation>Edit Field</translation>
</message>
<message>
<source>TOP_POP_UNPUBLISH_OBJ</source>
<translation>Unpublish object</translation>
@ -5408,6 +5452,148 @@ Number of sketch points too small</translation>
<translation type="unfinished">The selected shape is not a sub-shape of the main shape. Hide all extra shapes in the viewer for more suitable selection.</translation>
</message>
</context>
<context>
<name>EntityGUI</name>
<message>
<source>NO_FIELD</source>
<translation>Please, select a field to edit</translation>
</message>
</context>
<context>
<name>EntityGUI_FieldDlg</name>
<message>
<source>CREATE_FIELD_TITLE</source>
<translation>Create Field</translation>
</message>
<message>
<source>EDIT_FIELD_TITLE</source>
<translation>Edit Field</translation>
</message>
<message>
<source>FIELD_NAME</source>
<translation>Field name</translation>
</message>
<message>
<source>PROPERTIES</source>
<translation>Properties</translation>
</message>
<message>
<source>SHAPE</source>
<translation>Shape</translation>
</message>
<message>
<source>DATA_TYPE</source>
<translation>Type</translation>
</message>
<message>
<source></source>
<translation></translation>
</message>
<message>
<source>BOOL</source>
<translation>Boolean</translation>
</message>
<message>
<source>INT</source>
<translation>Integer</translation>
</message>
<message>
<source>DOUBLE</source>
<translation>Double</translation>
</message>
<message>
<source>STRING</source>
<translation>String</translation>
</message>
<message>
<source>SHAPE_TYPE</source>
<translation>Sub-shape</translation>
</message>
<message>
<source>VERTEX</source>
<translation>Vertex</translation>
</message>
<message>
<source>EDGE</source>
<translation>Edge</translation>
</message>
<message>
<source>FACE</source>
<translation>Face</translation>
</message>
<message>
<source>SOLID</source>
<translation>Solid</translation>
</message>
<message>
<source>WHOLE</source>
<translation>Whole shape</translation>
</message>
<message>
<source>NB_COMPS</source>
<translation>Nb. components</translation>
</message>
<message>
<source>VALUES</source>
<translation>Values</translation>
</message>
<message>
<source>PREV_STEP</source>
<translation>Previous step</translation>
</message>
<message>
<source>STEP</source>
<translation>Step</translation>
</message>
<message>
<source>NEXT_STEP</source>
<translation>Next step</translation>
</message>
<message>
<source>ADD_STEP</source>
<translation>Add step</translation>
</message>
<message>
<source>STAMP</source>
<translation>Stamp</translation>
</message>
<message>
<source>REMOVE_STEP</source>
<translation>Remove step</translation>
</message>
<message>
<source>FIELD_PREFIX</source>
<translation>Field</translation>
</message>
<message>
<source>GEOM_NO_STUDY</source>
<translation>No study availabel</translation>
</message>
<message>
<source>NO_SHAPE</source>
<translation>Shape not selected</translation>
</message>
<message>
<source>NO_FIELD</source>
<translation>Field not selected</translation>
</message>
<message>
<source>EMPTY_NAME</source>
<translation>Please, specify a non-empty field name</translation>
</message>
<message>
<source>NO_VALUES</source>
<translation>No steps added to the field</translation>
</message>
<message>
<source>SUB_SHAPE_HEADER</source>
<translation>Sub-shape</translation>
</message>
<message>
<source>WHOLE_SHAPE_VHEADER</source>
<translation>Shape</translation>
</message>
</context>
<context>
<name>MeasureGUI_1Sel1TextView1Check_QTD</name>
<message>

View File

@ -550,6 +550,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
#endif
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
case GEOMOp::OpCreateField: // MENU FIELD - CREATE FIELD
case GEOMOp::OpEditField: // MENU FIELD - EDIT FIELD
case GEOMOp::OpEditFieldPopup: // POPUP MENU - EDIT FIELD
libName = "EntityGUI";
break;
case GEOMOp::OpEdge: // MENU BUILD - EDGE
@ -908,6 +911,9 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpGroupIntersect, "GROUP_INTERSECT" );
createGeomAction( GEOMOp::OpGroupCut, "GROUP_CUT" );
createGeomAction( GEOMOp::OpCreateField, "FIELD_CREATE" );
createGeomAction( GEOMOp::OpEditField, "FIELD_EDIT" );
createGeomAction( GEOMOp::OpReimport, "RELOAD_IMPORTED" );
createGeomAction( GEOMOp::OpQuadFace, "Q_FACE" );
@ -1034,6 +1040,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpAutoColor, "POP_AUTO_COLOR" );
createGeomAction( GEOMOp::OpNoAutoColor, "POP_DISABLE_AUTO_COLOR" );
createGeomAction( GEOMOp::OpGroupCreatePopup, "POP_CREATE_GROUP" );
createGeomAction( GEOMOp::OpEditFieldPopup, "POP_EDIT_FIELD" );
createGeomAction( GEOMOp::OpDiscloseChildren, "POP_DISCLOSE_CHILDREN" );
createGeomAction( GEOMOp::OpConcealChildren, "POP_CONCEAL_CHILDREN" );
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
@ -1132,6 +1139,12 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( separator(), newEntId, -1 );
int fieldId = createMenu( tr( "MEN_FIELD" ), newEntId, -1 );
createMenu( GEOMOp::OpCreateField, fieldId, -1 );
createMenu( GEOMOp::OpEditField, fieldId, -1 );
createMenu( separator(), newEntId, -1 );
int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
createMenu( GEOMOp::OpQuadFace, blocksId, -1 );
createMenu( GEOMOp::OpHexaSolid, blocksId, -1 );
@ -1418,13 +1431,15 @@ void GeometryGUI::initialize( CAM_Application* app )
QtxPopupMgr* mgr = popupMgr();
mgr->insert( action( GEOMOp::OpDelete ), -1, -1 ); // delete
mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group' 'Folder'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group' 'Folder' 'Field' 'FieldStep'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpEditFieldPopup ), -1, -1 ); // edit field
mgr->setRule( action( GEOMOp::OpEditFieldPopup ), QString("(type='Field' or type='FieldStep') and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDiscloseChildren ), -1, -1 ); // disclose child items
mgr->setRule( action( GEOMOp::OpDiscloseChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasConcealedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpConcealChildren ), -1, -1 ); // conceal shild items
mgr->insert( action( GEOMOp::OpConcealChildren ), -1, -1 ); // conceal child items
mgr->setRule( action( GEOMOp::OpConcealChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasDisclosedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
@ -1496,7 +1511,7 @@ void GeometryGUI::initialize( CAM_Application* app )
QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
onlyComponent = "((type='Component') and selcount=1)",
rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")",
types = "'Shape' 'Group'";
types = "'Shape' 'Group' 'FieldStep'";
mgr->insert( action( GEOMOp::OpShow ), -1, -1 ); // display
mgr->setRule( action( GEOMOp::OpShow ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule );
@ -1542,7 +1557,7 @@ void GeometryGUI::initialize( CAM_Application* app )
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
mgr->setRule( action( GEOMOp::OpUnpublishObject ), QString("client='ObjectBrowser' and $type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpUnpublishObject ), QString("client='ObjectBrowser' and $type in {'Shape' 'Group' 'Field' 'FieldStep'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpPublishObject ), -1, -1 ); // Publish object
mgr->setRule( action( GEOMOp::OpPublishObject ), QString("client='ObjectBrowser' and isComponent=true"), QtxPopupMgr::VisibleRule );
@ -1886,6 +1901,8 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
action( GEOMOp::OpGroupCreate )->setEnabled( ViewOCC ); // Create Group
action( GEOMOp::OpGroupEdit )->setEnabled( ViewOCC ); // Edit Group
action( GEOMOp::OpCreateField )->setEnabled( ViewOCC ); // Create Field
action( GEOMOp::OpEditField )->setEnabled( ViewOCC ); // Edit Field
action( GEOMOp::OpMultiTransform )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION
}
@ -2047,7 +2064,7 @@ void GeometryGUI::onAutoBringToFront()
SUIT_ViewWindow* SUIT_window = application()->desktop()->activeWindow();
if ( !SUIT_window || SUIT_window->getViewManager()->getType() != OCCViewer_Viewer::Type() )
return;
return;
SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( getApp()->activeStudy() );
if (!appStudy) return;
@ -2995,12 +3012,12 @@ bool GeometryGUI::isDraggable( const SUIT_DataObject* what ) const
if ( dataObj ) {
_PTR(SObject) aSO = dataObj->object();
if ( aSO ) {
_PTR(GenericAttribute) anAttr;
_PTR(SObject) aFatherSO = aSO->GetStudy()->GetUseCaseBuilder()->GetFather( aSO );
if ( aFatherSO && aFatherSO->FindAttribute(anAttr, "AttributeLocalID") ) {
_PTR(AttributeLocalID) aLocalID( anAttr );
anObjectInFolder = aLocalID->Value() == 999;
}
_PTR(GenericAttribute) anAttr;
_PTR(SObject) aFatherSO = aSO->GetStudy()->GetUseCaseBuilder()->GetFather( aSO );
if ( aFatherSO && aFatherSO->FindAttribute(anAttr, "AttributeLocalID") ) {
_PTR(AttributeLocalID) aLocalID( anAttr );
anObjectInFolder = aLocalID->Value() == 999;
}
}
}
}
@ -3031,11 +3048,11 @@ bool GeometryGUI::isDropAccepted( const SUIT_DataObject* where ) const
if ( dataObj ) {
_PTR(SObject) aSO = dataObj->object();
if ( aSO ) {
_PTR(GenericAttribute) anAttr;
if ( aSO->FindAttribute(anAttr, "AttributeLocalID") ) {
_PTR(AttributeLocalID) aLocalID( anAttr );
isFolder = aLocalID->Value() == 999;
}
_PTR(GenericAttribute) anAttr;
if ( aSO->FindAttribute(anAttr, "AttributeLocalID") ) {
_PTR(AttributeLocalID) aLocalID( anAttr );
isFolder = aLocalID->Value() == 999;
}
}
}
}
@ -3062,7 +3079,7 @@ bool GeometryGUI::isDropAccepted( const SUIT_DataObject* where ) const
\sa isDraggable(), isDropAccepted()
*/
void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
const int row, Qt::DropAction action )
const int row, Qt::DropAction action )
{
if (action != Qt::CopyAction && action != Qt::MoveAction)
return; // unsupported action
@ -3102,8 +3119,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
// call engine function
GetGeomGen()->Move( objects.in(), // what
_CAST(SObject, parentObj)->GetSObject(), // where
row ); // row
_CAST(SObject, parentObj)->GetSObject(), // where
row ); // row
// update Object browser
getApp()->updateObjectBrowser( false );

View File

@ -112,6 +112,9 @@ namespace GEOMOp {
OpFeatureDetect = 3303, // MENU NEW ENTITY - FEATURE DETECTION
#endif
OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
OpCreateField = 3305, // MENU FIELD - CREATE FIELD
OpEditField = 3306, // MENU FIELD - EDIT FIELD
OpEditFieldPopup = 3307, // POPUP MENU - EDIT FIELD
// BuildGUI --------------------//--------------------------------
OpEdge = 3400, // MENU NEW ENTITY - BUILD - EDGE
OpWire = 3401, // MENU NEW ENTITY - BUILD - WIRE

View File

@ -67,7 +67,7 @@ GetCreationInformation(std::string& theOperationName,
if ( funType == GEOM_Field::FUN_ADD_FIELD )
{
theOperationName = "ADD_FIELD";
theOperationName = "FIELD_CREATE";
// geompy.CreateField(shape, name, type, dimension, componentNames)
Handle(GEOM_Field) f = GEOM_Field::GetField( function->GetOwnerEntry() );
AddParam( theParams, "Shape", data.GetShape() );