0023197: [CEA] Extract and rebuild: GUI

This commit is contained in:
skv 2015-11-13 09:21:54 +03:00
parent d3b57addeb
commit 0a40f988ad
15 changed files with 1718 additions and 0 deletions

View File

@ -2778,6 +2778,43 @@ module GEOM
in comparison_condition theCondition,
in double theTolerance);
/**
* This enumeration represents an extraction statistics type. It is used in
* the interface GEOM_IShapesOperations::MakeExtraction.
*/
enum ExtractionStatType
{
EST_Removed, ///< Removed sub-shapes
EST_Modified, ///< Modified sub-shapes
EST_Added ///< Newly created sub-shapes
};
/*!
* This structure defines a format of extraction statistics. It is used in
* the interface GEOM_IShapesOperations::MakeExtraction.
*/
struct ExtractionStat
{
ExtractionStatType type; ///< Type of extraction statistics.
ListOfLong indices; ///< Shape indices touched by this type of modification.
};
typedef sequence<ExtractionStat> ExtractionStats;
/*!
* \brief Return the shape that is constructed from theShape without
* extracted sub-shapes from the input list.
*
* \param theShape the original shape.
* \param theSubShapeIDs the list of sub-shape IDs to be extracted from
* the original shape.
* \param theStats the operation statistics. Output parameter.
* \return the shape without extracted sub-shapes.
*/
GEOM_Object MakeExtraction(in GEOM_Object theShape,
in ListOfLong theSubShapeIDs,
out ExtractionStats theStats);
};
// # GEOM_IBlocksOperations:

View File

