mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 08:50:36 +05:00
22755: [EDF] Improvement of Projection operation
This commit is contained in:
parent
23a1ce7d1c
commit
33eddb946d
@ -2,7 +2,6 @@
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
@ -25,24 +24,17 @@ projection = geompy.MakeProjection(curve, face_cyl)
|
||||
# add objects in the study
|
||||
geompy.addToStudy(cylinder, "cylinder")
|
||||
geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
|
||||
geompy.addToStudy(p1, "p1")
|
||||
geompy.addToStudy(p2, "p2")
|
||||
geompy.addToStudy(p3, "p3")
|
||||
geompy.addToStudy(p4, "p4")
|
||||
geompy.addToStudy(p5, "p5")
|
||||
geompy.addToStudy(curve, "curve")
|
||||
geompy.addToStudy(projection, "projection")
|
||||
|
||||
#projection of point on wire.
|
||||
#projection of point on wire
|
||||
e1 = geompy.MakeLineTwoPnt(p1, p2)
|
||||
e2 = geompy.MakeLineTwoPnt(p2, p3)
|
||||
|
||||
w1 = geompy.MakeWire([e1, e2], 1.e-7)
|
||||
v1 = geompy.MakeVertex(300, 40, 100)
|
||||
|
||||
prj = geompy.MakeProjectionOnWire(v1, w1)
|
||||
geompy.addToStudy(e1, "e1")
|
||||
geompy.addToStudy(e2, "e2")
|
||||
prj = geompy.MakeProjection(v1, w1)
|
||||
geompy.addToStudy(w1, "w1")
|
||||
geompy.addToStudy(v1, "v1")
|
||||
geompy.addToStudy(prj[1], "projOnWire")
|
||||
geompy.addToStudy(prj, "projOnWire")
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
BIN
doc/salome/gui/GEOM/images/projection_dlg1.png
Normal file
BIN
doc/salome/gui/GEOM/images/projection_dlg1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
doc/salome/gui/GEOM/images/projection_dlg2.png
Normal file
BIN
doc/salome/gui/GEOM/images/projection_dlg2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -27,7 +27,7 @@ parameter value, \em theMax the maximal parameter value.
|
||||
\note The input Edge parameters range is [0, 1]. If \b theMin parameter is
|
||||
negative, the input Edge is extended, otherwise it is shrinked by
|
||||
\b theMin parameter. If \b theMax is greater than 1, the Edge is
|
||||
extended, otherwise it is shrinked by \btheMax parameter.
|
||||
extended, otherwise it is shrinked by \b theMax parameter.
|
||||
|
||||
Secondly it is possible to resize a \b Face.
|
||||
\n <b>TUI Command:</b> <em>geompy.ExtendFace(theFace, theUMin, theUMax,
|
||||
|
@ -1,23 +1,34 @@
|
||||
/*!
|
||||
|
||||
\page projection_operation_page Projection on a Face
|
||||
\page projection_operation_page Projection
|
||||
|
||||
\n To produce a <b>Projection</b> in the <b>Main Menu</b> select
|
||||
<b>Operations - > Transformation - > Projection</b>
|
||||
|
||||
\n This operation makes normal projection of a <b>Source vertex, edge
|
||||
or wire</b> on a given <b>Target face</b>.
|
||||
\ref restore_presentation_parameters_page "Advanced options".
|
||||
\n This operation makes normal projection of one shape to another.
|
||||
\n There are 3 types of projection different by types of operands.
|
||||
|
||||
Firstly, you can project <b>Source vertex, edge or wire</b> on a given <b>Target face</b>.
|
||||
|
||||
\image html projection_dlg.png
|
||||
|
||||
Secondly, you can project <b>Source vertex</b> on a given <b>Target wire</b>.
|
||||
|
||||
\image html projection_dlg1.png
|
||||
|
||||
Thirdly, you can project <b>Source vertex</b> on a given <b>Target edge</b>.
|
||||
|
||||
\image html projection_dlg2.png
|
||||
|
||||
\ref restore_presentation_parameters_page "Advanced options".
|
||||
|
||||
\n <b>Example:</b>
|
||||
|
||||
\image html projection_preview.png "The curve (in red) and its projection on the cylindric surface"
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeProjection(Source, Target),</em>
|
||||
where \em Source is a shape which has to be projected, \em Target
|
||||
is a face, on which the \em Source shape will be projected. The \em
|
||||
is a shape, on which the \em Source shape will be projected. The \em
|
||||
Result will be a \em GEOM_Object.
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of the use of
|
||||
|
@ -3860,8 +3860,8 @@ module GEOM
|
||||
GEOM_Object MakeCopy (in GEOM_Object theOriginal);
|
||||
|
||||
/*!
|
||||
* \brief Deprecated method. Use Export<FormatName> (from the
|
||||
* corresponding plugin) instead; here <FormatName> is a name of format.
|
||||
* \brief Deprecated method. Use Export\<FormatName\> (from the
|
||||
* corresponding plugin) instead; here \<FormatName\> is a name of format.
|
||||
*
|
||||
* \brief Export the given shape into a file with given name.
|
||||
* \param theObject Shape to be stored in the file.
|
||||
@ -3871,8 +3871,8 @@ module GEOM
|
||||
void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName);
|
||||
|
||||
/*!
|
||||
* \brief Deprecated method. Use Import<FormatName> (from the
|
||||
* corresponding plugin) instead; here <FormatName> is a name of format.
|
||||
* \brief Deprecated method. Use Import\<FormatName\> (from the
|
||||
* corresponding plugin) instead; here \<FormatName\> is a name of format.
|
||||
*
|
||||
* \brief Import a shape from the STL, BREP, IGES or STEP file
|
||||
* (depends on given format) with given name.
|
||||
|
@ -131,6 +131,8 @@ SET( _res_files
|
||||
normale.png
|
||||
offset.png
|
||||
projection.png
|
||||
projection_on_edge.png
|
||||
projection_on_wire.png
|
||||
origin_and_vectors.png
|
||||
partition.png
|
||||
partitionkeep.png
|
||||
|
BIN
resources/projection_on_edge.png
Normal file
BIN
resources/projection_on_edge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 727 B |
BIN
resources/projection_on_wire.png
Normal file
BIN
resources/projection_on_wire.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 729 B |
@ -44,11 +44,11 @@ namespace GEOM
|
||||
{
|
||||
if (--myCounter == 0) {
|
||||
TCollection_AsciiString aDescr;
|
||||
if ( myAppend ) {
|
||||
if ( myAppend )
|
||||
aDescr = myFunction->GetDescription();
|
||||
if ( !aDescr.IsEmpty() ) aDescr += "\n\t";
|
||||
}
|
||||
std::string aString = myStream.str();
|
||||
if ( !aDescr.IsEmpty() && !aString.empty())
|
||||
aDescr += "\n\t";
|
||||
aDescr += (char *)aString.c_str();
|
||||
myFunction->SetDescription( aDescr );
|
||||
}
|
||||
|
@ -407,12 +407,12 @@ void GEOMBase_Helper::erasePreview( const bool update )
|
||||
{
|
||||
SUIT_ViewManager* aViewManager = myViewWindow->getViewManager();
|
||||
if ( aViewManager->getType() == OCCViewer_Viewer::Type() ||
|
||||
aViewManager->getType() == SVTK_Viewer::Type() )
|
||||
aViewManager->getType() == SVTK_Viewer::Type() )
|
||||
{
|
||||
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
||||
if (aView)
|
||||
aView->Erase( getDisplayer(), *anIter, true );
|
||||
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
||||
if (aView)
|
||||
aView->Erase( getDisplayer(), *anIter, true );
|
||||
}
|
||||
}
|
||||
delete *anIter;
|
||||
@ -843,21 +843,21 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
|
||||
QString aName = getObjectName(obj);
|
||||
if (aName.isEmpty()) {
|
||||
aName = getNewObjectName(currObj);
|
||||
if ( nbObjs > 1 ) {
|
||||
if (aName.isEmpty())
|
||||
aName = getPrefix(obj);
|
||||
if (nbObjs <= 30) {
|
||||
// Try to find a unique name
|
||||
aName = GEOMBase::GetDefaultName(aName, extractPrefix());
|
||||
} else {
|
||||
// Don't check name uniqueness in case of numerous objects
|
||||
aName = aName + "_" + QString::number(aNumber++);
|
||||
}
|
||||
} else {
|
||||
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
||||
if ( aName.isEmpty() )
|
||||
aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
|
||||
}
|
||||
if ( nbObjs > 1 ) {
|
||||
if (aName.isEmpty())
|
||||
aName = getPrefix(obj);
|
||||
if (nbObjs <= 30) {
|
||||
// Try to find a unique name
|
||||
aName = GEOMBase::GetDefaultName(aName, extractPrefix());
|
||||
} else {
|
||||
// Don't check name uniqueness in case of numerous objects
|
||||
aName = aName + "_" + QString::number(aNumber++);
|
||||
}
|
||||
} else {
|
||||
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
||||
if ( aName.isEmpty() )
|
||||
aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
|
||||
}
|
||||
}
|
||||
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
|
||||
// updateView=false
|
||||
@ -1137,10 +1137,10 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr
|
||||
if ( !CORBA::is_nil( cobject ) ) {
|
||||
GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices();
|
||||
int length = indices->length();
|
||||
// VSR 18/03/2014: we need only sub-shapes with single sub-shape index (to exclude groups, etc)
|
||||
if ( length == 1 && indices[0] == theIndex ) {
|
||||
object = cobject;
|
||||
break;
|
||||
// VSR 18/03/2014: we need only sub-shapes with single sub-shape index (to exclude groups, etc)
|
||||
if ( length == 1 && indices[0] == theIndex ) {
|
||||
object = cobject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,9 +432,17 @@
|
||||
<translation>offset.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PROJECTION</source>
|
||||
<source>ICON_DLG_PROJECTION_ON_FACE</source>
|
||||
<translation>projection.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PROJECTION_ON_WIRE</source>
|
||||
<translation>projection_on_wire.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PROJECTION_ON_EDGE</source>
|
||||
<translation>projection_on_edge.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_EXTEND_EDGE</source>
|
||||
<translation>edgeextension.png</translation>
|
||||
|
@ -1213,17 +1213,45 @@ Please, select face, shell or solid and try again</translation>
|
||||
<translation>Division pattern</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJECTION</source>
|
||||
<translation>Projection</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJECTION_TITLE</source>
|
||||
<source>GEOM_PROJECTION_ON_FACE</source>
|
||||
<translation>Projection on Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_SOURCE_OBJECT</source>
|
||||
<source>GEOM_PROJECTION_ON_WIRE</source>
|
||||
<translation>Projection on Wire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJECTION_ON_EDGE</source>
|
||||
<translation>Projection on Edge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJECTION_TITLE</source>
|
||||
<translation>Projection</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_FACE_SOURCE</source>
|
||||
<translation>Source vertex, edge or wire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_FACE_TARGET</source>
|
||||
<translation>Target face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_WIRE_SOURCE</source>
|
||||
<translation>Source vertex</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_WIRE_TARGET</source>
|
||||
<translation>Target wire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_EDGE_SOURCE</source>
|
||||
<translation>Source vertex</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PROJ_ON_EDGE_TARGET</source>
|
||||
<translation>Target edge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_SOLUTION</source>
|
||||
<translation>Solution :</translation>
|
||||
@ -1232,10 +1260,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_SOLUTION_I</source>
|
||||
<translation>Solution %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_TARGET_OBJECT</source>
|
||||
<translation>Target face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_WITH_CONTACT</source>
|
||||
<translation>With contact</translation>
|
||||
|
@ -1155,8 +1155,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
|
||||
* ProjectShapeCopy
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
|
||||
(Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget)
|
||||
Handle(GEOM_Object)
|
||||
GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
|
||||
Handle(GEOM_Object) theTarget)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -1165,35 +1166,54 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
|
||||
Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
|
||||
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
|
||||
|
||||
//Add a new Projection object
|
||||
Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
|
||||
Handle(GEOM_Object) aCopy;
|
||||
|
||||
//Add a Projection function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
|
||||
TopoDS_Shape aTarget = theTarget->GetValue();
|
||||
if ( aTarget.IsNull() ) return NULL;
|
||||
if ( aTarget.ShapeType() == TopAbs_EDGE ||
|
||||
aTarget.ShapeType() == TopAbs_WIRE )
|
||||
{
|
||||
// a TPythonDump prevents dumping ProjectPointOnWire(),
|
||||
// dump of MakeProjection() is done at the end of this function
|
||||
GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
|
||||
Standard_Integer dummy;
|
||||
ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
|
||||
if ( aCopy.IsNull() || !IsDone() )
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Add a new Projection object
|
||||
aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
|
||||
//Add a Projection function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
|
||||
|
||||
GEOMImpl_IMirror aTI (aFunction);
|
||||
aTI.SetPlane(theTarget->GetLastFunction());
|
||||
aTI.SetOriginal(aLastFunction);
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
|
||||
|
||||
//Compute the Projection
|
||||
try {
|
||||
OCC_CATCH_SIGNALS;
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Projection driver failed");
|
||||
GEOMImpl_IMirror aTI (aFunction);
|
||||
aTI.SetPlane(theTarget->GetLastFunction());
|
||||
aTI.SetOriginal(aLastFunction);
|
||||
|
||||
//Compute the Projection
|
||||
try {
|
||||
OCC_CATCH_SIGNALS;
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Projection driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
|
||||
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
|
||||
<< theSource << ", " << theTarget << ")";
|
||||
|
||||
|
@ -8785,9 +8785,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
self._autoPublish(anObj, theName, "offset")
|
||||
return anObj
|
||||
|
||||
## Create new object as projection of the given one on a 2D surface.
|
||||
## Create new object as projection of the given one on another.
|
||||
# @param theSource The source object for the projection. It can be a point, edge or wire.
|
||||
# @param theTarget The target object. It can be planar or cylindrical face.
|
||||
# Edge and wire are acceptable if @a theTarget is a face.
|
||||
# @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
|
||||
# @param theName Object name; when specified, this parameter is used
|
||||
# for result publication in the study. Otherwise, if automatic
|
||||
# publication is switched on, default value is used for result name.
|
||||
@ -8798,11 +8799,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
@ManageTransactions("TrsfOp")
|
||||
def MakeProjection(self, theSource, theTarget, theName=None):
|
||||
"""
|
||||
Create new object as projection of the given one on a 2D surface.
|
||||
Create new object as projection of the given one on another.
|
||||
|
||||
Parameters:
|
||||
theSource The source object for the projection. It can be a point, edge or wire.
|
||||
theTarget The target object. It can be planar or cylindrical face.
|
||||
Edge and wire are acceptable if theTarget is a face.
|
||||
theTarget The target object. It can be planar or cylindrical face, edge or wire.
|
||||
theName Object name; when specified, this parameter is used
|
||||
for result publication in the study. Otherwise, if automatic
|
||||
publication is switched on, default value is used for result name.
|
||||
|
@ -38,6 +38,11 @@
|
||||
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
enum EOperationType { PROJ_ON_FACE = 0, PROJ_ON_WIRE, PROJ_ON_EDGE };
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_ProjectionDlg()
|
||||
// purpose : Constructs a TransformationGUI_ProjectionDlg which is a child of 'parent', with the
|
||||
@ -49,23 +54,20 @@ TransformationGUI_ProjectionDlg::TransformationGUI_ProjectionDlg (GeometryGUI* t
|
||||
QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
|
||||
{
|
||||
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION")));
|
||||
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_FACE")));
|
||||
QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_WIRE")));
|
||||
QPixmap image4 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION_ON_EDGE")));
|
||||
|
||||
setWindowTitle(tr("GEOM_PROJECTION_TITLE"));
|
||||
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
mainFrame()->RadioButton1->setIcon(image2);
|
||||
mainFrame()->RadioButton2->setIcon(image3);
|
||||
mainFrame()->RadioButton3->setIcon(image4);
|
||||
|
||||
myGroup = new DlgRef_2Sel (centralWidget());
|
||||
|
||||
myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
myGroup->TextLabel1->setText(tr("GEOM_SOURCE_OBJECT"));
|
||||
myGroup->TextLabel2->setText(tr("GEOM_TARGET_OBJECT"));
|
||||
myGroup->PushButton1->setIcon(image1);
|
||||
myGroup->PushButton2->setIcon(image1);
|
||||
myGroup->LineEdit1->setReadOnly(true);
|
||||
@ -108,6 +110,8 @@ void TransformationGUI_ProjectionDlg::Init()
|
||||
showOnlyPreviewControl();
|
||||
|
||||
// signals and slots connections
|
||||
connect(this, SIGNAL( constructorsClicked( int )),
|
||||
this, SLOT ( ConstructorsClicked( int )));
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -115,20 +119,17 @@ void TransformationGUI_ProjectionDlg::Init()
|
||||
connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
initName(mainFrame()->GroupConstructors->title());
|
||||
initName( windowTitle() );
|
||||
|
||||
setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName);
|
||||
setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium);
|
||||
setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons);
|
||||
|
||||
mainFrame()->RadioButton1->setFocus();
|
||||
//mainFrame()->RadioButton1->setFocus();
|
||||
ConstructorsClicked( 0 );
|
||||
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
||||
myGroup->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
resize(100,100);
|
||||
}
|
||||
|
||||
@ -153,8 +154,8 @@ bool TransformationGUI_ProjectionDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
myGroup->PushButton1->click();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -166,9 +167,25 @@ void TransformationGUI_ProjectionDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE);
|
||||
GEOM::GeomObjPtr aSelectedObject;
|
||||
if ( myEditCurrentArgument == myGroup->LineEdit1 ) // what to project
|
||||
switch( getConstructorId() ) {
|
||||
case PROJ_ON_FACE: aSelectedObject = getSelected(TopAbs_SHAPE); break;
|
||||
case PROJ_ON_WIRE:
|
||||
case PROJ_ON_EDGE: aSelectedObject = getSelected(TopAbs_VERTEX); break;
|
||||
default:;
|
||||
}
|
||||
else
|
||||
switch( getConstructorId() ) { // where to project
|
||||
case PROJ_ON_FACE: aSelectedObject = getSelected(TopAbs_FACE); break;
|
||||
case PROJ_ON_WIRE: aSelectedObject = getSelected(TopAbs_WIRE); break;
|
||||
case PROJ_ON_EDGE: aSelectedObject = getSelected(TopAbs_EDGE); break;
|
||||
default:;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
|
||||
if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull())
|
||||
{
|
||||
QString aName = GEOMBase::GetName(aSelectedObject.get());
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
@ -193,6 +210,7 @@ void TransformationGUI_ProjectionDlg::SelectionIntoArgument()
|
||||
if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
|
||||
else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
|
||||
}
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -203,25 +221,45 @@ void TransformationGUI_ProjectionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if (send == myGroup->PushButton1) {
|
||||
globalSelection(); // close local contexts, if any
|
||||
|
||||
if (send == myGroup->PushButton1) // what to project
|
||||
{
|
||||
myEditCurrentArgument = myGroup->LineEdit1;
|
||||
|
||||
myGroup->PushButton2->setDown(false);
|
||||
myGroup->LineEdit2->setEnabled(false);
|
||||
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_POINT );
|
||||
aMap.Add( GEOM_EDGE );
|
||||
aMap.Add( GEOM_WIRE );
|
||||
globalSelection( aMap );
|
||||
switch ( getConstructorId() ) {
|
||||
case PROJ_ON_FACE: {
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_POINT );
|
||||
aMap.Add( GEOM_EDGE );
|
||||
aMap.Add( GEOM_WIRE );
|
||||
globalSelection( aMap );
|
||||
break;
|
||||
}
|
||||
case PROJ_ON_WIRE:
|
||||
case PROJ_ON_EDGE: {
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
break;
|
||||
}
|
||||
default:;
|
||||
}
|
||||
}
|
||||
else if (send == myGroup->PushButton2) {
|
||||
else if (send == myGroup->PushButton2) // where to project
|
||||
{
|
||||
myEditCurrentArgument = myGroup->LineEdit2;
|
||||
|
||||
myGroup->PushButton1->setDown(false);
|
||||
myGroup->LineEdit1->setEnabled(false);
|
||||
|
||||
globalSelection( GEOM_FACE );
|
||||
switch ( getConstructorId() ) {
|
||||
case PROJ_ON_FACE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); break;
|
||||
case PROJ_ON_WIRE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE); break;
|
||||
case PROJ_ON_EDGE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
// enable line edit
|
||||
@ -229,6 +267,8 @@ void TransformationGUI_ProjectionDlg::SetEditCurrentArgument()
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -281,9 +321,51 @@ bool TransformationGUI_ProjectionDlg::execute (ObjectList& objects)
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
|
||||
anObj = anOper->ProjectShapeCopy(myObject1.get(), myObject2.get());
|
||||
anObj = anOper->ProjectShapeCopy( myObject1.get(), myObject2.get() );
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_ProjectionDlg::ConstructorsClicked( int constructorId )
|
||||
{
|
||||
myObject1.nullify();
|
||||
myObject2.nullify();
|
||||
myGroup->LineEdit1->setText( "" );
|
||||
myGroup->LineEdit2->setText( "" );
|
||||
|
||||
switch ( constructorId ) {
|
||||
case PROJ_ON_FACE:
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_FACE"));
|
||||
myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_FACE_SOURCE"));
|
||||
myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_FACE_TARGET"));
|
||||
break;
|
||||
case PROJ_ON_EDGE:
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_EDGE"));
|
||||
myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_EDGE_SOURCE"));
|
||||
myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_EDGE_TARGET"));
|
||||
break;
|
||||
case PROJ_ON_WIRE:
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION_ON_WIRE"));
|
||||
myGroup->TextLabel1->setText(tr("GEOM_PROJ_ON_WIRE_SOURCE"));
|
||||
myGroup->TextLabel2->setText(tr("GEOM_PROJ_ON_WIRE_TARGET"));
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
myGroup->PushButton1->click();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : addSubshapeToStudy
|
||||
// purpose : virtual method to add new SubObjects if local selection
|
||||
//=================================================================================
|
||||
void TransformationGUI_ProjectionDlg::addSubshapesToStudy()
|
||||
{
|
||||
GEOMBase::PublishSubObject( myObject1.get() );
|
||||
GEOMBase::PublishSubObject( myObject2.get() );
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ protected:
|
||||
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
||||
virtual bool isValid (QString&);
|
||||
virtual bool execute (ObjectList&);
|
||||
virtual void addSubshapesToStudy();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
@ -66,6 +67,7 @@ private slots:
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void ActivateThisDialog();
|
||||
void ConstructorsClicked( int constructorId );
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_PROJECTIONDLG_H
|
||||
|
Loading…
Reference in New Issue
Block a user