0020082: EDF 869 GEOM : Edges Orientation indicator/reverse
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 38 KiB |
@ -21,6 +21,12 @@
|
||||
length that changes in arithmetic progression (Lk = Lk-1 + d)
|
||||
beginning from a given starting length and up to a given end length.
|
||||
|
||||
The direction of the splitting is defined by the orientation of the underlying geometrical edge.
|
||||
<b>"Reverse Edges"</b> list box allows to specify the edges for which the splitting should be made
|
||||
in the direction opposing to their orientation. This list box is enabled only if the geometry object
|
||||
is selected for the meshing. In this case the user can select edges to be reversed either directly
|
||||
picking them in the 3D viewer or by selecting the edges or groups of edges in the Object browser.
|
||||
|
||||
\image html a-arithmetic1d.png
|
||||
|
||||
\image html b-ithmetic1d.png "Arithmetic 1D hypothesis - the size of mesh elements gradually increases"
|
||||
@ -106,6 +112,12 @@ edges generated by these segments will represent nodes of your
|
||||
mesh. Later these nodes will be used for meshing of the faces abutting
|
||||
to these edges.
|
||||
|
||||
The direction of the splitting is defined by the orientation of the underlying geometrical edge.
|
||||
<b>"Reverse Edges"</b> list box allows to specify the edges for which the splitting should be made
|
||||
in the direction opposing to their orientation. This list box is enabled only if the geometry object
|
||||
is selected for the meshing. In this case the user can select edges to be reversed either directly
|
||||
picking them in the 3D viewer or by selecting the edges or groups of edges in the Object browser.
|
||||
|
||||
\image html image46.gif
|
||||
|
||||
You can set the type of distribution for this hypothesis in the
|
||||
@ -149,6 +161,12 @@ geometric progression. Then mesh nodes are
|
||||
constructed at segment ends location and 1D mesh elements are
|
||||
constructed on them.
|
||||
|
||||
The direction of the splitting is defined by the orientation of the underlying geometrical edge.
|
||||
<b>"Reverse Edges"</b> list box allows to specify the edges for which the splitting should be made
|
||||
in the direction opposing to their orientation. This list box is enabled only if the geometry object
|
||||
is selected for the meshing. In this case the user can select edges to be reversed either directly
|
||||
picking them in the 3D viewer or by selecting the edges or groups of edges in the Object browser.
|
||||
|
||||
\image html a-startendlength.png
|
||||
|
||||
\image html b-art_end_length.png "The lengths of the first and the last segment are strictly defined"
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "SMESH_Hypothesis.idl"
|
||||
#include "SMESH_Mesh.idl"
|
||||
|
||||
|
||||
/*!
|
||||
* StdMeshers: interfaces to standard hypotheses and algorithms
|
||||
*/
|
||||
@ -209,6 +208,26 @@ module StdMeshers
|
||||
*/
|
||||
long ConversionMode()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -226,6 +245,26 @@ module StdMeshers
|
||||
* Returns <start segment length> or <end segment length> parameter value
|
||||
*/
|
||||
double GetLength(in boolean isStartLength);
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -277,6 +316,26 @@ module StdMeshers
|
||||
* Returns <start segment length> or <end segment length> parameter value
|
||||
*/
|
||||
double GetLength(in boolean isStartLength);
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ salomeinclude_HEADERS = \
|
||||
SMESH_ActorUtils.h \
|
||||
SMESH_ActorDef.h \
|
||||
SMESH_DeviceActor.h \
|
||||
SMESH_PreviewActorsCollection.h \
|
||||
SMESH_ExtractGeometry.h \
|
||||
SMESH_ActorUtils.h \
|
||||
SMESH_FaceOrientationFilter.h
|
||||
@ -45,11 +46,13 @@ dist_libSMESHObject_la_SOURCES = \
|
||||
SMESH_Object.cxx \
|
||||
SMESH_DeviceActor.cxx \
|
||||
SMESH_Actor.cxx \
|
||||
SMESH_PreviewActorsCollection.cxx \
|
||||
SMESH_ExtractGeometry.cxx \
|
||||
SMESH_ActorUtils.cxx \
|
||||
SMESH_FaceOrientationFilter.cxx
|
||||
|
||||
libSMESHObject_la_CPPFLAGS = \
|
||||
$(QT_INCLUDES) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(GUI_CXXFLAGS) \
|
||||
$(MED_CXXFLAGS) \
|
||||
|
206
src/OBJECT/SMESH_PreviewActorsCollection.cxx
Normal file
@ -0,0 +1,206 @@
|
||||
// Copyright (C) 2007-2008 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
|
||||
//
|
||||
// SMESH OBJECT : interactive object for SMESH visualization
|
||||
// File : SMESH_PreviewActorsCollection.cxx
|
||||
// Author :
|
||||
// Module : SMESH
|
||||
//
|
||||
|
||||
#include "SMESH_PreviewActorsCollection.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
|
||||
// OCC includes
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
// VTK includes
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkScalarBarActor.h>
|
||||
#include <vtkPlane.h>
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkProperty.h>
|
||||
|
||||
#include "VTKViewer_Actor.h"
|
||||
|
||||
#include "SVTK_DeviceActor.h"
|
||||
#include "SALOME_Actor.h"
|
||||
|
||||
// QT
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
#else
|
||||
static int MYDEBUG = 0;
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
//vtkStandardNewMacro(SMESH_PreviewActorsCollection);
|
||||
|
||||
|
||||
SMESH_PreviewActorsCollection
|
||||
::SMESH_PreviewActorsCollection()
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("SMESH_PreviewActorsCollection - "<<this);
|
||||
}
|
||||
|
||||
|
||||
SMESH_PreviewActorsCollection
|
||||
::~SMESH_PreviewActorsCollection()
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("~SMESH_PreviewActorsCollection - "<<this);
|
||||
if (myRenderer)
|
||||
RemoveFromRender(myRenderer);
|
||||
|
||||
myMapOfActors.clear();
|
||||
}
|
||||
|
||||
bool SMESH_PreviewActorsCollection::Init( const TopoDS_Shape& theShape, TopAbs_ShapeEnum theType, const QString& theEntry )
|
||||
{
|
||||
myMainShape = theShape;
|
||||
myMapOfActors.clear();
|
||||
myMapOfShapes.Clear();
|
||||
|
||||
if ( theShape.IsNull() )
|
||||
return false;
|
||||
|
||||
Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
|
||||
anIO->setEntry( theEntry.toLatin1().constData() );
|
||||
|
||||
// get indexes of seleted elements
|
||||
TopExp::MapShapes(theShape, myMapOfShapes);
|
||||
|
||||
TopExp_Explorer exp( theShape, theType );
|
||||
for ( ; exp.More(); exp.Next() ) {
|
||||
int index = myMapOfShapes.FindIndex( exp.Current() );
|
||||
if ( index ) {
|
||||
// create actor if the index is present
|
||||
if ( GEOM_Actor* anActor = createActor( exp.Current() )) {
|
||||
// Create new entry for actor
|
||||
QString aString = theEntry;
|
||||
aString += QString("_%1").arg( index ); // add index to actor entry
|
||||
|
||||
// Create interactive object
|
||||
Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
|
||||
anIO->setEntry( aString.toLatin1().constData() );
|
||||
|
||||
// Init Actor
|
||||
anActor->SetVectorMode( true );
|
||||
anActor->setIO( anIO );
|
||||
anActor->SetSelector( mySelector );
|
||||
anActor->SetPickable( true );
|
||||
anActor->SetResolveCoincidentTopology( true );
|
||||
|
||||
// Add Actor to the Actors Map
|
||||
myMapOfActors.insert(index, anActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
mySelector->ClearIObjects();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GEOM_Actor* SMESH_PreviewActorsCollection::createActor(const TopoDS_Shape& shape)
|
||||
{
|
||||
GEOM_Actor* actor = GEOM_Actor::New();
|
||||
actor->SetShape(shape,0,0);
|
||||
|
||||
//Color Properties
|
||||
/*
|
||||
vtkProperty* aProp = vtkProperty::New();
|
||||
vtkProperty* aHLProp = vtkProperty::New();
|
||||
vtkProperty* aPHLProp = vtkProperty::New();
|
||||
|
||||
aProp->SetColor( 255, 0, 0);
|
||||
actor->SetProperty(aProp);
|
||||
|
||||
aHLProp->SetColor( 255, 255, 255);
|
||||
actor->SetHighlightProperty(aHLProp);
|
||||
|
||||
aPHLProp->SetColor( 155, 155, 155);
|
||||
aPHLProp->SetLineWidth ( 3 );
|
||||
aPHLProp->SetOpacity ( 0.75 );
|
||||
actor->SetPreHighlightProperty(aPHLProp);
|
||||
|
||||
aProp->Delete();
|
||||
aHLProp->Delete();
|
||||
aPHLProp->Delete();
|
||||
*/
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
GEOM_Actor* SMESH_PreviewActorsCollection::GetActorByIndex(int index)
|
||||
{
|
||||
return myMapOfActors.value(index);
|
||||
}
|
||||
|
||||
int SMESH_PreviewActorsCollection::GetIndexByShape( const TopoDS_Shape& theShape )
|
||||
{
|
||||
return myMapOfShapes.FindIndex( theShape );
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::AddToRender(vtkRenderer* theRenderer)
|
||||
{
|
||||
myRenderer = theRenderer;
|
||||
|
||||
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
|
||||
for ( ; iter != myMapOfActors.end(); ++iter )
|
||||
iter.value()->AddToRender( theRenderer );
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::RemoveFromRender(vtkRenderer* theRenderer){
|
||||
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
|
||||
for ( ; iter != myMapOfActors.end(); ++iter )
|
||||
iter.value()->RemoveFromRender( theRenderer );
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::SetSelector(SVTK_Selector* theSelector)
|
||||
{
|
||||
mySelector = theSelector;
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::HighlightAll( bool theHighlight ){
|
||||
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
|
||||
for ( ; iter != myMapOfActors.end(); ++iter )
|
||||
iter.value()->Highlight( theHighlight );
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::HighlightID( int index ){
|
||||
GEOM_Actor* anActor = GetActorByIndex( index );
|
||||
if ( anActor && !anActor->isHighlighted() )
|
||||
anActor->Highlight( true );
|
||||
}
|
||||
|
||||
void SMESH_PreviewActorsCollection::SetShown( bool shown ){
|
||||
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
|
||||
for ( ; iter != myMapOfActors.end(); ++iter )
|
||||
iter.value()->SetVisibility( shown );
|
||||
}
|
78
src/OBJECT/SMESH_PreviewActorsCollection.h
Normal file
@ -0,0 +1,78 @@
|
||||
// Copyright (C) 2007-2008 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
|
||||
//
|
||||
// SMESH OBJECT : interactive object for SMESH visualization
|
||||
// File : SMESH_PreviewActorsCollection.h
|
||||
// Author : OCN
|
||||
// Module : SMESH
|
||||
// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_PreviewActorsCollection.h,v 1
|
||||
//
|
||||
#ifndef SMESH_PREVIEW_ACTOR_COLLECTION_H
|
||||
#define SMESH_PREVIEW_ACTOR_COLLECTION_H
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <GEOM_Actor.h>
|
||||
#include "SMESH_Object.h"
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <SMDS_SetIterator.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
class vtkRenderer;
|
||||
class GEOM_Actor;
|
||||
|
||||
class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
|
||||
{
|
||||
public:
|
||||
SMESH_PreviewActorsCollection();
|
||||
~SMESH_PreviewActorsCollection();
|
||||
|
||||
virtual void AddToRender(vtkRenderer* theRenderer);
|
||||
virtual void RemoveFromRender(vtkRenderer* theRenderer);
|
||||
|
||||
bool Init( const TopoDS_Shape& theShape, TopAbs_ShapeEnum subShapeType = TopAbs_EDGE, const QString& = QString("") );
|
||||
|
||||
void SetSelector( SVTK_Selector* );
|
||||
|
||||
void HighlightAll( bool );
|
||||
void HighlightID( int );
|
||||
|
||||
GEOM_Actor* GetActorByIndex( int );
|
||||
|
||||
int GetIndexByShape( const TopoDS_Shape& );
|
||||
|
||||
void SetShown( bool );
|
||||
|
||||
protected:
|
||||
GEOM_Actor* createActor( const TopoDS_Shape& );
|
||||
|
||||
protected:
|
||||
TopoDS_Shape myMainShape;
|
||||
SVTK_Selector* mySelector;
|
||||
vtkRenderer* myRenderer;
|
||||
TopTools_IndexedMapOfShape myMapOfShapes;
|
||||
QMap<int, GEOM_Actor*> myMapOfActors;
|
||||
};
|
||||
|
||||
|
||||
#endif //SMESH_DEVICE_ACTOR_COLLECTION_H
|
@ -159,6 +159,7 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
||||
Dlg->setType( type() );
|
||||
retrieveParams();
|
||||
Dlg->show();
|
||||
Dlg->resize( Dlg->minimumSizeHint() );
|
||||
if ( !myEventLoop )
|
||||
myEventLoop = new QEventLoop( this );
|
||||
myEventLoop->exec(); // make myDlg not modal
|
||||
@ -383,6 +384,11 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() cons
|
||||
return myHypo;
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
|
||||
{
|
||||
myShapeEntry = theEntry;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return hypothesis containing initial parameters
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
QString hypName() const;
|
||||
bool isCreation() const;
|
||||
|
||||
QString getShapeEntry() const { return myShapeEntry; }
|
||||
void setShapeEntry( const QString& theEntry );
|
||||
|
||||
protected:
|
||||
struct StdParam
|
||||
{
|
||||
@ -121,6 +124,7 @@ private:
|
||||
bool myIsCreate;
|
||||
QtxDialog* myDlg;
|
||||
QEventLoop* myEventLoop;
|
||||
QString myShapeEntry;
|
||||
};
|
||||
|
||||
class SMESHGUI_HypothesisDlg : public QtxDialog
|
||||
|
@ -1063,6 +1063,15 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
||||
|
||||
int obj = myDlg->getActiveObject();
|
||||
removeCustomFilters(); // Issue 0020170
|
||||
|
||||
// Set Geometry
|
||||
QStringList aList;
|
||||
myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
|
||||
if (aList.count() != 0)
|
||||
aCreator->setShapeEntry( aList.first() );
|
||||
else
|
||||
aCreator->setShapeEntry( QString() );
|
||||
|
||||
myDlg->setEnabled( false );
|
||||
aCreator->create(initParamHyp, aHypName, myDlg);
|
||||
onActivateObject( obj ); // Issue 0020170. Restore filters
|
||||
@ -1116,6 +1125,14 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
|
||||
getInitParamsHypothesis( aHyp->GetName(), aHyp->GetLibName());
|
||||
aCreator->setInitParamsHypothesis( initParamHyp );
|
||||
|
||||
// Set Geometry
|
||||
QStringList aList;
|
||||
myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
|
||||
if (aList.count() > 0)
|
||||
aCreator->setShapeEntry( aList.first() );
|
||||
else
|
||||
aCreator->setShapeEntry( "" );
|
||||
|
||||
int obj = myDlg->getActiveObject();
|
||||
removeCustomFilters(); // Issue 0020170
|
||||
myDlg->setEnabled( false );
|
||||
|
@ -104,9 +104,32 @@ double StdMeshers_Arithmetic1D::GetLength(bool isStartLength) const
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Arithmetic1D::SetReversedEdges( std::vector<int>& ids )
|
||||
{
|
||||
if ( ids != _edgeIDs ) {
|
||||
_edgeIDs = ids;
|
||||
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save)
|
||||
{
|
||||
save << _begLength << " " << _endLength;
|
||||
int listSize = _edgeIDs.size();
|
||||
save << _begLength << " " << _endLength << " " << listSize;
|
||||
|
||||
if ( listSize > 0 ) {
|
||||
for ( int i = 0; i < listSize; i++)
|
||||
save << " " << _edgeIDs[i];
|
||||
save << " " << _objEntry;
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -119,12 +142,25 @@ ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save)
|
||||
istream & StdMeshers_Arithmetic1D::LoadFrom(istream & load)
|
||||
{
|
||||
bool isOK = true;
|
||||
int intVal;
|
||||
isOK = (load >> _begLength);
|
||||
if (!isOK)
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
isOK = (load >> _endLength);
|
||||
|
||||
if (!isOK)
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
|
||||
isOK = (load >> intVal);
|
||||
if (isOK && intVal > 0) {
|
||||
_edgeIDs.reserve( intVal );
|
||||
for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
|
||||
isOK = (load >> intVal);
|
||||
if ( isOK ) _edgeIDs.push_back( intVal );
|
||||
}
|
||||
isOK = (load >> _objEntry);
|
||||
}
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,15 @@
|
||||
#ifndef _SMESH_ARITHMETIC1D_HXX_
|
||||
#define _SMESH_ARITHMETIC1D_HXX_
|
||||
|
||||
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "Utils_SALOME_Exception.hxx"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_Arithmetic1D:
|
||||
public SMESH_Hypothesis
|
||||
{
|
||||
@ -43,6 +47,14 @@ public:
|
||||
|
||||
double GetLength(bool isStartLength) const;
|
||||
|
||||
void SetReversedEdges( std::vector<int>& ids);
|
||||
|
||||
void SetObjectEntry( const char* entry ) { _objEntry = entry; }
|
||||
|
||||
const char* GetObjectEntry() { return _objEntry.c_str(); }
|
||||
|
||||
const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
friend std::ostream& operator << (std::ostream & save, StdMeshers_Arithmetic1D & hyp);
|
||||
@ -64,6 +76,8 @@ public:
|
||||
|
||||
protected:
|
||||
double _begLength, _endLength;
|
||||
std::vector<int> _edgeIDs;
|
||||
std::string _objEntry;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -481,6 +481,7 @@ int StdMeshers_NumberOfSegments::ConversionMode() const
|
||||
|
||||
ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
|
||||
{
|
||||
int listSize = _edgeIDs.size();
|
||||
save << _numberOfSegments << " " << (int)_distrType;
|
||||
switch (_distrType)
|
||||
{
|
||||
@ -504,6 +505,13 @@ ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
|
||||
if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc)
|
||||
save << " " << _convMode;
|
||||
|
||||
if ( _distrType != DT_Regular && listSize > 0 ) {
|
||||
save << " " << listSize;
|
||||
for ( int i = 0; i < listSize; i++ )
|
||||
save << " " << _edgeIDs[i];
|
||||
save << " " << _objEntry;
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -619,6 +627,18 @@ istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
}
|
||||
|
||||
// load reversed edges IDs
|
||||
int intVal;
|
||||
isOK = (load >> intVal);
|
||||
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
|
||||
_edgeIDs.reserve( intVal );
|
||||
for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
|
||||
isOK = (load >> intVal);
|
||||
if ( isOK ) _edgeIDs.push_back( intVal );
|
||||
}
|
||||
isOK = (load >> _objEntry);
|
||||
}
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
@ -695,3 +715,18 @@ bool StdMeshers_NumberOfSegments::SetParametersByDefaults(const TDefaults& dflt
|
||||
return (_numberOfSegments = dflts._nbSegments );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_NumberOfSegments::SetReversedEdges( std::vector<int>& ids )
|
||||
{
|
||||
if ( ids != _edgeIDs ) {
|
||||
_edgeIDs = ids;
|
||||
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,13 @@ public:
|
||||
int ConversionMode() const
|
||||
throw (SALOME_Exception);
|
||||
|
||||
void SetReversedEdges( std::vector<int>& ids);
|
||||
|
||||
void SetObjectEntry( const char* entry ) { _objEntry = entry; }
|
||||
|
||||
const char* GetObjectEntry() { return _objEntry.c_str(); }
|
||||
|
||||
const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
|
||||
|
||||
/*!
|
||||
* \brief Initialize number of segments by the mesh built on the geometry
|
||||
@ -188,6 +195,8 @@ protected:
|
||||
std::vector<double> _table, _distr; //!< the table for DT_TabFunc, a sequence of pairs of numbers
|
||||
std::string _func; //!< the expression of the function for DT_ExprFunc
|
||||
int _convMode; //!< flag of conversion mode: 0=exponent, 1=cut negative
|
||||
std::vector<int> _edgeIDs; //!< list of reversed edges ids
|
||||
std::string _objEntry; //!< Entry of the main object to reverse edges
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -180,12 +180,15 @@ bool StdMeshers_Regular_1D::CheckHypothesis
|
||||
{
|
||||
case StdMeshers_NumberOfSegments::DT_Scale:
|
||||
_value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor();
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
break;
|
||||
case StdMeshers_NumberOfSegments::DT_TabFunc:
|
||||
_vvalue[ TAB_FUNC_IND ] = hyp->GetTableFunction();
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
break;
|
||||
case StdMeshers_NumberOfSegments::DT_ExprFunc:
|
||||
_svalue[ EXPR_FUNC_IND ] = hyp->GetExpressionFunction();
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
break;
|
||||
case StdMeshers_NumberOfSegments::DT_Regular:
|
||||
break;
|
||||
@ -209,6 +212,9 @@ bool StdMeshers_Regular_1D::CheckHypothesis
|
||||
_value[ END_LENGTH_IND ] = hyp->GetLength( false );
|
||||
ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
|
||||
_hypType = ARITHMETIC_1D;
|
||||
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
|
||||
@ -221,6 +227,9 @@ bool StdMeshers_Regular_1D::CheckHypothesis
|
||||
_value[ END_LENGTH_IND ] = hyp->GetLength( false );
|
||||
ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
|
||||
_hypType = BEG_END_LENGTH;
|
||||
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
|
||||
@ -821,6 +830,11 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
|
||||
bool reversed = false;
|
||||
if ( !_mainEdge.IsNull() )
|
||||
reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
|
||||
else if ( _revEdgesIDs.size() > 0 ) {
|
||||
for ( int i = 0; i < _revEdgesIDs.size(); i++)
|
||||
if ( _revEdgesIDs[i] == shapeID )
|
||||
reversed = true;
|
||||
}
|
||||
|
||||
BRepAdaptor_Curve C3d( E );
|
||||
double length = EdgeLength( E );
|
||||
@ -948,7 +962,7 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
|
||||
|
||||
const TopoDS_Edge & EE = TopoDS::Edge(theShape);
|
||||
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
|
||||
int shapeID = meshDS->ShapeToIndex( E );
|
||||
// int shapeID = meshDS->ShapeToIndex( E );
|
||||
|
||||
double f, l;
|
||||
Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
|
||||
|
@ -127,6 +127,7 @@ protected:
|
||||
int _ivalue[3];
|
||||
std::vector<double> _vvalue[1];
|
||||
std::string _svalue[1];
|
||||
std::vector<int> _revEdgesIDs;
|
||||
|
||||
// a source of propagated hypothesis, is set by CheckHypothesis()
|
||||
// always called before Compute()
|
||||
|
@ -105,9 +105,33 @@ double StdMeshers_StartEndLength::GetLength(bool isStartLength) const
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_StartEndLength::SetReversedEdges( std::vector<int>& ids )
|
||||
{
|
||||
if ( ids != _edgeIDs ) {
|
||||
_edgeIDs = ids;
|
||||
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & StdMeshers_StartEndLength::SaveTo(ostream & save)
|
||||
{
|
||||
save << _begLength << " " <<_endLength;
|
||||
int listSize = _edgeIDs.size();
|
||||
save << _begLength << " " << _endLength << " " << listSize;
|
||||
|
||||
if ( listSize > 0 ) {
|
||||
for ( int i = 0; i < listSize; i++) {
|
||||
save << " " << _edgeIDs[i];
|
||||
}
|
||||
save << " " << _objEntry;
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -120,12 +144,25 @@ ostream & StdMeshers_StartEndLength::SaveTo(ostream & save)
|
||||
istream & StdMeshers_StartEndLength::LoadFrom(istream & load)
|
||||
{
|
||||
bool isOK = true;
|
||||
int intVal;
|
||||
isOK = (load >> _begLength);
|
||||
if (!isOK)
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
isOK = (load >> _endLength);
|
||||
|
||||
if (!isOK)
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
|
||||
isOK = (load >> intVal);
|
||||
if (isOK && intVal > 0) {
|
||||
_edgeIDs.reserve( intVal );
|
||||
for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
|
||||
isOK = (load >> intVal);
|
||||
if ( isOK ) _edgeIDs.push_back( intVal );
|
||||
}
|
||||
isOK = (load >> _objEntry);
|
||||
}
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "Utils_SALOME_Exception.hxx"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis
|
||||
{
|
||||
public:
|
||||
@ -41,6 +43,14 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis
|
||||
|
||||
double GetLength(bool isStartLength) const;
|
||||
|
||||
void SetReversedEdges( std::vector<int>& ids);
|
||||
|
||||
const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
|
||||
|
||||
void SetObjectEntry( const char* entry ) { _objEntry = entry; }
|
||||
|
||||
const char* GetObjectEntry() { return _objEntry.c_str(); }
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
friend std::ostream & operator <<(std::ostream & save, StdMeshers_StartEndLength & hyp);
|
||||
@ -63,6 +73,8 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis
|
||||
|
||||
protected:
|
||||
double _begLength, _endLength;
|
||||
std::vector<int> _edgeIDs;
|
||||
std::string _objEntry;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,8 @@ salomeinclude_HEADERS = \
|
||||
StdMeshersGUI_DistrTable.h \
|
||||
StdMeshersGUI_NbSegmentsCreator.h \
|
||||
StdMeshersGUI_ObjectReferenceParamWdg.h \
|
||||
StdMeshersGUI_LayerDistributionParamWdg.h
|
||||
StdMeshersGUI_LayerDistributionParamWdg.h \
|
||||
StdMeshersGUI_EdgeDirectionParamWdg.h
|
||||
|
||||
# Libraries targets
|
||||
lib_LTLIBRARIES = libStdMeshersGUI.la
|
||||
@ -46,7 +47,8 @@ dist_libStdMeshersGUI_la_SOURCES = \
|
||||
StdMeshersGUI_DistrTable.cxx \
|
||||
StdMeshersGUI_NbSegmentsCreator.cxx \
|
||||
StdMeshersGUI_ObjectReferenceParamWdg.cxx \
|
||||
StdMeshersGUI_LayerDistributionParamWdg.cxx
|
||||
StdMeshersGUI_LayerDistributionParamWdg.cxx \
|
||||
StdMeshersGUI_EdgeDirectionParamWdg.cxx
|
||||
|
||||
MOC_FILES = \
|
||||
StdMeshersGUI_StdHypothesisCreator_moc.cxx \
|
||||
@ -54,7 +56,8 @@ MOC_FILES = \
|
||||
StdMeshersGUI_DistrTable_moc.cxx \
|
||||
StdMeshersGUI_NbSegmentsCreator_moc.cxx \
|
||||
StdMeshersGUI_ObjectReferenceParamWdg_moc.cxx \
|
||||
StdMeshersGUI_LayerDistributionParamWdg_moc.cxx
|
||||
StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \
|
||||
StdMeshersGUI_EdgeDirectionParamWdg_moc.cxx
|
||||
|
||||
nodist_libStdMeshersGUI_la_SOURCES= \
|
||||
$(MOC_FILES)
|
||||
|
417
src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.cxx
Normal file
@ -0,0 +1,417 @@
|
||||
// Copyright (C) 2007-2008 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
|
||||
//
|
||||
// File : StdMeshersGUI_EdgeDirectionParamWdg.cxx
|
||||
// Author : Open CASCADE S.A.S. (dmv)
|
||||
// SMESH includes
|
||||
//
|
||||
#include "StdMeshersGUI_EdgeDirectionParamWdg.h"
|
||||
|
||||
// SMESH Includes
|
||||
#include <SMESH_Type.h>
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_PreviewActorsCollection.h>
|
||||
#include <SMESH_ActorUtils.h>
|
||||
#include "SMESHGUI_GroupUtils.h"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
|
||||
// SVTK Includes
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SVTK_ViewModel.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SVTK_Selector.h>
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
// SUIT Includes
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
|
||||
// GEOM Includes
|
||||
#include <GEOMBase.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QPushButton>
|
||||
#include <QGridLayout>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
// OCCT includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
// SALOME KERNEL includes
|
||||
#include <SALOMEDS_SObject.hxx>
|
||||
|
||||
#define SPACING 6
|
||||
#define MARGIN 0
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg
|
||||
::StdMeshersGUI_EdgeDirectionParamWdg( QWidget * parent ):
|
||||
QWidget( parent )
|
||||
{
|
||||
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
|
||||
|
||||
QGridLayout* edgesLayout = new QGridLayout( this );
|
||||
edgesLayout->setMargin( MARGIN );
|
||||
edgesLayout->setSpacing( SPACING );
|
||||
|
||||
myListWidget = new QListWidget( this );
|
||||
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
|
||||
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
|
||||
myListWidget->setSelectionMode( QListWidget::ExtendedSelection );
|
||||
|
||||
edgesLayout->addWidget(myListWidget, 0, 0, 3, 3);
|
||||
edgesLayout->addWidget(myAddButton, 0, 4);
|
||||
edgesLayout->addWidget(myRemoveButton, 1, 4);
|
||||
|
||||
edgesLayout->setRowStretch(2, 5);
|
||||
edgesLayout->setColumnStretch(2, 5);
|
||||
|
||||
setLayout( edgesLayout );
|
||||
setMinimumWidth( 300 );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg::~StdMeshersGUI_EdgeDirectionParamWdg()
|
||||
{
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
|
||||
myPreviewActor->RemoveFromRender( myRenderer );
|
||||
aViewWindow->Repaint();
|
||||
}
|
||||
myEntry = "";
|
||||
myParamValue = "";
|
||||
myMainShape.Nullify();
|
||||
|
||||
delete myPreviewActor;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* Create a layout, initialize fields
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::init()
|
||||
{
|
||||
myParamValue = "";
|
||||
myListOfIDs.clear();
|
||||
mySelectedIDs.clear();
|
||||
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI();
|
||||
mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI );
|
||||
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
|
||||
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
aViewWindow->SetSelectionMode( ActorSelection );
|
||||
|
||||
connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd()));
|
||||
connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
|
||||
|
||||
connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect( myListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* Create a layout, initialize fields
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::showPreview( bool visible)
|
||||
{
|
||||
if ( myIsShown != visible ) {
|
||||
myPreviewActor->SetShown( visible );
|
||||
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
aViewWindow->Repaint();
|
||||
|
||||
myIsShown = visible;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::SelectionIntoArgument()
|
||||
{
|
||||
mySelectedIDs.clear();
|
||||
|
||||
// get selected mesh
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects( aList );
|
||||
int nbSel = aList.Extent();
|
||||
|
||||
if (nbSel < 1)
|
||||
return;
|
||||
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
|
||||
for ( ; anIt.More(); anIt.Next()) { // Loop on selected objects
|
||||
Handle(SALOME_InteractiveObject) IO = anIt.Value();
|
||||
|
||||
GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( IO->getEntry() );
|
||||
if ( !CORBA::is_nil( aGeomObj ) ) { // Selected Object From Study
|
||||
GEOM::GEOM_Object_ptr aGeomFatherObj = aGeomObj->GetMainShape();
|
||||
QString aFatherEntry = "";
|
||||
QString aMainFatherEntry = "";
|
||||
TopoDS_Shape shape;
|
||||
if ( !CORBA::is_nil( aGeomFatherObj ) ) {
|
||||
// Get Main Shape
|
||||
GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry );
|
||||
if ( !CORBA::is_nil( aGeomMain ) || aGeomMain->GetType() == 37 ) { // Main Shape is a Group
|
||||
GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape();
|
||||
if ( !CORBA::is_nil( aMainFatherObj ) )
|
||||
aMainFatherEntry = aMainFatherObj->GetStudyEntry();
|
||||
}
|
||||
aFatherEntry = aGeomFatherObj->GetStudyEntry();
|
||||
}
|
||||
|
||||
if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) ) {
|
||||
if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object
|
||||
GEOMBase::GetShape(aGeomObj, shape);
|
||||
if ( !shape.IsNull() ) {
|
||||
TopExp_Explorer exp( shape, TopAbs_EDGE );
|
||||
for ( ; exp.More(); exp.Next() ) {
|
||||
int index = myPreviewActor->GetIndexByShape( exp.Current() );
|
||||
if ( index ) {
|
||||
mySelectedIDs.append( index );
|
||||
myPreviewActor->HighlightID( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/ ) {
|
||||
GEOMBase::GetShape(aGeomObj, shape);
|
||||
if ( !shape.IsNull() && shape.ShapeType() == TopAbs_EDGE ) {
|
||||
int index = myPreviewActor->GetIndexByShape( shape );
|
||||
if ( index ) {
|
||||
mySelectedIDs.append( index );
|
||||
myPreviewActor->HighlightID( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // Selected Actor from Actor Collection
|
||||
QString anEntry = IO->getEntry();
|
||||
QString str = "_";
|
||||
int index = anEntry.lastIndexOf( str );
|
||||
anEntry.remove(0, index+1);
|
||||
int ind = anEntry.toInt();
|
||||
if ( ind )
|
||||
mySelectedIDs.append( ind );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onAdd()
|
||||
// purpose : Called when Add Button Clicked
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::onAdd()
|
||||
{
|
||||
if ( mySelectedIDs.size() < 1 )
|
||||
return;
|
||||
|
||||
myListWidget->blockSignals( true );
|
||||
for (int i = 0; i < mySelectedIDs.size(); i++) {
|
||||
if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) {
|
||||
QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
|
||||
|
||||
QListWidgetItem* anItem = new QListWidgetItem( anID, myListWidget );
|
||||
anItem->setSelected(true);
|
||||
|
||||
myListOfIDs.append( mySelectedIDs.at(i) );
|
||||
}
|
||||
}
|
||||
onListSelectionChanged();
|
||||
|
||||
myListWidget->blockSignals( false );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onRemove()
|
||||
// purpose : Called when Remove Button Clicked
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::onRemove()
|
||||
{
|
||||
if ( myListWidget->count() < 1 )
|
||||
return;
|
||||
|
||||
myListWidget->blockSignals( true );
|
||||
QList<QListWidgetItem*> selItems = myListWidget->selectedItems();
|
||||
QListWidgetItem* item;
|
||||
foreach(item, selItems) {
|
||||
QString idStr = item->text();
|
||||
int id = idStr.toInt();
|
||||
|
||||
int index = myListOfIDs.indexOf( id );
|
||||
myListOfIDs.removeAt( index );
|
||||
delete item;
|
||||
}
|
||||
|
||||
onListSelectionChanged();
|
||||
myListWidget->blockSignals( false );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onListSelectionChanged()
|
||||
// purpose : Called when selection in element list is changed
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::onListSelectionChanged()
|
||||
{
|
||||
mySelectionMgr->clearSelected();
|
||||
TColStd_MapOfInteger aIndexes;
|
||||
QList<QListWidgetItem*> selItems = myListWidget->selectedItems();
|
||||
QListWidgetItem* anItem;
|
||||
foreach(anItem, selItems)
|
||||
myPreviewActor->HighlightID( anItem->text().toInt() );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : setGeomShape
|
||||
// purpose : Called to set geometry
|
||||
//================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::SetMainShapeEntry( const QString& theEntry )
|
||||
{
|
||||
if ( theEntry != "") {
|
||||
myParamValue = theEntry;
|
||||
myEntry = theEntry;
|
||||
myMainShape = GetTopoDSByEntry( theEntry );
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateState
|
||||
// purpose : update Widget state
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::updateState()
|
||||
{
|
||||
bool state = false;
|
||||
if ( !myMainShape.IsNull() )
|
||||
state = true;
|
||||
|
||||
myListWidget->setEnabled( state );
|
||||
myAddButton->setEnabled( state );
|
||||
myRemoveButton->setEnabled( state );
|
||||
|
||||
if (state = true) {
|
||||
myPreviewActor = new SMESH_PreviewActorsCollection();
|
||||
myPreviewActor->SetSelector( mySelector );
|
||||
myPreviewActor->Init( myMainShape, TopAbs_EDGE, myEntry );
|
||||
myPreviewActor->SetShown( false );
|
||||
myIsShown = false;
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
|
||||
myRenderer = aViewWindow->getRenderer();
|
||||
myPreviewActor->AddToRender( myRenderer );
|
||||
aViewWindow->Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetGeomObjectByEntry
|
||||
// purpose : Called to get GeomObject
|
||||
//=================================================================================
|
||||
GEOM::GEOM_Object_var StdMeshersGUI_EdgeDirectionParamWdg::GetGeomObjectByEntry( const QString& theEntry )
|
||||
{
|
||||
GEOM::GEOM_Object_var aGeomObj;
|
||||
SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
|
||||
if (aStudy != 0) {
|
||||
SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
|
||||
if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
CORBA::String_var aVal = anIOR->Value();
|
||||
CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal);
|
||||
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
|
||||
}
|
||||
}
|
||||
return aGeomObj;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : setObjectByEntry
|
||||
// purpose : Called to get GeomObject
|
||||
//=================================================================================
|
||||
TopoDS_Shape StdMeshersGUI_EdgeDirectionParamWdg::GetTopoDSByEntry( const QString& theEntry )
|
||||
{
|
||||
TopoDS_Shape shape;
|
||||
GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( theEntry );
|
||||
GEOMBase::GetShape(aGeomObj, shape);
|
||||
return shape;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetListOfIds
|
||||
// purpose : Called to get the list of Edges IDs
|
||||
//=================================================================================
|
||||
SMESH::long_array_var StdMeshersGUI_EdgeDirectionParamWdg::GetListOfIDs()
|
||||
{
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
int size = myListOfIDs.size();
|
||||
anArray->length( size );
|
||||
if ( size ) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
anArray[i] = myListOfIDs.at(i);
|
||||
}
|
||||
}
|
||||
return anArray;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetListOfIds
|
||||
// purpose : Called to set the list of Edges IDs
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_EdgeDirectionParamWdg::SetListOfIDs( SMESH::long_array_var theIds)
|
||||
{
|
||||
mySelectedIDs.clear();
|
||||
myListOfIDs.clear();
|
||||
int size = theIds->length();
|
||||
for ( int i = 0; i < size; i++ )
|
||||
mySelectedIDs.append( theIds[ i ] );
|
||||
onAdd();
|
||||
}
|
107
src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.h
Normal file
@ -0,0 +1,107 @@
|
||||
// Copyright (C) 2007-2008 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
|
||||
//
|
||||
// File : StdMeshersGUI_EdgeDirectionParamWdg.h
|
||||
// Author : Open CASCADE S.A.S. (dmv)
|
||||
//
|
||||
#ifndef STDMESHERSGUI_EDGEDIRECTIONPARAMWGD_H
|
||||
#define STDMESHERSGUI_EDGEDIRECTIONPARAMWGD_H
|
||||
|
||||
// SMESH includes
|
||||
#include <SMESHGUI.h>
|
||||
#include "SMESH_StdMeshersGUI.hxx"
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QWidget>
|
||||
#include <QStringList>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <SMESHGUI_VTKUtils.h>
|
||||
|
||||
class SMESHGUI;
|
||||
class LightApp_SelectionMgr;
|
||||
class SVTK_Selector;
|
||||
class QPushButton;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QListWidget;
|
||||
class SMESH_Actor;
|
||||
class SMESH_PreviewActorsCollection;
|
||||
class vtkRenderer;
|
||||
|
||||
class STDMESHERSGUI_EXPORT StdMeshersGUI_EdgeDirectionParamWdg : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_EdgeDirectionParamWdg( QWidget* parent = 0 );
|
||||
~StdMeshersGUI_EdgeDirectionParamWdg();
|
||||
|
||||
SMESH::long_array_var GetListOfIDs();
|
||||
void SetListOfIDs( SMESH::long_array_var );
|
||||
|
||||
void SetMainShapeEntry( const QString& theEntry );
|
||||
const char* GetMainShapeEntry() { return myEntry.toLatin1().data();}
|
||||
|
||||
TopoDS_Shape GetMainShape() { return myMainShape; }
|
||||
|
||||
static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
|
||||
static TopoDS_Shape GetTopoDSByEntry( const QString& );
|
||||
|
||||
QString GetValue() const { return myParamValue; }
|
||||
|
||||
void showPreview ( bool );
|
||||
|
||||
private:
|
||||
void updateState();
|
||||
|
||||
private slots:
|
||||
void onAdd();
|
||||
void onRemove();
|
||||
void SelectionIntoArgument();
|
||||
void onListSelectionChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
SVTK_Selector* mySelector;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
TopoDS_Shape myMainShape;
|
||||
QString myEntry;
|
||||
vtkRenderer* myRenderer;
|
||||
|
||||
QListWidget* myListWidget;
|
||||
QPushButton* myAddButton;
|
||||
QPushButton* myRemoveButton;
|
||||
QList<int> mySelectedIDs;
|
||||
QList<int> myListOfIDs;
|
||||
|
||||
QString myParamValue;
|
||||
bool myIsShown;
|
||||
|
||||
SMESH_PreviewActorsCollection* myPreviewActor;
|
||||
};
|
||||
|
||||
#endif // STDMESHERSGUI_EDGEDIRECTIONPARAMWGD_H
|
@ -26,6 +26,7 @@
|
||||
#include "StdMeshersGUI_NbSegmentsCreator.h"
|
||||
#include "StdMeshersGUI_DistrTable.h"
|
||||
#include "StdMeshersGUI_DistrPreview.h"
|
||||
#include "StdMeshersGUI_EdgeDirectionParamWdg.h"
|
||||
|
||||
#include <SMESHGUI.h>
|
||||
#include <SMESHGUI_Utils.h>
|
||||
@ -99,7 +100,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
||||
|
||||
QVBoxLayout* lay = new QVBoxLayout( fr );
|
||||
lay->setMargin( 0 );
|
||||
lay->setSpacing( 0 );
|
||||
lay->setSpacing( SPACING );
|
||||
|
||||
QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
|
||||
lay->addWidget( GroupC1 );
|
||||
@ -195,11 +196,25 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
||||
myPreviewRow = row;
|
||||
row++;
|
||||
|
||||
// 8) reverce edge parameters
|
||||
myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERCE_EDGES" ), fr);
|
||||
QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );
|
||||
|
||||
myDirectionWidget = new StdMeshersGUI_EdgeDirectionParamWdg();
|
||||
QString anEntry = getShapeEntry();
|
||||
if ( anEntry == "" )
|
||||
anEntry = h->GetObjectEntry();
|
||||
myDirectionWidget->SetMainShapeEntry( anEntry );
|
||||
myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||
edgeLay->addWidget( myDirectionWidget );
|
||||
|
||||
lay->addWidget( myReversedEdgesBox );
|
||||
|
||||
connect( myNbSeg, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myDistr, SIGNAL( activated( int ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myExpr, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myConv, SIGNAL( cuttonClicked( int ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myConv, SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) );
|
||||
|
||||
return fr;
|
||||
}
|
||||
@ -348,6 +363,11 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
||||
if( distr==2 || distr==3 )
|
||||
h->SetConversionMode( h_data.myConv );
|
||||
|
||||
if( distr==1 || distr==2 || distr==3 ) {
|
||||
h->SetReversedEdges( myDirectionWidget->GetListOfIDs() );
|
||||
h->SetObjectEntry( myDirectionWidget->GetMainShapeEntry() );
|
||||
}
|
||||
|
||||
if( distr==2 )
|
||||
h->SetTableFunction( h_data.myTable );
|
||||
|
||||
@ -400,6 +420,8 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
|
||||
|
||||
myScale->setShown( distr==1 );
|
||||
myLScale->setShown( distr==1 );
|
||||
myReversedEdgesBox->setShown( !distr==0 );
|
||||
myDirectionWidget->showPreview( !distr==0 );
|
||||
|
||||
bool isFunc = distr==2 || distr==3;
|
||||
myPreview->setShown( isFunc );
|
||||
@ -434,8 +456,11 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
|
||||
|
||||
if ( (QtxComboBox*)sender() == myDistr && dlg() ) {
|
||||
QApplication::instance()->processEvents();
|
||||
myGroupLayout->invalidate();
|
||||
dlg()->layout()->invalidate();
|
||||
dlg()->updateGeometry();
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint() );
|
||||
dlg()->resize( dlg()->minimumSize() );
|
||||
QApplication::instance()->processEvents();
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ class QButtonGroup;
|
||||
class QGroupBox;
|
||||
class QGridLayout;
|
||||
class QRadioButton;
|
||||
class StdMeshersGUI_EdgeDirectionParamWdg;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -91,6 +92,9 @@ private:
|
||||
QGridLayout* myGroupLayout;
|
||||
int myTableRow, myPreviewRow;
|
||||
QRadioButton* myCutNeg;
|
||||
QGroupBox* myReversedEdgesBox;
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg* myDirectionWidget;
|
||||
};
|
||||
|
||||
#endif // STDMESHERSGUI_NBSEGMENTSCREATOR_H
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <SMESH_NumberFilter.hxx>
|
||||
#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
|
||||
#include "StdMeshersGUI_LayerDistributionParamWdg.h"
|
||||
#include "StdMeshersGUI_EdgeDirectionParamWdg.h"
|
||||
#include <SALOMEDSClient_Study.hxx>
|
||||
|
||||
// SALOME GUI includes
|
||||
@ -444,10 +445,18 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_Arithmetic1D_var h =
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg* w =
|
||||
widget< StdMeshersGUI_EdgeDirectionParamWdg >( 2 );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
if (w) {
|
||||
h->SetReversedEdges( w->GetListOfIDs() );
|
||||
const char * entry = w->GetMainShapeEntry();
|
||||
h->SetObjectEntry( entry );
|
||||
}
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
{
|
||||
@ -469,10 +478,17 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_StartEndLength_var h =
|
||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg* w =
|
||||
widget< StdMeshersGUI_EdgeDirectionParamWdg >( 2 );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
if (w) {
|
||||
h->SetReversedEdges( w->GetListOfIDs() );
|
||||
h->SetObjectEntry( w->GetMainShapeEntry() );
|
||||
}
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
@ -650,10 +666,26 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
|
||||
customWidgets()->append (0);
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
|
||||
customWidgets()->append (0);
|
||||
|
||||
item.myName = tr( "SMESH_REVERCE_EDGES" );
|
||||
p.append( item );
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg* aDirectionWidget = new StdMeshersGUI_EdgeDirectionParamWdg();
|
||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||
if ( anEntry == "" )
|
||||
anEntry = h->GetObjectEntry();
|
||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||
aDirectionWidget->showPreview( true );
|
||||
customWidgets()->append ( aDirectionWidget );
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
{
|
||||
@ -686,12 +718,26 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
customWidgets()->append(0);
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
customWidgets()->append(0);
|
||||
|
||||
item.myName = tr( "SMESH_REVERCE_EDGES" );
|
||||
p.append( item );
|
||||
|
||||
StdMeshersGUI_EdgeDirectionParamWdg* aDirectionWidget = new StdMeshersGUI_EdgeDirectionParamWdg();
|
||||
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||
if ( anEntry == "" )
|
||||
anEntry = h->GetObjectEntry();
|
||||
aDirectionWidget->SetMainShapeEntry( anEntry );
|
||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||
aDirectionWidget->SetMainShapeEntry( h->GetObjectEntry() );
|
||||
aDirectionWidget->showPreview( true );
|
||||
customWidgets()->append ( aDirectionWidget );
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
@ -1000,6 +1046,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
|
||||
param.myValue = w->GetValue();
|
||||
return true;
|
||||
}
|
||||
if ( widget->inherits( "StdMeshersGUI_EdgeDirectionParamWdg" ))
|
||||
{
|
||||
const StdMeshersGUI_EdgeDirectionParamWdg * w =
|
||||
static_cast<const StdMeshersGUI_EdgeDirectionParamWdg*>( widget );
|
||||
param.myValue = w->GetValue();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,10 @@
|
||||
<source>SMESH_REMOVE_ROW</source>
|
||||
<translation>Remove row</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_REVERCE_EDGES</source>
|
||||
<translation>Reverce Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SEGMENT_LENGTH_AROUND_VERTEX_HYPOTHESIS</source>
|
||||
<translation>Segment Length Around Vertex</translation>
|
||||
|
@ -107,11 +107,109 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
|
||||
|
||||
CORBA::Double StdMeshers_Arithmetic1D_i::GetLength( CORBA::Boolean theIsStart)
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::GetLength" );
|
||||
MESSAGE( "StdMeshers_Arithmetic1D_i::GetLength" );
|
||||
ASSERT( myBaseImpl );
|
||||
return this->GetImpl()->GetLength( theIsStart );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D_i::SetReversedEdges
|
||||
*
|
||||
* Set edges to reverse
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theIds )
|
||||
{
|
||||
MESSAGE( "StdMeshers_Arithmetic1D_i::SetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
std::vector<int> ids( theIds.length() );
|
||||
CORBA::Long iEnd = theIds.length();
|
||||
for ( CORBA::Long i = 0; i < iEnd; i++ )
|
||||
ids[ i ] = theIds[ i ];
|
||||
|
||||
this->GetImpl()->SetReversedEdges( ids );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
|
||||
// Update Python script
|
||||
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
|
||||
<< theList << " )";*/
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D_i::SetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Arithmetic1D_i::SetObjectEntry( const char* entry )
|
||||
{
|
||||
MESSAGE( "StdMeshers_Arithmetic1D_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
|
||||
try {
|
||||
this->GetImpl()->SetObjectEntry( entry );
|
||||
// Update Python script
|
||||
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D_i::GetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
char* StdMeshers_Arithmetic1D_i::GetObjectEntry()
|
||||
{
|
||||
MESSAGE( "StdMeshers_Arithmetic1D_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
const char* entry;
|
||||
try {
|
||||
entry = this->GetImpl()->GetObjectEntry();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
return CORBA::string_dup( entry );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D_i::GetReversedEdges
|
||||
*
|
||||
* Get reversed edges
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* StdMeshers_Arithmetic1D_i::GetReversedEdges()
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::GetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
|
||||
anArray->length( ids.size() );
|
||||
for ( CORBA::Long i = 0; i < ids.size(); i++)
|
||||
anArray [ i ] = ids [ i ];
|
||||
|
||||
return anArray._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D_i::GetImpl
|
||||
|
@ -54,9 +54,22 @@ public:
|
||||
// Set length
|
||||
void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Get length
|
||||
CORBA::Double GetLength(CORBA::Boolean theIsStart);
|
||||
|
||||
//Set Reversed Edges
|
||||
void SetReversedEdges( const SMESH::long_array& theIDs);
|
||||
|
||||
//Get Reversed Edges
|
||||
SMESH::long_array* GetReversedEdges();
|
||||
|
||||
//Set the Entry of the Object
|
||||
void SetObjectEntry( const char* theEntry);
|
||||
|
||||
//Get Object Entry
|
||||
char* GetObjectEntry();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Arithmetic1D* GetImpl();
|
||||
|
||||
|
@ -162,6 +162,105 @@ CORBA::Long StdMeshers_NumberOfSegments_i::GetNumberOfSegments()
|
||||
return this->GetImpl()->GetNumberOfSegments();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::SetReversedEdges
|
||||
*
|
||||
* Set edges to reverse
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& theIds )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::SetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
std::vector<int> ids( theIds.length() );
|
||||
CORBA::Long iEnd = theIds.length();
|
||||
for ( CORBA::Long i = 0; i < iEnd; i++ )
|
||||
ids[ i ] = theIds[ i ];
|
||||
|
||||
this->GetImpl()->SetReversedEdges( ids );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
|
||||
// Update Python script
|
||||
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
|
||||
<< theList << " )";*/
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::SetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_NumberOfSegments_i::SetObjectEntry( const char* entry )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
|
||||
try {
|
||||
this->GetImpl()->SetObjectEntry( entry );
|
||||
// Update Python script
|
||||
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::GetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
char* StdMeshers_NumberOfSegments_i::GetObjectEntry()
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
|
||||
const char* entry;
|
||||
try {
|
||||
entry = this->GetImpl()->GetObjectEntry();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
return CORBA::string_dup( entry );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::GetReversedEdges
|
||||
*
|
||||
* Get reversed edges
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* StdMeshers_NumberOfSegments_i::GetReversedEdges()
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::GetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
|
||||
anArray->length( ids.size() );
|
||||
for ( CORBA::Long i = 0; i < ids.size(); i++)
|
||||
anArray [ i ] = ids [ i ];
|
||||
|
||||
return anArray._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*/
|
||||
|
@ -104,6 +104,18 @@ public:
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
|
||||
//Set Reversed Edges
|
||||
void SetReversedEdges( const SMESH::long_array& theIDs);
|
||||
|
||||
//Get Reversed Edges
|
||||
SMESH::long_array* GetReversedEdges();
|
||||
|
||||
//Set Object Entry
|
||||
void SetObjectEntry( const char* entry);
|
||||
|
||||
//Get Object Entry
|
||||
char* GetObjectEntry();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -113,6 +113,103 @@ CORBA::Double StdMeshers_StartEndLength_i::GetLength( CORBA::Boolean theIsStart)
|
||||
return this->GetImpl()->GetLength( theIsStart );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_StartEndLength_i::SetReversedEdges
|
||||
*
|
||||
* Set edges to reverse
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& theIds )
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::SetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
std::vector<int> ids( theIds.length() );
|
||||
CORBA::Long iEnd = theIds.length();
|
||||
for ( CORBA::Long i = 0; i < iEnd; i++ )
|
||||
ids[ i ] = theIds[ i ];
|
||||
|
||||
this->GetImpl()->SetReversedEdges( ids );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
|
||||
// Update Python script
|
||||
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
|
||||
<< theList << " )";*/
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_StartEndLength_i::SetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_StartEndLength_i::SetObjectEntry( const char* entry )
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
this->GetImpl()->SetObjectEntry( entry );
|
||||
// Update Python script
|
||||
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_StartEndLength_i::GetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
char* StdMeshers_StartEndLength_i::GetObjectEntry()
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::SetObjectEntry" );
|
||||
ASSERT( myBaseImpl );
|
||||
const char* entry;
|
||||
try {
|
||||
entry = this->GetImpl()->GetObjectEntry();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
return CORBA::string_dup( entry );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_StartEndLength_i::GetReversedEdges
|
||||
*
|
||||
* Get reversed edges
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* StdMeshers_StartEndLength_i::GetReversedEdges()
|
||||
{
|
||||
MESSAGE( "StdMeshers_StartEndLength_i::GetReversedEdges" );
|
||||
ASSERT( myBaseImpl );
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
|
||||
anArray->length( ids.size() );
|
||||
for ( CORBA::Long i = 0; i < ids.size(); i++)
|
||||
anArray [ i ] = ids [ i ];
|
||||
|
||||
return anArray._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_StartEndLength_i::GetImpl
|
||||
|
@ -65,6 +65,18 @@ public:
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
|
||||
//Set Reversed Edges
|
||||
void SetReversedEdges( const SMESH::long_array& theIDs);
|
||||
|
||||
//Get Reversed Edges
|
||||
SMESH::long_array* GetReversedEdges();
|
||||
|
||||
//Set Object Entry
|
||||
void SetObjectEntry( const char* entry);
|
||||
|
||||
//Get Object Entry
|
||||
char* GetObjectEntry();
|
||||
};
|
||||
|
||||
#endif
|
||||
|