@ -94,6 +94,7 @@ SET( _res_files
edgeextension.png
erase.png
eraseall.png
extract.png
extruded_boss.png
extruded_cut.png
facetosurface.png

BIN
resources/extract.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1387,6 +1387,10 @@
<source>ICO_TRANSFER_DATA</source>
<translation>transfer_data.png</translation>
</message>
<message>
<source>ICO_EXTRACTION</source>
<translation>extract.png</translation>
</message>
<message>
<source>ICO_IMPORT_SHAPE</source>
<translation>import.png</translation>
@ -1407,6 +1411,10 @@
<source>ICON_DLG_TRANSFER_DATA</source>
<translation>transfer_data.png</translation>
</message>
<message>
<source>ICON_DLG_EXTRACTION</source>
<translation>extract.png</translation>
</message>
<message>
<source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation>

View File

@ -471,6 +471,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_COMPOUNDSOLID</source>
<translation>CompSolid</translation>
</message>
<message>
<source>GEOM_COMPSOLIDS</source>
<translation>CompSolids</translation>
</message>
<message>
<source>GEOM_COMPOUND_TITLE</source>
<translation>Create A Compound</translation>
@ -607,6 +611,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_EDGE</source>
<translation>Edge</translation>
</message>
<message>
<source>GEOM_EDGES</source>
<translation>Edges</translation>
</message>
<message>
<source>GEOM_EDGE_TITLE</source>
<translation>Create An Edge</translation>
@ -2024,6 +2032,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SOLID</source>
<translation>Solid</translation>
</message>
<message>
<source>GEOM_SOLIDS</source>
<translation>Solids</translation>
</message>
<message>
<source>GEOM_SOLID_TITLE</source>
<translation>Solid Construction</translation>
@ -5228,6 +5240,18 @@ Please, select face, shell or solid and try again</translation>
<source>STB_TRANSFER_DATA</source>
<translation>Transfer Data</translation>
</message>
<message>
<source>TOP_EXTRACTION</source>
<translation>Extract and Rebuild</translation>
</message>
<message>
<source>MEN_EXTRACTION</source>
<translation>Extract and Rebuild</translation>
</message>
<message>
<source>STB_EXTRACTION</source>
<translation>Extract and Rebuild</translation>
</message>
<message>
<source>TOP_EXTENSION</source>
<translation>Extend Edge or Face</translation>
@ -7621,4 +7645,55 @@ Do you want to create new material?</translation>
<translation>Rotation angle</translation>
</message>
</context>
<context>
<name>OperationGUI_ExtractionDlg</name>
<message>
<source>GEOM_EXTRACT_TITLE</source>
<translation>Extract and Rebuild</translation>
</message>
<message>
<source>GEOM_EXTRACT_TYPE</source>
<translation>Extraction type</translation>
</message>
<message>
<source>GEOM_EXTRACT_INPUT_PARAMS</source>
<translation>Input parameters</translation>
</message>
<message>
<source>GEOM_EXTRACT_STATISTICS</source>
<translation>Statistics</translation>
</message>
<message>
<source>GEOM_EXTRACT_SUB_SHAPE_TYPE</source>
<translation>Sub-shape type</translation>
</message>
<message>
<source>GEOM_EXTRACT_FILTERED_SHAPES</source>
<translation>Filtered shapes</translation>
</message>
<message>
<source>GEOM_EXTRACT_SHAPES_TO_EXTRACT</source>
<translation>Shapes to extract</translation>
</message>
<message>
<source>GEOM_EXTRACT_REBUILD</source>
<translation>Rebuild</translation>
</message>
<message>
<source>GEOM_EXTRACT_REMOVED</source>
<translation>Removed</translation>
</message>
<message>
<source>GEOM_EXTRACT_MODIFIED</source>
<translation>Modified</translation>
</message>
<message>
<source>GEOM_EXTRACT_ADDED</source>
<translation>Added</translation>
</message>
<message>
<source>GEOM_EXTRACT_NAME</source>
<translation>Extraction</translation>
</message>
</context>
</TS>

View File

@ -623,6 +623,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS
case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT
case GEOMOp::OpTransferData: // MENU OPERATION - TRANSFER DATA
case GEOMOp::OpExtraction: // MENU OPERATION - EXTRACT AND REBUILD
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
@ -1005,6 +1006,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
createGeomAction( GEOMOp::OpTransferData, "TRANSFER_DATA" );
createGeomAction( GEOMOp::OpExtraction, "EXTRACTION" );
createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" );
createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" );
createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
@ -1262,6 +1264,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
createMenu( GEOMOp::OpSharedShapes, operId, -1 );
createMenu( GEOMOp::OpTransferData, operId, -1 );
createMenu( GEOMOp::OpExtraction, operId, -1 );
createMenu( separator(), operId, -1 );
@ -1438,6 +1441,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
createTool( GEOMOp::OpTransferData, operTbId );
createTool( GEOMOp::OpExtraction, operTbId );
int featTbId = createTool( tr( "TOOL_FEATURES" ), QString( "GEOMModification" ) );
createTool( GEOMOp::OpFillet1d, featTbId );

View File

@ -166,6 +166,7 @@ namespace GEOMOp {
OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS
OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT
OpTransferData = 3711, // MENU OPERATION - TRANSFER DATA
OpExtraction = 3712, // MENU OPERATION - EXTRACT AND REBUILD
// RepairGUI -------------------//--------------------------------
OpSewing = 4000, // MENU REPAIR - SEWING
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES

View File

@ -3162,6 +3162,23 @@ Handle(TColStd_HSequenceOfTransient)
return aSeq;
}
//=============================================================================
/*!
* MakeExtraction
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeExtraction
(const Handle(GEOM_Object) &theShape,
const Handle(TColStd_HArray1OfInteger) &theSubShapeIDs,
std::list<ExtractionStat> &theStats)
{
theStats.clear();
SetErrorCode(OK);
return theShape;
}
//=======================================================================
//function : getShapesOnSurfaceIDs
/*!

View File

@ -59,6 +59,25 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
All = Groups | Fields | SubShapes,
};
/**
* This enumeration represents an extraction statistics type.
*/
enum ExtractionStatType
{
EST_Removed, ///< Removed sub-shapes
EST_Modified, ///< Modified sub-shapes
EST_Added ///< Newly created sub-shapes
};
/*!
* This structure defines a format of extraction statistics.
*/
struct ExtractionStat
{
ExtractionStatType type; ///< Type of extraction statistics.
std::list<Standard_Integer> indices; ///< Shape indices touched by this type of modification.
};
Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IShapesOperations();
@ -470,6 +489,21 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
const GEOMUtils::ComparisonCondition theCondition,
const Standard_Real theTolerance);
/*!
* \brief Return the shape that is constructed from theShape without
* extracted sub-shapes from the input list.
*
* \param theShape the original shape.
* \param theSubShapeIDs the list of sub-shape IDs to be extracted from
* the original shape.
* \param theStats the operation statistics. Output parameter.
* \return the shape without extracted sub-shapes.
*/
Handle(GEOM_Object) MakeExtraction
(const Handle(GEOM_Object) &theShape,
const Handle(TColStd_HArray1OfInteger) &theSubShapeIDs,
std::list<ExtractionStat> &theStats);
private:
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,

