From: jfa Date: Wed, 5 Oct 2005 10:08:47 +0000 (+0000) Subject: PAL10147: Impossible to create groups and families presentations - two different... X-Git-Tag: V2_2_6~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e308093b9acc85febf151b11d052dd36cc7ee298;p=modules%2Fvisu.git PAL10147: Impossible to create groups and families presentations - two different problems fixed --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index a039ad74..531e792d 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -232,41 +232,55 @@ static int ComputeVisiblePropBounds(VTKViewer_ViewFrame* theViewFrame, float all return nothingVisible; } -VisuGUI::CameraOrient VisuGUI::SetFitAll(VTKViewer_ViewFrame* theViewFrame){ +VisuGUI::CameraOrient VisuGUI::SetFitAll(VTKViewer_ViewFrame* theViewFrame) +{ static float PRECISION = 0.000001; static float DEVIATION = 600; float XYZ_Bnd[6]; - if(ComputeVisiblePropBounds(theViewFrame,XYZ_Bnd)) return e3D; + if (ComputeVisiblePropBounds(theViewFrame,XYZ_Bnd)) return e3D; float absX = XYZ_Bnd[1]-XYZ_Bnd[0]; - + float absY = XYZ_Bnd[3]-XYZ_Bnd[2]; - + float absZ = XYZ_Bnd[5]-XYZ_Bnd[4]; - + CameraOrient aCameraOrient = e3D; - if(absX <= PRECISION) aCameraOrient = eFront; - else {if(absY <= PRECISION) aCameraOrient = eLeft; - else {if(absZ <= PRECISION) aCameraOrient = eTop;}} - - float dev_abs_XY = absX / absY; - float dev_abs_YZ = absY / absZ; - float dev_abs_XZ = absX / absZ; - if(dev_abs_XY >= DEVIATION || 1./dev_abs_YZ >= DEVIATION) aCameraOrient = eLeft; - else{if(1./dev_abs_XY >= DEVIATION || 1./dev_abs_XZ >= DEVIATION) aCameraOrient = eFront; - else {if(dev_abs_XZ >= DEVIATION || dev_abs_YZ >= DEVIATION) aCameraOrient = eTop;}} - - switch(aCameraOrient){ + if (absX <= PRECISION) aCameraOrient = eFront; + else { + if (absY <= PRECISION) aCameraOrient = eLeft; + else { + if (absZ <= PRECISION) aCameraOrient = eTop; + else { + // all the three dimensions exceeds precision + float dev_abs_XY = absX / absY; + float dev_abs_YZ = absY / absZ; + float dev_abs_XZ = absX / absZ; + if (dev_abs_XY >= DEVIATION || 1./dev_abs_YZ >= DEVIATION) + aCameraOrient = eLeft; + else { + if (1./dev_abs_XY >= DEVIATION || 1./dev_abs_XZ >= DEVIATION) + aCameraOrient = eFront; + else { + if (dev_abs_XZ >= DEVIATION || dev_abs_YZ >= DEVIATION) + aCameraOrient = eTop; + } + } + } + } + } + + switch (aCameraOrient) { case eFront: theViewFrame->onViewFront(); break; case eLeft: theViewFrame->onViewLeft(); break; case eTop: theViewFrame->onViewTop(); break; - case e3D: theViewFrame->onViewReset(); break; + case e3D: theViewFrame->onViewReset(); break; } theViewFrame->getRenderer()->ResetCameraClippingRange(); theViewFrame->onViewFitAll(); return aCameraOrient; } - + QAD_Desktop* VisuGUI::GetDesktop(){ return QAD_Application::getDesktop() ; } diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 27b69a65..71a45766 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -98,7 +98,8 @@ int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, Entit VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, Entity theEntity, const char* theFamilyName){ myMeshName = theMeshName; - myEntity = VISU::TEntity(theEntity); + //jfa PAL10147:myEntity = VISU::TEntity(theEntity); + myEntity = int(theEntity);//jfa PAL10147 mySubMeshName = theFamilyName; return Build(false); } @@ -121,9 +122,11 @@ int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, const } -VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGroupName){ +VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGroupName) +{ myMeshName = theMeshName; - myEntity = VISU::TEntity(-1); + //jfa PAL10147:myEntity = VISU::TEntity(-1); + myEntity = -1;//jfa PAL10147 mySubMeshName = theGroupName; return Build(false); } @@ -134,7 +137,8 @@ VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap) Prs3d_i::Restore(theMap); myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); - myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt(); + //jfa PAL10147:myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt(); + myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa PAL10147 mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1(); myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt()); @@ -196,7 +200,8 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){ myNodeColor.R = myNodeColor.G = 1.0; myNodeColor.B = 1.0; myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.; } - if(int(myEntity) >= 0) + //jfa PAL10147:if(int(myEntity) >= 0) + if(myEntity >= 0) //jfa PAL10147 if(mySubMeshName == "") myType = VISU::TENTITY; else @@ -209,12 +214,15 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){ VISU_Convertor::TOutput *anOutput; switch(myType){ case VISU::TENTITY : - anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity); + //jfa PAL10147:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity); + anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa PAL10147 aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", VISU::TENTITY,myMeshName.c_str(),myEntity); break; case VISU::TFAMILY : - anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity,mySubMeshName); + //jfa PAL10147:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity,mySubMeshName); + anOutput = myResult->GetInput()->GetMeshOnEntity + (myMeshName,(VISU::TEntity)myEntity,mySubMeshName);//jfa PAL10147 aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str()); break; diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index ebed10ac..6593658d 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -71,7 +71,7 @@ namespace VISU{ VISU_MeshPL* myMeshPL; string myMeshName; - TEntity myEntity; + int myEntity;//jfa PAL10147: TEntity myEntity; string mySubMeshName; VISU::VISUType myType;