-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
const char* interfaceName )
: Engines_Component_i( orb, poa, contId, instanceName, interfaceName )
{
- MESSAGE( "SMESH_Gen_i::SMESH_Gen_i : standard constructor" );
myOrb = CORBA::ORB::_duplicate(orb);
myPoa = PortableServer::POA::_duplicate(poa);
SMESH_Gen_i::~SMESH_Gen_i()
{
- MESSAGE( "SMESH_Gen_i::~SMESH_Gen_i" );
-
// delete hypothesis creators
map<string, GenericHypothesisCreator_i*>::iterator itHyp, itHyp2;
for (itHyp = myHypCreatorMap.begin(); itHyp != myHypCreatorMap.end(); itHyp++)
// create a new mesh object servant, store it in a map in study context
SMESH_Mesh_i* meshServant = new SMESH_Mesh_i( GetPOA(), this, GetCurrentStudyID() );
// create a new mesh object
- MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
+ if(MYDEBUG) MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
meshServant->SetImpl( myGen.CreateMesh( GetCurrentStudyID(), myIsEmbeddedMode ));
// activate the CORBA servant of Mesh
void SMESH_Gen_i::SetEmbeddedMode( CORBA::Boolean theMode )
{
myIsEmbeddedMode = theMode;
- MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
if ( !myIsEmbeddedMode ) {
//PAL10867: disable signals catching with "noexcepthandler" option
{
if ( !foundMesh->_is_nil() ) // not a sole mesh
{
- GEOM::GEOM_Object_var s1 = mesh_i ->GetShapeToMesh();
- GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
- if ( ! ( isSole = s1->IsSame( s2 )))
- break;
+ if ( !foundMesh->HasShapeToMesh() ||
+ !mesh_i ->HasShapeToMesh() )
+ {
+ isSole = ( foundMesh->HasShapeToMesh() == mesh_i->HasShapeToMesh() );
+ }
+ else
+ {
+ GEOM::GEOM_Object_var s1 = mesh_i ->GetShapeToMesh();
+ GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
+ isSole = s1->IsSame( s2 );
+ }
}
foundMesh = SMESH::SMESH_Mesh::_narrow( obj );
}
msgToGUI = "preferences/SMESH/forget_mesh_on_hyp_modif/";
msgToGUI += myToForgetMeshDataOnHypModif ? "true" : "false";
}
+ else if ( strcmp(name, "default_grp_color") == 0 )
+ {
+ vector<int> color;
+ string str = value;
+ // color must be presented as a string of next form:
+ if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example)
+ str = str.substr(1);
+ for ( size_t i = 0; i < str.length()/2; i++ )
+ if ( str.at(i*2) >= '0' && str.at(i*2) <= 'f' && str.at(i*2+1) >= '0' && str.at(i*2+1) <= 'f' )
+ color.push_back( strtol( str.substr( i*2, 2 ).c_str(), NULL, 16 ) );
+ }
+ else if ( value ) { // rgb color ("255,170,0", for example)
+ string tempValue( value );
+ char* colorValue = strtok( &tempValue[0], "," );
+ while ( colorValue != NULL ) {
+ int c_value = atoi( colorValue );
+ if ( c_value >= 0 && c_value <= 255 )
+ color.push_back( c_value );
+ colorValue = strtok( NULL, "," );
+ }
+ }
+ if ( color.size() == 3 ) { // color must have three valid component
+ SMESHDS_GroupBase::SetDefaultColor( Quantity_Color( color[0]/255., color[1]/255., color[2]/255., Quantity_TOC_RGB ) );
+ myDefaultGroupColor = value;
+ msgToGUI = "preferences/SMESH/default_grp_color/";
+ msgToGUI += value;
+ }
+ }
// update preferences in case if SetOption() is invoked from python console
if ( !msgToGUI.empty() )
{
return CORBA::string_dup( myToForgetMeshDataOnHypModif ? "true" : "false" );
}
+ if ( strcmp(name, "default_grp_color") == 0 )
+ {
+ return CORBA::string_dup( myDefaultGroupColor.c_str() );
+ }
}
return CORBA::string_dup( "" );
}
myLocShape = SMESH_Mesh::PseudoShape();
// call implementation compute
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
- myGen.PrepareCompute( myLocMesh, myLocShape);
- bool ok = myGen.Compute( myLocMesh, myLocShape);
+ myGen.PrepareCompute( myLocMesh, myLocShape );
+ int how = ::SMESH_Gen::COMPACT_MESH;
+ if ( myLocShape != myLocMesh.GetShapeToMesh() ) // compute a sub-mesh
+ how |= ::SMESH_Gen::SHAPE_ONLY;
+ bool ok = myGen.Compute( myLocMesh, myLocShape, how );
meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
myLocMesh.GetMeshDS()->Modified();
return ok;
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
TSetOfInt shapeIds;
::MeshDimension aDim = (MeshDimension)theDimension;
- if ( myGen.Compute( myLocMesh, myLocShape, false, false, aDim, &shapeIds ) )
+ if ( myGen.Compute( myLocMesh, myLocShape, ::SMESH_Gen::COMPACT_MESH, aDim, &shapeIds ) )
{
int nbShapeId = shapeIds.size();
theShapesId.length( nbShapeId );
// make a group name
const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
- { // check of typeNames, compilation failure mains that NB_ELEMENT_TYPES changed:
+ { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
const int nbNames = sizeof(typeNames) / sizeof(const char*);
- int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 1 : -1 ]; _assert[0]=0;
+ int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1];
}
string groupName = "Gr";
SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );
// --> try to find SUB-MESHES containers for each type of submesh
for ( int j = GetSubMeshOnVertexTag(); j <= GetSubMeshOnCompoundTag(); j++ ) {
- const char* name_meshgroup;
+ const char* name_meshgroup = 0;
if ( j == GetSubMeshOnVertexTag() )
name_meshgroup = "SubMeshes On Vertex";
else if ( j == GetSubMeshOnEdgeTag() )
_CORBA_Octet* buffer = new _CORBA_Octet[real_size];
char tmp[3];
tmp[2]='\0';
- int c = -1;
+ unsigned int c = -1;
for ( int i = 0; i < real_size; i++ )
{
memcpy( &(tmp[0]), &(theStream[i*3+1]), 2 );