View File

@ -2230,3 +2230,97 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
return aSeq._retn();
}
//=============================================================================
/*!
* MakeExtraction
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeExtraction
(GEOM::GEOM_Object_ptr theShape,
const GEOM::ListOfLong &theSubShapeIDs,
GEOM::GEOM_IShapesOperations::ExtractionStats_out theStats)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
//Get the reference object
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) {
return aGEOMObject._retn();
}
const int aNbIDs = theSubShapeIDs.length();
int i;
Handle(TColStd_HArray1OfInteger) anArray =
new TColStd_HArray1OfInteger (1, aNbIDs);
for (i = 0; i < aNbIDs; i++) {
anArray->SetValue(i + 1, theSubShapeIDs[i]);
}
//Get Shapes in place of aShapeWhat
std::list<GEOMImpl_IShapesOperations::ExtractionStat> aStats;
Handle(GEOM_Object) aResult =
GetOperations()->MakeExtraction(aShape, anArray, aStats);
if (!GetOperations()->IsDone() || aResult.IsNull()) {
return aGEOMObject._retn();
}
// Convert statistics.
GEOM::GEOM_IShapesOperations::ExtractionStats_var aResStats =
new GEOM::GEOM_IShapesOperations::ExtractionStats;
const int aNbStats = aStats.size();
aResStats->length(aNbStats);
// fill the local CORBA array with values from lists
std::list<GEOMImpl_IShapesOperations::ExtractionStat>::const_iterator
anIt = aStats.begin();
for (i = 0; anIt != aStats.end(); i++, anIt++) {
GEOM::GEOM_IShapesOperations::ExtractionStat_var aResStat =
new GEOM::GEOM_IShapesOperations::ExtractionStat;
// Copy type
switch (anIt->type) {
case GEOMImpl_IShapesOperations::EST_Removed:
aResStat->type = GEOM::GEOM_IShapesOperations::EST_Removed;
break;
case GEOMImpl_IShapesOperations::EST_Modified:
aResStat->type = GEOM::GEOM_IShapesOperations::EST_Modified;
break;
case GEOMImpl_IShapesOperations::EST_Added:
aResStat->type = GEOM::GEOM_IShapesOperations::EST_Added;
break;
default:
break;
}
// Copy the list of IDs
std::list<Standard_Integer> aIDList = anIt->indices;
GEOM::ListOfLong_var aResIDList = new GEOM::ListOfLong;
aResIDList->length(aIDList.size());
std::list<Standard_Integer>::iterator anIDIt = aIDList.begin();
int j = 0;
for (; anIDIt != aIDList.end(); j++, anIDIt++) {
aResIDList[j] = *anIDIt;
}
aResStat->indices = aResIDList;
aResStats[i] = aResStat;
}
// initialize out-parameter with local array
theStats = aResStats._retn();
return GetObject(aResult);
}

View File

@ -306,6 +306,11 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::comparison_condition theCondition,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeExtraction
(GEOM::GEOM_Object_ptr theShape,
const GEOM::ListOfLong &theSubShapeIDs,
GEOM::GEOM_IShapesOperations::ExtractionStats_out theStats);
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
};

View File

@ -74,6 +74,7 @@ SET(OperationGUI_HEADERS
OperationGUI_ChamferDlg.h
OperationGUI_GetShapesOnShapeDlg.h
OperationGUI_GetSharedShapesDlg.h
OperationGUI_ExtractionDlg.h
OperationGUI_ExtrudedFeatureDlg.h
OperationGUI_ClippingDlg.h
OperationGUI_TransferDataDlg.h
@ -88,6 +89,7 @@ SET(_moc_HEADERS
OperationGUI_ChamferDlg.h
OperationGUI_GetShapesOnShapeDlg.h
OperationGUI_GetSharedShapesDlg.h
OperationGUI_ExtractionDlg.h
OperationGUI_ExtrudedFeatureDlg.h
OperationGUI_ClippingDlg.h
OperationGUI_TransferDataDlg.h
@ -110,6 +112,7 @@ SET(OperationGUI_SOURCES
OperationGUI_FilletDlg.cxx
OperationGUI_Fillet1d2dDlg.cxx
OperationGUI_ChamferDlg.cxx
OperationGUI_ExtractionDlg.cxx
OperationGUI_ExtrudedFeatureDlg.cxx
OperationGUI_ClippingDlg.cxx
OperationGUI_TransferDataDlg.cxx

View File

@ -40,6 +40,7 @@
#include "OperationGUI_GetSharedShapesDlg.h"
#include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT
#include "OperationGUI_TransferDataDlg.h"
#include "OperationGUI_ExtractionDlg.h"
//=======================================================================
// function : OperationGUI()
@ -83,6 +84,7 @@ bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent)
case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break;
case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break;
case GEOMOp::OpTransferData: (new OperationGUI_TransferDataDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpExtraction: (new OperationGUI_ExtractionDlg (getGeometryGUI(), parent))->show(); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
// Copyright (C) 2007-2015 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, or (at your option) any later version.
//
// 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
//
#ifndef OPERATIONGUI_EXTRACTIONDLG_H
#define OPERATIONGUI_EXTRACTIONDLG_H
#include <GEOMBase_Skeleton.h>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_MapOfInteger.hxx>
class QComboBox;
class QListWidget;
class QTreeWidget;
class QTreeWidgetItem;
//=================================================================================
// class : OperationGUI_ExtractionDlg
// purpose :
//=================================================================================
class OperationGUI_ExtractionDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
OperationGUI_ExtractionDlg( GeometryGUI*, QWidget* );
~OperationGUI_ExtractionDlg();
protected:
// redefined from GEOMBase_Helper and MeasureGUI_Skeleton
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute(ObjectList &);
virtual void activateSelection();
virtual bool isValid( QString& );
private slots:
void SelectionIntoArgument();
void ClickOnOk();
bool ClickOnApply();
void onShapeTypeChanged();
void onAddExtracted();
void onRemoveExtracted();
void onListSelectionChanged();
void showOnlySelected();
void hideSelected();
void showAllSelected();
void onRebuild();
void ActivateThisDialog();
void SetEditCurrentArgument();
private:
void Init();
bool updateSubShTypeCompo();
void updateFilteredList();
void resetBuildData(const bool isEnableBuild);
bool isEmptyExtracted();
void selectMainShape();
void selectSubShapes();
void enterEvent(QEvent *);
bool getResult
(GEOM::GEOM_Object_ptr &theResult,
GEOM::GEOM_IShapesOperations::ExtractionStats &theStats);
QString getSubShapeEntry(const int theId);
Handle_SALOME_InteractiveObject createIO(const char *theEntry);
void displaySubShape(const int theId);
void eraseSubShape(const int theId);
void eraseAll();
void restoreViewer();
private:
GEOM::GEOM_Object_var myObj;
QPushButton *mySelBtn;
QLineEdit *myMainShapeEdit;
QComboBox *mySubShTypeCompo;
QListWidget *myFilteredList;
QTreeWidget *myExtractedTree;
QListWidget *myRemovedList;
QListWidget *myModifiedList;
QListWidget *myAddedList;
QTreeWidgetItem *myTopItems[8];
QPushButton *myRebuildBtn;
TColStd_MapOfInteger myMapExtractedIDs;
bool myIsHiddenMain;
TColStd_MapOfInteger myMapDisplayedIDs;
TopTools_IndexedMapOfShape myIndices;
};
#endif // OPERATIONGUI_EXTRACTIONDLG_H