mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-19 17:43:09 +05:00
IPAL21136 Repair add point regression - wrong resulting shape
This commit is contained in:
parent
95a6b131ce
commit
e88595c992
@ -41,8 +41,10 @@
|
|||||||
#include <Geom_Curve.hxx>
|
#include <Geom_Curve.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
|
||||||
@ -124,6 +126,7 @@ void RepairGUI_DivideEdgeDlg::Init()
|
|||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
myIndex = -1;
|
||||||
|
|
||||||
//myGeomGUI->SetState( 0 );
|
//myGeomGUI->SetState( 0 );
|
||||||
initSelection();
|
initSelection();
|
||||||
@ -163,20 +166,26 @@ void RepairGUI_DivideEdgeDlg::displayPreview()
|
|||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
gp_Pnt aPnt;
|
gp_Pnt aPnt;
|
||||||
if ( GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ) ) {
|
GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE );
|
||||||
if (aShape.ShapeType() == TopAbs_EDGE) {
|
|
||||||
Standard_Real aFP, aLP, aP;
|
if ( myIndex != -1) {
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
|
TopTools_IndexedMapOfShape aShapes;
|
||||||
aP = aFP + (aLP - aFP) * myValEdt->value();
|
TopExp::MapShapes(aShape, aShapes);
|
||||||
aPnt = aCurve->Value(aP);
|
aShape = aShapes.FindKey(myIndex);
|
||||||
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
|
|
||||||
aShape = mkVertex.Shape();
|
|
||||||
// Build prs
|
|
||||||
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
|
|
||||||
if ( aPrs != 0 && !aPrs->IsNull() )
|
|
||||||
GEOMBase_Helper::displayPreview( aPrs, false, true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aShape.ShapeType() == TopAbs_EDGE) {
|
||||||
|
Standard_Real aFP, aLP, aP;
|
||||||
|
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
|
||||||
|
aP = aFP + (aLP - aFP) * myValEdt->value();
|
||||||
|
aPnt = aCurve->Value(aP);
|
||||||
|
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
|
||||||
|
aShape = mkVertex.Shape();
|
||||||
|
// Build prs
|
||||||
|
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
|
||||||
|
if ( aPrs != 0 && !aPrs->IsNull() )
|
||||||
|
GEOMBase_Helper::displayPreview( aPrs, false, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -203,6 +212,7 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply()
|
|||||||
|
|
||||||
myEditCurrentArgument->setText( "" );
|
myEditCurrentArgument->setText( "" );
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
myIndex = -1;
|
||||||
|
|
||||||
initSelection();
|
initSelection();
|
||||||
|
|
||||||
@ -220,6 +230,7 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
|
|||||||
myEditCurrentArgument->setText( "" );
|
myEditCurrentArgument->setText( "" );
|
||||||
|
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
myIndex = -1;
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
@ -228,46 +239,45 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
|
|||||||
if ( aSelList.Extent() == 1 ) {
|
if ( aSelList.Extent() == 1 ) {
|
||||||
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
|
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
|
||||||
Standard_Boolean aRes;
|
Standard_Boolean aRes;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
|
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
|
||||||
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
|
if ( !CORBA::is_nil( aSelectedObj ) && aRes )
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
{
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) {
|
QString aName = GEOMBase::GetName( aSelectedObj );
|
||||||
|
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
|
||||||
|
{
|
||||||
const int aType = aShape.ShapeType();
|
const int aType = aShape.ShapeType();
|
||||||
if ( aType <= TopAbs_EDGE ) {
|
if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound
|
||||||
// edge, wire, face, shell, solid, compound
|
{
|
||||||
GEOM::short_array anIndexes;
|
GEOM::short_array anIndexes;
|
||||||
|
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
aSelMgr->GetIndexes( anIO, aMap );
|
SalomeApp_Application* anApp =
|
||||||
|
(SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
|
||||||
|
anApp->selectionMgr()->GetIndexes( anIO, aMap );
|
||||||
|
|
||||||
if ( aMap.Extent() == 1 ) { // local selection
|
if ( !aMap.IsEmpty() ) // subshape selection
|
||||||
int anIndex = aMap( 1 );
|
{
|
||||||
myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( anIndex ) );
|
myIndex = aMap( 1 );
|
||||||
|
myObject = aSelectedObj;
|
||||||
//Find SubShape Object in Father
|
myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( myIndex ) );
|
||||||
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
|
|
||||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
|
|
||||||
myObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myObject = aFindedObject; // get Object from study
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( aType == TopAbs_EDGE ) {
|
else if ( aType == TopAbs_EDGE ) // single shape selection
|
||||||
// single shape selection
|
{
|
||||||
myObject = aSelectedObject;
|
myIndex = -1;
|
||||||
|
myObject = aSelectedObj;
|
||||||
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
|
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
|
||||||
}
|
}
|
||||||
else {
|
else // face, shell, solid or compound was selected, and NOT its subshape.
|
||||||
// face, shell, solid or compound was selected, and NOT its subshape.
|
{
|
||||||
|
myIndex = -1;
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,6 +319,7 @@ void RepairGUI_DivideEdgeDlg::ActivateThisDialog()
|
|||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||||
|
|
||||||
// myObject = GEOM::GEOM_Object::_nil();
|
// myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
myIndex = -1;
|
||||||
|
|
||||||
//myGeomGUI->SetState( 0 );
|
//myGeomGUI->SetState( 0 );
|
||||||
initSelection();
|
initSelection();
|
||||||
@ -351,7 +362,7 @@ bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
|
|||||||
bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
|
bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge
|
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge
|
||||||
( myObject, -1, myValEdt->value(), getIsByParameter() );
|
( myObject, myIndex, myValEdt->value(), getIsByParameter() );
|
||||||
bool aResult = !anObj->_is_nil();
|
bool aResult = !anObj->_is_nil();
|
||||||
if ( aResult )
|
if ( aResult )
|
||||||
{
|
{
|
||||||
@ -387,15 +398,3 @@ void RepairGUI_DivideEdgeDlg::initSelection()
|
|||||||
GEOM::GEOM_Object_var aNullGeomObject;
|
GEOM::GEOM_Object_var aNullGeomObject;
|
||||||
localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects
|
localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : addSubshapeToStudy
|
|
||||||
// purpose : virtual method to add new SubObjects if local selection
|
|
||||||
//=================================================================================
|
|
||||||
void RepairGUI_DivideEdgeDlg::addSubshapesToStudy()
|
|
||||||
{
|
|
||||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
|
||||||
objMap[GroupPoints->LineEdit1->text()] = myObject;
|
|
||||||
|
|
||||||
addSubshapesToFather( objMap );
|
|
||||||
}
|
|
||||||
|
@ -49,7 +49,6 @@ protected:
|
|||||||
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
||||||
virtual bool isValid( QString& );
|
virtual bool isValid( QString& );
|
||||||
virtual bool execute( ObjectList& );
|
virtual bool execute( ObjectList& );
|
||||||
virtual void addSubshapesToStudy();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
@ -57,6 +56,7 @@ private:
|
|||||||
void initSelection();
|
void initSelection();
|
||||||
|
|
||||||
bool getIsByParameter() const;
|
bool getIsByParameter() const;
|
||||||
|
int myIndex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GEOM::GEOM_Object_var myObject;
|
GEOM::GEOM_Object_var myObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user