This commit is contained in:
eap 2011-01-18 10:58:29 +00:00
parent 8b21a624a6
commit 4a3492c3f1
3 changed files with 181 additions and 181 deletions

View File

@ -151,46 +151,46 @@ SMESH_VisualObjDef::~SMESH_VisualObjDef()
//================================================================================= //=================================================================================
vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
{ {
if (myLocalGrid) if (myLocalGrid)
{ {
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID); TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
return i == myVTK2SMDSNodes.end() ? -1 : i->second; return i == myVTK2SMDSNodes.end() ? -1 : i->second;
} }
return this->GetMesh()->FindNodeVtk(theVTKID)->GetID(); return this->GetMesh()->FindNodeVtk(theVTKID)->GetID();
} }
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
{ {
if (myLocalGrid) if (myLocalGrid)
{ {
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID); TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
return i == mySMDS2VTKNodes.end() ? -1 : i->second; return i == mySMDS2VTKNodes.end() ? -1 : i->second;
} }
const SMDS_MeshNode* aNode = 0; const SMDS_MeshNode* aNode = 0;
if( this->GetMesh() ) { if( this->GetMesh() ) {
aNode = this->GetMesh()->FindNode(theObjID); aNode = this->GetMesh()->FindNode(theObjID);
} }
return aNode ? aNode->getVtkId() : -1; return aNode ? aNode->getVtkId() : -1;
} }
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
{ {
if (myLocalGrid) if (myLocalGrid)
{ {
TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID); TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID);
return i == myVTK2SMDSElems.end() ? -1 : i->second; return i == myVTK2SMDSElems.end() ? -1 : i->second;
} }
return this->GetMesh()->fromVtkToSmds(theVTKID); return this->GetMesh()->fromVtkToSmds(theVTKID);
} }
vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
{ {
if (myLocalGrid) if (myLocalGrid)
{ {
TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID); TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID);
return i == mySMDS2VTKElems.end() ? -1 : i->second; return i == mySMDS2VTKElems.end() ? -1 : i->second;
} }
return this->GetMesh()->FindElement(theObjID)->getVtkId(); return this->GetMesh()->FindElement(theObjID)->getVtkId();
//return this->GetMesh()->fromSmdsToVtk(theObjID); //return this->GetMesh()->fromSmdsToVtk(theObjID);
} }
@ -241,45 +241,45 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs " << buildGrid); MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs " << buildGrid);
if (buildGrid) if (buildGrid)
{ {
myLocalGrid = true; myLocalGrid = true;
try try
{ {
mySMDS2VTKNodes.clear(); mySMDS2VTKNodes.clear();
myVTK2SMDSNodes.clear(); myVTK2SMDSNodes.clear();
mySMDS2VTKElems.clear(); mySMDS2VTKElems.clear();
myVTK2SMDSElems.clear(); myVTK2SMDSElems.clear();
if ( IsNodePrs() ) if ( IsNodePrs() )
buildNodePrs(); buildNodePrs();
else else
buildElemPrs(); buildElemPrs();
} }
catch(...) catch(...)
{ {
mySMDS2VTKNodes.clear(); mySMDS2VTKNodes.clear();
myVTK2SMDSNodes.clear(); myVTK2SMDSNodes.clear();
mySMDS2VTKElems.clear(); mySMDS2VTKElems.clear();
myVTK2SMDSElems.clear(); myVTK2SMDSElems.clear();
myGrid->SetPoints( 0 ); myGrid->SetPoints( 0 );
myGrid->SetCells( 0, 0, 0, 0, 0 ); myGrid->SetCells( 0, 0, 0, 0, 0 );
throw; throw;
} }
} }
else else
{ {
myLocalGrid = false; myLocalGrid = false;
if (!GetMesh()->isCompacted()) if (!GetMesh()->isCompacted())
{ {
MESSAGE("*** buildPrs ==> compactMesh!"); MESSAGE("*** buildPrs ==> compactMesh!");
GetMesh()->compactMesh(); GetMesh()->compactMesh();
} }
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid(); vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
myGrid->ShallowCopy(theGrid); myGrid->ShallowCopy(theGrid);
//MESSAGE(myGrid->GetReferenceCount()); //MESSAGE(myGrid->GetReferenceCount());
//MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() ); //MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() ); //MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"buildPrs.vtu" ); if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"buildPrs.vtu" );
} }
} }
@ -570,8 +570,8 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid() vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
{ {
//MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid); //MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid);
return myGrid; return myGrid;
} }
@ -581,7 +581,7 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
//================================================================================= //=================================================================================
bool SMESH_VisualObjDef::IsValid() const bool SMESH_VisualObjDef::IsValid() const
{ {
//MESSAGE("SMESH_VisualObjDef::IsValid"); //MESSAGE("SMESH_VisualObjDef::IsValid");
return GetNbEntities(SMDSAbs_Node) > 0 || return GetNbEntities(SMDSAbs_Node) > 0 ||
GetNbEntities(SMDSAbs_0DElement) > 0 || GetNbEntities(SMDSAbs_0DElement) > 0 ||
GetNbEntities(SMDSAbs_Edge) > 0 || GetNbEntities(SMDSAbs_Edge) > 0 ||
@ -601,7 +601,7 @@ bool SMESH_VisualObjDef::IsValid() const
SMESH_MeshObj::SMESH_MeshObj(SMESH::SMESH_Mesh_ptr theMesh): SMESH_MeshObj::SMESH_MeshObj(SMESH::SMESH_Mesh_ptr theMesh):
myClient(SalomeApp_Application::orb(),theMesh) myClient(SalomeApp_Application::orb(),theMesh)
{ {
myEmptyGrid = 0; myEmptyGrid = 0;
if ( MYDEBUG ) if ( MYDEBUG )
MESSAGE("SMESH_MeshObj - this = "<<this<<"; theMesh->_is_nil() = "<<theMesh->_is_nil()); MESSAGE("SMESH_MeshObj - this = "<<this<<"; theMesh->_is_nil() = "<<theMesh->_is_nil());
} }
@ -634,20 +634,20 @@ bool SMESH_MeshObj::Update( int theIsClear )
bool SMESH_MeshObj::NulData() bool SMESH_MeshObj::NulData()
{ {
MESSAGE ("SMESH_MeshObj::NulData() =================================================================================="); MESSAGE ("SMESH_MeshObj::NulData() ==================================================================================");
if (!myEmptyGrid) if (!myEmptyGrid)
{ {
myEmptyGrid = SMDS_UnstructuredGrid::New(); myEmptyGrid = SMDS_UnstructuredGrid::New();
myEmptyGrid->Initialize(); myEmptyGrid->Initialize();
myEmptyGrid->Allocate(); myEmptyGrid->Allocate();
vtkPoints* points = vtkPoints::New(); vtkPoints* points = vtkPoints::New();
points->SetNumberOfPoints(0); points->SetNumberOfPoints(0);
myEmptyGrid->SetPoints( points ); myEmptyGrid->SetPoints( points );
points->Delete(); points->Delete();
myEmptyGrid->BuildLinks(); myEmptyGrid->BuildLinks();
} }
myGrid->ShallowCopy(myEmptyGrid); myGrid->ShallowCopy(myEmptyGrid);
return true; return true;
} }
//================================================================================= //=================================================================================
// function : GetElemDimension // function : GetElemDimension
@ -815,7 +815,7 @@ void SMESH_SubMeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunc
//================================================================================= //=================================================================================
bool SMESH_SubMeshObj::Update( int theIsClear ) bool SMESH_SubMeshObj::Update( int theIsClear )
{ {
MESSAGE("SMESH_SubMeshObj::Update " << this) MESSAGE("SMESH_SubMeshObj::Update " << this)
bool changed = myMeshObj->Update( theIsClear ); bool changed = myMeshObj->Update( theIsClear );
buildPrs(true); buildPrs(true);
return changed; return changed;

View File

@ -330,10 +330,10 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
if (distrVisibility && GetDistributionVisibility()) { if (distrVisibility && GetDistributionVisibility()) {
for( i=0 ;i<myNbValues.size();i++ ) { for( i=0 ;i<myNbValues.size();i++ ) {
if(myNbValues[i]) { if(myNbValues[i]) {
numPositiveVal++; numPositiveVal++;
maxValue = std::max(maxValue,myNbValues[i]); maxValue = std::max(maxValue,myNbValues[i]);
} }
} }
numDistrPts = 4*(numPositiveVal); numDistrPts = 4*(numPositiveVal);
distrPts = vtkPoints::New(); distrPts = vtkPoints::New();
@ -346,13 +346,13 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
distrPts->Delete(); distrPts->Delete();
distrPolys->Delete(); distrPolys->Delete();
if ( myDistributionColoringType == SMESH_MULTICOLOR_TYPE ) { if ( myDistributionColoringType == SMESH_MULTICOLOR_TYPE ) {
distColors = vtkUnsignedCharArray::New(); distColors = vtkUnsignedCharArray::New();
distColors->SetNumberOfComponents(3); distColors->SetNumberOfComponents(3);
distColors->SetNumberOfTuples(numPositiveVal); distColors->SetNumberOfTuples(numPositiveVal);
this->myDistribution->GetCellData()->SetScalars(distColors); this->myDistribution->GetCellData()->SetScalars(distColors);
distColors->Delete(); distColors->Delete();
} else if( myDistributionColoringType == SMESH_MONOCOLOR_TYPE ){ } else if( myDistributionColoringType == SMESH_MONOCOLOR_TYPE ){
this->myDistribution->GetCellData()->SetScalars(NULL); this->myDistribution->GetCellData()->SetScalars(NULL);
} }
} else { } else {
myDistribution->Reset(); myDistribution->Reset();
@ -412,12 +412,12 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
// Customization of the vtkScalarBarActor to show distribution histogram. // Customization of the vtkScalarBarActor to show distribution histogram.
double delimeter=0.0; double delimeter=0.0;
if(GetDistributionVisibility() && distrVisibility) { if(GetDistributionVisibility() && distrVisibility) {
delimeter=0.01*size[0]; //1 % from horizontal size of the full presentation size. delimeter=0.01*size[0]; //1 % from horizontal size of the full presentation size.
barWidth = size[0] - 4 - labelSize[0]; barWidth = size[0] - 4 - labelSize[0];
distrHeight = barWidth/2; distrHeight = barWidth/2;
} else { } else {
barWidth = size[0] - 4 - labelSize[0]; barWidth = size[0] - 4 - labelSize[0];
distrHeight = 0; distrHeight = 0;
} }
barHeight = (int)(0.86*size[1]); barHeight = (int)(0.86*size[1]);
@ -432,45 +432,45 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
} }
if(GetDistributionVisibility() && distrVisibility) { if(GetDistributionVisibility() && distrVisibility) {
// Distribution points // Distribution points
shrink = delta*SHRINK_COEF; shrink = delta*SHRINK_COEF;
vtkIdType distPtsId=0; vtkIdType distPtsId=0;
vtkIdType distPtsIds[4]; vtkIdType distPtsIds[4];
for(i=0; i<numColors; i++) { for(i=0; i<numColors; i++) {
if(myNbValues[i]) { if(myNbValues[i]) {
itemH = distrHeight*((double)myNbValues[i]/maxValue); itemH = distrHeight*((double)myNbValues[i]/maxValue);
if(distrHeight == itemH) if(distrHeight == itemH)
itemH = itemH - delimeter/2; itemH = itemH - delimeter/2;
x[1] = i*delta+shrink; x[1] = i*delta+shrink;
// first point of polygon (quadrangle) // first point of polygon (quadrangle)
x[0] = 0; x[0] = 0;
distPtsIds[0] = distPtsId; distPtsIds[0] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// second point of polygon (quadrangle) // second point of polygon (quadrangle)
x[0] = itemH; x[0] = itemH;
distPtsIds[1] = distPtsId; distPtsIds[1] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
x[1] = i*delta+delta-shrink; x[1] = i*delta+delta-shrink;
// third point of polygon (quadrangle) // third point of polygon (quadrangle)
x[0] = 0; x[0] = 0;
distPtsIds[3] = distPtsId; distPtsIds[3] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// fourth point of polygon (quadrangle) // fourth point of polygon (quadrangle)
x[0] = itemH; x[0] = itemH;
distPtsIds[2] = distPtsId; distPtsIds[2] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
//Inser Quadrangle //Inser Quadrangle
distrPolys->InsertNextCell(4,distPtsIds); distrPolys->InsertNextCell(4,distPtsIds);
} }
} }
} }
} }
// rnv end // rnv end
@ -481,15 +481,15 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
// Customization of the vtkScalarBarActor to show distribution histogram. // Customization of the vtkScalarBarActor to show distribution histogram.
double coef1, delimeter=0.0; double coef1, delimeter=0.0;
if(GetDistributionVisibility() && distrVisibility) { if(GetDistributionVisibility() && distrVisibility) {
coef1=0.62; coef1=0.62;
distrHeight = (int)((coef1/2)*size[1]); distrHeight = (int)((coef1/2)*size[1]);
//delimeter between distribution diagram and scalar bar //delimeter between distribution diagram and scalar bar
delimeter=0.02*size[1]; delimeter=0.02*size[1];
} }
else { else {
coef1=0.4; coef1=0.4;
barHeight = (int)(coef1*size[1]); barHeight = (int)(coef1*size[1]);
distrHeight = 0; distrHeight = 0;
} }
barHeight = (int)(coef1*size[1]); barHeight = (int)(coef1*size[1]);
@ -498,48 +498,48 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
for (i=0; i<numPts/2; i++) { for (i=0; i<numPts/2; i++) {
x[0] = i*delta; x[0] = i*delta;
x[1] = barHeight; x[1] = barHeight;
pts->SetPoint(2*i,x); pts->SetPoint(2*i,x);
x[1] = distrHeight + delimeter; x[1] = distrHeight + delimeter;
pts->SetPoint(2*i+1,x); pts->SetPoint(2*i+1,x);
} }
if(GetDistributionVisibility() && distrVisibility) { if(GetDistributionVisibility() && distrVisibility) {
// Distribution points // Distribution points
shrink = delta*SHRINK_COEF; shrink = delta*SHRINK_COEF;
vtkIdType distPtsId=0; vtkIdType distPtsId=0;
vtkIdType distPtsIds[4]; vtkIdType distPtsIds[4];
for(i=0; i<numColors; i++) { for(i=0; i<numColors; i++) {
if(myNbValues[i]) { if(myNbValues[i]) {
itemH = distrHeight*((double)myNbValues[i]/maxValue); itemH = distrHeight*((double)myNbValues[i]/maxValue);
// first point of polygon (quadrangle) // first point of polygon (quadrangle)
x[0] = i*delta+shrink; x[0] = i*delta+shrink;
x[1] = 0; x[1] = 0;
distPtsIds[0] = distPtsId; distPtsIds[0] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// second point of polygon (quadrangle) // second point of polygon (quadrangle)
x[0] = i*delta+shrink; x[0] = i*delta+shrink;
x[1] = itemH; x[1] = itemH;
distPtsIds[3] = distPtsId; distPtsIds[3] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// third point of polygon (quadrangle) // third point of polygon (quadrangle)
x[0] = i*delta+delta-shrink; x[0] = i*delta+delta-shrink;
x[1] = 0; x[1] = 0;
distPtsIds[1] = distPtsId; distPtsIds[1] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// fourth point of polygon (quadrangle) // fourth point of polygon (quadrangle)
x[0] = i*delta+delta-shrink; x[0] = i*delta+delta-shrink;
x[1] = itemH; x[1] = itemH;
distPtsIds[2] = distPtsId; distPtsIds[2] = distPtsId;
distrPts->SetPoint(distPtsId++,x); distrPts->SetPoint(distPtsId++,x);
// Add polygon into poly data // Add polygon into poly data
distrPolys->InsertNextCell(4,distPtsIds); distrPolys->InsertNextCell(4,distPtsIds);
} }
} }
} }
// rnv end // rnv end
} }
@ -575,13 +575,13 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
// rnv begin // rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram. // Customization of the vtkScalarBarActor to show distribution histogram.
if(myNbValues[i] && myDistributionColoringType == SMESH_MULTICOLOR_TYPE && GetDistributionVisibility() && distrVisibility) if(myNbValues[i] && myDistributionColoringType == SMESH_MULTICOLOR_TYPE && GetDistributionVisibility() && distrVisibility)
{ {
rgb = distColors->GetPointer(3*dcCount); //write into array directly rgb = distColors->GetPointer(3*dcCount); //write into array directly
rgb[0] = rgba[0]; rgb[0] = rgba[0];
rgb[1] = rgba[1]; rgb[1] = rgba[1];
rgb[2] = rgba[2]; rgb[2] = rgba[2];
dcCount++; dcCount++;
} }
} }
// Now position everything properly // Now position everything properly
@ -824,14 +824,14 @@ void SMESH_ScalarBarActor::AllocateAndSizeLabels(int *labelSize,
double coef; double coef;
if( GetDistributionVisibility() && distrVisibility ) if( GetDistributionVisibility() && distrVisibility )
if(this->Orientation == VTK_ORIENT_VERTICAL) if(this->Orientation == VTK_ORIENT_VERTICAL)
coef = 0.4; coef = 0.4;
else else
coef = 0.18; coef = 0.18;
else else
if(this->Orientation == VTK_ORIENT_VERTICAL) if(this->Orientation == VTK_ORIENT_VERTICAL)
coef = 0.6; coef = 0.6;
else else
coef=0.25; coef=0.25;
if ( this->Orientation == VTK_ORIENT_VERTICAL ) if ( this->Orientation == VTK_ORIENT_VERTICAL )

View File

@ -707,12 +707,12 @@ SMESH_Client::Update(bool theIsClear)
{ {
bool anIsModified = true; bool anIsModified = true;
if(mySMESHDSMesh){ if(mySMESHDSMesh){
MESSAGE("Update mySMESHDSMesh"); MESSAGE("Update mySMESHDSMesh");
SMESHDS_Script* aScript = mySMESHDSMesh->GetScript(); SMESHDS_Script* aScript = mySMESHDSMesh->GetScript();
anIsModified = aScript->IsModified(); anIsModified = aScript->IsModified();
aScript->SetModified(false); aScript->SetModified(false);
}else{ }else{
MESSAGE("Update CORBA"); MESSAGE("Update CORBA");
SMESH::log_array_var aSeq = myMeshServer->GetLog( theIsClear ); SMESH::log_array_var aSeq = myMeshServer->GetLog( theIsClear );
CORBA::Long aLength = aSeq->length(); CORBA::Long aLength = aSeq->length();
anIsModified = aLength > 0; anIsModified = aLength > 0;