mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
Fix for PAL21179:
1) draw outlines (borders) of the shapes, 2) material properties.
This commit is contained in:
parent
354f127d1d
commit
a2ad5e1364
@ -448,6 +448,7 @@ AC_OUTPUT([ \
|
||||
src/GEOMBase/Makefile \
|
||||
src/GEOMClient/Makefile \
|
||||
src/GEOMFiltersSelection/Makefile \
|
||||
src/Material/Makefile \
|
||||
src/GEOMGUI/Makefile \
|
||||
src/GEOMImpl/Makefile \
|
||||
src/GEOMToolsGUI/Makefile \
|
||||
|
BIN
doc/salome/gui/GEOM/images/material_OCC.png
Normal file
BIN
doc/salome/gui/GEOM/images/material_OCC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
doc/salome/gui/GEOM/images/material_VTK.png
Normal file
BIN
doc/salome/gui/GEOM/images/material_VTK.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
doc/salome/gui/GEOM/images/material_back.png
Normal file
BIN
doc/salome/gui/GEOM/images/material_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
BIN
doc/salome/gui/GEOM/images/material_front.png
Normal file
BIN
doc/salome/gui/GEOM/images/material_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
56
doc/salome/gui/GEOM/input/material.doc
Normal file
56
doc/salome/gui/GEOM/input/material.doc
Normal file
@ -0,0 +1,56 @@
|
||||
/*!
|
||||
|
||||
\page material_page Material
|
||||
|
||||
\n You can change the material properties of the selected shape(s) by
|
||||
- choosing one of predefined global materials,
|
||||
- choosing one of predefined user materials,
|
||||
- creating a new user material and applying it to the selected shape(s)
|
||||
|
||||
in the following dialog box.
|
||||
|
||||
\image html material_front.png
|
||||
<center><em><b>Set Material Properties</b> dialog: <b>Front material</b> tab</em></center>
|
||||
|
||||
\image html material_back.png
|
||||
<center><em><b>Set Material Properties</b> dialog: <b>Back material</b> tab</em></center>
|
||||
|
||||
This functionality is available in both OCC and VTK viewers.
|
||||
|
||||
User can changed the following material properties
|
||||
|
||||
- ambient color and coefficient
|
||||
- diffuse color and coefficient
|
||||
- specular color and coefficient
|
||||
- emission color and coefficient (available only in OCC viewer)
|
||||
- shininess
|
||||
|
||||
With help of <b>Front material</b> and <b>Back material</b> tabs of
|
||||
<b>Set Material Properties</b> dialog it is possible to set front and
|
||||
back materials of the selected shape(s). To make <b>Back material</b>
|
||||
tab visible it is needed to check <b>Enable back material</b> check
|
||||
box. If back material is not defined, front material specified for the
|
||||
selected shape(s) is used as both front and back materials.
|
||||
|
||||
All currently available materials are shown in the left-side list box
|
||||
of the <b>Set Material Properties</b> dialog.
|
||||
|
||||
- <b>[Current]</b> item in the list corresponds to
|
||||
the front/back (depending on what tab is currently active) material
|
||||
currently used for the selected shape(s)
|
||||
- <b>[Default]</b> item in the list corresponds to the front/back material
|
||||
specified in Geometry module preferences
|
||||
- <b>Global</b> materials are shown in blue color in the list
|
||||
- <b>User</b> materials are shown in black color in the list
|
||||
|
||||
|
||||
<b>Examples:</b>
|
||||
|
||||
\image html material_OCC.png
|
||||
<center><em>Different materials in OCC viewer</em></center>
|
||||
|
||||
\image html material_VTK.png
|
||||
<center><em>Different materials in VTK viewer</em></center>
|
||||
|
||||
*/
|
||||
|
@ -29,6 +29,8 @@ transparency of geometrical objects.</li>
|
||||
isolines displayed within a shape.</li>
|
||||
<li>\subpage deflection_page "Deflection" - allows to change the
|
||||
deflection coefficient of a shape.</li>
|
||||
<li>\subpage material_page "Material" - allows to change the
|
||||
material properties of a shape.</li>
|
||||
<li>\subpage point_marker_page "Point Marker" - allows to change the
|
||||
representation of geometrical vertices.</li>
|
||||
<li><b>Auto color</b> / <b>Disable auto color</b> - activates the auto color
|
||||
|
@ -43,6 +43,7 @@
|
||||
<parameter name="SettingsGeomStep" value="10" />
|
||||
<parameter name="display_mode" value="0" />
|
||||
<parameter name="shading_color" value="255, 255, 0" />
|
||||
<parameter name="edges_in_shading_color" value="255, 255, 255" />
|
||||
<parameter name="wireframe_color" value="255, 255, 0" />
|
||||
<parameter name="free_bound_color" value="0, 255, 0" />
|
||||
<parameter name="line_color" value="255, 0, 0" />
|
||||
@ -54,6 +55,8 @@
|
||||
<parameter name="base_vectors_length" value="1" />
|
||||
<parameter name="marker_scale" value="1" />
|
||||
<parameter name="geom_preview" value="false" />
|
||||
<parameter name="front_material" value="Gold" />
|
||||
<parameter name="back_material" value="Gold" />
|
||||
<!-- Input field precisions -->
|
||||
<parameter name="def_precision" value="3" />
|
||||
<parameter name="length_precision" value="6" />
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "DisplayGUI.h"
|
||||
#include <GeometryGUI.h>
|
||||
#include "GeometryGUI_Operations.h"
|
||||
#include <GEOM_Constants.h>
|
||||
#include <GEOM_Displayer.h>
|
||||
#include <GEOM_AISShape.hxx>
|
||||
#include <GEOM_Actor.h>
|
||||
@ -91,11 +92,28 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
||||
SALOME_ListIO selected;
|
||||
Sel->selectedObjects( selected );
|
||||
|
||||
QString aDispModeName;
|
||||
int aDispMode;
|
||||
if ( theCommandID == GEOMOp::OpDisplayMode )
|
||||
aDispMode = GetDisplayMode();
|
||||
|
||||
switch ( theCommandID ) {
|
||||
case GEOMOp::OpDisplayMode: // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING
|
||||
InvertDisplayMode();
|
||||
getGeometryGUI()->action( GEOMOp::OpDisplayMode )->setText
|
||||
( GetDisplayMode() == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") );
|
||||
case GEOMOp::OpDisplayMode: // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
|
||||
//InvertDisplayMode();
|
||||
switch ( aDispMode) {
|
||||
case 0:
|
||||
aDispModeName = tr( "GEOM_MEN_WIREFRAME" );
|
||||
break;
|
||||
case 1:
|
||||
aDispModeName = tr("GEOM_MEN_SHADING");
|
||||
break;
|
||||
case 2:
|
||||
aDispModeName = tr("GEOM_MEN_SHADING_WITH_EDGES");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
getGeometryGUI()->action( GEOMOp::OpDisplayMode )->setText( aDispModeName );
|
||||
getGeometryGUI()->menuMgr()->update();
|
||||
break;
|
||||
case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
|
||||
@ -128,11 +146,14 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
||||
case GEOMOp::OpShading: // POPUP MENU - DISPLAY MODE - SHADING
|
||||
ChangeDisplayMode( 1 );
|
||||
break;
|
||||
case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
|
||||
ChangeDisplayMode( 2 );
|
||||
break;
|
||||
case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE
|
||||
ChangeDisplayMode( 3 );
|
||||
break;
|
||||
case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
|
||||
ChangeDisplayMode( 2 );
|
||||
case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
|
||||
ChangeDisplayMode( 4 );
|
||||
break;
|
||||
default:
|
||||
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||
@ -350,23 +371,42 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
|
||||
else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
AIS_DisplayMode newmode = (mode == 1 ? AIS_Shaded : AIS_WireFrame);
|
||||
|
||||
AIS_DisplayMode newmode;
|
||||
switch (mode) {
|
||||
case 0:
|
||||
newmode = AIS_WireFrame;
|
||||
break;
|
||||
case 1:
|
||||
newmode = AIS_Shaded;
|
||||
break;
|
||||
case 2:
|
||||
newmode = AIS_DisplayMode( GEOM_AISShape::ShadingWithEdges );
|
||||
break;
|
||||
case 3:
|
||||
newmode = AIS_DisplayMode( GEOM_AISShape::TexturedShape );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIS_ListOfInteractive List;
|
||||
ic->DisplayedObjects( List );
|
||||
AIS_ListOfInteractive List1;
|
||||
ic->ObjectsInCollector( List1 );
|
||||
List.Append( List1 );
|
||||
|
||||
|
||||
AIS_ListIteratorOfListOfInteractive ite( List );
|
||||
while( ite.More() ) {
|
||||
if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
|
||||
ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true );
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
|
||||
ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true );
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
|
||||
|
||||
ic->SetDisplayMode( newmode, Standard_False );
|
||||
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
}
|
||||
@ -386,9 +426,8 @@ int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow )
|
||||
}
|
||||
else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode();
|
||||
dispMode = (mode == AIS_WireFrame ? 0 : 1 );
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
dispMode = ic->DisplayMode();
|
||||
}
|
||||
return dispMode;
|
||||
}
|
||||
@ -456,7 +495,7 @@ int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
|
||||
|
||||
//=====================================================================================
|
||||
// function : DisplayGUI::InvertDisplayMode()
|
||||
// purpose : Invert display mode ( shadin <-> wireframe ) for the viewer
|
||||
// purpose : Invert display mode ( shading <-> wireframe ) for the viewer
|
||||
// (current viewer if <viewWindow> = 0 )
|
||||
//=====================================================================================
|
||||
void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow )
|
||||
@ -503,11 +542,13 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
SVTK_Prs* vtkPrs =
|
||||
stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0;
|
||||
if ( vtkPrs && !vtkPrs->IsNull() ) {
|
||||
if ( mode == 0 )
|
||||
if (mode == 0 )
|
||||
aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() );
|
||||
else if ( mode == 1 )
|
||||
else if ( mode == 1 )
|
||||
aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() );
|
||||
else if ( mode == 2 ) {
|
||||
else if ( mode == 2 )
|
||||
aView->ChangeRepresentationToSurfaceWithEdges( vtkPrs->GetObjects() );
|
||||
else if ( mode == 4 ) {
|
||||
vtkActorCollection* anActors = vtkPrs->GetObjects();
|
||||
anActors->InitTraversal();
|
||||
while (vtkActor* anAct = anActors->GetNextActor()) {
|
||||
@ -516,12 +557,12 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
aGeomActor->SetVectorMode(vectorMode);
|
||||
}
|
||||
}
|
||||
if(mode == 0 || mode == 1) {
|
||||
aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
||||
}
|
||||
else if (mode == 3) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP , vectorMode);
|
||||
}
|
||||
if(mode == 0 || mode == 1 || mode == 2) {
|
||||
aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
||||
}
|
||||
else if (mode == 4) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
aView->Repaint();
|
||||
@ -543,14 +584,16 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
|
||||
AIS_ListIteratorOfListOfInteractive interIter( shapes );
|
||||
for ( ; interIter.More(); interIter.Next() ) {
|
||||
if ( mode == 0 )
|
||||
if ( mode == 0 )
|
||||
ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false );
|
||||
else if ( mode == 1 )
|
||||
else if ( mode == 1 )
|
||||
ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false );
|
||||
else if ( mode == 3 )
|
||||
else if ( mode == 2 )
|
||||
ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false );
|
||||
else if ( mode == 3 )
|
||||
ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false );
|
||||
else if (mode == 2 ) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
|
||||
else if (mode == 4 ) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
|
||||
if ( !aSh.IsNull() ) {
|
||||
vectorMode = !aSh->isShowVectors();
|
||||
aSh->SetDisplayVectors(vectorMode);
|
||||
@ -558,11 +601,12 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mode == 0 || mode == 1) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
||||
} else if (mode == 2) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
|
||||
}
|
||||
if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
||||
}
|
||||
else if (mode == 4) {
|
||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
ic->UpdateCurrentViewer();
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "GeometryGUI.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
|
||||
#include <GEOM_Constants.h>
|
||||
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
|
||||
@ -66,6 +68,10 @@
|
||||
str = QString( "Wireframe" ); \
|
||||
else if ( dm == AIS_Shaded ) \
|
||||
str = QString( "Shading" ); \
|
||||
else if ( dm == GEOM_AISShape::ShadingWithEdges ) \
|
||||
str = QString( "ShadingWithEdges" ); \
|
||||
else if ( dm == GEOM_AISShape::TexturedShape ) \
|
||||
str = QString( "Texture" ); \
|
||||
else \
|
||||
str = QString(); }
|
||||
|
||||
@ -74,6 +80,8 @@
|
||||
str = QString( "Wireframe" ); \
|
||||
else if ( dm == 1 ) \
|
||||
str = QString( "Shading" ); \
|
||||
else if ( dm == 3 ) \
|
||||
str = QString( "ShadingWithEdges" ); \
|
||||
else \
|
||||
str = QString(); }
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
|
||||
#include <GEOM_Constants.h>
|
||||
#include <GEOM_TypeFilter.h>
|
||||
#include <GEOM_EdgeFilter.h>
|
||||
#include <GEOM_FaceFilter.h>
|
||||
@ -41,6 +42,8 @@
|
||||
#include <GEOM_AISTrihedron.hxx>
|
||||
#include <GEOM_VTKTrihedron.hxx>
|
||||
|
||||
#include <Material_Model.h>
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_ViewWindow.h>
|
||||
#include <SUIT_Session.h>
|
||||
@ -78,6 +81,7 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
|
||||
@ -810,6 +814,11 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
||||
anAspect->SetColor( aColor );
|
||||
AISShape->Attributes()->SetWireAspect( anAspect );
|
||||
|
||||
// Set color for edges in shading
|
||||
col = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) );
|
||||
aColor = SalomeApp_Tools::color( col );
|
||||
AISShape->SetEdgesInShadingColor( aColor );
|
||||
|
||||
// bug [SALOME platform 0019868]
|
||||
// Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18)
|
||||
//AISShape->SetOwnDeviationAngle( 10*PI/180 );
|
||||
@ -934,6 +943,68 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get material properties, set material
|
||||
Material_Model* aModelF = 0;
|
||||
Material_Model* aModelB = 0;
|
||||
if ( useStudy ) {
|
||||
// Get front material property from study and construct front material model
|
||||
QString aMaterialF = aPropMap.value(FRONT_MATERIAL_PROP).toString();
|
||||
QStringList aProps = aMaterialF.split(DIGIT_SEPARATOR);
|
||||
aModelF = Material_Model::getMaterialModel( aProps );
|
||||
|
||||
// Get back material property from study and construct back material model
|
||||
QString aMaterialB = aPropMap.value(BACK_MATERIAL_PROP).toString();
|
||||
if ( !aMaterialB.isEmpty() ) {
|
||||
QStringList aPropsB = aMaterialB.split(DIGIT_SEPARATOR);
|
||||
aModelB = Material_Model::getMaterialModel( aPropsB );
|
||||
}
|
||||
else
|
||||
aModelB = aModelF;
|
||||
|
||||
} else {
|
||||
// Get front material property from study and construct front material model
|
||||
aModelF = new Material_Model();
|
||||
aModelF->fromResources( aResMgr, "Geometry", true );
|
||||
|
||||
// Get back material property from study and construct back material model
|
||||
aModelB = new Material_Model();
|
||||
aModelB->fromResources( aResMgr, "Geometry", false );
|
||||
}
|
||||
|
||||
// Set front material property
|
||||
QString aMaterialPropF = aModelF->getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), FRONT_MATERIAL_PROP, aMaterialPropF );
|
||||
|
||||
// Set back material property
|
||||
QString aMaterialPropB = aModelB->getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), BACK_MATERIAL_PROP, aMaterialPropB );
|
||||
|
||||
// Get front material properties from the model
|
||||
Graphic3d_MaterialAspect aMatF = aModelF->getMaterialOCCAspect();
|
||||
|
||||
// Get back material properties from the model
|
||||
Graphic3d_MaterialAspect aMatB = aModelB->getMaterialOCCAspect();
|
||||
|
||||
printf(">> GEOM_Displayer::Update() : SetMaterial\n");
|
||||
// Set front material for the selected shape
|
||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
|
||||
AISShape->SetMaterial(aMatF);
|
||||
|
||||
// Set back material for the selected shape
|
||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
|
||||
AISShape->SetMaterial(aMatB);
|
||||
|
||||
// Return to the default facing mode
|
||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||
|
||||
// Release memory
|
||||
if ( aModelF )
|
||||
delete aModelF;
|
||||
if ( aModelB )
|
||||
delete aModelB;
|
||||
|
||||
|
||||
// AISShape->SetName(???); ??? necessary to set name ???
|
||||
occPrs->AddObject( AISShape );
|
||||
|
||||
@ -993,6 +1064,11 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
|
||||
vtkActorCollection* theActors = 0;
|
||||
|
||||
QString anEntry;
|
||||
if(!myIO.IsNull()) {
|
||||
anEntry = myIO->getEntry();
|
||||
}
|
||||
|
||||
if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) {
|
||||
//myToActivate = false; // ouv: commented to make the trihedron pickable (see IPAL18657)
|
||||
GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
|
||||
@ -1021,10 +1097,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
else {
|
||||
PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
|
||||
|
||||
QString anEntry;
|
||||
if(!myIO.IsNull()) {
|
||||
aMgrId = getViewManagerId(myViewFrame);
|
||||
anEntry = myIO->getEntry();
|
||||
}
|
||||
useStudy = !anEntry.isEmpty() && aMgrId != -1;
|
||||
|
||||
@ -1083,6 +1157,14 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
aGeomGActor->SetShadingProperty( aProp );
|
||||
aGeomGActor->SetWireframeProperty( aProp );
|
||||
}
|
||||
|
||||
// Set color for edges in shading
|
||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||
if(aResMgr) {
|
||||
QColor c = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) );
|
||||
aGeomGActor->SetEdgesInShadingColor( c.red()/255., c.green()/255., c.blue()/255. );
|
||||
}
|
||||
|
||||
int aIsos[2]= { 1, 1 };
|
||||
if(useStudy) {
|
||||
QString anIsos = aPropMap.value(ISOS_PROP).toString();
|
||||
@ -1091,9 +1173,61 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
aGeomGActor->SetNbIsos(aIsos);
|
||||
aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
|
||||
aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
|
||||
aGeomGActor->setDisplayMode(aPropMap.value(DISPLAY_MODE_PROP).toInt());
|
||||
int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
|
||||
// Specially processing of 'Shading with edges' mode from preferences,
|
||||
// because there is the following enum in VTK viewer:
|
||||
// Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
|
||||
// (see VTKViewer::Representation enum) and the following enum in GEOM_Actor:
|
||||
// eWireframe - 0, eShading - 1, eShadingWithEdges - 3
|
||||
if ( aDispModeId == 2 )
|
||||
// this is 'Shading with edges' mode => do the correct mapping to EDisplayMode
|
||||
// enum in GEOM_Actor (and further to VTKViewer::Representation enum)
|
||||
aDispModeId++;
|
||||
aGeomGActor->setDisplayMode(aDispModeId);
|
||||
aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble());
|
||||
|
||||
// Get front material property of the object stored in the study
|
||||
QString aMaterialF = aPropMap.value(FRONT_MATERIAL_PROP).toString();
|
||||
QStringList aPropsF = aMaterialF.split(DIGIT_SEPARATOR);
|
||||
// Create front material model
|
||||
Material_Model* aModelF = Material_Model::getMaterialModel( aPropsF );
|
||||
// Set front material properties for the object
|
||||
QString aMaterialPropF = aModelF->getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anEntry, FRONT_MATERIAL_PROP, aMaterialPropF );
|
||||
// Get material properties from the front model
|
||||
vtkProperty* aMatPropF = aModelF->getMaterialVTKProperty();
|
||||
|
||||
// Get back material property of the object stored in the study
|
||||
QString aMaterialB = aPropMap.value(BACK_MATERIAL_PROP).toString();
|
||||
if ( !aMaterialB.isEmpty() ) {
|
||||
QStringList aPropsB = aMaterialB.split(DIGIT_SEPARATOR);
|
||||
// Create back material model
|
||||
Material_Model* aModelB = Material_Model::getMaterialModel( aPropsB );
|
||||
// Set back material properties for the object
|
||||
QString aMaterialPropB = aModelB->getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anEntry, BACK_MATERIAL_PROP, aMaterialPropB );
|
||||
// Get material properties from the back model
|
||||
vtkProperty* aMatPropB = aModelB->getMaterialVTKProperty();
|
||||
|
||||
// Set front and back materials for the selected shape
|
||||
std::vector<vtkProperty*> aProps;
|
||||
aProps.push_back(aMatPropF);
|
||||
aProps.push_back(aMatPropB);
|
||||
aGeomGActor->SetMaterial(aProps);
|
||||
|
||||
// Release memory
|
||||
delete aModelB;
|
||||
}
|
||||
else {
|
||||
// Set the same front and back materials for the selected shape
|
||||
std::vector<vtkProperty*> aProps;
|
||||
aProps.push_back(aMatPropF);
|
||||
aGeomGActor->SetMaterial(aProps);
|
||||
}
|
||||
|
||||
// Release memory
|
||||
delete aModelF;
|
||||
|
||||
vtkFloatingPointType aColor[3] = {1.,0.,0.};
|
||||
if(aPropMap.contains(COLOR_PROP)) {
|
||||
QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
|
||||
@ -1126,6 +1260,36 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
}
|
||||
aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]);
|
||||
}
|
||||
else {
|
||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||
if ( aResMgr ) {
|
||||
// Create front material model
|
||||
Material_Model aModelF;
|
||||
// Get front material name from resources
|
||||
aModelF.fromResources( aResMgr, "Geometry", true );
|
||||
// Set front material properties for the object
|
||||
QString aMaterialPropF = aModelF.getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anEntry, FRONT_MATERIAL_PROP, aMaterialPropF );
|
||||
// Get material properties from the front model
|
||||
vtkProperty* aMatPropF = aModelF.getMaterialVTKProperty();
|
||||
|
||||
// Create back material model
|
||||
Material_Model aModelB;
|
||||
// Get back material name from resources
|
||||
aModelB.fromResources( aResMgr, "Geometry", false );
|
||||
// Set back material properties for the object
|
||||
QString aMaterialPropB = aModelB.getMaterialProperty();
|
||||
aStudy->setObjectProperty( aMgrId, anEntry, BACK_MATERIAL_PROP, aMaterialPropB );
|
||||
// Get material properties from the back model
|
||||
vtkProperty* aMatPropB = aModelB.getMaterialVTKProperty();
|
||||
|
||||
// Set material for the selected shape
|
||||
std::vector<vtkProperty*> aProps;
|
||||
aProps.push_back(aMatPropF);
|
||||
aProps.push_back(aMatPropB);
|
||||
aGeomGActor->SetMaterial(aProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( myToActivate )
|
||||
@ -1791,6 +1955,19 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
|
||||
|
||||
aDefaultMap.insert( DEFLECTION_COEFF_PROP , aDC);
|
||||
|
||||
//8. Material
|
||||
// Front material
|
||||
Material_Model aModelF;
|
||||
aModelF.fromResources( aResMgr, "Geometry", true );
|
||||
QString aMaterialF = aModelF.getMaterialProperty();
|
||||
aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF );
|
||||
|
||||
// Back material
|
||||
Material_Model aModelB;
|
||||
aModelB.fromResources( aResMgr, "Geometry", false );
|
||||
QString aMaterialB = aModelB.getMaterialProperty();
|
||||
aDefaultMap.insert( BACK_MATERIAL_PROP , aMaterialB );
|
||||
|
||||
return aDefaultMap;
|
||||
}
|
||||
|
||||
@ -1820,6 +1997,14 @@ bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
|
||||
theOrigin.insert(DEFLECTION_COEFF_PROP, theDefault.value(DEFLECTION_COEFF_PROP));
|
||||
nbInserted++;
|
||||
}
|
||||
if(!theOrigin.contains(FRONT_MATERIAL_PROP)) {
|
||||
theOrigin.insert(FRONT_MATERIAL_PROP, theDefault.value(FRONT_MATERIAL_PROP));
|
||||
nbInserted++;
|
||||
}
|
||||
if(!theOrigin.contains(BACK_MATERIAL_PROP)) {
|
||||
theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP));
|
||||
nbInserted++;
|
||||
}
|
||||
return (nbInserted > 0);
|
||||
}
|
||||
|
||||
|
@ -945,6 +945,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_MEN_SHADING</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_MEN_SHADING_WITH_EDGES</source>
|
||||
<translation>Shading With Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_MEN_SKETCHER_X</source>
|
||||
<translation>Enter a Length to Set X</translation>
|
||||
@ -2561,6 +2565,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_POP_SHADING</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Shading With Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_TEXTURE</source>
|
||||
<translation>Texture</translation>
|
||||
@ -2637,6 +2645,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_SHADING</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHADING_WITH_EDGES</source>
|
||||
<translation>Shading With Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHADING_COLOR</source>
|
||||
<translation>Shading Color</translation>
|
||||
@ -2753,6 +2765,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_POP_POINT_MARKER</source>
|
||||
<translation>Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Material Properties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME_LBL</source>
|
||||
<translation>Name: </translation>
|
||||
@ -2857,6 +2873,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>PREF_SHADING_COLOR</source>
|
||||
<translation>Default shading color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_EDGES_IN_SHADING</source>
|
||||
<translation>Edges in shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_STEP_VALUE</source>
|
||||
<translation>Step value for spin boxes</translation>
|
||||
@ -2877,6 +2897,14 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>PREF_WIREFRAME_COLOR</source>
|
||||
<translation>Default wireframe color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_FRONT_MATERIAL</source>
|
||||
<translation>Default front material</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_BACK_MATERIAL</source>
|
||||
<translation>Default back material</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
|
||||
<translation>ProcessShape</translation>
|
||||
@ -3229,6 +3257,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_POP_SHADING</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Shading With Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SETTEXTURE</source>
|
||||
<translation>Add a texture</translation>
|
||||
@ -3369,6 +3401,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_POP_POINT_MARKER</source>
|
||||
<translation>Set Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Set Material Properties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SUPPRESS_RESULT</source>
|
||||
<translation>Suppress Result</translation>
|
||||
@ -3781,6 +3817,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_POP_SHADING</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Shading With Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SETTEXTURE</source>
|
||||
<translation>Texture</translation>
|
||||
@ -3901,6 +3941,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_POP_POINT_MARKER</source>
|
||||
<translation>Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Material Properties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WRN_NOT_IMPLEMENTED</source>
|
||||
<translation>Sorry, this functionality is not yet implemented</translation>
|
||||
@ -5005,6 +5049,61 @@ Would you like to continue?</translation>
|
||||
<translation>Load Texture</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_MaterialPropertiesDlg</name>
|
||||
<message>
|
||||
<source>MATERIAL_PROPERTIES_TLT</source>
|
||||
<translation>Set Material Properties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MATERIAL_BACK_CHK</source>
|
||||
<translation>Enable back material</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AMBIENT_GRP</source>
|
||||
<translation>Ambient</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DIFFUSE_GRP</source>
|
||||
<translation>Diffuse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SPECULAR_GRP</source>
|
||||
<translation>Specular</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>EMISSION_GRP</source>
|
||||
<translation>Emission</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>COLOR</source>
|
||||
<translation>Color:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>COEFFICIENT</source>
|
||||
<translation>Coefficient:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SHININESS</source>
|
||||
<translation>Shininess:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CUSTOM_MATERIAL</source>
|
||||
<translation>Custom material</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK_BTN</source>
|
||||
<translation>&OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL_BTN</source>
|
||||
<translation>&Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HELP_BTN</source>
|
||||
<translation>&Help</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OperationGUI_GetSharedShapesDlg</name>
|
||||
<message>
|
||||
|
@ -945,6 +945,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>GEOM_MEN_SHADING</source>
|
||||
<translation>Ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_MEN_SHADING_WITH_EDGES</source>
|
||||
<translation>Ombrage Avec Arêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_MEN_SKETCHER_X</source>
|
||||
<translation>Indiquez la distance selon l'axe X</translation>
|
||||
@ -2561,6 +2565,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>MEN_POP_SHADING</source>
|
||||
<translation>Ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Ombrage Avec Arêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_TEXTURE</source>
|
||||
<translation>Texture</translation>
|
||||
@ -2637,6 +2645,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>MEN_SHADING</source>
|
||||
<translation>Ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHADING_WITH_EDGES</source>
|
||||
<translation>Ombrage Avec Arêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHADING_COLOR</source>
|
||||
<translation>Couleur d'ombrage</translation>
|
||||
@ -2753,6 +2765,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>MEN_POP_POINT_MARKER</source>
|
||||
<translation>Marqueur de point</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Propriétés des matériaux</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME_LBL</source>
|
||||
<translation>Nom : </translation>
|
||||
@ -2857,6 +2873,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>PREF_SHADING_COLOR</source>
|
||||
<translation>Couleur d'ombrage par défaut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_EDGES_IN_SHADING</source>
|
||||
<translation>Bords de l'ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_STEP_VALUE</source>
|
||||
<translation>Valeur du pas pour les boîtes d'incrément</translation>
|
||||
@ -2877,6 +2897,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>PREF_WIREFRAME_COLOR</source>
|
||||
<translation>Couleur des contours par défaut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_FRONT_MATERIAL</source>
|
||||
<translation>Devant du matériel par défaut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_BACK_MATERIAL</source>
|
||||
<translation>Retour du matériel par défaut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
|
||||
<translation>FormeRetraitée</translation>
|
||||
@ -3229,6 +3257,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>STB_POP_SHADING</source>
|
||||
<translation>Ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Ombrage Avec Arêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SETTEXTURE</source>
|
||||
<translation>Ajoute une texture</translation>
|
||||
@ -3369,6 +3401,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>STB_POP_POINT_MARKER</source>
|
||||
<translation>Définir un marqueur de point</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Définir un propriétés des matériaux</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SUPPRESS_RESULT</source>
|
||||
<translation>Supprimer le résultat</translation>
|
||||
@ -3781,6 +3817,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>TOP_POP_SHADING</source>
|
||||
<translation>Ombrage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHADING_WITH_EDGES</source>
|
||||
<translation>Ombrage Avec Arêtes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SETTEXTURE</source>
|
||||
<translation>Texture</translation>
|
||||
@ -3901,6 +3941,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>TOP_POP_POINT_MARKER</source>
|
||||
<translation>Marqueur de point</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_MATERIAL_PROPERTIES</source>
|
||||
<translation>Propriétés des matériaux</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WRN_NOT_IMPLEMENTED</source>
|
||||
<translation>Désolé, cette fonctionnalité n'est pas encore implémentée</translation>
|
||||
@ -5005,6 +5049,61 @@ Voulez-vous continuer?</translation>
|
||||
<translation>Ouvrir une Texture</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_MaterialPropertiesDlg</name>
|
||||
<message>
|
||||
<source>MATERIAL_PROPERTIES_TLT</source>
|
||||
<translation>Définir un Propriétés des Matériaux</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MATERIAL_BACK_CHK</source>
|
||||
<translation>Activer retour du matériel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AMBIENT_GRP</source>
|
||||
<translation>Ambiante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DIFFUSE_GRP</source>
|
||||
<translation>Diffuse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SPECULAR_GRP</source>
|
||||
<translation>Spéculaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>EMISSION_GRP</source>
|
||||
<translation>Démission</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>COLOR</source>
|
||||
<translation>Couleurs:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>COEFFICIENT</source>
|
||||
<translation>Coefficient:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SHININESS</source>
|
||||
<translation>Shininess:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CUSTOM_MATERIAL</source>
|
||||
<translation>Matériau personnalisé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK_BTN</source>
|
||||
<translation>&OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL_BTN</source>
|
||||
<translation>A&nnuler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HELP_BTN</source>
|
||||
<translation>&Aide</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OperationGUI_GetSharedShapesDlg</name>
|
||||
<message>
|
||||
|
@ -31,11 +31,14 @@
|
||||
#include "GeometryGUI_Operations.h"
|
||||
#include "GEOMGUI_OCCSelector.h"
|
||||
#include "GEOMGUI_Selection.h"
|
||||
#include "GEOM_Constants.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_AISShape.hxx"
|
||||
|
||||
#include "GEOM_Actor.h"
|
||||
|
||||
#include <Material_ResourceMgr.h>
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
@ -389,169 +392,171 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
QString libName;
|
||||
// find corresponding GUI library
|
||||
switch ( id ) {
|
||||
case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS
|
||||
case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS
|
||||
createOriginAndBaseVectors(); // internal operation
|
||||
return;
|
||||
case GEOMOp::OpImport: // MENU FILE - IMPORT
|
||||
case GEOMOp::OpExport: // MENU FILE - EXPORT
|
||||
case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX
|
||||
case GEOMOp::OpSelectEdge: // POPUP MENU - SELECT ONLY - EDGE
|
||||
case GEOMOp::OpSelectWire: // POPUP MENU - SELECT ONLY - WIRE
|
||||
case GEOMOp::OpSelectFace: // POPUP MENU - SELECT ONLY - FACE
|
||||
case GEOMOp::OpSelectShell: // POPUP MENU - SELECT ONLY - SHELL
|
||||
case GEOMOp::OpSelectSolid: // POPUP MENU - SELECT ONLY - SOLID
|
||||
case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND
|
||||
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
|
||||
case GEOMOp::OpDelete: // MENU EDIT - DELETE
|
||||
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
|
||||
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
||||
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
|
||||
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
|
||||
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||
case GEOMOp::OpIsos: // POPUP MENU - ISOS
|
||||
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS
|
||||
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
|
||||
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
|
||||
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
|
||||
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
|
||||
case GEOMOp::OpHideChildren: // POPUP MENU - HIDE CHILDREN
|
||||
case GEOMOp::OpUnpublishObject: // POPUP MENU - UNPUBLISH
|
||||
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
|
||||
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
|
||||
case GEOMOp::OpImport: // MENU FILE - IMPORT
|
||||
case GEOMOp::OpExport: // MENU FILE - EXPORT
|
||||
case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX
|
||||
case GEOMOp::OpSelectEdge: // POPUP MENU - SELECT ONLY - EDGE
|
||||
case GEOMOp::OpSelectWire: // POPUP MENU - SELECT ONLY - WIRE
|
||||
case GEOMOp::OpSelectFace: // POPUP MENU - SELECT ONLY - FACE
|
||||
case GEOMOp::OpSelectShell: // POPUP MENU - SELECT ONLY - SHELL
|
||||
case GEOMOp::OpSelectSolid: // POPUP MENU - SELECT ONLY - SOLID
|
||||
case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND
|
||||
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
|
||||
case GEOMOp::OpDelete: // MENU EDIT - DELETE
|
||||
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
|
||||
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
||||
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
|
||||
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
|
||||
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||
case GEOMOp::OpIsos: // POPUP MENU - ISOS
|
||||
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS
|
||||
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
|
||||
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
|
||||
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
|
||||
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
|
||||
case GEOMOp::OpHideChildren: // POPUP MENU - HIDE CHILDREN
|
||||
case GEOMOp::OpUnpublishObject: // POPUP MENU - UNPUBLISH
|
||||
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
|
||||
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
|
||||
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
|
||||
libName = "GEOMToolsGUI";
|
||||
break;
|
||||
case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING
|
||||
case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
|
||||
case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY
|
||||
case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL
|
||||
case GEOMOp::OpHide: // MENU VIEW - ERASE
|
||||
case GEOMOp::OpShow: // MENU VIEW - DISPLAY
|
||||
case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE
|
||||
case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME
|
||||
case GEOMOp::OpShading: // POPUP MENU - SHADING
|
||||
case GEOMOp::OpTexture: // POPUP MENU - TEXTURE
|
||||
case GEOMOp::OpVectors: // POPUP MENU - VECTORS
|
||||
case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING
|
||||
case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
|
||||
case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY
|
||||
case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL
|
||||
case GEOMOp::OpHide: // MENU VIEW - ERASE
|
||||
case GEOMOp::OpShow: // MENU VIEW - DISPLAY
|
||||
case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE
|
||||
case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME
|
||||
case GEOMOp::OpShading: // POPUP MENU - SHADING
|
||||
case GEOMOp::OpShadingWithEdges: // POPUP MENU - SHADING WITH EDGES
|
||||
case GEOMOp::OpTexture: // POPUP MENU - TEXTURE
|
||||
case GEOMOp::OpVectors: // POPUP MENU - VECTORS
|
||||
libName = "DisplayGUI";
|
||||
break;
|
||||
case GEOMOp::OpPoint: // MENU BASIC - POINT
|
||||
case GEOMOp::OpLine: // MENU BASIC - LINE
|
||||
case GEOMOp::OpCircle: // MENU BASIC - CIRCLE
|
||||
case GEOMOp::OpEllipse: // MENU BASIC - ELLIPSE
|
||||
case GEOMOp::OpArc: // MENU BASIC - ARC
|
||||
case GEOMOp::OpVector: // MENU BASIC - VECTOR
|
||||
case GEOMOp::OpPlane: // MENU BASIC - PLANE
|
||||
case GEOMOp::OpCurve: // MENU BASIC - CURVE
|
||||
case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM
|
||||
case GEOMOp::OpPoint: // MENU BASIC - POINT
|
||||
case GEOMOp::OpLine: // MENU BASIC - LINE
|
||||
case GEOMOp::OpCircle: // MENU BASIC - CIRCLE
|
||||
case GEOMOp::OpEllipse: // MENU BASIC - ELLIPSE
|
||||
case GEOMOp::OpArc: // MENU BASIC - ARC
|
||||
case GEOMOp::OpVector: // MENU BASIC - VECTOR
|
||||
case GEOMOp::OpPlane: // MENU BASIC - PLANE
|
||||
case GEOMOp::OpCurve: // MENU BASIC - CURVE
|
||||
case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM
|
||||
libName = "BasicGUI";
|
||||
break;
|
||||
case GEOMOp::OpBox: // MENU PRIMITIVE - BOX
|
||||
case GEOMOp::OpCylinder: // MENU PRIMITIVE - CYLINDER
|
||||
case GEOMOp::OpSphere: // MENU PRIMITIVE - SPHERE
|
||||
case GEOMOp::OpTorus: // MENU PRIMITIVE - TORUS
|
||||
case GEOMOp::OpCone: // MENU PRIMITIVE - CONE
|
||||
case GEOMOp::OpRectangle: // MENU PRIMITIVE - FACE
|
||||
case GEOMOp::OpDisk: // MENU PRIMITIVE - DISK
|
||||
case GEOMOp::OpBox: // MENU PRIMITIVE - BOX
|
||||
case GEOMOp::OpCylinder: // MENU PRIMITIVE - CYLINDER
|
||||
case GEOMOp::OpSphere: // MENU PRIMITIVE - SPHERE
|
||||
case GEOMOp::OpTorus: // MENU PRIMITIVE - TORUS
|
||||
case GEOMOp::OpCone: // MENU PRIMITIVE - CONE
|
||||
case GEOMOp::OpRectangle: // MENU PRIMITIVE - FACE
|
||||
case GEOMOp::OpDisk: // MENU PRIMITIVE - DISK
|
||||
libName = "PrimitiveGUI";
|
||||
break;
|
||||
case GEOMOp::OpPrism: // MENU GENERATION - PRISM
|
||||
case GEOMOp::OpRevolution: // MENU GENERATION - REVOLUTION
|
||||
case GEOMOp::OpFilling: // MENU GENERATION - FILLING
|
||||
case GEOMOp::OpPipe: // MENU GENERATION - PIPE
|
||||
case GEOMOp::OpPrism: // MENU GENERATION - PRISM
|
||||
case GEOMOp::OpRevolution: // MENU GENERATION - REVOLUTION
|
||||
case GEOMOp::OpFilling: // MENU GENERATION - FILLING
|
||||
case GEOMOp::OpPipe: // MENU GENERATION - PIPE
|
||||
libName = "GenerationGUI";
|
||||
break;
|
||||
case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER
|
||||
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
|
||||
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
|
||||
case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER
|
||||
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
|
||||
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
|
||||
#ifdef WITH_OPENCV
|
||||
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
|
||||
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
|
||||
#endif
|
||||
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
|
||||
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
|
||||
libName = "EntityGUI";
|
||||
break;
|
||||
case GEOMOp::OpEdge: // MENU BUILD - EDGE
|
||||
case GEOMOp::OpWire: // MENU BUILD - WIRE
|
||||
case GEOMOp::OpFace: // MENU BUILD - FACE
|
||||
case GEOMOp::OpShell: // MENU BUILD - SHELL
|
||||
case GEOMOp::OpSolid: // MENU BUILD - SOLID
|
||||
case GEOMOp::OpCompound: // MENU BUILD - COMPUND
|
||||
case GEOMOp::OpEdge: // MENU BUILD - EDGE
|
||||
case GEOMOp::OpWire: // MENU BUILD - WIRE
|
||||
case GEOMOp::OpFace: // MENU BUILD - FACE
|
||||
case GEOMOp::OpShell: // MENU BUILD - SHELL
|
||||
case GEOMOp::OpSolid: // MENU BUILD - SOLID
|
||||
case GEOMOp::OpCompound: // MENU BUILD - COMPUND
|
||||
libName = "BuildGUI";
|
||||
break;
|
||||
case GEOMOp::OpFuse: // MENU BOOLEAN - FUSE
|
||||
case GEOMOp::OpCommon: // MENU BOOLEAN - COMMON
|
||||
case GEOMOp::OpCut: // MENU BOOLEAN - CUT
|
||||
case GEOMOp::OpSection: // MENU BOOLEAN - SECTION
|
||||
case GEOMOp::OpFuse: // MENU BOOLEAN - FUSE
|
||||
case GEOMOp::OpCommon: // MENU BOOLEAN - COMMON
|
||||
case GEOMOp::OpCut: // MENU BOOLEAN - CUT
|
||||
case GEOMOp::OpSection: // MENU BOOLEAN - SECTION
|
||||
libName = "BooleanGUI";
|
||||
break;
|
||||
case GEOMOp::OpTranslate: // MENU TRANSFORMATION - TRANSLATION
|
||||
case GEOMOp::OpRotate: // MENU TRANSFORMATION - ROTATION
|
||||
case GEOMOp::OpChangeLoc: // MENU TRANSFORMATION - LOCATION
|
||||
case GEOMOp::OpMirror: // MENU TRANSFORMATION - MIRROR
|
||||
case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE
|
||||
case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET
|
||||
case GEOMOp::OpProjection: // MENU TRANSFORMATION - PROJECTION
|
||||
case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
|
||||
case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
|
||||
case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
|
||||
case GEOMOp::OpTranslate: // MENU TRANSFORMATION - TRANSLATION
|
||||
case GEOMOp::OpRotate: // MENU TRANSFORMATION - ROTATION
|
||||
case GEOMOp::OpChangeLoc: // MENU TRANSFORMATION - LOCATION
|
||||
case GEOMOp::OpMirror: // MENU TRANSFORMATION - MIRROR
|
||||
case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE
|
||||
case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET
|
||||
case GEOMOp::OpProjection: // MENU TRANSFORMATION - PROJECTION
|
||||
case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
|
||||
case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
|
||||
case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
|
||||
libName = "TransformationGUI";
|
||||
break;
|
||||
case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
|
||||
case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE
|
||||
case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET
|
||||
case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER
|
||||
case GEOMOp::OpClipping: // MENU OPERATION - CLIPPING RANGE
|
||||
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
|
||||
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
|
||||
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
|
||||
case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
|
||||
case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE
|
||||
case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET
|
||||
case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER
|
||||
case GEOMOp::OpClipping: // MENU OPERATION - CLIPPING RANGE
|
||||
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
|
||||
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
|
||||
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
|
||||
libName = "OperationGUI";
|
||||
break;
|
||||
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
|
||||
case GEOMOp::OpSuppressFaces: // MENU REPAIR - SUPPRESS FACES
|
||||
case GEOMOp::OpSuppressHoles: // MENU REPAIR - SUPPRESS HOLE
|
||||
case GEOMOp::OpShapeProcess: // MENU REPAIR - SHAPE PROCESSING
|
||||
case GEOMOp::OpCloseContour: // MENU REPAIR - CLOSE CONTOUR
|
||||
case GEOMOp::OpRemoveIntWires: // MENU REPAIR - REMOVE INTERNAL WIRES
|
||||
case GEOMOp::OpAddPointOnEdge: // MENU REPAIR - ADD POINT ON EDGE
|
||||
case GEOMOp::OpFreeBoundaries: // MENU MEASURE - FREE BOUNDARIES
|
||||
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
|
||||
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
|
||||
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
|
||||
case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
|
||||
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
|
||||
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
|
||||
case GEOMOp::OpSuppressFaces: // MENU REPAIR - SUPPRESS FACES
|
||||
case GEOMOp::OpSuppressHoles: // MENU REPAIR - SUPPRESS HOLE
|
||||
case GEOMOp::OpShapeProcess: // MENU REPAIR - SHAPE PROCESSING
|
||||
case GEOMOp::OpCloseContour: // MENU REPAIR - CLOSE CONTOUR
|
||||
case GEOMOp::OpRemoveIntWires: // MENU REPAIR - REMOVE INTERNAL WIRES
|
||||
case GEOMOp::OpAddPointOnEdge: // MENU REPAIR - ADD POINT ON EDGE
|
||||
case GEOMOp::OpFreeBoundaries: // MENU MEASURE - FREE BOUNDARIES
|
||||
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
|
||||
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
|
||||
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
|
||||
case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
|
||||
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
|
||||
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
libName = "RepairGUI";
|
||||
break;
|
||||
case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES
|
||||
case GEOMOp::OpCenterMass: // MENU MEASURE - CDG
|
||||
case GEOMOp::OpInertia: // MENU MEASURE - INERTIA
|
||||
case GEOMOp::OpNormale: // MENU MEASURE - NORMALE
|
||||
case GEOMOp::OpBoundingBox: // MENU MEASURE - BOUNDING BOX
|
||||
case GEOMOp::OpMinDistance: // MENU MEASURE - MIN DISTANCE
|
||||
case GEOMOp::OpAngle: // MENU MEASURE - ANGLE
|
||||
case GEOMOp::OpTolerance: // MENU MEASURE - TOLERANCE
|
||||
case GEOMOp::OpWhatIs: // MENU MEASURE - WHATIS
|
||||
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
|
||||
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
|
||||
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
|
||||
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
|
||||
case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES
|
||||
case GEOMOp::OpCenterMass: // MENU MEASURE - CDG
|
||||
case GEOMOp::OpInertia: // MENU MEASURE - INERTIA
|
||||
case GEOMOp::OpNormale: // MENU MEASURE - NORMALE
|
||||
case GEOMOp::OpBoundingBox: // MENU MEASURE - BOUNDING BOX
|
||||
case GEOMOp::OpMinDistance: // MENU MEASURE - MIN DISTANCE
|
||||
case GEOMOp::OpAngle: // MENU MEASURE - ANGLE
|
||||
case GEOMOp::OpTolerance: // MENU MEASURE - TOLERANCE
|
||||
case GEOMOp::OpWhatIs: // MENU MEASURE - WHATIS
|
||||
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
|
||||
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
|
||||
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
|
||||
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
|
||||
libName = "MeasureGUI";
|
||||
break;
|
||||
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
|
||||
case GEOMOp::OpGroupCreatePopup: // POPUP MENU - CREATE GROUP
|
||||
case GEOMOp::OpGroupEdit: // MENU GROUP - EDIT
|
||||
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
|
||||
case GEOMOp::OpGroupCreatePopup: // POPUP MENU - CREATE GROUP
|
||||
case GEOMOp::OpGroupEdit: // MENU GROUP - EDIT
|
||||
libName = "GroupGUI";
|
||||
break;
|
||||
case GEOMOp::OpHexaSolid: // MENU BLOCKS - HEXAHEDRAL SOLID
|
||||
case GEOMOp::OpMultiTransform: // MENU BLOCKS - MULTI-TRANSFORMATION
|
||||
case GEOMOp::OpQuadFace: // MENU BLOCKS - QUADRANGLE FACE
|
||||
case GEOMOp::OpPropagate: // MENU BLOCKS - PROPAGATE
|
||||
case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS
|
||||
case GEOMOp::OpHexaSolid: // MENU BLOCKS - HEXAHEDRAL SOLID
|
||||
case GEOMOp::OpMultiTransform: // MENU BLOCKS - MULTI-TRANSFORMATION
|
||||
case GEOMOp::OpQuadFace: // MENU BLOCKS - QUADRANGLE FACE
|
||||
case GEOMOp::OpPropagate: // MENU BLOCKS - PROPAGATE
|
||||
case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS
|
||||
libName = "BlocksGUI";
|
||||
break;
|
||||
case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
|
||||
case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
|
||||
case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
|
||||
case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
|
||||
// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
libName = "AdvancedGUI";
|
||||
@ -571,8 +576,24 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
}
|
||||
|
||||
// call method of corresponding GUI library
|
||||
if ( library )
|
||||
if ( library ) {
|
||||
library->OnGUIEvent( id, desk );
|
||||
|
||||
// Update a list of materials for "Preferences" dialog
|
||||
if ( id == GEOMOp::OpMaterialProperties ) {
|
||||
LightApp_Preferences* pref = preferences();
|
||||
if ( pref ) {
|
||||
Material_ResourceMgr aMatResMgr;
|
||||
QStringList aPerfMatNames = aMatResMgr.getPreferenceMaterialsNames();
|
||||
setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_FRONT_MATERIAL" ), true )->id(),
|
||||
"strings",
|
||||
aPerfMatNames );
|
||||
setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_BACK_MATERIAL" ), true )->id(),
|
||||
"strings",
|
||||
aPerfMatNames );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
|
||||
}
|
||||
@ -821,6 +842,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
|
||||
createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true );
|
||||
createGeomAction( GEOMOp::OpShading, "POP_SHADING", "", 0, true );
|
||||
createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true );
|
||||
createGeomAction( GEOMOp::OpTexture, "POP_TEXTURE", "", 0, true );
|
||||
createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true );
|
||||
createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" );
|
||||
@ -836,6 +858,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
|
||||
createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" );
|
||||
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
||||
createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" );
|
||||
|
||||
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
||||
|
||||
@ -1185,6 +1208,9 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading
|
||||
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
|
||||
mgr->insert( action( GEOMOp::OpShadingWithEdges ), dispmodeId, -1 ); // shading with edges
|
||||
mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK + " and displaymode='ShadingWithEdges'", QtxPopupMgr::ToggleRule );
|
||||
mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe
|
||||
mgr->setRule( action( GEOMOp::OpTexture ), clientOCC_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpTexture), clientOCC + " and displaymode='Texture'", QtxPopupMgr::ToggleRule );
|
||||
@ -1204,6 +1230,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
|
||||
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); // material properties
|
||||
mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture
|
||||
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
@ -1624,6 +1652,9 @@ void GeometryGUI::createPreferences()
|
||||
addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
|
||||
LightApp_Preferences::Color, "Geometry", "shading_color" );
|
||||
|
||||
addPreference( tr( "PREF_EDGES_IN_SHADING" ), genGroup,
|
||||
LightApp_Preferences::Color, "Geometry", "edges_in_shading_color" );
|
||||
|
||||
addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup,
|
||||
LightApp_Preferences::Color, "Geometry", "wireframe_color" );
|
||||
|
||||
@ -1645,6 +1676,14 @@ void GeometryGUI::createPreferences()
|
||||
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
|
||||
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
||||
|
||||
int front_material = addPreference( tr( "PREF_FRONT_MATERIAL" ), genGroup,
|
||||
LightApp_Preferences::Selector,
|
||||
"Geometry", "front_material" );
|
||||
|
||||
int back_material = addPreference( tr( "PREF_BACK_MATERIAL" ), genGroup,
|
||||
LightApp_Preferences::Selector,
|
||||
"Geometry", "back_material" );
|
||||
|
||||
// Quantities with individual precision settings
|
||||
int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
|
||||
setPreferenceProperty( precGroup, "columns", 2 );
|
||||
@ -1688,10 +1727,12 @@ void GeometryGUI::createPreferences()
|
||||
QStringList aModesList;
|
||||
aModesList.append( tr("MEN_WIREFRAME") );
|
||||
aModesList.append( tr("MEN_SHADING") );
|
||||
aModesList.append( tr("MEN_SHADING_WITH_EDGES") );
|
||||
|
||||
QList<QVariant> anIndexesList;
|
||||
anIndexesList.append(0);
|
||||
anIndexesList.append(1);
|
||||
anIndexesList.append(2);
|
||||
|
||||
setPreferenceProperty( dispmode, "strings", aModesList );
|
||||
setPreferenceProperty( dispmode, "indexes", anIndexesList );
|
||||
@ -1707,6 +1748,12 @@ void GeometryGUI::createPreferences()
|
||||
setPreferenceProperty( defl, "step", 1.0e-04 );
|
||||
setPreferenceProperty( defl, "precision", 6 );
|
||||
|
||||
// Set property for default material
|
||||
Material_ResourceMgr aMatResMgr;
|
||||
QStringList aPrefMatNames = aMatResMgr.getPreferenceMaterialsNames();
|
||||
setPreferenceProperty( front_material, "strings", aPrefMatNames );
|
||||
setPreferenceProperty( back_material, "strings", aPrefMatNames );
|
||||
|
||||
// Set property vertex marker type
|
||||
QList<QVariant> aMarkerTypeIndicesList;
|
||||
QList<QVariant> aMarkerTypeIconsList;
|
||||
@ -1787,7 +1834,7 @@ const char gDigitsSep = ':'; // character used to separate numeric parameter val
|
||||
* \brief Store visual parameters
|
||||
*
|
||||
* This method is called just before the study document is saved.
|
||||
* Store visual parameters in AttributeParameter attribue(s)
|
||||
* Store visual parameters in AttributeParameter attribute(s)
|
||||
*/
|
||||
void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
{
|
||||
@ -1894,6 +1941,16 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
param = occParam + MARKER_TYPE_PROP;
|
||||
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
|
||||
}
|
||||
|
||||
if(aProps.contains(FRONT_MATERIAL_PROP)) {
|
||||
param = occParam + FRONT_MATERIAL_PROP;
|
||||
ip->setParameter(entry, param, aProps.value(FRONT_MATERIAL_PROP).toString().toLatin1().data());
|
||||
}
|
||||
|
||||
if(aProps.contains(BACK_MATERIAL_PROP)) {
|
||||
param = occParam + BACK_MATERIAL_PROP;
|
||||
ip->setParameter(entry, param, aProps.value(BACK_MATERIAL_PROP).toString().toLatin1().data());
|
||||
}
|
||||
} // object iterator
|
||||
} // for (views)
|
||||
} // for (viewManagers)
|
||||
@ -1903,7 +1960,7 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
* \brief Restore visual parameters
|
||||
*
|
||||
* This method is called after the study document is opened.
|
||||
* Restore visual parameters from AttributeParameter attribue(s)
|
||||
* Restore visual parameters from AttributeParameter attribute(s)
|
||||
*/
|
||||
void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
{
|
||||
@ -2001,6 +2058,10 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
|
||||
} else if(paramNameStr == MARKER_TYPE_PROP) {
|
||||
aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
|
||||
} else if(paramNameStr == FRONT_MATERIAL_PROP) {
|
||||
aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val);
|
||||
} else if(paramNameStr == BACK_MATERIAL_PROP) {
|
||||
aListOfMap[viewIndex].insert( BACK_MATERIAL_PROP, val);
|
||||
}
|
||||
|
||||
} // for names/parameters iterator
|
||||
|
@ -54,24 +54,6 @@
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
||||
|
||||
// minimum allowed value for deflection coefficient
|
||||
#define DEFLECTION_MIN 1e-06
|
||||
|
||||
//Define separators
|
||||
#define NAME_SEPARATOR '_' // character used to separate parameter names
|
||||
#define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b)
|
||||
|
||||
#define VISIBILITY_PROP "Visibility" //Object visibility property
|
||||
#define OPACITY_PROP "Opacity" //Object opacity property
|
||||
#define TRANSPARENCY_PROP "Transparency" //Object transparency property
|
||||
#define DISPLAY_MODE_PROP "DisplayMode" //Object display mode property
|
||||
#define ISOS_PROP "Isos" //Number of the Isos property of the object
|
||||
#define COLOR_PROP "Color" //Color of the object
|
||||
#define VECTOR_MODE_PROP "VectorMode" //Vector mode property
|
||||
#define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property
|
||||
#define MARKER_TYPE_PROP "MarkerType" // Marker type property
|
||||
|
||||
|
||||
class QDialog;
|
||||
class QMenu;
|
||||
class GEOMGUI_OCCSelector;
|
||||
|
@ -25,155 +25,157 @@
|
||||
namespace GEOMOp {
|
||||
enum {
|
||||
// ToolsGUI ------------------//--------------------------------
|
||||
OpImport = 1000, // MENU FILE - IMPORT
|
||||
OpExport = 1001, // MENU FILE - EXPORT
|
||||
OpDelete = 1020, // MENU EDIT - DELETE
|
||||
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
|
||||
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
|
||||
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
|
||||
OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE
|
||||
OpSelectFace = 1103, // POPUP MENU - SELECT ONLY - FACE
|
||||
OpSelectShell = 1104, // POPUP MENU - SELECT ONLY - SHELL
|
||||
OpSelectSolid = 1105, // POPUP MENU - SELECT ONLY - SOLID
|
||||
OpSelectCompound = 1106, // POPUP MENU - SELECT ONLY - COMPOUND
|
||||
OpSelectAll = 1107, // POPUP MENU - SELECT ONLY - SELECT ALL
|
||||
OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
OpColor = 1201, // POPUP MENU - COLOR
|
||||
OpTransparency = 1202, // POPUP MENU - TRANSPARENCY
|
||||
OpIncrTransparency = 1203, // SHORTCUT - INCREASE TRANSPARENCY
|
||||
OpDecrTransparency = 1204, // SHORTCUT - DECREASE TRANSPARENCY
|
||||
OpIsos = 1205, // POPUP MENU - ISOS
|
||||
OpIncrNbIsos = 1206, // SHORTCUT - INCREASE NB ISOS
|
||||
OpDecrNbIsos = 1207, // SHORTCUT - DECREASE NB ISOS
|
||||
OpAutoColor = 1208, // POPUP MENU - AUTO COLOR
|
||||
OpNoAutoColor = 1209, // POPUP MENU - DISABLE AUTO COLOR
|
||||
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
||||
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
|
||||
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
|
||||
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
|
||||
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
|
||||
OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH
|
||||
OpImport = 1000, // MENU FILE - IMPORT
|
||||
OpExport = 1001, // MENU FILE - EXPORT
|
||||
OpDelete = 1020, // MENU EDIT - DELETE
|
||||
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
|
||||
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
|
||||
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
|
||||
OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE
|
||||
OpSelectFace = 1103, // POPUP MENU - SELECT ONLY - FACE
|
||||
OpSelectShell = 1104, // POPUP MENU - SELECT ONLY - SHELL
|
||||
OpSelectSolid = 1105, // POPUP MENU - SELECT ONLY - SOLID
|
||||
OpSelectCompound = 1106, // POPUP MENU - SELECT ONLY - COMPOUND
|
||||
OpSelectAll = 1107, // POPUP MENU - SELECT ONLY - SELECT ALL
|
||||
OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
OpColor = 1201, // POPUP MENU - COLOR
|
||||
OpTransparency = 1202, // POPUP MENU - TRANSPARENCY
|
||||
OpIncrTransparency = 1203, // SHORTCUT - INCREASE TRANSPARENCY
|
||||
OpDecrTransparency = 1204, // SHORTCUT - DECREASE TRANSPARENCY
|
||||
OpIsos = 1205, // POPUP MENU - ISOS
|
||||
OpIncrNbIsos = 1206, // SHORTCUT - INCREASE NB ISOS
|
||||
OpDecrNbIsos = 1207, // SHORTCUT - DECREASE NB ISOS
|
||||
OpAutoColor = 1208, // POPUP MENU - AUTO COLOR
|
||||
OpNoAutoColor = 1209, // POPUP MENU - DISABLE AUTO COLOR
|
||||
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
||||
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
|
||||
OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES
|
||||
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
|
||||
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
|
||||
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
|
||||
OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH
|
||||
|
||||
// DisplayGUI ----------------//--------------------------------
|
||||
OpDisplayMode = 2000, // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING
|
||||
OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
|
||||
OpShowAll = 2002, // MENU VIEW - SHOW ALL
|
||||
OpHideAll = 2003, // MENU VIEW - HIDE ALL
|
||||
OpShow = 2100, // POPUP MENU - SHOW
|
||||
OpShowOnly = 2101, // POPUP MENU - SHOW ONLY
|
||||
OpHide = 2102, // POPUP MENU - HIDE
|
||||
OpWireframe = 2200, // POPUP MENU - DISPLAY MODE - WIREFRAME
|
||||
OpShading = 2201, // POPUP MENU - DISPLAY MODE - SHADING
|
||||
OpVectors = 2202, // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
|
||||
OpTexture = 2203, // POPUP MENU - DISPLAY MODE - TEXTURE
|
||||
OpDisplayMode = 2000, // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
|
||||
OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
|
||||
OpShowAll = 2002, // MENU VIEW - SHOW ALL
|
||||
OpHideAll = 2003, // MENU VIEW - HIDE ALL
|
||||
OpShow = 2100, // POPUP MENU - SHOW
|
||||
OpShowOnly = 2101, // POPUP MENU - SHOW ONLY
|
||||
OpHide = 2102, // POPUP MENU - HIDE
|
||||
OpWireframe = 2200, // POPUP MENU - DISPLAY MODE - WIREFRAME
|
||||
OpShading = 2201, // POPUP MENU - DISPLAY MODE - SHADING
|
||||
OpShadingWithEdges = 2202, // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
|
||||
OpVectors = 2203, // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
|
||||
OpTexture = 2204, // POPUP MENU - DISPLAY MODE - TEXTURE
|
||||
// BasicGUI ------------------//--------------------------------
|
||||
OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT
|
||||
OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE
|
||||
OpCircle = 3002, // MENU NEW ENTITY - BASIC - CIRCLE
|
||||
OpEllipse = 3003, // MENU NEW ENTITY - BASIC - ELLIPSE
|
||||
OpArc = 3004, // MENU NEW ENTITY - BASIC - ARC
|
||||
OpVector = 3005, // MENU NEW ENTITY - BASIC - VECTOR
|
||||
OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE
|
||||
OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE
|
||||
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
|
||||
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
|
||||
OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT
|
||||
OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE
|
||||
OpCircle = 3002, // MENU NEW ENTITY - BASIC - CIRCLE
|
||||
OpEllipse = 3003, // MENU NEW ENTITY - BASIC - ELLIPSE
|
||||
OpArc = 3004, // MENU NEW ENTITY - BASIC - ARC
|
||||
OpVector = 3005, // MENU NEW ENTITY - BASIC - VECTOR
|
||||
OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE
|
||||
OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE
|
||||
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
|
||||
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
|
||||
// PrimitiveGUI --------------//--------------------------------
|
||||
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
|
||||
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER
|
||||
OpSphere = 3102, // MENU NEW ENTITY - PRIMITIVES - SPHERE
|
||||
OpTorus = 3103, // MENU NEW ENTITY - PRIMITIVES - TORUS
|
||||
OpCone = 3104, // MENU NEW ENTITY - PRIMITIVES - CONE
|
||||
OpRectangle = 3105, // MENU NEW ENTITY - PRIMITIVES - FACE
|
||||
OpDisk = 3106, // MENU NEW ENTITY - PRIMITIVES - DISK
|
||||
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
|
||||
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER
|
||||
OpSphere = 3102, // MENU NEW ENTITY - PRIMITIVES - SPHERE
|
||||
OpTorus = 3103, // MENU NEW ENTITY - PRIMITIVES - TORUS
|
||||
OpCone = 3104, // MENU NEW ENTITY - PRIMITIVES - CONE
|
||||
OpRectangle = 3105, // MENU NEW ENTITY - PRIMITIVES - FACE
|
||||
OpDisk = 3106, // MENU NEW ENTITY - PRIMITIVES - DISK
|
||||
// GenerationGUI -------------//--------------------------------
|
||||
OpPrism = 3200, // MENU NEW ENTITY - GENERATION - EXTRUSION
|
||||
OpRevolution = 3201, // MENU NEW ENTITY - GENERATION - REVOLUTION
|
||||
OpFilling = 3202, // MENU NEW ENTITY - GENERATION - FILLING
|
||||
OpPipe = 3203, // MENU NEW ENTITY - GENERATION - EXTRUSION ALONG PATH
|
||||
OpPrism = 3200, // MENU NEW ENTITY - GENERATION - EXTRUSION
|
||||
OpRevolution = 3201, // MENU NEW ENTITY - GENERATION - REVOLUTION
|
||||
OpFilling = 3202, // MENU NEW ENTITY - GENERATION - FILLING
|
||||
OpPipe = 3203, // MENU NEW ENTITY - GENERATION - EXTRUSION ALONG PATH
|
||||
// EntityGUI -----------------//--------------------------------
|
||||
Op2dSketcher = 3300, // MENU NEW ENTITY - SKETCHER
|
||||
Op3dSketcher = 3301, // MENU NEW ENTITY - 3D SKETCHER
|
||||
OpExplode = 3302, // MENU NEW ENTITY - EXPLODE
|
||||
Op2dSketcher = 3300, // MENU NEW ENTITY - SKETCHER
|
||||
Op3dSketcher = 3301, // MENU NEW ENTITY - 3D SKETCHER
|
||||
OpExplode = 3302, // MENU NEW ENTITY - EXPLODE
|
||||
#ifdef WITH_OPENCV
|
||||
OpFeatureDetect = 3303, // MENU NEW ENTITY - FEATURE DETECTION
|
||||
OpFeatureDetect = 3303, // MENU NEW ENTITY - FEATURE DETECTION
|
||||
#endif
|
||||
OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
|
||||
OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
|
||||
|
||||
// BuildGUI ------------------//--------------------------------
|
||||
OpEdge = 3400, // MENU NEW ENTITY - BUILD - EDGE
|
||||
OpWire = 3401, // MENU NEW ENTITY - BUILD - WIRE
|
||||
OpFace = 3402, // MENU NEW ENTITY - BUILD - FACE
|
||||
OpShell = 3403, // MENU NEW ENTITY - BUILD - SHELL
|
||||
OpSolid = 3404, // MENU NEW ENTITY - BUILD - SOLID
|
||||
OpCompound = 3405, // MENU NEW ENTITY - BUILD - COMPOUND
|
||||
OpEdge = 3400, // MENU NEW ENTITY - BUILD - EDGE
|
||||
OpWire = 3401, // MENU NEW ENTITY - BUILD - WIRE
|
||||
OpFace = 3402, // MENU NEW ENTITY - BUILD - FACE
|
||||
OpShell = 3403, // MENU NEW ENTITY - BUILD - SHELL
|
||||
OpSolid = 3404, // MENU NEW ENTITY - BUILD - SOLID
|
||||
OpCompound = 3405, // MENU NEW ENTITY - BUILD - COMPOUND
|
||||
// BooleanGUI ----------------//--------------------------------
|
||||
OpFuse = 3500, // MENU OPERATIONS - BOOLEAN - FUSE
|
||||
OpCommon = 3501, // MENU OPERATIONS - BOOLEAN - COMMON
|
||||
OpCut = 3502, // MENU OPERATIONS - BOOLEAN - CUT
|
||||
OpSection = 3503, // MENU OPERATIONS - BOOLEAN - SECTION
|
||||
OpFuse = 3500, // MENU OPERATIONS - BOOLEAN - FUSE
|
||||
OpCommon = 3501, // MENU OPERATIONS - BOOLEAN - COMMON
|
||||
OpCut = 3502, // MENU OPERATIONS - BOOLEAN - CUT
|
||||
OpSection = 3503, // MENU OPERATIONS - BOOLEAN - SECTION
|
||||
// TransformationGUI ---------//--------------------------------
|
||||
OpTranslate = 3600, // MENU OPERATIONS - TRANSFORMATION - TRANSLATION
|
||||
OpRotate = 3601, // MENU OPERATIONS - TRANSFORMATION - ROTATION
|
||||
OpChangeLoc = 3602, // MENU OPERATIONS - TRANSFORMATION - LOCATION
|
||||
OpMirror = 3603, // MENU OPERATIONS - TRANSFORMATION - MIRROR
|
||||
OpScale = 3604, // MENU OPERATIONS - TRANSFORMATION - SCALE
|
||||
OpOffset = 3605, // MENU OPERATIONS - TRANSFORMATION - OFFSET
|
||||
OpMultiTranslate = 3606, // MENU OPERATIONS - TRANSFORMATION - MULTI-TRANSLATION
|
||||
OpMultiRotate = 3607, // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION
|
||||
OpReimport = 3608, // POPUP MENU - RELOAD IMPORTED
|
||||
OpProjection = 3609, // MENU OPERATIONS - TRANSFORMATION - PROJECTION
|
||||
OpTranslate = 3600, // MENU OPERATIONS - TRANSFORMATION - TRANSLATION
|
||||
OpRotate = 3601, // MENU OPERATIONS - TRANSFORMATION - ROTATION
|
||||
OpChangeLoc = 3602, // MENU OPERATIONS - TRANSFORMATION - LOCATION
|
||||
OpMirror = 3603, // MENU OPERATIONS - TRANSFORMATION - MIRROR
|
||||
OpScale = 3604, // MENU OPERATIONS - TRANSFORMATION - SCALE
|
||||
OpOffset = 3605, // MENU OPERATIONS - TRANSFORMATION - OFFSET
|
||||
OpMultiTranslate = 3606, // MENU OPERATIONS - TRANSFORMATION - MULTI-TRANSLATION
|
||||
OpMultiRotate = 3607, // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION
|
||||
OpReimport = 3608, // POPUP MENU - RELOAD IMPORTED
|
||||
OpProjection = 3609, // MENU OPERATIONS - TRANSFORMATION - PROJECTION
|
||||
// OperationGUI
|
||||
OpPartition = 3700, // MENU OPERATION - PARTITION
|
||||
OpArchimede = 3701, // MENU OPERATION - ARCHIMEDE
|
||||
OpFillet3d = 3702, // MENU OPERATION - FILLET
|
||||
OpChamfer = 3703, // MENU OPERATION - CHAMFER
|
||||
OpShapesOnShape = 3704, // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
OpFillet2d = 3705, // MENU OPERATION - FILLET 2D
|
||||
OpFillet1d = 3706, // MENU OPERATION - FILLET 1D
|
||||
OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE
|
||||
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
|
||||
OpPartition = 3700, // MENU OPERATION - PARTITION
|
||||
OpArchimede = 3701, // MENU OPERATION - ARCHIMEDE
|
||||
OpFillet3d = 3702, // MENU OPERATION - FILLET
|
||||
OpChamfer = 3703, // MENU OPERATION - CHAMFER
|
||||
OpShapesOnShape = 3704, // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
OpFillet2d = 3705, // MENU OPERATION - FILLET 2D
|
||||
OpFillet1d = 3706, // MENU OPERATION - FILLET 1D
|
||||
OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE
|
||||
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
|
||||
// RepairGUI -----------------//--------------------------------
|
||||
OpSewing = 4000, // MENU REPAIR - SEWING
|
||||
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES
|
||||
OpSuppressHoles = 4002, // MENU REPAIR - SUPPRESS HOLES
|
||||
OpShapeProcess = 4003, // MENU REPAIR - SHAPE PROCESSING
|
||||
OpCloseContour = 4004, // MENU REPAIR - CLOSE CONTOUR
|
||||
OpRemoveIntWires = 4005, // MENU REPAIR - REMOVE INTERNAL WIRES
|
||||
OpAddPointOnEdge = 4006, // MENU REPAIR - ADD POINT ON EDGE
|
||||
OpFreeBoundaries = 4007, // MENU MEASURES - FREE BOUNDARIES
|
||||
OpFreeFaces = 4008, // MENU MEASURES - FREE FACES
|
||||
OpOrientation = 4009, // MENU REPAIR - CHANGE ORIENTATION
|
||||
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
|
||||
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
|
||||
OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES
|
||||
OpSewing = 4000, // MENU REPAIR - SEWING
|
||||
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES
|
||||
OpSuppressHoles = 4002, // MENU REPAIR - SUPPRESS HOLES
|
||||
OpShapeProcess = 4003, // MENU REPAIR - SHAPE PROCESSING
|
||||
OpCloseContour = 4004, // MENU REPAIR - CLOSE CONTOUR
|
||||
OpRemoveIntWires = 4005, // MENU REPAIR - REMOVE INTERNAL WIRES
|
||||
OpAddPointOnEdge = 4006, // MENU REPAIR - ADD POINT ON EDGE
|
||||
OpFreeBoundaries = 4007, // MENU MEASURES - FREE BOUNDARIES
|
||||
OpFreeFaces = 4008, // MENU MEASURES - FREE FACES
|
||||
OpOrientation = 4009, // MENU REPAIR - CHANGE ORIENTATION
|
||||
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
|
||||
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
|
||||
OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES
|
||||
// MeasureGUI ----------------//--------------------------------
|
||||
OpProperties = 5000, // MENU MEASURES - PROPERTIES
|
||||
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
|
||||
OpInertia = 5002, // MENU MEASURES - INERTIA
|
||||
OpNormale = 5003, // MENU MEASURES - NORMALE
|
||||
OpBoundingBox = 5004, // MENU MEASURES - BOUNDING BOX
|
||||
OpMinDistance = 5005, // MENU MEASURES - MIN DISTANCE
|
||||
OpAngle = 5006, // MENU MEASURES - ANGLE
|
||||
OpTolerance = 5007, // MENU MEASURES - TOLERANCE
|
||||
OpWhatIs = 5008, // MENU MEASURES - WHAT IS
|
||||
OpCheckShape = 5009, // MENU MEASURES - CHECK
|
||||
OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS
|
||||
OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES
|
||||
OpCheckSelfInters = 5012, // MENU MEASURES - CHECK SELF INTERSECTIONS
|
||||
OpProperties = 5000, // MENU MEASURES - PROPERTIES
|
||||
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
|
||||
OpInertia = 5002, // MENU MEASURES - INERTIA
|
||||
OpNormale = 5003, // MENU MEASURES - NORMALE
|
||||
OpBoundingBox = 5004, // MENU MEASURES - BOUNDING BOX
|
||||
OpMinDistance = 5005, // MENU MEASURES - MIN DISTANCE
|
||||
OpAngle = 5006, // MENU MEASURES - ANGLE
|
||||
OpTolerance = 5007, // MENU MEASURES - TOLERANCE
|
||||
OpWhatIs = 5008, // MENU MEASURES - WHAT IS
|
||||
OpCheckShape = 5009, // MENU MEASURES - CHECK
|
||||
OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS
|
||||
OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES
|
||||
OpCheckSelfInters = 5012, // MENU MEASURES - CHECK SELF INTERSECTIONS
|
||||
// GroupGUI ------------------//--------------------------------
|
||||
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
||||
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
||||
OpGroupCreatePopup = 6002, // POPUP MENU - CREATE GROUP
|
||||
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
||||
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
||||
OpGroupCreatePopup = 6002, // POPUP MENU - CREATE GROUP
|
||||
// BlocksGUI -----------------//--------------------------------
|
||||
OpHexaSolid = 6100, // MENU BLOCKS - HEXAHEDRAL SOLID
|
||||
OpMultiTransform = 6101, // MENU BLOCKS - MULTI-TRANSFORMATION
|
||||
OpQuadFace = 6102, // MENU BLOCKS - QUADRANGLE FACE
|
||||
OpPropagate = 6103, // MENU BLOCKS - PROPAGATE
|
||||
OpExplodeBlock = 6104, // MENU BLOCKS - EXPLODE ON BLOCKS
|
||||
OpHexaSolid = 6100, // MENU BLOCKS - HEXAHEDRAL SOLID
|
||||
OpMultiTransform = 6101, // MENU BLOCKS - MULTI-TRANSFORMATION
|
||||
OpQuadFace = 6102, // MENU BLOCKS - QUADRANGLE FACE
|
||||
OpPropagate = 6103, // MENU BLOCKS - PROPAGATE
|
||||
OpExplodeBlock = 6104, // MENU BLOCKS - EXPLODE ON BLOCKS
|
||||
// AdvancedGUI ---------------//--------------------------------
|
||||
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
|
||||
OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
|
||||
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
|
||||
OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
|
||||
// OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
|
||||
//@@ insert new functions before this line @@ do not remove this line @@//
|
||||
};
|
||||
|
@ -74,6 +74,7 @@ libGEOM_la_CPPFLAGS = \
|
||||
$(OPENCV_INCLUDES) \
|
||||
-I$(srcdir)/../OBJECT \
|
||||
-I$(srcdir)/../GEOMFiltersSelection \
|
||||
-I$(srcdir)/../Material \
|
||||
-I$(srcdir)/../GEOMClient \
|
||||
-I$(srcdir)/../GEOMImpl \
|
||||
-I$(top_builddir)/idl \
|
||||
@ -82,6 +83,7 @@ libGEOM_la_CPPFLAGS = \
|
||||
libGEOM_la_LDFLAGS = \
|
||||
$(PYTHON_LIBS) \
|
||||
../GEOMFiltersSelection/libGEOMFiltersSelection.la \
|
||||
../Material/libMaterial.la \
|
||||
../GEOMClient/libGEOMClient.la \
|
||||
../OBJECT/libGEOMObject.la \
|
||||
$(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeNS -lSalomeDSClient \
|
||||
|
@ -349,6 +349,9 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
||||
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOLINES
|
||||
OnNbIsos( DECR );
|
||||
break;
|
||||
case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES
|
||||
OnMaterialProperties();
|
||||
break;
|
||||
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
||||
OnAutoColor();
|
||||
break;
|
||||
|
@ -75,6 +75,7 @@ private:
|
||||
void OnUnpublishObject();
|
||||
void OnPublishObject() ;
|
||||
void OnPointMarker();
|
||||
void OnMaterialProperties();
|
||||
|
||||
// Shortcut commands
|
||||
void OnChangeTransparency( bool );
|
||||
|
@ -31,9 +31,11 @@
|
||||
#include "GEOMToolsGUI_DeflectionDlg.h"
|
||||
#include "GEOMToolsGUI_MarkerDlg.h"
|
||||
#include "GEOMToolsGUI_PublishDlg.h"
|
||||
#include "GEOMToolsGUI_MaterialPropertiesDlg.h"
|
||||
|
||||
#include <GeometryGUI.h>
|
||||
#include <GeometryGUI_Operations.h>
|
||||
#include <GEOM_Constants.h>
|
||||
#include <GEOM_Displayer.h>
|
||||
|
||||
#include <GEOMBase.h>
|
||||
@ -518,6 +520,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||
ic->InitCurrent();
|
||||
if ( ic->MoreCurrent() ) {
|
||||
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||
CurObject->restoreIsoNumbers();
|
||||
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
||||
|
||||
int UIso = CurDrawer->UIsoAspect()->Number();
|
||||
@ -557,16 +560,18 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||
|
||||
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
||||
|
||||
|
||||
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) );
|
||||
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) );
|
||||
|
||||
CurObject->storeIsoNumbers();
|
||||
|
||||
ic->SetLocalAttributes(CurObject, CurDrawer);
|
||||
ic->Redisplay(CurObject);
|
||||
|
||||
QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
|
||||
int aMgrId = window->getViewManager()->getGlobalId();
|
||||
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), "Isos", anIsos);
|
||||
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
|
||||
}
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
@ -616,8 +621,10 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||
int VIso = 0;
|
||||
|
||||
vtkActor* anAct = aCollection->GetNextActor();
|
||||
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
|
||||
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
||||
anActor->RestoreIsoNumbers();
|
||||
anActor->GetNbIsos(UIso,VIso);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
@ -656,6 +663,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||
// There are no casting to needed actor.
|
||||
int aIsos[2]={newNbUIso,newNbVIso};
|
||||
anActor->SetNbIsos(aIsos);
|
||||
anActor->StoreIsoNumbers();
|
||||
|
||||
QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
|
||||
int aMgrId = window->getViewManager()->getGlobalId();
|
||||
@ -847,6 +855,11 @@ void GEOMToolsGUI::OnPointMarker()
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnMaterialProperties()
|
||||
{
|
||||
GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnUnpublishObject() {
|
||||
SALOME_ListIO selected;
|
||||
|
@ -23,6 +23,7 @@
|
||||
//
|
||||
#include "GEOMToolsGUI_DeflectionDlg.h"
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOM_Constants.h>
|
||||
#include <LightApp_Application.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "GEOMToolsGUI_MarkerDlg.h"
|
||||
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOM_Constants.h>
|
||||
#include <GEOM_Displayer.h>
|
||||
|
||||
#include <Basics_OCCTVersion.hxx>
|
||||
|
1254
src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx
Normal file
1254
src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx
Normal file
File diff suppressed because it is too large
Load Diff
163
src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h
Normal file
163
src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h
Normal file
@ -0,0 +1,163 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : GEOMToolsGUI_MaterialPropertiesDlg.h
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
//
|
||||
#ifndef GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
|
||||
#define GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
|
||||
|
||||
#include "GEOM_ToolsGUI.hxx"
|
||||
|
||||
#include <QtxDialog.h>
|
||||
#include <QFrame>
|
||||
#include <QMap>
|
||||
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QPushButton;
|
||||
class QSpinBox;
|
||||
class QTabWidget;
|
||||
|
||||
class QtxColorButton;
|
||||
class QtxDoubleSpinBox;
|
||||
|
||||
class Material_Model;
|
||||
class Material_ResourceMgr;
|
||||
|
||||
class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum { Current, Default, Global, User };
|
||||
enum { TypeRole = Qt::UserRole + 123, NameRole };
|
||||
|
||||
//! Enumeration of viewer types
|
||||
typedef enum {
|
||||
OCC, //!< OCC viewer
|
||||
VTK //!< VTK viewer
|
||||
} ViewerType;
|
||||
|
||||
public:
|
||||
GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
|
||||
~GEOMToolsGUI_MaterialPropertiesDlg();
|
||||
|
||||
void accept();
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
|
||||
private:
|
||||
Material_ResourceMgr* resourceMgr();
|
||||
|
||||
void fromModel( Material_Model* );
|
||||
void toModel( Material_Model* ) const;
|
||||
void toFrontModel( Material_Model* ) const;
|
||||
void toBackModel( Material_Model* ) const;
|
||||
|
||||
QString findUniqueName( const QString&,
|
||||
QListWidgetItem* = 0,
|
||||
bool = false );
|
||||
|
||||
bool isFrontTabActive() const;
|
||||
|
||||
signals:
|
||||
void materialChanged();
|
||||
void changed();
|
||||
|
||||
private slots:
|
||||
|
||||
void onApply();
|
||||
void onHelp();
|
||||
|
||||
void onBackMaterialChecked( bool );
|
||||
void onCurrentTabChanged( int );
|
||||
void onMaterialChanged();
|
||||
void onChanged();
|
||||
void onItemChanged( QListWidgetItem* );
|
||||
void onReflectionTypeToggled( bool );
|
||||
|
||||
private:
|
||||
|
||||
Material_ResourceMgr* myResMgr;
|
||||
|
||||
QCheckBox* myBackMaterialCheck;
|
||||
|
||||
//! Current material model for front material
|
||||
Material_Model* myCurrentModelF;
|
||||
|
||||
//! Current material model for back material
|
||||
Material_Model* myCurrentModelB;
|
||||
|
||||
QListWidget* myMaterialList;
|
||||
int myMaterialListFId;
|
||||
int myMaterialListBId;
|
||||
|
||||
QTabWidget* myMaterialTab;
|
||||
QWidget* myMaterialBWidget;
|
||||
bool myIsBTabWasActivated;
|
||||
|
||||
//! Controls defining front material properties
|
||||
QGroupBox* myAmbientGroupF;
|
||||
QtxColorButton* myAmbientColorF;
|
||||
QtxDoubleSpinBox* myAmbientCoefntF;
|
||||
|
||||
QGroupBox* myDiffuseGroupF;
|
||||
QtxColorButton* myDiffuseColorF;
|
||||
QtxDoubleSpinBox* myDiffuseCoefntF;
|
||||
|
||||
QGroupBox* mySpecularGroupF;
|
||||
QtxColorButton* mySpecularColorF;
|
||||
QtxDoubleSpinBox* mySpecularCoefntF;
|
||||
|
||||
QGroupBox* myEmissionGroupF;
|
||||
QtxColorButton* myEmissionColorF;
|
||||
QtxDoubleSpinBox* myEmissionCoefntF;
|
||||
|
||||
QtxDoubleSpinBox* myShininessF;
|
||||
|
||||
//! Controls defining back material properties
|
||||
QGroupBox* myAmbientGroupB;
|
||||
QtxColorButton* myAmbientColorB;
|
||||
QtxDoubleSpinBox* myAmbientCoefntB;
|
||||
|
||||
QGroupBox* myDiffuseGroupB;
|
||||
QtxColorButton* myDiffuseColorB;
|
||||
QtxDoubleSpinBox* myDiffuseCoefntB;
|
||||
|
||||
QGroupBox* mySpecularGroupB;
|
||||
QtxColorButton* mySpecularColorB;
|
||||
QtxDoubleSpinBox* mySpecularCoefntB;
|
||||
|
||||
QGroupBox* myEmissionGroupB;
|
||||
QtxColorButton* myEmissionColorB;
|
||||
QtxDoubleSpinBox* myEmissionCoefntB;
|
||||
|
||||
QtxDoubleSpinBox* myShininessB;
|
||||
|
||||
QString myHelpFileName;
|
||||
|
||||
ViewerType myViewerType;
|
||||
|
||||
};
|
||||
|
||||
#endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
|
@ -28,6 +28,7 @@
|
||||
#include <GEOMBase.h>
|
||||
#include <GEOM_AISShape.hxx>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOM_Constants.h>
|
||||
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
@ -35,7 +35,8 @@ salomeinclude_HEADERS = \
|
||||
GEOMToolsGUI_TransparencyDlg.h \
|
||||
GEOMToolsGUI_DeleteDlg.h \
|
||||
GEOMToolsGUI_MarkerDlg.h \
|
||||
GEOMToolsGUI_PublishDlg.h
|
||||
GEOMToolsGUI_PublishDlg.h \
|
||||
GEOMToolsGUI_MaterialPropertiesDlg.h
|
||||
|
||||
dist_libGEOMToolsGUI_la_SOURCES = \
|
||||
GEOMToolsGUI.cxx \
|
||||
@ -45,7 +46,8 @@ dist_libGEOMToolsGUI_la_SOURCES = \
|
||||
GEOMToolsGUI_DeflectionDlg.cxx \
|
||||
GEOMToolsGUI_DeleteDlg.cxx \
|
||||
GEOMToolsGUI_MarkerDlg.cxx \
|
||||
GEOMToolsGUI_PublishDlg.cxx
|
||||
GEOMToolsGUI_PublishDlg.cxx \
|
||||
GEOMToolsGUI_MaterialPropertiesDlg.cxx
|
||||
|
||||
MOC_FILES = \
|
||||
GEOMToolsGUI_TransparencyDlg_moc.cxx \
|
||||
@ -53,7 +55,8 @@ MOC_FILES = \
|
||||
GEOMToolsGUI_DeflectionDlg_moc.cxx \
|
||||
GEOMToolsGUI_DeleteDlg_moc.cxx \
|
||||
GEOMToolsGUI_MarkerDlg_moc.cxx \
|
||||
GEOMToolsGUI_PublishDlg_moc.cxx
|
||||
GEOMToolsGUI_PublishDlg_moc.cxx \
|
||||
GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx
|
||||
|
||||
nodist_libGEOMToolsGUI_la_SOURCES = \
|
||||
$(MOC_FILES)
|
||||
@ -72,6 +75,7 @@ libGEOMToolsGUI_la_CPPFLAGS = \
|
||||
$(CORBA_INCLUDES) \
|
||||
-I$(srcdir)/../OBJECT \
|
||||
-I$(srcdir)/../GEOMBase \
|
||||
-I$(srcdir)/../Material \
|
||||
-I$(srcdir)/../GEOMGUI \
|
||||
-I$(srcdir)/../GEOMClient \
|
||||
-I$(srcdir)/../GEOMImpl \
|
||||
@ -79,5 +83,6 @@ libGEOMToolsGUI_la_CPPFLAGS = \
|
||||
|
||||
libGEOMToolsGUI_la_LDFLAGS = \
|
||||
../GEOMBase/libGEOMBase.la \
|
||||
../Material/libMaterial.la \
|
||||
../GEOMGUI/libGEOM.la \
|
||||
$(GUI_LDFLAGS) -lVTKViewer -lOCCViewer -lsuit -lSalomeApp -lPyConsole
|
||||
|
@ -32,7 +32,7 @@ if WITH_OPENCV
|
||||
endif
|
||||
|
||||
if GEOM_ENABLE_GUI
|
||||
SUBDIRS += OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI \
|
||||
SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase GEOMToolsGUI \
|
||||
DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI \
|
||||
BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI \
|
||||
GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM
|
||||
|
51
src/Material/Makefile.am
Normal file
51
src/Material/Makefile.am
Normal file
@ -0,0 +1,51 @@
|
||||
# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
#
|
||||
# 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 : Makefile.am
|
||||
# Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
# Package : Material
|
||||
#
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# Libraries targets
|
||||
lib_LTLIBRARIES = libMaterial.la
|
||||
|
||||
# header files
|
||||
salomeinclude_HEADERS = \
|
||||
Material.h \
|
||||
Material_Model.h \
|
||||
Material_ResourceMgr.h
|
||||
|
||||
dist_libMaterial_la_SOURCES = \
|
||||
Material_Model.cxx \
|
||||
Material_ResourceMgr.cxx
|
||||
|
||||
# additional information to compile and link file
|
||||
libMaterial_la_CPPFLAGS = \
|
||||
$(QT_INCLUDES) \
|
||||
$(VTK_INCLUDES) \
|
||||
$(CAS_CPPFLAGS) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(GUI_CXXFLAGS) \
|
||||
-I$(srcdir)/../OBJECT
|
||||
|
||||
libMaterial_la_LDFLAGS = \
|
||||
$(GUI_LDFLAGS) -lVTKViewer -lOCCViewer -lsuit -lSalomeApp
|
||||
|
||||
dist_salomeres_DATA = resources/SalomeMaterial.xml
|
36
src/Material/Material.h
Normal file
36
src/Material/Material.h
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : Material.h
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S.
|
||||
//
|
||||
#ifndef MATERIAL_H
|
||||
#define MATERIAL_H
|
||||
|
||||
#if defined WIN32
|
||||
# if defined MATERIAL_SALOME_EXPORTS || defined MATERIAL_EXPORTS || defined SalomeMaterial_EXPORTS
|
||||
# define MATERIAL_SALOME_EXPORT _declspec( dllexport )
|
||||
# else
|
||||
# define MATERIAL_SALOME_EXPORT _declspec( dllimport )
|
||||
# endif
|
||||
#else
|
||||
# define MATERIAL_SALOME_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // MATERIAL_H
|
682
src/Material/Material_Model.cxx
Normal file
682
src/Material/Material_Model.cxx
Normal file
@ -0,0 +1,682 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : Material_Model.cxx
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
//
|
||||
|
||||
#include "Material_Model.h"
|
||||
#include "Material_ResourceMgr.h"
|
||||
|
||||
#include <GEOM_Constants.h>
|
||||
|
||||
#include <QtxResourceMgr.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
|
||||
// VTK includes
|
||||
#include <vtkProperty.h>
|
||||
|
||||
/*!
|
||||
\brief Constructor
|
||||
|
||||
Create new SALOME material model with default properties.
|
||||
*/
|
||||
Material_Model::Material_Model()
|
||||
: myResourceMgr( 0 )
|
||||
{
|
||||
myShininess = 0.0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor
|
||||
*/
|
||||
Material_Model::~Material_Model()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Construct material model according to the given list of
|
||||
material properties
|
||||
|
||||
\param theProps the list of material properties
|
||||
\return material model object with correspondent properties
|
||||
\sa getMaterialProperty()
|
||||
*/
|
||||
Material_Model* Material_Model::getMaterialModel( QStringList theProps )
|
||||
{
|
||||
Material_Model* aModel = new Material_Model();
|
||||
|
||||
foreach ( QString aProp, theProps ) {
|
||||
if ( aProp.isNull() ) continue;
|
||||
|
||||
// Set current ambient color
|
||||
aModel->setColor( aProp, "AmbientColor=", Material_Model::Ambient );
|
||||
// Set current ambient coefficient
|
||||
aModel->setCoefficient( aProp, "AmbientCoefficient=", Material_Model::Ambient );
|
||||
|
||||
// Set current diffuse color
|
||||
aModel->setColor( aProp, "DiffuseColor=", Material_Model::Diffuse );
|
||||
// Set current diffuse coefficient
|
||||
aModel->setCoefficient( aProp, "DiffuseCoefficient=", Material_Model::Diffuse );
|
||||
|
||||
// Set current specular color
|
||||
aModel->setColor( aProp, "SpecularColor=", Material_Model::Specular );
|
||||
// Set current specular coefficient
|
||||
aModel->setCoefficient( aProp, "SpecularCoefficient=", Material_Model::Specular );
|
||||
|
||||
// Set current emission color
|
||||
aModel->setColor( aProp, "EmissionColor=", Material_Model::Emission );
|
||||
// Set current emission coefficient
|
||||
aModel->setCoefficient( aProp, "EmissionCoefficient=", Material_Model::Emission );
|
||||
|
||||
// Set current shininess
|
||||
QString aPropName = "Shininess=";
|
||||
int anId = aProp.indexOf(aPropName);
|
||||
if ( anId != -1 ) {
|
||||
bool ok;
|
||||
double aCoef = aProp.right( aProp.length() - (anId+aPropName.length()) ).toDouble(&ok);
|
||||
if ( ok )
|
||||
aModel->setShininess( aCoef );
|
||||
}
|
||||
}
|
||||
|
||||
return aModel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Construct string of material properties for this model object
|
||||
|
||||
\return a string representing a set of material properties
|
||||
\sa getMaterialModel()
|
||||
*/
|
||||
QString Material_Model::getMaterialProperty()
|
||||
{
|
||||
// Parse material properties of the current model and form a string for persistent purpose
|
||||
QString aMaterial;
|
||||
|
||||
bool isReflectionTypeActive;
|
||||
QColor c;
|
||||
double coef;
|
||||
|
||||
// Ambient reflection
|
||||
isReflectionTypeActive = hasAmbientReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Ambient );
|
||||
coef = coefficient(Material_Model::Ambient);
|
||||
// Insert properties into persistent string
|
||||
aMaterial = "AmbientColor=%1%2AmbientCoefficient=%3";
|
||||
aMaterial = aMaterial.arg( Qtx::colorToString(c) );
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( coef );
|
||||
}
|
||||
// Diffuse reflection
|
||||
isReflectionTypeActive = hasDiffuseReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Diffuse );
|
||||
coef = coefficient(Material_Model::Diffuse);
|
||||
// Insert properties into persistent string
|
||||
aMaterial += "%1DiffuseColor=%2%3DiffuseCoefficient=%4";
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( Qtx::colorToString(c) );
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( coef );
|
||||
}
|
||||
// Specular reflection
|
||||
isReflectionTypeActive = hasSpecularReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Specular );
|
||||
coef = coefficient(Material_Model::Specular);
|
||||
// Insert properties into persistent string
|
||||
aMaterial += "%1SpecularColor=%2%3SpecularCoefficient=%4";
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( Qtx::colorToString(c) );
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( coef );
|
||||
}
|
||||
// Emission reflection
|
||||
isReflectionTypeActive = hasEmissionReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Emission );
|
||||
coef = coefficient(Material_Model::Emission);
|
||||
// Insert properties into persistent string
|
||||
aMaterial += "%1EmissionColor=%2%3EmissionCoefficient=%4";
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( Qtx::colorToString(c) );
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( coef );
|
||||
}
|
||||
if ( !aMaterial.isEmpty() ) {
|
||||
// Shininess
|
||||
// Insert properties into persistent string
|
||||
aMaterial += "%1Shininess=%2";
|
||||
aMaterial = aMaterial.arg( DIGIT_SEPARATOR );
|
||||
aMaterial = aMaterial.arg( shininess() );
|
||||
}
|
||||
|
||||
return aMaterial;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Construct OCCT material aspect object based on the current model
|
||||
|
||||
\return material aspect object with correspondent properties
|
||||
*/
|
||||
Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
||||
{
|
||||
// Get material aspect from the current model
|
||||
Graphic3d_MaterialAspect aMat;
|
||||
|
||||
bool isReflectionTypeActive;
|
||||
QColor c;
|
||||
double coef;
|
||||
|
||||
// Ambient reflection
|
||||
isReflectionTypeActive = hasAmbientReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
aMat.SetReflectionModeOn( Graphic3d_TOR_AMBIENT );
|
||||
c = color( Material_Model::Ambient );
|
||||
aMat.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||
coef = coefficient( Material_Model::Ambient );
|
||||
aMat.SetAmbient( coef );
|
||||
}
|
||||
// Diffuse reflection
|
||||
isReflectionTypeActive = hasDiffuseReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
aMat.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE );
|
||||
c = color( Material_Model::Diffuse );
|
||||
aMat.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||
coef = coefficient( Material_Model::Diffuse );
|
||||
aMat.SetDiffuse( coef );
|
||||
}
|
||||
// Specular reflection
|
||||
isReflectionTypeActive = hasSpecularReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
aMat.SetReflectionModeOn( Graphic3d_TOR_SPECULAR );
|
||||
c = color( Material_Model::Specular );
|
||||
aMat.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||
coef = coefficient( Material_Model::Specular );
|
||||
aMat.SetSpecular( coef );
|
||||
}
|
||||
// Emission reflection
|
||||
isReflectionTypeActive = hasEmissionReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
aMat.SetReflectionModeOn( Graphic3d_TOR_EMISSION );
|
||||
c = color( Material_Model::Emission );
|
||||
aMat.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||
coef = coefficient( Material_Model::Emission );
|
||||
aMat.SetEmissive( coef );
|
||||
}
|
||||
// Shininess
|
||||
aMat.SetShininess( shininess() );
|
||||
|
||||
return aMat;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Construct VTK property with properties of material based on the current model
|
||||
|
||||
\return VTK property with correspondent material properties
|
||||
*/
|
||||
vtkProperty* Material_Model::getMaterialVTKProperty()
|
||||
{
|
||||
// Get material properties from the current model
|
||||
vtkProperty* aProperty = vtkProperty::New();
|
||||
|
||||
bool isReflectionTypeActive;
|
||||
QColor c;
|
||||
double coef;
|
||||
|
||||
// Ambient reflection
|
||||
isReflectionTypeActive = hasAmbientReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Ambient );
|
||||
aProperty->SetAmbientColor( c.redF(), c.greenF(), c.blueF() ); //SalomeApp_Tools::color( c )
|
||||
coef = coefficient( Material_Model::Ambient );
|
||||
aProperty->SetAmbient( coef );
|
||||
}
|
||||
// Diffuse reflection
|
||||
isReflectionTypeActive = hasDiffuseReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Diffuse );
|
||||
aProperty->SetDiffuseColor( c.redF(), c.greenF(), c.blueF() );
|
||||
coef = coefficient( Material_Model::Diffuse );
|
||||
aProperty->SetDiffuse( coef );
|
||||
}
|
||||
// Specular reflection
|
||||
isReflectionTypeActive = hasSpecularReflection();
|
||||
if ( isReflectionTypeActive ) {
|
||||
c = color( Material_Model::Specular );
|
||||
aProperty->SetSpecularColor( c.redF(), c.greenF(), c.blueF() );
|
||||
coef = coefficient( Material_Model::Specular );
|
||||
aProperty->SetSpecular( coef );
|
||||
}
|
||||
// Shininess
|
||||
aProperty->SetSpecularPower( shininess()*100.0 );
|
||||
|
||||
return aProperty;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Initialize material model with default values
|
||||
*/
|
||||
void Material_Model::initDefaults()
|
||||
{
|
||||
// Set default ambient color
|
||||
setColor( Ambient, "#333333" );
|
||||
// Set default ambient coefficient
|
||||
setCoefficient( Ambient, 0.3 );
|
||||
|
||||
// Set default diffuse color
|
||||
setColor( Diffuse, "#000000" );
|
||||
// Set default diffuse coefficient
|
||||
setCoefficient( Diffuse, 0.65 );
|
||||
|
||||
// Set default specular color
|
||||
setColor( Specular, "#ffffff" );
|
||||
// Set default specular coefficient
|
||||
setCoefficient( Specular, 0.0 );
|
||||
|
||||
// Set default shininess
|
||||
setShininess( 0.039 );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Clear current content of this material model
|
||||
*/
|
||||
void Material_Model::clearModel()
|
||||
{
|
||||
myColors.clear();
|
||||
myCoefficients.clear();
|
||||
myShininess = 0.0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Initialize material model from the resources
|
||||
|
||||
This function can be used to retrieve material properties from the resource file(s).
|
||||
Note, that paremeters \a theResMgr and \a theResSection are stored by the model to be used
|
||||
later with save() method.
|
||||
|
||||
\param theResMgr resources manager
|
||||
\param theResSection resources section name
|
||||
\sa save()
|
||||
*/
|
||||
void Material_Model::fromResources( QtxResourceMgr* theResMgr,
|
||||
const QString& theResSection,
|
||||
bool theIsFront )
|
||||
{
|
||||
// Clear current content of the model
|
||||
// before setting properties from resources
|
||||
clearModel();
|
||||
|
||||
myResourceMgr = theResMgr;
|
||||
myResourceSection = theResSection;
|
||||
|
||||
// init from resource manager
|
||||
if ( !resourceMgr() )
|
||||
return;
|
||||
|
||||
if ( theResSection.compare( "Geometry" ) == 0 ) {
|
||||
if ( theIsFront ) {
|
||||
myResourceSection = theResMgr->stringValue("Geometry", "front_material", "Gold");
|
||||
}
|
||||
else {
|
||||
myResourceSection = theResMgr->stringValue("Geometry", "back_material", "");
|
||||
if ( myResourceSection.isEmpty() )
|
||||
myResourceSection = theResMgr->stringValue("Geometry", "front_material", "Gold");
|
||||
}
|
||||
|
||||
myResourceMgr = new Material_ResourceMgr();
|
||||
}
|
||||
|
||||
QString section = resourceSection( theIsFront );
|
||||
|
||||
// If there is no material preference in XML files,
|
||||
// use the default material hardcoded in material model
|
||||
if ( section.isEmpty() ) {
|
||||
initDefaults();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set ambient color
|
||||
if ( resourceMgr()->hasValue( section, "ambient-color" ) ) {
|
||||
setColor( Ambient, resourceMgr()->colorValue( section, "ambient-color" ) );
|
||||
}
|
||||
// Set ambient coefficient
|
||||
if ( resourceMgr()->hasValue( section, "ambient-coefficient" ) ) {
|
||||
setCoefficient( Ambient, resourceMgr()->doubleValue( section, "ambient-coefficient" ) );
|
||||
}
|
||||
|
||||
// Set diffuse color
|
||||
if ( resourceMgr()->hasValue( section, "diffuse-color" ) ) {
|
||||
setColor( Diffuse, resourceMgr()->colorValue( section, "diffuse-color" ) );
|
||||
}
|
||||
// Set diffuse coefficient
|
||||
if ( resourceMgr()->hasValue( section, "diffuse-coefficient" ) ) {
|
||||
setCoefficient( Diffuse, resourceMgr()->doubleValue( section, "diffuse-coefficient" ) );
|
||||
}
|
||||
|
||||
// Set specular color
|
||||
if ( resourceMgr()->hasValue( section, "specular-color" ) ) {
|
||||
setColor( Specular, resourceMgr()->colorValue( section, "specular-color" ) );
|
||||
}
|
||||
// Set specular coefficient
|
||||
if ( resourceMgr()->hasValue( section, "specular-coefficient" ) ) {
|
||||
setCoefficient( Specular, resourceMgr()->doubleValue( section, "specular-coefficient" ) );
|
||||
}
|
||||
|
||||
// Set emission color
|
||||
if ( resourceMgr()->hasValue( section, "emission-color" ) ) {
|
||||
setColor( Emission, resourceMgr()->colorValue( section, "emission-color" ) );
|
||||
}
|
||||
// Set emission coefficient
|
||||
if ( resourceMgr()->hasValue( section, "emission-coefficient" ) ) {
|
||||
setCoefficient( Emission, resourceMgr()->doubleValue( section, "emission-coefficient" ) );
|
||||
}
|
||||
|
||||
// Set shininess
|
||||
if ( resourceMgr()->hasValue( section, "shininess" ) ) {
|
||||
setShininess( resourceMgr()->doubleValue( section, "shininess" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Save material properties to the resource file.
|
||||
|
||||
If paremeters \a theResMgr and \a theResSection are not specified, default ones
|
||||
(those passed to the fromResources() function) are used instead.
|
||||
|
||||
\param theResMgr resources manager
|
||||
\param theResSection resources section name
|
||||
\sa fromResources()
|
||||
*/
|
||||
void Material_Model::save( QtxResourceMgr* theResMgr,
|
||||
const QString& theResSection,
|
||||
bool theIsFront )
|
||||
{
|
||||
if ( !theResMgr )
|
||||
theResMgr = resourceMgr();
|
||||
if ( !theResMgr )
|
||||
return;
|
||||
|
||||
QString section = theResSection.isEmpty() ? resourceSection( theIsFront ) : theResSection;
|
||||
myResourceSection = section;
|
||||
|
||||
if ( hasAmbientReflection() ) {
|
||||
// Save ambient color
|
||||
theResMgr->setValue( section, "ambient-color", color( Ambient ) );
|
||||
// Save ambient coefficient
|
||||
theResMgr->setValue( section, "ambient-coefficient", coefficient( Ambient ) );
|
||||
}
|
||||
else {
|
||||
// Remove ambient color
|
||||
theResMgr->remove( section, "ambient-color" );
|
||||
// Remove ambient coefficient
|
||||
theResMgr->remove( section, "ambient-coefficient" );
|
||||
}
|
||||
|
||||
if ( hasDiffuseReflection() ) {
|
||||
// Save diffuse color
|
||||
theResMgr->setValue( section, "diffuse-color", color( Diffuse ) );
|
||||
// Save diffuse coefficient
|
||||
theResMgr->setValue( section, "diffuse-coefficient", coefficient( Diffuse ) );
|
||||
}
|
||||
else {
|
||||
// Remove diffuse color
|
||||
theResMgr->remove( section, "diffuse-color" );
|
||||
// Remove diffuse coefficient
|
||||
theResMgr->remove( section, "diffuse-coefficient" );
|
||||
}
|
||||
|
||||
if ( hasSpecularReflection() ) {
|
||||
// Save specular color
|
||||
theResMgr->setValue( section, "specular-color", color( Specular ) );
|
||||
// Save specular coefficient
|
||||
theResMgr->setValue( section, "specular-coefficient", coefficient( Specular ) );
|
||||
}
|
||||
else {
|
||||
// Remove specular color
|
||||
theResMgr->remove( section, "specular-color" );
|
||||
// Remove specular coefficient
|
||||
theResMgr->remove( section, "specular-coefficient" );
|
||||
}
|
||||
|
||||
if ( hasEmissionReflection() ) {
|
||||
// Save emission color
|
||||
theResMgr->setValue( section, "emission-color", color( Emission ) );
|
||||
// Save emission coefficient
|
||||
theResMgr->setValue( section, "emission-coefficient", coefficient( Emission ) );
|
||||
}
|
||||
else {
|
||||
// Remove emission color
|
||||
theResMgr->remove( section, "emission-color" );
|
||||
// Remove emission coefficient
|
||||
theResMgr->remove( section, "emission-coefficient" );
|
||||
}
|
||||
|
||||
// Save shininess
|
||||
theResMgr->setValue( section, "shininess", shininess() );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get resource manager used by this material model.
|
||||
|
||||
\return pointer to the resource manager passed previously to the fromResources() method
|
||||
\sa fromResources(), resourceSection()
|
||||
*/
|
||||
QtxResourceMgr* Material_Model::resourceMgr() const
|
||||
{
|
||||
return myResourceMgr;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get resources section name
|
||||
|
||||
If section name is empty, default material name from "Geometry" section
|
||||
is returned ("front_material" or "back_material" is used depending on
|
||||
the parameter value)
|
||||
|
||||
\param theIsFront the flag indicating that section of front or back material
|
||||
is required
|
||||
\return resource section name passed previously to the fromResources() method
|
||||
\sa fromResources(), resourceMgr()
|
||||
*/
|
||||
QString Material_Model::resourceSection( bool theIsFront ) const
|
||||
{
|
||||
return !myResourceSection.isEmpty() ? myResourceSection :
|
||||
SUIT_Session::session()->resourceMgr()->stringValue("Geometry",
|
||||
( theIsFront ? "front_material" : "back_material" ),
|
||||
"Gold");
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Check if ambient reflection type is defined for this material
|
||||
|
||||
\return true if ambient reflection type is defined for this material,
|
||||
false - otherwise
|
||||
*/
|
||||
bool Material_Model::hasAmbientReflection()
|
||||
{
|
||||
return ( !myColors.isEmpty() && myColors.contains(Ambient) || !myCoefficients.isEmpty() && myCoefficients.contains(Ambient) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Check if diffuse reflection type is defined for this material
|
||||
|
||||
\return true if diffuse reflection type is defined for this material,
|
||||
false - otherwise
|
||||
*/
|
||||
bool Material_Model::hasDiffuseReflection()
|
||||
{
|
||||
return ( !myColors.isEmpty() && myColors.contains(Diffuse) || !myCoefficients.isEmpty() && myCoefficients.contains(Diffuse) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Check if specular reflection type is defined for this material
|
||||
|
||||
\return true if specular reflection type is defined for this material,
|
||||
false - otherwise
|
||||
*/
|
||||
bool Material_Model::hasSpecularReflection()
|
||||
{
|
||||
return ( !myColors.isEmpty() && myColors.contains(Specular) || !myCoefficients.isEmpty() && myCoefficients.contains(Specular) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Check if emission reflection type is defined for this material
|
||||
|
||||
\return true if emission reflection type is defined for this material,
|
||||
false - otherwise
|
||||
*/
|
||||
bool Material_Model::hasEmissionReflection()
|
||||
{
|
||||
return ( !myColors.isEmpty() && myColors.contains(Emission) || !myCoefficients.isEmpty() && myCoefficients.contains(Emission) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get color value for the given reflection type
|
||||
\param theReflectionType reflection type
|
||||
\return a color which should be used by the given reflection type
|
||||
\sa setColor()
|
||||
*/
|
||||
QColor Material_Model::color( ReflectionType theReflectionType ) const
|
||||
{
|
||||
return myColors[ theReflectionType ];
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set color value for the given reflection type
|
||||
|
||||
\param theReflectionType reflection type
|
||||
\param theColor a color to be used by the given reflection type
|
||||
\sa color()
|
||||
*/
|
||||
void Material_Model::setColor( ReflectionType theReflectionType,
|
||||
const QColor& theColor )
|
||||
{
|
||||
myColors[ theReflectionType ] = theColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set color of the current material from the given string
|
||||
\param theProp the considered property
|
||||
\param theColorName the name of the color property
|
||||
\param theReflectionType the type of reflection
|
||||
*/
|
||||
void Material_Model::setColor( QString theProp,
|
||||
QString theColorName,
|
||||
ReflectionType theReflectionType )
|
||||
{
|
||||
int anId = theProp.indexOf( theColorName );
|
||||
if ( anId != -1 ) {
|
||||
QColor c;
|
||||
if ( Qtx::stringToColor( theProp.right( theProp.length() - ( anId + theColorName.length() ) ), c ) )
|
||||
setColor( theReflectionType, c );
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Remove color value for the given reflection type
|
||||
|
||||
\param theReflectionType reflection type
|
||||
\sa color(), setColor()
|
||||
*/
|
||||
void Material_Model::removeColor( ReflectionType theReflectionType )
|
||||
{
|
||||
myColors.remove( theReflectionType );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get coefficient value for the given reflection type
|
||||
\param theReflectionType reflection type
|
||||
\return a coefficient which should be used by the given reflection type
|
||||
\sa setCoefficient()
|
||||
*/
|
||||
double Material_Model::coefficient( ReflectionType theReflectionType ) const
|
||||
{
|
||||
return myCoefficients[ theReflectionType ];
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set coefficient value for the given reflection type
|
||||
|
||||
\param theReflectionType reflection type
|
||||
\param theCoefficient a coefficient to be used by the given reflection type
|
||||
\sa coefficient()
|
||||
*/
|
||||
void Material_Model::setCoefficient( ReflectionType theReflectionType,
|
||||
double theCoefficient )
|
||||
{
|
||||
myCoefficients[ theReflectionType ] = theCoefficient;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set coefficient of the current material from the given string
|
||||
\param theProp the considered property
|
||||
\param theCoefName the name of the color property
|
||||
\param theReflectionType the type of reflection
|
||||
*/
|
||||
void Material_Model::setCoefficient( QString theProp,
|
||||
QString theCoefName,
|
||||
ReflectionType theReflectionType )
|
||||
{
|
||||
int anId = theProp.indexOf( theCoefName );
|
||||
if ( anId != -1 ) {
|
||||
bool ok;
|
||||
double aCoef = theProp.right( theProp.length() - ( anId + theCoefName.length() ) ).toDouble( &ok );
|
||||
if ( ok )
|
||||
setCoefficient( theReflectionType, aCoef );
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Remove coefficient value for the given reflection type
|
||||
|
||||
\param theReflectionType reflection type
|
||||
\sa coefficient(), setCoefficient()
|
||||
*/
|
||||
void Material_Model::removeCoefficient( ReflectionType theReflectionType )
|
||||
{
|
||||
myCoefficients.remove( theReflectionType );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get shininess value
|
||||
\return a shininess value of this material
|
||||
\sa setShininess()
|
||||
*/
|
||||
double Material_Model::shininess() const
|
||||
{
|
||||
return myShininess;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Set shininess value
|
||||
|
||||
\param theShininess a shininess value of this material
|
||||
\sa shininess()
|
||||
*/
|
||||
void Material_Model::setShininess( double theShininess)
|
||||
{
|
||||
myShininess = theShininess;
|
||||
}
|
108
src/Material/Material_Model.h
Normal file
108
src/Material/Material_Model.h
Normal file
@ -0,0 +1,108 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : Material_Model.h
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
//
|
||||
#ifndef MATERIAL_MODEL_H
|
||||
#define MATERIAL_MODEL_H
|
||||
|
||||
#include "Material.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
class Graphic3d_MaterialAspect;
|
||||
|
||||
class vtkProperty;
|
||||
|
||||
class QtxResourceMgr;
|
||||
|
||||
class MATERIAL_SALOME_EXPORT Material_Model
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Enumeration of reflection types of material
|
||||
typedef enum {
|
||||
Ambient, //!< Ambient
|
||||
Diffuse, //!< Diffuse
|
||||
Specular, //!< Specular
|
||||
Emission //!< Emission
|
||||
} ReflectionType;
|
||||
|
||||
|
||||
Material_Model();
|
||||
virtual ~Material_Model();
|
||||
|
||||
static Material_Model* getMaterialModel( QStringList );
|
||||
|
||||
QString getMaterialProperty();
|
||||
|
||||
Graphic3d_MaterialAspect getMaterialOCCAspect();
|
||||
vtkProperty* getMaterialVTKProperty();
|
||||
|
||||
void initDefaults();
|
||||
void fromResources( QtxResourceMgr*, const QString& = QString(), bool theIsFront = true );
|
||||
void save( QtxResourceMgr* = 0, const QString& = QString(), bool theIsFront = true );
|
||||
|
||||
QtxResourceMgr* resourceMgr() const;
|
||||
QString resourceSection( bool theIsFront ) const;
|
||||
|
||||
bool hasAmbientReflection();
|
||||
bool hasDiffuseReflection();
|
||||
bool hasSpecularReflection();
|
||||
bool hasEmissionReflection();
|
||||
|
||||
QColor color( ReflectionType ) const;
|
||||
void setColor( ReflectionType, const QColor& );
|
||||
void setColor( QString,
|
||||
QString,
|
||||
ReflectionType );
|
||||
void removeColor( ReflectionType );
|
||||
|
||||
double coefficient( ReflectionType ) const;
|
||||
void setCoefficient( ReflectionType, double );
|
||||
void setCoefficient( QString,
|
||||
QString,
|
||||
ReflectionType );
|
||||
void removeCoefficient( ReflectionType );
|
||||
|
||||
double shininess() const;
|
||||
void setShininess( double );
|
||||
|
||||
private:
|
||||
void clearModel();
|
||||
|
||||
private:
|
||||
typedef QMap<ReflectionType, QColor> ColorMap;
|
||||
typedef QMap<ReflectionType, double> CoefficientMap;
|
||||
|
||||
QtxResourceMgr* myResourceMgr;
|
||||
QString myResourceSection;
|
||||
|
||||
ColorMap myColors;
|
||||
CoefficientMap myCoefficients;
|
||||
|
||||
double myShininess;
|
||||
|
||||
};
|
||||
|
||||
#endif // MATERIAL_MODEL_H
|
407
src/Material/Material_ResourceMgr.cxx
Normal file
407
src/Material/Material_ResourceMgr.cxx
Normal file
@ -0,0 +1,407 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : Material_ResourceMgr.cxx
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
//
|
||||
#include "Material_ResourceMgr.h"
|
||||
|
||||
//#include "Qtx.h" // used to print colors of global materials
|
||||
//#include <iostream> // used to print colors of global materials
|
||||
|
||||
/*!
|
||||
\class Material_ResourceMgr
|
||||
\brief Material properties resources manager.
|
||||
|
||||
This class is used to manage the material properties throughout the application
|
||||
in the similar way as QtxResourceMgr does it with application preferences.
|
||||
|
||||
Standard material types are stored in the global application settings files
|
||||
(named as SalomeMaterial.xml). User-defined materials are stored in user's home
|
||||
directory - in the file .SalomeMaterialrc.
|
||||
|
||||
The Material_ResourceMgr class is used by material properties dialog box
|
||||
(GEOMToolsGUI_MaterialPropertiesDlg class).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Constructor
|
||||
*/
|
||||
Material_ResourceMgr::Material_ResourceMgr()
|
||||
: QtxResourceMgr( "SalomeMaterial", "%1Config" )
|
||||
{
|
||||
if ( dirList().isEmpty() && ::getenv( "GEOM_ROOT_DIR" ) )
|
||||
setDirList( QStringList() << Qtx::addSlash( ::getenv( "GEOM_ROOT_DIR" ) ) + "share/salome/resources/geom" );
|
||||
setCurrentFormat( "xml" );
|
||||
|
||||
/*
|
||||
// Get string equivalent for colors of global materials ---->
|
||||
QColor c;
|
||||
QString s;
|
||||
|
||||
// 1. ============= Plastic
|
||||
std::cout << "---- Plastic:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2, 0.2, 0.2);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 2. ============= Shiny plastic
|
||||
std::cout << "---- Shiny plastic:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2, 0.2, 0.2);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 3. ============= Satin
|
||||
std::cout << "---- Satin:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2, 0.2, 0.2);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 4. ============= Metal
|
||||
std::cout << "---- Metal:" << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 5. ============= Brass
|
||||
std::cout << "---- Brass:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.329412, 0.223529, 0.027451);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.780392, 0.568627, 0.113725);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.992157, 0.941176, 0.807843);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 6. ============= Bronze
|
||||
std::cout << "---- Bronze:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2125, 0.1275, 0.054);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.714, 0.4284, 0.18144);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.393548, 0.271906, 0.166721);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 7. ============= Copper
|
||||
std::cout << "---- Copper:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.33, 0.26, 0.23);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.50, 0.11, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.95, 0.73, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 8. ============= Gold
|
||||
std::cout << "---- Gold:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(1.0, 0.76862745, 0.31764706);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(1.0, 0.69, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 0.98, 0.78);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 9. ============= Pewter
|
||||
std::cout << "---- Pewter:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.105882, 0.058824, 0.113725);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.427451, 0.470588, 0.541176);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.333333, 0.333333, 0.521569);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 10. ============= Plaster
|
||||
std::cout << "---- Plaster:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.19225, 0.19225, 0.19225);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.50754, 0.50754, 0.50754);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.508273, 0.508273, 0.508273);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 11. ============= Silver
|
||||
std::cout << "---- Silver:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.19225, 0.19225, 0.19225);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.50754, 0.50754, 0.50754);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.508273, 0.508273, 0.508273);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 12. ============= Steel
|
||||
std::cout << "---- Steel:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2, 0.2, 0.2);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 13. ============= Stone
|
||||
std::cout << "---- Stone:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(1.0, 0.8, 0.62);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(1.0, 0.8, 0.62);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.98, 1.0, 0.60);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 14. ============= Chrome
|
||||
std::cout << "---- Chrome:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.35, 0.35, 0.35);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.4, 0.4, 0.4);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.974597, 0.974597, 0.974597);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 15. ============= Neon
|
||||
std::cout << "---- Neon:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
// emissive
|
||||
c.setRgbF(0.0, 1.0, 0.46);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " emissive color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 16. ============= Aluminium
|
||||
std::cout << "---- Aluminium:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.30, 0.30, 0.30);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.30, 0.30, 0.30);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.70, 0.70, 0.80);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 17. ============= Obsidian
|
||||
std::cout << "---- Obsidian:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.05375, 0.05, 0.06625);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.18275, 0.17, 0.22525);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.332741, 0.328634, 0.346435);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 18. ============= Jade
|
||||
std::cout << "---- Jade:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.135, 0.2225, 0.1575);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.54, 0.89, 0.63);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(0.316228, 0.316228, 0.316228);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// 19. ============= Default material
|
||||
std::cout << "---- Default material:" << std::endl;
|
||||
// ambient
|
||||
c.setRgbF(0.2, 0.2, 0.2);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " ambient color: " << s.toStdString().c_str() << std::endl;
|
||||
// diffuse
|
||||
c.setRgbF(0.0, 0.0, 0.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " diffuse color: " << s.toStdString().c_str() << std::endl;
|
||||
// specular
|
||||
c.setRgbF(1.0, 1.0, 1.0);
|
||||
s = Qtx::colorToString( c );
|
||||
std::cout << " specular color: " << s.toStdString().c_str() << std::endl;
|
||||
|
||||
// Get string equivalent for colors of global materials <----
|
||||
*/
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor
|
||||
*/
|
||||
Material_ResourceMgr::~Material_ResourceMgr()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get list of avaiable materials
|
||||
\param theType material type
|
||||
\param theSort if \c true (default), returns a list of materials sorted by name
|
||||
\return list of avaiable materials names
|
||||
*/
|
||||
QStringList Material_ResourceMgr::materials( MaterialType theType, bool theSort )
|
||||
{
|
||||
QStringList sl;
|
||||
|
||||
WorkingMode m = workingMode();
|
||||
|
||||
switch ( theType ) {
|
||||
case Global:
|
||||
setWorkingMode( IgnoreUserValues );
|
||||
sl = sections();
|
||||
break;
|
||||
case User:
|
||||
{
|
||||
setWorkingMode( AllowUserValues );
|
||||
sl = sections();
|
||||
setWorkingMode( IgnoreUserValues );
|
||||
QMutableListIterator<QString> it( sl );
|
||||
while ( it.hasNext() ) {
|
||||
QString s = it.next();
|
||||
if ( hasSection( s ) ) it.remove();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case All:
|
||||
setWorkingMode( AllowUserValues );
|
||||
sl = sections();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setWorkingMode( m );
|
||||
|
||||
if ( theSort )
|
||||
qSort( sl );
|
||||
|
||||
return sl;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get list of materials names for preferences dialog
|
||||
\return list of materials names
|
||||
*/
|
||||
QStringList Material_ResourceMgr::getPreferenceMaterialsNames()
|
||||
{
|
||||
QStringList aMaterialsList = materials( Material_ResourceMgr::All );
|
||||
return aMaterialsList;
|
||||
}
|
49
src/Material/Material_ResourceMgr.h
Normal file
49
src/Material/Material_ResourceMgr.h
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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 : Material_ResourceMgr.h
|
||||
// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
|
||||
//
|
||||
#ifndef MATERIAL_RESOURCEMGR_H
|
||||
#define MATERIAL_RESOURCEMGR_H
|
||||
|
||||
#include "Material.h"
|
||||
|
||||
#include <QtxResourceMgr.h>
|
||||
|
||||
class MATERIAL_SALOME_EXPORT Material_ResourceMgr : public QtxResourceMgr
|
||||
{
|
||||
public:
|
||||
//! Material type
|
||||
typedef enum {
|
||||
Global, //!< Global materials
|
||||
User, //!< User materials
|
||||
All //!< All materials
|
||||
} MaterialType;
|
||||
|
||||
Material_ResourceMgr();
|
||||
~Material_ResourceMgr();
|
||||
|
||||
QStringList materials( MaterialType = All, bool = true );
|
||||
|
||||
QStringList getPreferenceMaterialsNames();
|
||||
|
||||
};
|
||||
|
||||
#endif // MATERIAL_RESOURCEMGR_H
|
187
src/Material/resources/SalomeMaterial.xml
Normal file
187
src/Material/resources/SalomeMaterial.xml
Normal file
@ -0,0 +1,187 @@
|
||||
<!--
|
||||
Copyright (C) 2007-2011 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
|
||||
|
||||
-->
|
||||
<document>
|
||||
<section name="Plastic" >
|
||||
<parameter name="ambient-color" value="#333333" />
|
||||
<parameter name="ambient-coefficient" value="0.5" />
|
||||
<parameter name="diffuse-color" value="#000000" />
|
||||
<parameter name="diffuse-coefficient" value="0.24" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="0.06" />
|
||||
<parameter name="shininess" value="0.0078125" />
|
||||
</section>
|
||||
<section name="Shiny plastic" >
|
||||
<parameter name="ambient-color" value="#333333" />
|
||||
<parameter name="ambient-coefficient" value="0.44" />
|
||||
<parameter name="diffuse-color" value="#000000" />
|
||||
<parameter name="diffuse-coefficient" value="0.5" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="1.0" />
|
||||
</section>
|
||||
<section name="Satin" >
|
||||
<parameter name="ambient-color" value="#333333" />
|
||||
<parameter name="ambient-coefficient" value="0.33" />
|
||||
<parameter name="diffuse-color" value="#000000" />
|
||||
<parameter name="diffuse-coefficient" value="0.4" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="0.44" />
|
||||
<parameter name="shininess" value="0.09375" />
|
||||
</section>
|
||||
<section name="Metal" >
|
||||
<parameter name="diffuse-color" value="#000000" />
|
||||
<parameter name="diffuse-coefficient" value="0.47" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="0.45" />
|
||||
<parameter name="shininess" value="0.13" />
|
||||
</section>
|
||||
<section name="Brass">
|
||||
<parameter name="ambient-color" value="#543907" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#c7911d" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#fdf0ce" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.21794844" />
|
||||
</section>
|
||||
<section name="Bronze">
|
||||
<parameter name="ambient-color" value="#36200d" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#b66d2e" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#64452a" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.2" />
|
||||
</section>
|
||||
<section name="Copper" >
|
||||
<parameter name="ambient-color" value="#54423a" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#801c00" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#f3ba00" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.93" />
|
||||
</section>
|
||||
<section name="Gold" >
|
||||
<parameter name="ambient-color" value="#ffc451" />
|
||||
<parameter name="ambient-coefficient" value="0.3" />
|
||||
<parameter name="diffuse-color" value="#ffb000" />
|
||||
<parameter name="diffuse-coefficient" value="0.4" />
|
||||
<parameter name="specular-color" value="#fffac7" />
|
||||
<parameter name="specular-coefficient" value="0.9" />
|
||||
<parameter name="shininess" value="0.0625" />
|
||||
</section>
|
||||
<section name="Pewter" >
|
||||
<parameter name="ambient-color" value="#1b0f1d" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#6d788a" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#555585" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.076923047" />
|
||||
</section>
|
||||
<section name="Plaster" >
|
||||
<parameter name="ambient-color" value="#313131" />
|
||||
<parameter name="ambient-coefficient" value="0.26" />
|
||||
<parameter name="diffuse-color" value="#818181" />
|
||||
<parameter name="diffuse-coefficient" value="0.23" />
|
||||
<parameter name="specular-color" value="#828282" />
|
||||
<parameter name="specular-coefficient" value="0.06" />
|
||||
<parameter name="shininess" value="0.0078125" />
|
||||
</section>
|
||||
<section name="Silver" >
|
||||
<parameter name="ambient-color" value="#313131" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#818181" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#828282" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.2" />
|
||||
</section>
|
||||
<section name="Steel" >
|
||||
<parameter name="ambient-color" value="#333333" />
|
||||
<parameter name="ambient-coefficient" value="0.01" />
|
||||
<parameter name="diffuse-color" value="#000000" />
|
||||
<parameter name="diffuse-coefficient" value="0.03" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="0.98" />
|
||||
<parameter name="shininess" value="0.06" />
|
||||
</section>
|
||||
<section name="Stone" >
|
||||
<parameter name="ambient-color" value="#ffcc9e" />
|
||||
<parameter name="ambient-coefficient" value="0.19" />
|
||||
<parameter name="diffuse-color" value="#ffcc9e" />
|
||||
<parameter name="diffuse-coefficient" value="0.75" />
|
||||
<parameter name="specular-color" value="#faff99" />
|
||||
<parameter name="specular-coefficient" value="0.08" />
|
||||
<parameter name="shininess" value="0.17" />
|
||||
</section>
|
||||
<section name="Chrome" >
|
||||
<parameter name="ambient-color" value="#595959" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#666666" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#f9f9f9" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.1" />
|
||||
</section>
|
||||
<section name="Neon" >
|
||||
<parameter name="ambient-color" value="#ffffff" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#ffffff" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#ffffff" />
|
||||
<parameter name="specular-coefficient" value="0.62" />
|
||||
<parameter name="emission-color" value="#00ff75" />
|
||||
<parameter name="emission-coefficient" value="0.9" />
|
||||
<parameter name="shininess" value="0.05" />
|
||||
</section>
|
||||
<section name="Aluminium" >
|
||||
<parameter name="ambient-color" value="#4c4c4c" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#4c4c4c" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#b3b3cc" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.09" />
|
||||
</section>
|
||||
<section name="Obsidian" >
|
||||
<parameter name="ambient-color" value="#0d0c10" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#2e2b39" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#555458" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.3" />
|
||||
</section>
|
||||
<section name="Jade" >
|
||||
<parameter name="ambient-color" value="#223828" />
|
||||
<parameter name="ambient-coefficient" value="1.0" />
|
||||
<parameter name="diffuse-color" value="#8ae3a1" />
|
||||
<parameter name="diffuse-coefficient" value="1.0" />
|
||||
<parameter name="specular-color" value="#505050" />
|
||||
<parameter name="specular-coefficient" value="1.0" />
|
||||
<parameter name="shininess" value="0.1" />
|
||||
</section>
|
||||
</document>
|
@ -45,9 +45,11 @@
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
@ -130,6 +132,13 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
|
||||
: SALOME_AISShape(shape), myName(aName), myDisplayVectors(false)
|
||||
{
|
||||
myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD );
|
||||
|
||||
storeBoundaryColors();
|
||||
|
||||
myEdgesInShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD );
|
||||
|
||||
myUIsoNumber = -1;
|
||||
myVIsoNumber = -1;
|
||||
}
|
||||
|
||||
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
||||
@ -170,38 +179,19 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
switch (aMode) {
|
||||
case 0://StdSelect_DM_Wireframe:
|
||||
{
|
||||
restoreIsoNumbers();
|
||||
|
||||
// Restore wireframe edges colors
|
||||
restoreBoundaryColors();
|
||||
|
||||
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
|
||||
break;
|
||||
}
|
||||
case 1://StdSelect_DM_Shading:
|
||||
{
|
||||
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
|
||||
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
aMatAspect.SetAmbient( 0.5 );
|
||||
aMatAspect.SetDiffuse( 0.5 );
|
||||
aMatAspect.SetEmissive( 0.5 );
|
||||
aMatAspect.SetShininess(0.5 );
|
||||
aMatAspect.SetSpecular( 0.5 );
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
|
||||
|
||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||
FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
||||
restoreIsoNumbers();
|
||||
|
||||
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
||||
// P->SetPrimitivesAspect(a4bis);
|
||||
// G->SetGroupPrimitivesAspect(a4bis);
|
||||
//a4bis->SetInteriorColor(myShadingColor);
|
||||
myDrawer->ShadingAspect()->SetColor(myShadingColor);
|
||||
|
||||
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
|
||||
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
|
||||
AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
|
||||
shadingMode(aPresentationManager, aPrs, aMode);
|
||||
break;
|
||||
}
|
||||
case 3: //StdSelect_DM_HLR:
|
||||
@ -211,6 +201,34 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
}
|
||||
}
|
||||
|
||||
if ( aMode == ShadingWithEdges ) {
|
||||
// Temporary store number of iso lines in order to recover its later
|
||||
// when display mode is achnged to 'Wirefame' or 'Shading'.
|
||||
// Iso lines are not displayed in 'Shading with edges' mode.
|
||||
storeIsoNumbers();
|
||||
|
||||
// Reset number of iso lines to 0
|
||||
resetIsoNumbers();
|
||||
|
||||
//Shaded faces
|
||||
shadingMode(aPresentationManager, aPrs, AIS_Shaded);
|
||||
|
||||
// Store wireframe edges colors
|
||||
storeBoundaryColors();
|
||||
|
||||
// Coloring edges
|
||||
Handle(Prs3d_LineAspect) anAspect = myDrawer->UnFreeBoundaryAspect();
|
||||
anAspect->SetColor( myEdgesInShadingColor );
|
||||
myDrawer->SetUnFreeBoundaryAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->FreeBoundaryAspect();
|
||||
anAspect->SetColor( myEdgesInShadingColor );
|
||||
myDrawer->SetFreeBoundaryAspect( anAspect );
|
||||
|
||||
// Add edges to presentation
|
||||
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
|
||||
}
|
||||
|
||||
if (isShowVectors())
|
||||
{
|
||||
const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector));
|
||||
@ -282,6 +300,11 @@ void GEOM_AISShape::SetShadingColor(const Quantity_Color &aCol)
|
||||
myShadingColor = aCol;
|
||||
}
|
||||
|
||||
void GEOM_AISShape::SetEdgesInShadingColor(const Quantity_Color &aCol)
|
||||
{
|
||||
myEdgesInShadingColor = aCol;
|
||||
}
|
||||
|
||||
void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap,
|
||||
const Standard_Boolean aHighlight )
|
||||
{
|
||||
@ -317,3 +340,92 @@ void GEOM_AISShape::SetDisplayVectors(bool isDisplayed)
|
||||
{
|
||||
myDisplayVectors = isDisplayed;
|
||||
}
|
||||
|
||||
void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
|
||||
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
if ( !HasMaterial() ) {
|
||||
aMatAspect.SetAmbient( 0.5 );
|
||||
aMatAspect.SetDiffuse( 0.5 );
|
||||
aMatAspect.SetEmissive( 0.5 );
|
||||
aMatAspect.SetShininess(0.5 );
|
||||
aMatAspect.SetSpecular( 0.5 );
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||
FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
||||
|
||||
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
||||
// P->SetPrimitivesAspect(a4bis);
|
||||
// G->SetGroupPrimitivesAspect(a4bis);
|
||||
//a4bis->SetInteriorColor(myShadingColor);
|
||||
myDrawer->ShadingAspect()->SetColor(myShadingColor);
|
||||
|
||||
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
|
||||
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
|
||||
AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
|
||||
}
|
||||
|
||||
void GEOM_AISShape::storeIsoNumbers()
|
||||
{
|
||||
myUIsoNumber = myDrawer->UIsoAspect()->Number();
|
||||
myVIsoNumber = myDrawer->VIsoAspect()->Number();
|
||||
}
|
||||
|
||||
void GEOM_AISShape::restoreIsoNumbers()
|
||||
{
|
||||
if ( myUIsoNumber > 0 ) {
|
||||
// Restore number of U iso lines
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect();
|
||||
anAspect->SetNumber( myUIsoNumber );
|
||||
myDrawer->SetUIsoAspect( anAspect );
|
||||
}
|
||||
|
||||
if ( myVIsoNumber > 0 ) {
|
||||
// Restore number of V iso lines
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->VIsoAspect();
|
||||
anAspect->SetNumber( myVIsoNumber );
|
||||
myDrawer->SetVIsoAspect( anAspect );
|
||||
}
|
||||
}
|
||||
|
||||
void GEOM_AISShape::resetIsoNumbers()
|
||||
{
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect();
|
||||
anAspect->SetNumber( 0 );
|
||||
myDrawer->SetUIsoAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->VIsoAspect();
|
||||
anAspect->SetNumber( 0 );
|
||||
myDrawer->SetVIsoAspect( anAspect );
|
||||
}
|
||||
|
||||
void GEOM_AISShape::storeBoundaryColors()
|
||||
{
|
||||
Aspect_TypeOfLine aLT;
|
||||
Standard_Real aW;
|
||||
|
||||
myDrawer->FreeBoundaryAspect()->Aspect()->Values( myFreeBoundaryColor, aLT, aW);
|
||||
myDrawer->UnFreeBoundaryAspect()->Aspect()->Values( myUnFreeBoundaryColor, aLT, aW);
|
||||
}
|
||||
|
||||
void GEOM_AISShape::restoreBoundaryColors()
|
||||
{
|
||||
Handle(Prs3d_LineAspect) anAspect = myDrawer->FreeBoundaryAspect();
|
||||
anAspect->SetColor( myFreeBoundaryColor );
|
||||
myDrawer->SetFreeBoundaryAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->UnFreeBoundaryAspect();
|
||||
anAspect->SetColor( myUnFreeBoundaryColor );
|
||||
myDrawer->SetUnFreeBoundaryAspect( anAspect );
|
||||
}
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
|
||||
class PrsMgr_PresentationManager3d;
|
||||
class Prs3d_Presentation;
|
||||
class SALOME_InteractiveObject;
|
||||
@ -66,6 +68,14 @@ class GEOM_OBJECT_EXPORT GEOM_AISShape : public SALOME_AISShape {
|
||||
|
||||
public:
|
||||
|
||||
//! Enumeration of display modes
|
||||
typedef enum {
|
||||
//WireFrame, //!< the same as AIS_WireFrame
|
||||
//Shading, //!< the same as AIS_Shaded
|
||||
ShadingWithEdges = AIS_Shaded+1, //!< shading with edges
|
||||
TexturedShape = ShadingWithEdges+1 //!< the same as AIS_ExactHLR
|
||||
} DispMode;
|
||||
|
||||
inline void* operator new(size_t,void* anAddress)
|
||||
{
|
||||
return anAddress;
|
||||
@ -95,6 +105,7 @@ public:
|
||||
|
||||
void SetTransparency(const Standard_Real aValue);
|
||||
void SetShadingColor(const Quantity_Color &aCol);
|
||||
void SetEdgesInShadingColor(const Quantity_Color &aCol);
|
||||
void SetDisplayVectors(bool isShow);
|
||||
|
||||
virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
@ -109,9 +120,28 @@ public:
|
||||
const Handle(Standard_Type)& DynamicType() const;
|
||||
Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||
|
||||
void storeIsoNumbers();
|
||||
void restoreIsoNumbers();
|
||||
void resetIsoNumbers();
|
||||
|
||||
protected:
|
||||
void shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Standard_Integer aMode);
|
||||
|
||||
void storeBoundaryColors();
|
||||
void restoreBoundaryColors();
|
||||
|
||||
Quantity_Color myShadingColor;
|
||||
|
||||
Quantity_Color myFreeBoundaryColor;
|
||||
Quantity_Color myUnFreeBoundaryColor;
|
||||
|
||||
Quantity_Color myEdgesInShadingColor;
|
||||
|
||||
int myUIsoNumber;
|
||||
int myVIsoNumber;
|
||||
|
||||
private:
|
||||
TCollection_AsciiString myName;
|
||||
bool myDisplayVectors;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "GEOM_EdgeSource.h"
|
||||
#include "GEOM_WireframeFace.h"
|
||||
#include "GEOM_ShadingFace.h"
|
||||
#include "GEOM_PainterPolyDataMapper.h"
|
||||
#include "SVTK_Actor.h"
|
||||
|
||||
#include <OCC2VTK_Tools.h>
|
||||
@ -103,11 +104,17 @@ GEOM_Actor::GEOM_Actor():
|
||||
|
||||
myHighlightActor(GEOM_DeviceActor::New(),true),
|
||||
myAppendFilter(vtkAppendPolyData::New(),true),
|
||||
myPolyDataMapper(vtkPolyDataMapper::New(),true),
|
||||
// Use mapper as an instance of GEOM_PainterPolyDataMapper class
|
||||
// to prevent drawing of mappers' content (due to an empty definition
|
||||
// of GEOM_PainterPolyDataMapper::RenderPiece(...)).
|
||||
// !!! Presentation of GEOM_Actor is drawing only with help of actors
|
||||
// defined in this class !!!
|
||||
myPolyDataMapper(GEOM_PainterPolyDataMapper::New(),true),
|
||||
|
||||
myHighlightProp(vtkProperty::New()),
|
||||
myPreHighlightProp(vtkProperty::New()),
|
||||
myShadingFaceProp(vtkProperty::New())
|
||||
myShadingFaceProp(vtkProperty::New()),
|
||||
myShadingBackFaceProp(vtkProperty::New())
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
||||
@ -140,13 +147,13 @@ GEOM_Actor::GEOM_Actor():
|
||||
aProperty->SetPointSize(3);
|
||||
aProperty->SetColor(1, 1, 0);
|
||||
|
||||
myAppendFilter->AddInput(myIsolatedEdgeSource->GetOutput());
|
||||
myAppendFilter->AddInput(myIsolatedEdgeSource->GetOutput());
|
||||
myIsolatedEdgeActor->SetInput(myIsolatedEdgeSource->GetOutput(),false);
|
||||
aProperty = myIsolatedEdgeActor->GetProperty();
|
||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||
aProperty->SetColor(1, 0, 0);
|
||||
|
||||
myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput());
|
||||
myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput());
|
||||
myOneFaceEdgeActor->SetInput(myOneFaceEdgeSource->GetOutput(),false);
|
||||
aProperty = myOneFaceEdgeActor->GetProperty();
|
||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||
@ -166,7 +173,7 @@ GEOM_Actor::GEOM_Actor():
|
||||
|
||||
myShadingFaceActor->SetInput(myShadingFaceSource->GetOutput(),true);
|
||||
|
||||
myShadingFaceProp->SetRepresentation(VTK_SURFACE);
|
||||
myShadingFaceProp->SetRepresentation(VTKViewer::Representation::Surface);
|
||||
myShadingFaceProp->SetInterpolationToGouraud();
|
||||
myShadingFaceProp->SetAmbient(1.0);
|
||||
myShadingFaceProp->SetDiffuse(1.0);
|
||||
@ -177,10 +184,14 @@ GEOM_Actor::GEOM_Actor():
|
||||
|
||||
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||
|
||||
StoreBoundaryColors();
|
||||
|
||||
myNbIsos[0] = -1;
|
||||
myNbIsos[1] = -1;
|
||||
|
||||
// Toggle display mode
|
||||
setDisplayMode(0); // WIRE FRAME
|
||||
SetVectorMode(0); //
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -192,6 +203,7 @@ GEOM_Actor::~GEOM_Actor()
|
||||
myHighlightProp->Delete();
|
||||
myPreHighlightProp->Delete();
|
||||
myShadingFaceProp->Delete();
|
||||
myShadingBackFaceProp->Delete();
|
||||
}
|
||||
|
||||
GEOM_Actor*
|
||||
@ -282,8 +294,45 @@ GEOM_Actor::
|
||||
setDisplayMode(int theMode)
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
MESSAGE ( "GEOM_Actor::SetDisplayMode = "<<theMode );
|
||||
MESSAGE ( "GEOM_Actor::setDisplayMode = "<<theMode );
|
||||
#endif
|
||||
|
||||
if ( theMode == (int)eWireframe ) {
|
||||
RestoreIsoNumbers();
|
||||
// Restore wireframe edges colors
|
||||
RestoreBoundaryColors();
|
||||
}
|
||||
else if ( theMode == (int)eShading || theMode == (int)eShadingWithEdges ) {
|
||||
// Temporary store number of iso lines in order to recover its later
|
||||
// when display mode is achnged to 'Wirefame' or 'Shading'.
|
||||
// Iso lines are not displayed in 'Shading with edges' mode.
|
||||
StoreIsoNumbers();
|
||||
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
|
||||
if ( theMode == (int)eShadingWithEdges ) {
|
||||
// Store wireframe edges colors
|
||||
StoreBoundaryColors();
|
||||
|
||||
// Coloring edges
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
|
||||
myEdgesInShadingColor[1],
|
||||
myEdgesInShadingColor[2]);
|
||||
myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
|
||||
myEdgesInShadingColor[1],
|
||||
myEdgesInShadingColor[2]);
|
||||
mySharedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
|
||||
myEdgesInShadingColor[1],
|
||||
myEdgesInShadingColor[2]);
|
||||
//SetModified();
|
||||
} else {
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
|
||||
myEdgesInWireframeColor[1],
|
||||
myEdgesInWireframeColor[2]);
|
||||
}
|
||||
}
|
||||
|
||||
VTKViewer_Actor::setDisplayMode(theMode);
|
||||
SetVisibility(GetVisibility());
|
||||
}
|
||||
@ -313,14 +362,14 @@ SetVisibility(int theVisibility)
|
||||
|
||||
this->myHighlightActor->SetVisibility(theVisibility && (myIsSelected || myIsPreselected));
|
||||
|
||||
myShadingFaceActor->SetVisibility(theVisibility && (myDisplayMode == (int)eShading) && (!myIsSelected || !myIsPreselected));
|
||||
myWireframeFaceActor->SetVisibility(theVisibility && (myDisplayMode ==(int)eWireframe) && !myIsSelected);
|
||||
myShadingFaceActor->SetVisibility(theVisibility && (myDisplayMode == (int)eShading || myDisplayMode == (int)eShadingWithEdges) && (!myIsSelected || !myIsPreselected));
|
||||
myWireframeFaceActor->SetVisibility(theVisibility && (myDisplayMode == (int)eWireframe) && !myIsSelected);
|
||||
|
||||
mySharedEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);
|
||||
myOneFaceEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);
|
||||
mySharedEdgeActor->SetVisibility(theVisibility && (myDisplayMode == (int)eWireframe || myDisplayMode == (int)eShadingWithEdges) && !myIsSelected);
|
||||
myOneFaceEdgeActor->SetVisibility(theVisibility && (myDisplayMode == (int)eWireframe || myDisplayMode == (int)eShadingWithEdges) && !myIsSelected);
|
||||
myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected);
|
||||
|
||||
myVertexActor->SetVisibility(theVisibility && !myIsSelected);// must be added new mode points
|
||||
myVertexActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);// must be added new mode points
|
||||
}
|
||||
|
||||
|
||||
@ -479,11 +528,12 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
|
||||
}
|
||||
|
||||
switch(myDisplayMode){
|
||||
case 0://wireframe
|
||||
case eWireframe://wireframe
|
||||
myPreHighlightProp->SetRepresentationToWireframe();
|
||||
myHighlightProp->SetRepresentationToWireframe();
|
||||
break;
|
||||
case 1://shading
|
||||
case eShading://shading
|
||||
case eShadingWithEdges://shading with edges
|
||||
myPreHighlightProp->SetRepresentationToSurface();
|
||||
myHighlightProp->SetRepresentationToSurface();
|
||||
break;
|
||||
@ -493,14 +543,17 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
|
||||
if(myIsPreselected){
|
||||
this->myHighlightActor->SetProperty(myPreHighlightProp.GetPointer());
|
||||
myShadingFaceActor->SetProperty(myPreHighlightProp.GetPointer());
|
||||
myShadingFaceActor->SetBackfaceProperty(myPreHighlightProp.GetPointer());
|
||||
} else {
|
||||
this->myHighlightActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||
myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
|
||||
}
|
||||
}
|
||||
else{
|
||||
this->myHighlightActor->SetProperty(myHighlightProp.GetPointer());
|
||||
myShadingFaceActor->SetProperty(myHighlightProp.GetPointer());
|
||||
myShadingFaceActor->SetBackfaceProperty(myHighlightProp.GetPointer());
|
||||
}
|
||||
|
||||
this->Property->Render(this, ren);
|
||||
@ -604,13 +657,14 @@ void GEOM_Actor::highlight(bool highlight)
|
||||
#ifdef MYDEBUG
|
||||
MESSAGE ( this << " GEOM_Actor::highlight highlight="<<highlight );
|
||||
#endif
|
||||
SALOME_Actor::highlight(highlight);
|
||||
SALOME_Actor::highlight(highlight);
|
||||
}
|
||||
|
||||
void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
|
||||
{
|
||||
// enk:tested OK
|
||||
myShadingFaceProp->SetOpacity(opa);
|
||||
myShadingBackFaceProp->SetOpacity(opa);
|
||||
myHighlightProp->SetOpacity(opa);
|
||||
myPreHighlightProp->SetOpacity(opa);
|
||||
myVertexActor->GetProperty()->SetOpacity(opa);
|
||||
@ -626,10 +680,13 @@ void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloat
|
||||
{
|
||||
// enk:tested OK
|
||||
myShadingFaceProp->SetColor(r,g,b); // shading color (Shading)
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe)
|
||||
myShadingBackFaceProp->SetColor(r,g,b); // back face shading color (Shading)
|
||||
myVertexActor->GetProperty()->SetColor(r,g,b); // vertex actor (Shading/Wireframe)
|
||||
myOneFaceEdgeActor->GetProperty()->SetColor(r,g,b); // standalone face edge color (Wireframe)
|
||||
mySharedEdgeActor->GetProperty()->SetColor(r,g,b); // share edge color (Wireframe)
|
||||
if ( myDisplayMode != (int)eShadingWithEdges ) {
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe)
|
||||
myOneFaceEdgeActor->GetProperty()->SetColor(r,g,b); // standalone face edge color (Wireframe)
|
||||
mySharedEdgeActor->GetProperty()->SetColor(r,g,b); // share edge color (Wireframe)
|
||||
}
|
||||
}
|
||||
|
||||
void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
|
||||
@ -642,6 +699,93 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
|
||||
b = aRGB[2];
|
||||
}
|
||||
|
||||
void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
|
||||
{
|
||||
int aSize = theProps.size();
|
||||
|
||||
if ( aSize < 1 || aSize > 2)
|
||||
return;
|
||||
|
||||
// theProps[0] -- front material properties
|
||||
// theProps[1] -- back material properties (if exist)
|
||||
// If there are no back material properties,
|
||||
// we get front material properties as back material
|
||||
|
||||
double aCoefnt;
|
||||
|
||||
// Set reflection coefficients
|
||||
aCoefnt = theProps[0]->GetAmbient();
|
||||
myShadingFaceProp->SetAmbient(aCoefnt);
|
||||
myVertexActor->GetProperty()->SetAmbient(aCoefnt);
|
||||
if ( aSize == 2 )
|
||||
aCoefnt = theProps[1]->GetAmbient();
|
||||
myShadingBackFaceProp->SetAmbient(aCoefnt);
|
||||
|
||||
// Set diffuse coefficients
|
||||
aCoefnt = theProps[0]->GetDiffuse();
|
||||
myShadingFaceProp->SetDiffuse(aCoefnt);
|
||||
myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
|
||||
if ( aSize == 2 )
|
||||
aCoefnt = theProps[1]->GetDiffuse();
|
||||
myShadingBackFaceProp->SetDiffuse(aCoefnt);
|
||||
|
||||
// Set specular coefficients
|
||||
aCoefnt = theProps[0]->GetSpecular();
|
||||
myShadingFaceProp->SetSpecular(aCoefnt);
|
||||
myVertexActor->GetProperty()->SetSpecular(aCoefnt);
|
||||
if ( aSize == 2 )
|
||||
aCoefnt = theProps[1]->GetSpecular();
|
||||
myShadingBackFaceProp->SetSpecular(aCoefnt);
|
||||
|
||||
|
||||
double* aColor;
|
||||
|
||||
// Set reflection colors
|
||||
aColor = theProps[0]->GetAmbientColor();
|
||||
myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||
myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||
if ( aSize == 2 )
|
||||
aColor = theProps[1]->GetAmbientColor();
|
||||
myShadingBackFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||
|
||||
// Set diffuse colors
|
||||
aColor = theProps[0]->GetDiffuseColor();
|
||||
myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||
myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||
if ( aSize == 2 )
|
||||
aColor = theProps[1]->GetDiffuseColor();
|
||||
myShadingBackFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||
|
||||
// Set specular colors
|
||||
aColor = theProps[0]->GetSpecularColor();
|
||||
myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||
myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||
if ( aSize == 2 )
|
||||
aColor = theProps[1]->GetSpecularColor();
|
||||
myShadingBackFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||
|
||||
// Set shininess
|
||||
aCoefnt = theProps[0]->GetSpecularPower();
|
||||
myShadingFaceProp->SetSpecularPower(aCoefnt);
|
||||
myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
|
||||
if ( aSize == 2 )
|
||||
aCoefnt = theProps[1]->GetSpecularPower();
|
||||
myShadingBackFaceProp->SetSpecularPower(aCoefnt);
|
||||
|
||||
// Set back face material property
|
||||
myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
|
||||
}
|
||||
|
||||
vtkProperty* GEOM_Actor::GetFrontMaterial()
|
||||
{
|
||||
return myShadingFaceProp;
|
||||
}
|
||||
|
||||
vtkProperty* GEOM_Actor::GetBackMaterial()
|
||||
{
|
||||
return myShadingBackFaceProp;
|
||||
}
|
||||
|
||||
bool GEOM_Actor::IsInfinitive()
|
||||
{
|
||||
return ((bool)myShape.Infinite() || isOnlyVertex);
|
||||
@ -658,7 +802,15 @@ GEOM_Actor
|
||||
#ifdef MYDEBUG
|
||||
MESSAGE ( this << " GEOM_Actor::Highlight myIsSelected="<<myIsSelected );
|
||||
#endif
|
||||
|
||||
|
||||
if ( myDisplayMode == (int)eShading || myDisplayMode == (int)eShadingWithEdges ) {
|
||||
if ( theIsHighlight )
|
||||
RestoreIsoNumbers();
|
||||
else
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
}
|
||||
|
||||
SALOME_Actor::Highlight(theIsHighlight); // this method call ::highlight(theIsHighlight) in the end
|
||||
SetVisibility(GetVisibility());
|
||||
}
|
||||
@ -679,6 +831,14 @@ GEOM_Actor
|
||||
if ( !GetPickable() )
|
||||
return false;
|
||||
|
||||
if ( myDisplayMode == (int)eShading || myDisplayMode == (int)eShadingWithEdges ) {
|
||||
if ( theIsHighlight )
|
||||
RestoreIsoNumbers();
|
||||
else
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
}
|
||||
|
||||
myPreHighlightActor->SetVisibility( false );
|
||||
bool anIsPreselected = myIsPreselected;
|
||||
|
||||
@ -821,4 +981,45 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result)
|
||||
this->Transform->Pop();
|
||||
}
|
||||
|
||||
void GEOM_Actor::SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
|
||||
{
|
||||
myEdgesInShadingColor[0] = r;
|
||||
myEdgesInShadingColor[1] = g;
|
||||
myEdgesInShadingColor[2] = b;
|
||||
}
|
||||
|
||||
void GEOM_Actor::StoreIsoNumbers()
|
||||
{
|
||||
myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]);
|
||||
}
|
||||
|
||||
void GEOM_Actor::RestoreIsoNumbers()
|
||||
{
|
||||
if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 )
|
||||
// Restore number of U and (or) V iso lines
|
||||
myWireframeFaceSource->SetNbIso(myNbIsos);
|
||||
}
|
||||
|
||||
void GEOM_Actor::ResetIsoNumbers()
|
||||
{
|
||||
int aNb[2] = {0, 0};
|
||||
myWireframeFaceSource->SetNbIso(aNb);
|
||||
}
|
||||
|
||||
void GEOM_Actor::StoreBoundaryColors()
|
||||
{
|
||||
mySharedEdgeActor->GetProperty()->GetColor(myEdgesInWireframeColor);
|
||||
}
|
||||
|
||||
void GEOM_Actor::RestoreBoundaryColors()
|
||||
{
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
|
||||
myEdgesInWireframeColor[1],
|
||||
myEdgesInWireframeColor[2]);
|
||||
myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
|
||||
myEdgesInWireframeColor[1],
|
||||
myEdgesInWireframeColor[2]);
|
||||
mySharedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
|
||||
myEdgesInWireframeColor[1],
|
||||
myEdgesInWireframeColor[2]);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
void AddToRender(vtkRenderer* theRenderer);
|
||||
void RemoveFromRender(vtkRenderer* theRenderer);
|
||||
|
||||
enum EDisplayMode{ eWireframe, eShading};
|
||||
enum EDisplayMode{ eWireframe, eShading, eShadingWithEdges = eShading + 2 };
|
||||
|
||||
/* void SetDisplayMode(EDisplayMode theMode); */
|
||||
/* EDisplayMode GetDisplayMode() const { return myDisplayMode;} */
|
||||
@ -122,6 +122,11 @@ public:
|
||||
void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
|
||||
void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
|
||||
|
||||
// Material
|
||||
void SetMaterial(std::vector<vtkProperty*> theProps);
|
||||
vtkProperty* GetFrontMaterial();
|
||||
vtkProperty* GetBackMaterial();
|
||||
|
||||
virtual bool IsInfinitive();
|
||||
|
||||
// overloaded functions
|
||||
@ -169,12 +174,27 @@ public:
|
||||
virtual
|
||||
bool
|
||||
GetVectorMode();
|
||||
|
||||
//! Edges in shading color management
|
||||
void SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
|
||||
|
||||
void
|
||||
StoreIsoNumbers();
|
||||
|
||||
void
|
||||
RestoreIsoNumbers();
|
||||
|
||||
void
|
||||
ResetIsoNumbers();
|
||||
|
||||
protected:
|
||||
void SetModified();
|
||||
|
||||
void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
|
||||
|
||||
void StoreBoundaryColors();
|
||||
void RestoreBoundaryColors();
|
||||
|
||||
GEOM_Actor();
|
||||
~GEOM_Actor();
|
||||
|
||||
@ -212,14 +232,18 @@ private:
|
||||
vtkSmartPointer<vtkProperty> myHighlightProp;
|
||||
vtkSmartPointer<vtkProperty> myPreHighlightProp;
|
||||
vtkSmartPointer<vtkProperty> myShadingFaceProp;
|
||||
vtkSmartPointer<vtkProperty> myShadingBackFaceProp;
|
||||
|
||||
PAppendFilter myAppendFilter;
|
||||
PPolyDataMapper myPolyDataMapper;
|
||||
PPolyGeomPainterDataMapper myPolyDataMapper;
|
||||
|
||||
virtual void SetMapper(vtkMapper*);
|
||||
|
||||
GEOM_Actor(const GEOM_Actor&);
|
||||
void operator=(const GEOM_Actor&);
|
||||
|
||||
vtkFloatingPointType myEdgesInWireframeColor[3];
|
||||
vtkFloatingPointType myEdgesInShadingColor[3];
|
||||
};
|
||||
|
||||
#endif //GEOM_ACTOR_H
|
||||
|
49
src/OBJECT/GEOM_Constants.h
Normal file
49
src/OBJECT/GEOM_Constants.h
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2007-2011 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 : GEOM_Constants.h
|
||||
// Author : Margarita KARPUNINA
|
||||
// Module : GEOM
|
||||
//
|
||||
#ifndef GEOM_CONSTANTS_H
|
||||
#define GEOM_CONSTANTS_H
|
||||
|
||||
// minimum allowed value for deflection coefficient
|
||||
#define DEFLECTION_MIN 1e-06
|
||||
|
||||
//Define separators
|
||||
#define NAME_SEPARATOR '_' // character used to separate parameter names
|
||||
#define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b)
|
||||
|
||||
#define VISIBILITY_PROP "Visibility" //Object visibility property
|
||||
#define OPACITY_PROP "Opacity" //Object opacity property
|
||||
#define TRANSPARENCY_PROP "Transparency" //Object transparency property
|
||||
#define DISPLAY_MODE_PROP "DisplayMode" //Object display mode property
|
||||
#define ISOS_PROP "Isos" //Number of the Isos property of the object
|
||||
#define COLOR_PROP "Color" //Color of the object
|
||||
#define VECTOR_MODE_PROP "VectorMode" //Vector mode property
|
||||
#define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property
|
||||
#define MARKER_TYPE_PROP "MarkerType" //Marker type property
|
||||
#define FRONT_MATERIAL_PROP "FrontMaterial" //Object front material property
|
||||
#define BACK_MATERIAL_PROP "BackMaterial" //Object back material property
|
||||
|
||||
#endif //GEOM_CONSTANTS_H
|
@ -72,6 +72,20 @@ GetProperty()
|
||||
{
|
||||
return myActor->GetProperty();
|
||||
}
|
||||
|
||||
void
|
||||
GEOM_DeviceActor::
|
||||
SetBackfaceProperty(vtkProperty* theProperty)
|
||||
{
|
||||
myActor->SetBackfaceProperty(theProperty);
|
||||
}
|
||||
|
||||
vtkProperty*
|
||||
GEOM_DeviceActor::
|
||||
GetBackfaceProperty()
|
||||
{
|
||||
return myActor->GetBackfaceProperty();
|
||||
}
|
||||
|
||||
void
|
||||
GEOM_DeviceActor::
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
|
||||
void SetProperty(vtkProperty* theProperty);
|
||||
vtkProperty* GetProperty();
|
||||
|
||||
void SetBackfaceProperty(vtkProperty* theProperty);
|
||||
vtkProperty* GetBackfaceProperty();
|
||||
|
||||
void SetVisibility(int theVisibility);
|
||||
int GetVisibility();
|
||||
|
24
src/OBJECT/GEOM_PainterPolyDataMapper.cxx
Normal file
24
src/OBJECT/GEOM_PainterPolyDataMapper.cxx
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
#include "GEOM_PainterPolyDataMapper.h"
|
||||
|
||||
#include <vtkObjectFactory.h>
|
||||
|
||||
vtkStandardNewMacro(GEOM_PainterPolyDataMapper);
|
44
src/OBJECT/GEOM_PainterPolyDataMapper.h
Normal file
44
src/OBJECT/GEOM_PainterPolyDataMapper.h
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
#ifndef GEOM_PAINTERPOLYDATAMAPPER_H
|
||||
#define GEOM_PAINTERPOLYDATAMAPPER_H
|
||||
|
||||
#include <vtkPainterPolyDataMapper.h>
|
||||
|
||||
/*
|
||||
* This class can be used to prevent drawing of mappers' content (due to an
|
||||
* empty definition of GEOM_PainterPolyDataMapper::RenderPiece(...) method).
|
||||
* It is used as poly data mapper in GEOM_Actor class.
|
||||
*/
|
||||
class GEOM_PainterPolyDataMapper: public vtkPainterPolyDataMapper
|
||||
{
|
||||
public:
|
||||
vtkTypeMacro(GEOM_PainterPolyDataMapper,vtkPainterPolyDataMapper);
|
||||
static GEOM_PainterPolyDataMapper* New();
|
||||
|
||||
virtual void RenderPiece(vtkRenderer *ren, vtkActor *act) {}
|
||||
|
||||
protected:
|
||||
GEOM_PainterPolyDataMapper() {}
|
||||
~GEOM_PainterPolyDataMapper() {}
|
||||
|
||||
};
|
||||
|
||||
#endif //GEOM_PAINTERPOLYDATAMAPPER_H
|
@ -41,12 +41,14 @@ public:
|
||||
T* Get() const { return this->GetPointer();}
|
||||
};
|
||||
|
||||
|
||||
class GEOM_DeviceActor;
|
||||
typedef GEOM_SmartPtr<GEOM_DeviceActor> PDeviceActor;
|
||||
|
||||
class vtkPolyDataMapper;
|
||||
typedef GEOM_SmartPtr<vtkPolyDataMapper> PPolyDataMapper;
|
||||
typedef GEOM_SmartPtr<vtkPolyDataMapper> PPolyDataMapper;
|
||||
|
||||
class GEOM_PainterPolyDataMapper;
|
||||
typedef GEOM_SmartPtr<GEOM_PainterPolyDataMapper> PPolyGeomPainterDataMapper;
|
||||
|
||||
|
||||
#endif //GEOM_SMARTPTR_H
|
||||
|
@ -42,6 +42,7 @@ salomeinclude_HEADERS = \
|
||||
GEOM_OBJECT_defs.hxx \
|
||||
GEOM_OCCReader.h \
|
||||
GEOM_SmartPtr.h \
|
||||
GEOM_PainterPolyDataMapper.h \
|
||||
GEOM_DeviceActor.h
|
||||
|
||||
# Libraries targets
|
||||
@ -55,6 +56,7 @@ dist_libGEOMObject_la_SOURCES = \
|
||||
GEOM_AISTrihedron.cxx \
|
||||
GEOM_VTKTrihedron.cxx \
|
||||
GEOM_AISVector.cxx \
|
||||
GEOM_PainterPolyDataMapper.cxx \
|
||||
GEOM_DeviceActor.cxx
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user