typedef sequence<TPreCadPeriodicity> TPeriodicityList;
// Hyper-patches
- typedef sequence<long> THyperPatch;
- typedef sequence<THyperPatch> THyperPatchList;
+ typedef sequence< long > THyperPatch;
+ typedef sequence< THyperPatch > THyperPatchList;
+ typedef sequence< string > THyperPatchEntries;
+ typedef sequence< THyperPatchEntries > THyperPatchEntriesList;
+ typedef sequence< GEOM::ListOfGO > THyperPatchShapesList;
/*!
* BLSURFPlugin_BLSURF: interface of BLSURF algorithm
* Set hyper-patches
*/
void SetHyperPatches(in THyperPatchList hpl);
- THyperPatchList GetHyperPatches();
+ THyperPatchList GetHyperPatches( in GEOM::GEOM_Object mainShape );
+ void SetHyperPatchShapes(in THyperPatchShapesList hpsl);
+ THyperPatchEntriesList GetHyperPatchShapes();
+ void SetHyperPatchEntries(in THyperPatchEntriesList hpel);
/*!
* To merges edges.
if ( !opIt->second.empty() ) {
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
+
+ if ( hyp->GetHyperPatches().size() < hyp->GetHyperPatchEntries().size() )
+ {
+ std::map< std::string, TopoDS_Shape > entryToShape;
+ FillEntryToShape( hyp, entryToShape );
+ const_cast<BLSURFPlugin_Hypothesis*>( hyp )->SetHyperPatchIDsByEntry( theGeomShape,
+ entryToShape );
+ }
}
if ( BLSURFPlugin_Hypothesis::HasPreCADOptions( hyp ))
return true;
}
+
+//================================================================================
+/*!
+ * \brief Find TopoDS_Shape for each hyper-patch study entry in a hypothesis
+ */
+//================================================================================
+
+void BLSURFPlugin_BLSURF::FillEntryToShape( const BLSURFPlugin_Hypothesis* hyp,
+ std::map< std::string, TopoDS_Shape > & entryToShape )
+{
+ SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
+ for ( const ::BLSURFPlugin_Hypothesis::THyperPatchEntries& entries : hyp->GetHyperPatchEntries() )
+ for ( const std::string& entry : entries )
+ {
+ GEOM::GEOM_Object_var go = smeshGen->GetGeomObjectByEntry( entry );
+ TopoDS_Shape shape = smeshGen->GeomObjectToShape( go );
+ if ( !shape.IsNull() )
+ entryToShape.insert({ entry, shape });
+ }
+}
class TopoDS_Shape;
-class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
- public:
- BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
-
- virtual ~BLSURFPlugin_BLSURF();
-
- virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- SMESH_Hypothesis::Hypothesis_Status& aStatus);
-
- void SetParameters(const BLSURFPlugin_Hypothesis* hyp, cadsurf_session_t *css, const TopoDS_Shape& shape);
-
- virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
- virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
-
- virtual void CancelCompute();
- bool computeCanceled() { return _compute_canceled; }
-
- virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
- MapShapeNbElems& aResMap);
-
- // List of ids
- typedef std::vector<int> TListOfIDs;
-
- // PreCad Edges periodicity
- struct TPreCadPeriodicityIDs {
- TListOfIDs shape1IDs;
- TListOfIDs shape2IDs;
- std::vector<double> theSourceVerticesCoords;
- std::vector<double> theTargetVerticesCoords;
- };
-
- // Edge periodicity
- struct TEdgePeriodicityIDs {
- int theFace1ID;
- int theEdge1ID;
- int theFace2ID;
- int theEdge2ID;
- int edge_orientation;
- };
-
- // Vertex periodicity
- struct TVertexPeriodicityIDs {
- int theEdge1ID;
- int theVertex1ID;
- int theEdge2ID;
- int theVertex2ID;
- };
-
- // Vector of pairs of ids
- typedef std::vector< TPreCadPeriodicityIDs > TPreCadIDsPeriodicityVector;
- typedef std::vector< std::pair<int, int> > TShapesIDsPeriodicityVector;
- typedef std::vector< TEdgePeriodicityIDs > TEdgesIDsPeriodicityVector;
- typedef std::vector< TVertexPeriodicityIDs > TVerticesIDsPeriodicityVector;
-
-
-
- protected:
- const BLSURFPlugin_Hypothesis* _hypothesis;
- bool _haveViscousLayers;
-
- TPreCadIDsPeriodicityVector _preCadFacesIDsPeriodicityVector;
- TPreCadIDsPeriodicityVector _preCadEdgesIDsPeriodicityVector;
-
- private:
- bool compute(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- bool allowSubMeshClearing);
-
- void set_param(cadsurf_session_t *css,
- const char * option_name,
- const char * option_value);
-
- TopoDS_Shape entryToShape(std::string entry);
- void addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords);
- void addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords);
- void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
- void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
- void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
- void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, const SMDS_MeshNode* node, const TopoDS_Shape& ed);
- void BRepClass_FaceClassifierPerform(BRepClass_FaceClassifier* fc, const TopoDS_Face& face, const gp_Pnt& P, const Standard_Real Tol);
-
- private:
- PyObject * main_mod;
- PyObject * main_dict;
- SMESH_MesherHelper* myHelper;
-
- volatile bool _compute_canceled;
+class BLSURFPlugin_BLSURF: public SMESH_2D_Algo
+{
+public:
+ BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
+
+ virtual ~BLSURFPlugin_BLSURF();
+
+ virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+ void SetParameters(const BLSURFPlugin_Hypothesis* hyp, cadsurf_session_t *css, const TopoDS_Shape& shape);
+
+ virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
+
+ virtual void CancelCompute();
+ bool computeCanceled() { return _compute_canceled; }
+
+ virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+ MapShapeNbElems& aResMap);
+
+ static void FillEntryToShape( const BLSURFPlugin_Hypothesis* hyp,
+ std::map< std::string, TopoDS_Shape > & s2eMap );
+
+ // List of ids
+ typedef std::vector<int> TListOfIDs;
+
+ // PreCad Edges periodicity
+ struct TPreCadPeriodicityIDs {
+ TListOfIDs shape1IDs;
+ TListOfIDs shape2IDs;
+ std::vector<double> theSourceVerticesCoords;
+ std::vector<double> theTargetVerticesCoords;
+ };
+
+ // Edge periodicity
+ struct TEdgePeriodicityIDs {
+ int theFace1ID;
+ int theEdge1ID;
+ int theFace2ID;
+ int theEdge2ID;
+ int edge_orientation;
+ };
+
+ // Vertex periodicity
+ struct TVertexPeriodicityIDs {
+ int theEdge1ID;
+ int theVertex1ID;
+ int theEdge2ID;
+ int theVertex2ID;
+ };
+
+ // Vector of pairs of ids
+ typedef std::vector< TPreCadPeriodicityIDs > TPreCadIDsPeriodicityVector;
+ typedef std::vector< std::pair<int, int> > TShapesIDsPeriodicityVector;
+ typedef std::vector< TEdgePeriodicityIDs > TEdgesIDsPeriodicityVector;
+ typedef std::vector< TVertexPeriodicityIDs > TVerticesIDsPeriodicityVector;
+
+
+
+protected:
+ const BLSURFPlugin_Hypothesis* _hypothesis;
+ bool _haveViscousLayers;
+
+ TPreCadIDsPeriodicityVector _preCadFacesIDsPeriodicityVector;
+ TPreCadIDsPeriodicityVector _preCadEdgesIDsPeriodicityVector;
+
+private:
+ bool compute(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ bool allowSubMeshClearing);
+
+ void set_param(cadsurf_session_t *css,
+ const char * option_name,
+ const char * option_value);
+
+ TopoDS_Shape entryToShape(std::string entry);
+ void addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords);
+ void addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords);
+ void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
+ void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
+ void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
+ void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, const SMDS_MeshNode* node, const TopoDS_Shape& ed);
+ void BRepClass_FaceClassifierPerform(BRepClass_FaceClassifier* fc, const TopoDS_Face& face, const gp_Pnt& P, const Standard_Real Tol);
+
+private:
+ PyObject * main_mod;
+ PyObject * main_dict;
+ SMESH_MesherHelper* myHelper;
+
+ volatile bool _compute_canceled;
};
#endif
#include <meshgems/meshgems.h>
#define MESHGEMS_VERSION_HEX (MESHGEMS_VERSION_MAJOR << 16 | MESHGEMS_VERSION_MINOR << 8 | MESHGEMS_VERSION_PATCH)
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/serialization/set.hpp>
+#include <boost/serialization/vector.hpp>
+#include <boost/serialization/string.hpp>
+
namespace
{
struct GET_DEFAULT // struct used to get default value from GetOptionValue()
{
return GetPreCADOptionValue("tags", GET_DEFAULT());
}
+
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchList& hpl)
+void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh)
{
if ( hpl != _hyperPatchList )
{
_hyperPatchList.erase( _hyperPatchList.begin() + j );
}
}
+ if ( notifyMesh )
+ NotifySubMeshesHypothesisModification();
+ }
+}
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchEntriesList& hpel)
+{
+ if ( hpel != _hyperPatchEntriesList )
+ {
+ _hyperPatchEntriesList = hpel;
+ _hyperPatchList.clear();
+
NotifySubMeshesHypothesisModification();
}
}
+//================================================================================
+/*!
+ * \brief Set _hyperPatchList by _hyperPatchEntriesList
+ */
+//================================================================================
+
+void BLSURFPlugin_Hypothesis::
+SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
+ const std::map< std::string, TopoDS_Shape >& entryToShape)
+{
+ _hyperPatchList.clear();
+ if ( _hyperPatchEntriesList.empty() || mainShape.IsNull() )
+ return;
+
+ _hyperPatchList.resize( _hyperPatchEntriesList.size() );
+
+ TopTools_IndexedMapOfShape shapeMap;
+ TopExp::MapShapes( mainShape, shapeMap );
+
+ for ( size_t i = 0; i < _hyperPatchEntriesList.size(); ++i )
+ {
+ THyperPatchTags & idsList = _hyperPatchList [ i ];
+ const THyperPatchEntries & entryList = _hyperPatchEntriesList[ i ];
+ for ( const std::string & entry : entryList )
+ {
+ auto e2sIt = entryToShape.find( entry );
+ if ( e2sIt != entryToShape.end() )
+ {
+ for ( TopExp_Explorer fExp( e2sIt->second, TopAbs_FACE ); fExp.More(); fExp.Next() )
+ {
+ int id = shapeMap.FindIndex( fExp.Current() );
+ if ( id > 0 )
+ idsList.insert( id );
+ }
+ }
+ }
+ }
+ THyperPatchList hpl;
+ hpl.swap( _hyperPatchList );
+ SetHyperPatches( hpl, /*notifyMesh=*/false );
+}
+
//=============================================================================
/*!
* \brief Return a tag of a face taking into account the hyper-patches. Optionally
save << " " << _nbVolumeProximityLayers;
save << " " << _volumeProximityRatio;
+ // hyper-patches as entries
+ std::ostringstream hpStream;
+ boost::archive::text_oarchive( hpStream ) << _hyperPatchEntriesList;
+ std::string hpString = hpStream.str();
+ save << " " << hpString.size() << " " << hpString;
+
+
return save;
}
isOK = static_cast<bool>( load >> _volumeProximityRatio );
}
+ // hyper-patches as entries (issue bos #20543)
+ if ( static_cast<bool>( load >> i ) && i > 0 )
+ {
+ std::string buffer( i, '\0' );
+ load.get( buffer[0] ); // remove a white-space
+ load.get( & buffer[0], i + 1 );
+
+ std::istringstream istream( buffer.data() );
+ boost::archive::text_iarchive archive( istream );
+ try {
+ archive >> _hyperPatchEntriesList;
+ }
+ catch (...) {}
+ }
+
return load;
}
// Hyper-patches
typedef std::set< int > THyperPatchTags;
typedef std::vector< THyperPatchTags > THyperPatchList;
-
- void SetHyperPatches(const THyperPatchList& hpl);
- const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+ typedef std::set< std::string > THyperPatchEntries;
+ typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
+
+ void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
+ void SetHyperPatches(const THyperPatchEntriesList& hpl);
+ void SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
+ const std::map< std::string, TopoDS_Shape >& entryToShape);
+ const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+ const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+
void SetPreCADMergeEdges(bool theVal);
bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
- TFacesPeriodicityVector _facesPeriodicityVector;
- TEdgesPeriodicityVector _edgesPeriodicityVector;
+ TFacesPeriodicityVector _facesPeriodicityVector;
+ TEdgesPeriodicityVector _edgesPeriodicityVector;
TVerticesPeriodicityVector _verticesPeriodicityVector;
- THyperPatchList _hyperPatchList;
+ THyperPatchList _hyperPatchList;
+ THyperPatchEntriesList _hyperPatchEntriesList;
// Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
// ---
//
#include "BLSURFPlugin_Hypothesis_i.hxx"
+#include "BLSURFPlugin_BLSURF.hxx"
#include <SMESH_Gen.hxx>
#include <SMESH_Gen_i.hxx>
}
if ( GetImpl()->GetHyperPatches() != patchList )
{
+ GetImpl()->SetHyperPatches( ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList() ); // erase entries
GetImpl()->SetHyperPatches( patchList );
SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
}
}
//=============================================================================
-BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
+void BLSURFPlugin_Hypothesis_i::SetHyperPatchEntries(const BLSURFPlugin::THyperPatchEntriesList& hpe)
+{
+ ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList patchList( hpe.length() );
+ SMESH_Comment hpeDump;
+ hpeDump << "[";
+ for ( size_t i = 0; i < patchList.size(); ++i )
+ {
+ hpeDump << "[ ";
+ const BLSURFPlugin::THyperPatchEntries& entryList = hpe[ i ];
+ for ( CORBA::ULong j = 0; j < entryList.length(); ++j )
+ {
+ patchList[ i ].insert( entryList[ j ].in() );
+ hpeDump << entryList[ j ].in() << ( j+1 < entryList.length() ? ", " : " ]" );
+ }
+ hpeDump << ( i+1 < patchList.size() ? "," : "]");
+ }
+ if ( GetImpl()->GetHyperPatchEntries() != patchList )
+ {
+ GetImpl()->SetHyperPatches( ::BLSURFPlugin_Hypothesis::THyperPatchList(), /*notify=*/false );
+ GetImpl()->SetHyperPatches( patchList );
+ // TPythonDump converts entries to objects
+ SMESH::TPythonDump() << _this() << ".SetHyperPatchShapes( " << hpeDump << " )";
+ }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetHyperPatchShapes(const BLSURFPlugin::THyperPatchShapesList& hpsl)
+{
+ BLSURFPlugin::THyperPatchEntriesList patchList;
+ patchList.length( hpsl.length() );
+ for ( size_t i = 0; i < hpsl.length(); ++i )
+ {
+ const GEOM::ListOfGO& shapeList = hpsl[ i ];
+ BLSURFPlugin::THyperPatchEntries& entryList = patchList[ i ];
+ entryList.length( shapeList.length() );
+ for ( CORBA::ULong j = 0; j < shapeList.length(); ++j )
+ {
+ CORBA::String_var entry = shapeList[ j ]->GetStudyEntry();
+ if ( !entry.in() || !entry.in()[0] )
+ THROW_SALOME_CORBA_EXCEPTION( "BLSURFPlugin_Hypothesis::SetHyperPatchShapes(), "
+ "Not published hyper-patch shape", SALOME::BAD_PARAM );
+ entryList[ j ] = CORBA::string_dup( entry );
+ }
+ }
+ this->SetHyperPatchEntries( patchList );
+}
+
+//=============================================================================
+BLSURFPlugin::THyperPatchList*
+BLSURFPlugin_Hypothesis_i::GetHyperPatches( GEOM::GEOM_Object_ptr mainShape )
{
const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
- BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
+ BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
+ if ( hpl.empty() &&
+ !CORBA::is_nil( mainShape ) &&
+ !GetImpl()->GetHyperPatchEntries().empty() )
+ {
+ // set IDs by entries
+ SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
+ TopoDS_Shape S = smeshGen->GeomObjectToShape( mainShape );
+ if ( !S.IsNull() )
+ {
+ std::map< std::string, TopoDS_Shape > entryToShape;
+ BLSURFPlugin_BLSURF::FillEntryToShape( GetImpl(), entryToShape );
+ GetImpl()->SetHyperPatchIDsByEntry( S, entryToShape );
+ }
+ }
resHpl->length( hpl.size() );
::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
return resHpl;
}
+//=============================================================================
+BLSURFPlugin::THyperPatchEntriesList* BLSURFPlugin_Hypothesis_i::GetHyperPatchShapes()
+{
+ const ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList& hpel = GetImpl()->GetHyperPatchEntries();
+ BLSURFPlugin::THyperPatchEntriesList* resHpl = new BLSURFPlugin::THyperPatchEntriesList();
+ resHpl->length( hpel.size() );
+
+ ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList::const_iterator hpIt = hpel.begin();
+ for ( int i = 0; hpIt != hpel.end(); ++hpIt, ++i )
+ {
+ const ::BLSURFPlugin_Hypothesis::THyperPatchEntries& hp = *hpIt;
+ BLSURFPlugin::THyperPatchEntries& resHp = (*resHpl)[ i ];
+ resHp.length( hp.size() );
+
+ ::BLSURFPlugin_Hypothesis::THyperPatchEntries::const_iterator entry = hp.begin();
+ for ( int j = 0; entry != hp.end(); ++entry, ++j )
+ resHp[ j ] = CORBA::string_dup( entry->c_str() );
+ }
+ return resHpl;
+}
+
//=============================================================================
/*!
* BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
char* GetTags();
void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
- BLSURFPlugin::THyperPatchList* GetHyperPatches();
+ BLSURFPlugin::THyperPatchList* GetHyperPatches( GEOM::GEOM_Object_ptr mainShape );
+ void SetHyperPatchShapes(const BLSURFPlugin::THyperPatchShapesList& hpsl);
+ BLSURFPlugin::THyperPatchEntriesList* GetHyperPatchShapes();
+ void SetHyperPatchEntries(const BLSURFPlugin::THyperPatchEntriesList& hpel);
void SetPreCADMergeEdges(CORBA::Boolean theValue);
CORBA::Boolean GetPreCADMergeEdges();
}
// Hyper patches
+ QString patchEntries;
for ( int i = 0; i < data.hyperpatches.size(); ++i )
- that->addHyPatchToTable( data.hyperpatches[i] );
-
+ {
+ if ( i < data.hyperEntries.size() )
+ patchEntries = data.hyperEntries[i];
+ that->addHyPatchToTable( data.hyperpatches[i], patchEntries );
+ }
// update widgets
that->myStdWidget->onPhysicalMeshChanged();
that->myStdWidget->onGeometricMeshChanged();
// Hyper Patches
+ GEOM::GEOM_Object_var geom = myHyPatchFaceSelector->GetGeomObjectByEntry( getMainShapeEntry() );
+ if ( geom->_is_nil() )
+ geom = myHyPatchFaceSelector->GetGeomObjectByEntry( getShapeEntry() );
+
h_data.hyperpatches.clear();
- BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
+ h_data.hyperEntries.clear();
+ BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches( geom );
+ BLSURFPlugin::THyperPatchEntriesList_var patchEntriesList = h->GetHyperPatchShapes();
for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
{
QString tags;
tags += QString::number( patch[j] ) + " ";
if ( !tags.isEmpty() )
h_data.hyperpatches.append( tags );
+
+ if ( patchEntriesList->length() == patchList->length() )
+ {
+ QString entries;
+ BLSURFPlugin::THyperPatchEntries& patchEntries = patchEntriesList[i];
+ for ( CORBA::ULong j = 0; j < patchEntries.length(); ++j )
+ entries += patchEntries[j].in() + QString(" ");
+ if ( !entries.isEmpty() )
+ h_data.hyperEntries.append( entries );
+ }
}
+ if ( h_data.hyperpatches.size() != h_data.hyperEntries.size() )
+ h_data.hyperEntries.clear();
return true;
}
}
// Hyper-patches
- BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
- hpl->length( h_data.hyperpatches.size() );
+ BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
+ BLSURFPlugin::THyperPatchEntriesList_var hpel = new BLSURFPlugin::THyperPatchEntriesList();
+ hpl ->length( h_data.hyperpatches.size() );
+ hpel->length( h_data.hyperEntries.size() );
for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
{
patch.length( tags.size() );
for ( int j = 0; j < tags.size(); ++j )
- patch[ j ] = tags[ j ].toDouble();
+ patch[ j ] = tags[ j ].toInt();
+
+ if ( i < h_data.hyperEntries.size() )
+ {
+ QStringList entries = h_data.hyperEntries[i].split(" ", QString::SkipEmptyParts);
+ BLSURFPlugin::THyperPatchEntries& pe = hpel[ i ];
+ pe.length( entries.size() );
+
+ for ( int j = 0; j < entries.size(); ++j )
+ pe[ j ] = CORBA::string_dup( entries[ j ].toStdString().c_str() );
+ }
}
- h->SetHyperPatches( hpl );
+ if ( h_data.hyperEntries.size() == h_data.hyperpatches.size() )
+ h->SetHyperPatchEntries( hpel );
+ else
+ h->SetHyperPatches( hpl );
} // try
// Hyper-patches
h_data.hyperpatches.clear();
+ h_data.hyperEntries.clear();
for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
- h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
+ {
+ QTableWidgetItem* cell = myHyPatchTable->item( row, 0 );
+ h_data.hyperpatches.append( cell->text() );
+ if ( cell->data( Qt::UserRole ).isValid() )
+ h_data.hyperEntries.append( cell->data( Qt::UserRole ).toString() );
+ }
+ if ( h_data.hyperpatches.size() != h_data.hyperEntries.size() )
+ h_data.hyperEntries.clear();
return guiHyp;
}
QStringList tagList = myHyPatchTagsLE->text().split(" ", QString::SkipEmptyParts);
if ( tagList.size() > 1 )
{
- addHyPatchToTable( myHyPatchTagsLE->text() );
+ LightApp_SelectionMgr* selMrg = SMESHGUI::GetSMESHGUI()->selectionMgr();
+ SALOME_ListIO aList;
+ selMrg->selectedObjects( aList );
+ QString entries;
+ for ( SALOME_ListIteratorOfListIO anIt( aList ); anIt.More(); anIt.Next() )
+ {
+ Handle(SALOME_InteractiveObject) io = anIt.Value();
+ GEOM::GEOM_Object_var go = myHyPatchFaceSelector->GetGeomObjectByEntry( io->getEntry() );
+ if ( !CORBA::is_nil( go ))
+ entries += io->getEntry() + QString(" ");
+ else
+ {
+ entries.clear();
+ break;
+ }
+ }
+ addHyPatchToTable( myHyPatchTagsLE->text(), entries );
myHyPatchTagsLE->setText("");
}
}
*/
//================================================================================
-void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
+void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags,
+ const QString& entries)
{
if ( tags.isEmpty() ) return;
QTableWidgetItem* cell = new QTableWidgetItem( tags );
cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ if ( entries.isEmpty() )
+ cell->setData( Qt::UserRole, QVariant() );
+ else
+ cell->setData( Qt::UserRole, entries );
int row = myHyPatchTable->rowCount();
myHyPatchTable->insertRow( row );
TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
*/
TPreCadPeriodicityVector preCadPeriodicityVector;
- QStringList hyperpatches;
+ QStringList hyperpatches, hyperEntries;
QString myName;
} BlsurfHypothesisData;
static LightApp_SelectionMgr* selectionMgr();
void avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
void AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
- void addHyPatchToTable(const QString& tags);
+ void addHyPatchToTable(const QString& tags, const QString& entries);
bool hasGeom() const;
private: