From: ouv Date: Thu, 25 Mar 2010 13:48:01 +0000 (+0000) Subject: Issue 0020613: EDF 1106 : Modify Node Marker in SMESH and VISU X-Git-Tag: V5_1_main_20100326 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cf23216ed711e4c24105040f2d9e6947de5df061;p=modules%2Fvisu.git Issue 0020613: EDF 1106 : Modify Node Marker in SMESH and VISU --- diff --git a/doc/salome/gui/VISU/images/custom_point_marker.png b/doc/salome/gui/VISU/images/custom_point_marker.png new file mode 100755 index 00000000..29b2dd90 Binary files /dev/null and b/doc/salome/gui/VISU/images/custom_point_marker.png differ diff --git a/doc/salome/gui/VISU/images/point_marker_dlg1.png b/doc/salome/gui/VISU/images/point_marker_dlg1.png new file mode 100755 index 00000000..9bcecefc Binary files /dev/null and b/doc/salome/gui/VISU/images/point_marker_dlg1.png differ diff --git a/doc/salome/gui/VISU/images/point_marker_dlg2.png b/doc/salome/gui/VISU/images/point_marker_dlg2.png new file mode 100755 index 00000000..3a67294c Binary files /dev/null and b/doc/salome/gui/VISU/images/point_marker_dlg2.png differ diff --git a/doc/salome/gui/VISU/images/std_point_marker.png b/doc/salome/gui/VISU/images/std_point_marker.png new file mode 100755 index 00000000..f35b0df7 Binary files /dev/null and b/doc/salome/gui/VISU/images/std_point_marker.png differ diff --git a/doc/salome/gui/VISU/input/3d_management.doc b/doc/salome/gui/VISU/input/3d_management.doc index 962f0d57..2b54a0cd 100755 --- a/doc/salome/gui/VISU/input/3d_management.doc +++ b/doc/salome/gui/VISU/input/3d_management.doc @@ -38,6 +38,8 @@ module are: presentations on fields.
  • \subpage evolution_page - tracing of temporal evolution of a variable at a given point.
  • +
  • \subpage point_marker_page - allows to change the representation +of points, using standard or custom markers.
  • \subpage translate_presentation_page - displacement of presentations in the viewer.
  • \subpage recording_page - allows to dump user actions in an AVI diff --git a/doc/salome/gui/VISU/input/point_marker.doc b/doc/salome/gui/VISU/input/point_marker.doc new file mode 100644 index 00000000..efd0bcd9 --- /dev/null +++ b/doc/salome/gui/VISU/input/point_marker.doc @@ -0,0 +1,56 @@ +/*! + +\page point_marker_page Point Marker + +\n You can change the representation of points in +the 3D viewer either by selecting one of the predefined +shapes or by loading a custom texture from an external file. + +- Standard point markers + +The Post-Pro module provides a set of predefined point marker shapes +which can be used to display points in 3D viewer. +Each standard point marker has two attributes: type (defines shape +form) and scale factor (defines shape size). + +\image html point_marker_dlg1.png + +
    + +\image html std_point_marker.png "Presentation with standard point markers" + +- Custom point markers + +It is also possible to load a point marker shape from an external file. +This file should provide a description of the point texture as a set +of lines; each line is represented as sequence of "0" and "1" symbols, +where "1" symbol means an opaque pixel and "0" symbol means a +transparent pixel. The width of the texture correspond to the length +of the longest line in the file, expanded to the nearest byte-aligned +value. The height of the texture is equal to the number of non-empty +lines in the file. Note that missing symbols are replaced by "0". + +Here is a texture file sample: + +
    +00111100
    +00111100
    +11111111
    +11111111
    +11111111
    +11111111
    +00111100
    +00111100
    +
    + +\image html point_marker_dlg2.png + +
    + +\image html custom_point_marker.png "Presentation with custom point markers" + + +Our TUI Scripts provide you with \subpage tui_point_marker_page script. + +*/ + diff --git a/doc/salome/gui/VISU/input/tui_point_marker.doc b/doc/salome/gui/VISU/input/tui_point_marker.doc new file mode 100644 index 00000000..1199dc9a --- /dev/null +++ b/doc/salome/gui/VISU/input/tui_point_marker.doc @@ -0,0 +1,48 @@ +/*! + +\page tui_point_marker_page Example of using Point Markers + +\code +import os +import time +import VISU +from visu_gui import * + +data_dir = os.getenv("DATA_DIR") +sleep_delay = 2 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView() +myView.SetTitle("The viewer for Point Marker Example") +print "myViewManager.Create3DView()" + +medFile = "fra.med" +medFile = data_dir + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +aMeshName ="LE VOLUME" +anEntity = VISU.NODE +aFieldName = "VITESSE"; +aTimeStampId = 1 + +aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,aFieldName,aTimeStampId) +myView.Display(aScalarMap); +myView.FitAll(); + +print "Set representation type to Point" +myView.SetPresentationType(aScalarMap, VISU.POINT) + +print "Set standard marker" +aScalarMap.SetMarkerStd(VISU.MT_PLUS, VISU.MS_25) +myView.Update() +time.sleep(sleep_delay) + +print "Set custom marker" +custom_texture = myVisu.LoadTexture(os.path.join(data_dir, "Textures", "texture1.dat")) +aScalarMap.SetMarkerTexture(custom_texture) +myView.Update() + +\endcode + +*/ diff --git a/doc/salome/gui/VISU/input/viewing_3d_presentations.doc b/doc/salome/gui/VISU/input/viewing_3d_presentations.doc index fb116a68..0ea0cecc 100644 --- a/doc/salome/gui/VISU/input/viewing_3d_presentations.doc +++ b/doc/salome/gui/VISU/input/viewing_3d_presentations.doc @@ -102,6 +102,8 @@ are visualized: as straight lines or as arcs of circle. shrink_factor.png - Edge Color - allows to set the color of lines representing the edges of the presentation displayed in SurfaceFrame mode. + - \ref point_marker_page "Point Marker" - allows to change the + representation of points. - \ref translate_presentation_page "Translate Presentation" - allows to translate the presentation along coordinate axes. diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index dded558f..c5e40f34 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -78,6 +78,43 @@ module VISU { NONE /*!< Indicates undefined entity value */ }; + /*! + * Marker type (used for point rendering) + */ + enum MarkerType { + MT_NONE, + MT_POINT, + MT_PLUS, + MT_STAR, + MT_O, + MT_X, + MT_O_POINT, + MT_O_PLUS, + MT_O_STAR, + MT_O_X, + MT_USER + }; + + /*! + * Marker scale (used for point rendering) + */ + enum MarkerScale { + MS_NONE, + MS_10, + MS_15, + MS_20, + MS_25, + MS_30, + MS_35, + MS_40, + MS_45, + MS_50, + MS_55, + MS_60, + MS_65, + MS_70 + }; + /*! * This enumeration contains a set of elements defining the type of the %VISU object. * This enumeration is used for navigation between a set of %VISU interfaces. @@ -307,6 +344,38 @@ module VISU { */ void GetOffset(out float theDx, out float theDy, out float theDz); + /*! + * Set standard point marker for the object + * \param theType standard marker type + * \param theScale standard marker scale + */ + void SetMarkerStd(in MarkerType theType, in MarkerScale theScale); + + /*! + * Set custom point marker for the object. The texture can be added + * by LoadTexture() function + * \param theTextureId texture ID + */ + void SetMarkerTexture(in long theTextureId); + + /*! + * Get type of the point marker assigned to the object + * \return current marker type (MT_NONE if no marker is set) + */ + MarkerType GetMarkerType(); + + /*! + * Get scale of the point marker assigned to the object + * \return current marker scale (MS_NONE if no marker is set) + */ + MarkerScale GetMarkerScale(); + + /*! + * Get texture idenifier of the point marker assigned to the object + * \return marker texture ID (0 if no marker set) + */ + long GetMarkerTexture(); + /*! * Gets memory size actually used by the presentation (Mb). */ @@ -2492,6 +2561,12 @@ module VISU { in string theMeshName, in double_array theTStamps ); + /*! + * Load texture from file + * \param theTextureFile texture file name + * \return unique texture identifier + */ + long LoadTexture(in string theTextureFile); }; /*! \brief %View interface diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index e25cb85c..2e79ca19 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -63,6 +63,8 @@ + + diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index 117e5473..291258e4 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -546,4 +546,9 @@ namespace VISU{ return myVisuGen->VTK2MED(theVTKFiles, theMEDFile, theMeshName, theTStamps); } + /* Load texture from file */ + CORBA::Long VISU_Gen_i::LoadTexture(const char* theTextureFile) + { + return myVisuGen->LoadTexture(theTextureFile); + } }; diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 97cff3cd..ecf428c2 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -276,6 +276,9 @@ namespace VISU const char* theMEDFile, const char* theMeshName, const VISU::double_array& theTStamps ); + + /* Load texture from file */ + virtual CORBA::Long LoadTexture(const char* theTextureFile); }; }; diff --git a/src/OBJECT/VISU_DataSetActor.cxx b/src/OBJECT/VISU_DataSetActor.cxx index 128982ab..05fda9ba 100644 --- a/src/OBJECT/VISU_DataSetActor.cxx +++ b/src/OBJECT/VISU_DataSetActor.cxx @@ -28,7 +28,8 @@ #include "VISU_UnstructuredGridPL.hxx" #include "VISU_PipeLineUtils.hxx" -#include +#include + #include #include #include @@ -52,7 +53,7 @@ vtkStandardNewMacro(VISU_DataSetActor); //---------------------------------------------------------------------------- VISU_DataSetActor ::VISU_DataSetActor(): - myMapper(vtkDataSetMapper::New()), + myMapper(VTKViewer_DataSetMapper::New()), myExtractor(SALOME_ExtractGeometry::New()), myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()), myFunction(vtkImplicitBoolean::New()) diff --git a/src/OBJECT/VISU_DataSetActor.h b/src/OBJECT/VISU_DataSetActor.h index b3aa197a..9261b6f9 100644 --- a/src/OBJECT/VISU_DataSetActor.h +++ b/src/OBJECT/VISU_DataSetActor.h @@ -31,6 +31,7 @@ #include "VISU_Actor.h" class vtkDataSetMapper; +class VTKViewer_DataSetMapper; class SALOME_ExtractGeometry; class SALOME_ExtractPolyDataGeometry; class vtkImplicitBoolean; @@ -77,7 +78,7 @@ class VISU_OBJECT_EXPORT VISU_DataSetActor : public VISU_Actor SetMapperInput(vtkDataSet* theDataSet); //---------------------------------------------------------------------------- - vtkSmartPointer myMapper; + vtkSmartPointer myMapper; vtkSmartPointer myExtractor; vtkSmartPointer myPolyDataExtractor; vtkSmartPointer myFunction; diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index 13e81879..41799765 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -457,3 +457,15 @@ void VISU_MeshAct::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theM break; } } + +void VISU_MeshAct::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale ) +{ + Superclass::SetMarkerStd( theMarkerType, theMarkerScale ); + myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale ); +} + +void VISU_MeshAct::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture ) +{ + Superclass::SetMarkerTexture( theMarkerId, theMarkerTexture ); + myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture ); +} diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index 1c041bde..9e24df92 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -141,6 +141,13 @@ class VISU_OBJECT_EXPORT VISU_MeshAct : public VISU_DataSetActor virtual void SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode ); + virtual + void + SetMarkerStd( VTK::MarkerType, VTK::MarkerScale ); + + virtual + void + SetMarkerTexture( int, VTK::MarkerTexture ); protected: VISU_MeshAct(); diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index 7daf7259..54996e98 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -55,163 +55,6 @@ #include -//============================================================================ -class VISU_PointsDeviceActor: public VISU_GaussDeviceActorBase -{ - public: - vtkTypeMacro(VISU_PointsDeviceActor, VISU_GaussDeviceActorBase); - - static - VISU_PointsDeviceActor* - New(); - - - //---------------------------------------------------------------------------- - virtual - void - SetInput(vtkDataSet* theDataSet) - { - myGeomFilter->SetInput( theDataSet ); - } - - - //---------------------------------------------------------------------------- - void - SetInteractor(vtkRenderWindowInteractor* theInteractor) - { - if(theInteractor == myInteractor) - return; - - if(myInteractor) - myInteractor->RemoveObserver(myEventCallbackCommand); - - if(theInteractor) - theInteractor->AddObserver(vtkCommand::CharEvent, - myEventCallbackCommand, - 0.0); - - myInteractor = theInteractor; - } - - - //---------------------------------------------------------------------------- - void - DoMapperShallowCopy( vtkMapper* theMapper, - bool theIsCopyInput ) - { - Superclass::DoMapperShallowCopy( theMapper, theIsCopyInput ); - - vtkDataSet* aDataSet = theMapper->GetInput(); - vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); - - GetPointSpriteMapper()->SetAverageCellSize( aScaleFactor ); - } - - - //---------------------------------------------------------------------------- - void - DeepCopy( VISU_PointsDeviceActor *theActor ) - { - VISU::CopyPointSpriteDataMapper( GetPointSpriteMapper(), theActor->GetPointSpriteMapper(), false ); - } - - protected: - //---------------------------------------------------------------------------- - VISU_PointsDeviceActor(): - myGeomFilter( VTKViewer_GeometryFilter::New() ), - myEventCallbackCommand( vtkCallbackCommand::New() ), - myInteractor( NULL ) - { - myGeomFilter->SetInside(true); - - VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New(); - aMapper->SetInput( myGeomFilter->GetOutput() ); - - std::string aRootDir( getenv( "VISU_ROOT_DIR") ); - std::string aMainTexture = aRootDir + "/share/salome/resources/visu/sprite_texture.bmp"; - std::string anAlphaTexture = aRootDir + "/share/salome/resources/visu/sprite_alpha.bmp"; - VISU::TTextureValue aTextureValue = VISU::GetTexture( aMainTexture, anAlphaTexture ); - aMapper->SetImageData( aTextureValue.GetPointer() ); - - aMapper->SetUseLookupTableScalarRange(true); - aMapper->SetColorModeToMapScalars(); - aMapper->SetScalarVisibility(true); - - SetPointSpriteMapper( aMapper ); - - aMapper->Delete(); - - myEventCallbackCommand->SetClientData( this ); - myEventCallbackCommand->SetCallback( VISU_PointsDeviceActor::ProcessEvents ); - } - - - //---------------------------------------------------------------------------- - ~VISU_PointsDeviceActor() - { - SetInteractor( NULL ); - myGeomFilter->Delete(); - myEventCallbackCommand->Delete(); - } - - - //---------------------------------------------------------------------------- - static - void - ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData) - { - if ( VISU_PointsDeviceActor* self = reinterpret_cast( theClientData ) ) - self->OnInteractorEvent( theEvent ); - } - - - //---------------------------------------------------------------------------- - void - OnInteractorEvent(unsigned long theEvent) - { - switch ( theEvent ) { - case vtkCommand::CharEvent: { - switch( myInteractor->GetKeyCode() ) { - case 'M' : - case 'm' : { - if ( !GetVisibility() ) - return; - - static vtkFloatingPointType anIncrement = 2; - vtkFloatingPointType aMagnification = GetPointSpriteMapper()->GetPointSpriteMagnification(); - vtkFloatingPointType coefficient = myInteractor->GetShiftKey() ? anIncrement : 1 / anIncrement; - - GetPointSpriteMapper()->SetPointSpriteMagnification( aMagnification * coefficient ); - - myInteractor->CreateTimer(VTKI_TIMER_UPDATE); - break; - } - default: - return; - } - break; - } - default: - return; - } - } - - - //---------------------------------------------------------------------------- - vtkCallbackCommand* myEventCallbackCommand; - vtkRenderWindowInteractor* myInteractor; - VTKViewer_GeometryFilter* myGeomFilter; - - private: - VISU_PointsDeviceActor(const VISU_PointsDeviceActor&); // Not implemented - void operator=(const VISU_PointsDeviceActor&); // Not implemented -}; - -vtkStandardNewMacro(VISU_PointsDeviceActor); - //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_ScalarMapAct); static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT; @@ -241,7 +84,8 @@ VISU_ScalarMapAct myEdgeActor->SetUserMatrix(aMatrix); myEdgeActor->GetProperty()->SetColor(255.,255.,255.); - myPointsActor = VISU_PointsDeviceActor::New(); + myPointsActor = SVTK_DeviceActor::New(); + myPointsActor->SetRepresentation(SVTK::Representation::Points); myPointsActor->SetProperty(aProperty); myPointsActor->SetUserMatrix(aMatrix); @@ -280,8 +124,7 @@ VISU_ScalarMapAct myEdgeActor->GetMapper()->ScalarVisibilityOff(); - myPointsActor->DoMapperShallowCopy( thePipeLine->GetMapper(), false ); - + VISU::CopyMapper( myPointsActor->GetMapper(), thePipeLine->GetMapper(), false ); VISU::CopyMapper( mySurfaceActor->GetMapper(), thePipeLine->GetMapper(), false ); } @@ -465,7 +308,6 @@ VISU_ScalarMapAct if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ Superclass::DeepCopy(theActor); SetBarVisibility(anActor->GetBarVisibility()); - myPointsActor->DeepCopy( anActor->myPointsActor ); SetShading(anActor->IsShading()); } } @@ -478,8 +320,6 @@ VISU_ScalarMapAct { Superclass::AddToRender(theRenderer); - myPointsActor->SetInteractor( myInteractor ); - if(myScalarBar) theRenderer->AddActor2D(myScalarBar); } @@ -666,18 +506,6 @@ VISU_ScalarMapAct return 1; } -//---------------------------------------------------------------------------- -unsigned long int -VISU_ScalarMapAct -::GetMemorySize() -{ - unsigned long int aSize = Superclass::GetMemorySize(); - - aSize += myPointsActor->GetMemorySize(); - - return aSize; -} - //---------------------------------------------------------------------------- VISU_Actor::EQuadratic2DRepresentation @@ -708,3 +536,15 @@ void VISU_ScalarMapAct::SetQuadratic2DRepresentation( VISU_Actor::EQuadratic2DRe break; } } + +void VISU_ScalarMapAct::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale ) +{ + Superclass::SetMarkerStd( theMarkerType, theMarkerScale ); + myPointsActor->SetMarkerStd( theMarkerType, theMarkerScale ); +} + +void VISU_ScalarMapAct::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture ) +{ + Superclass::SetMarkerTexture( theMarkerId, theMarkerTexture ); + myPointsActor->SetMarkerTexture( theMarkerId, theMarkerTexture ); +} diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index f16e6ada..9ff48ab2 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -32,8 +32,6 @@ #include "VISU_DataSetActor.h" class VISU_ScalarBarActor; -class VISU_PointsDeviceActor; - //---------------------------------------------------------------------------- class VISU_OBJECT_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor @@ -171,11 +169,14 @@ class VISU_OBJECT_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor bool IsShading(); - //! Gets memory size used by the instance (bytes). virtual - unsigned long int - GetMemorySize(); - + void + SetMarkerStd( VTK::MarkerType, VTK::MarkerScale ); + + virtual + void + SetMarkerTexture( int, VTK::MarkerTexture ); + protected: VISU_ScalarMapAct(); @@ -186,7 +187,7 @@ class VISU_OBJECT_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor bool myBarVisibility; VISU_ScalarBarActor* myScalarBar; - VISU_PointsDeviceActor* myPointsActor; + SVTK_DeviceActor* myPointsActor; SVTK_DeviceActor* mySurfaceActor; SVTK_DeviceActor* myEdgeActor; }; diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 22d1baf4..f863f8b5 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -265,6 +265,10 @@ number of time stamps or number of components is not the same! VISU_LOGARITHMIC_SCALING Logarithmic + + VISU_MARKER_SCALE + Scale of marker + VISU_MAX Max: @@ -409,6 +413,10 @@ number of time stamps or number of components is not the same! VISU_TITLE Title + + VISU_TYPE_OF_MARKER + Type of marker + QUADRATIC_REPRESENT_MODE Representation of the 2D quadratic elements @@ -1241,6 +1249,10 @@ Please, refer to the documentation. MEN_POINT_SELECTION Point Selection + + MEN_POINT_MARKER + Point Marker + MEN_POINTS Points diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 97ba5489..330f6317 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -64,6 +64,7 @@ //#include "SVTK_MainWindow.h" #include "VTKViewer_Algorithm.h" +#include "VTKViewer_MarkerDlg.h" #include "SPlot2d_ViewModel.h" #include "VisuGUI_SetupPlot2dDlg.h" @@ -1428,6 +1429,67 @@ VisuGUI delete CursorDlg; } +//---------------------------------------------------------------------------- +void +VisuGUI +::OnChangePointMarker() +{ + SALOME_ListIO aListIO; + GetSelectionMgr( this )->selectedObjects( aListIO ); + if( aListIO.Extent() < 1 ) + return; + + VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap(); + _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) ); + int aStudyId = aCStudy->StudyId(); + + bool update = false; + for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() ) + { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + std::vector aPrsList = GetPrs3dList( this, anIO ); + for( int i = 0, n = aPrsList.size(); i < n; i++ ) + { + if( VISU::Prs3d_i* aPrs = aPrsList[i] ) + { + VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) ); + + aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] ); + + VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType(); + VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale(); + int aMarkerTextureCurrent = aPrs->GetMarkerTexture(); + if( aMarkerTypeCurrent != VISU::MT_USER ) + aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent ); + else + aDlg->setCustomMarker( aMarkerTextureCurrent ); + + if( aDlg->exec() ) + { + aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap(); + + VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType(); + VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale(); + int aMarkerTextureNew = aDlg->getCustomMarkerID(); + if( aMarkerTypeNew != VISU::MT_USER ) + aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew ); + else + aPrs->SetMarkerTexture( aMarkerTextureNew ); + + aPrs->UpdateActors(); + update = true; + } + + delete aDlg; + } + } + } + + if( update ) + if( SVTK_ViewWindow* vw = GetActiveViewWindow( this ) ) + vw->Repaint(); +} + //---------------------------------------------------------------------------- void VisuGUI @@ -2724,6 +2786,10 @@ VisuGUI tr("MEN_LINE_WIDTH"), "", 0, aParent, false, this, SLOT(OnChangeLines())); + createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(), + tr("MEN_POINT_MARKER"), "", 0, aParent, false, + this, SLOT(OnChangePointMarker())); + createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(), tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false, this, SLOT(OnChangeShrinkFactor())); @@ -3077,6 +3143,7 @@ VisuGUI mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width + mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor mgr->insert( separator(), -1, -1, -1 ); @@ -3258,6 +3325,7 @@ VisuGUI "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" ); mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" ); mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" ); + mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" ); mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" ); // rename command @@ -4125,6 +4193,32 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" ); addPreference( "", representGr, LightApp_Preferences::Space ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + + int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" ); + + QList aMarkerTypeIndicesList; + QList aMarkerTypeIconsList; + for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) { + QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i ); + QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) ); + aMarkerTypeIndicesList << i; + aMarkerTypeIconsList << pixmap; + } + setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList ); + setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList ); + + int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" ); + + QList aMarkerScaleIndicesList; + QStringList aMarkerScaleValuesList; + for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) { + aMarkerScaleIndicesList << i; + aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 ); + } + setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList ); + setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList ); + addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" ); sp = addPreference( "", representGr, LightApp_Preferences::Space ); setPreferenceProperty( sp, "hstretch", 0 ); diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 90205718..05f19dd8 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -153,6 +153,7 @@ protected slots: void OnChangeWireframeColor(); void OnChangeOpacity(); void OnChangeLines(); + void OnChangePointMarker(); void OnChangeShrinkFactor(); void OnShowTable(); diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 3b0be7fc..f0717599 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -92,6 +92,7 @@ #define VISU_EDGE_COLOR 4059 #define VISU_OPACITY 4060 #define VISU_LINE_WIDTH 4061 +#define VISU_POINT_MARKER 40611 #define VISU_SHRINK_FACTOR 40629 #define VISU_EDIT_SCALARMAP 40620 diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index b8356d85..6ef7dee1 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -212,6 +212,48 @@ namespace VISU theServant->GetOffset(x,y,z); theStr<GetMarkerType(); + if( aMarkerType != VISU::MT_NONE ) { + if( aMarkerType != VISU::MT_USER ) { + VISU::MarkerScale aMarkerScale = theServant->GetMarkerScale(); + std::string aParam1, aParam2; + switch( aMarkerType ) { + case MT_POINT: aParam1 = "MT_POINT"; break; + case MT_PLUS: aParam1 = "MT_PLUS"; break; + case MT_STAR: aParam1 = "MT_STAR"; break; + case MT_O: aParam1 = "MT_O"; break; + case MT_X: aParam1 = "MT_X"; break; + case MT_O_POINT: aParam1 = "MT_O_POINT"; break; + case MT_O_PLUS: aParam1 = "MT_O_PLUS"; break; + case MT_O_STAR: aParam1 = "MT_O_STAR"; break; + case MT_O_X: aParam1 = "MT_O_X"; break; + default: aParam1 = "MT_NONE"; break; + } + switch( aMarkerScale ) { + case MS_10: aParam2 = "MS_10"; break; + case MS_15: aParam2 = "MS_15"; break; + case MS_20: aParam2 = "MS_20"; break; + case MS_25: aParam2 = "MS_25"; break; + case MS_30: aParam2 = "MS_30"; break; + case MS_35: aParam2 = "MS_35"; break; + case MS_40: aParam2 = "MS_40"; break; + case MS_45: aParam2 = "MS_45"; break; + case MS_50: aParam2 = "MS_50"; break; + case MS_55: aParam2 = "MS_55"; break; + case MS_60: aParam2 = "MS_60"; break; + case MS_65: aParam2 = "MS_65"; break; + case MS_70: aParam2 = "MS_70"; break; + default: aParam2 = "MT_NONE"; break; + } + theStr<GetMarkerTexture(); + if( aMarkerTexture >= 0 ) + theStr<StudyId()); + if(anIter == theMarkerMap.end()) + return; + + theStr<second; + VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.begin(); + for(; aMarkerIter != aMarkerMap.end(); aMarkerIter++) { + int aMarkerId = aMarkerIter->first; + std::string aMarkerTexture = aMarkerIter->second.first; + theStr<URL(); + aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in()); + } + + theMarkerMapFileName = aPrefix + "_textures"; + theMarkerMapFile = VISU_TMP_DIR + theMarkerMapFileName; + + if( theIsASCII && !HDFascii::ConvertFromASCIIToHDF( const_cast( theMarkerMapFile.c_str() ), true ) ) + return false; + + HDFfile* aFile; + HDFdataset* aDataset; + HDFgroup* aTopGroup; + HDFgroup* aGroup; + HDFgroup* aSubGroup; + HDFgroup* aSubSubGroup; + int aSize; + + aFile = new HDFfile( (char*)theMarkerMapFile.c_str() ); + try { + aFile->OpenOnDisk( HDF_RDONLY ); + } + catch ( HDFexception ) { + INFOS( "Load(): " << theMarkerMapFile << " not found!" ); + return false; + } + + VTK::MarkerMap& aMarkerMap = theStudyId2MarkerMap[ theStudy->StudyId() ]; + + for( int i = 0, n = aFile->nInternalObjects(); i < n; i++ ) { + char markerGrpName[ HDF_NAME_MAX_LEN+1 ]; + aFile->InternalObjectIndentify( i, markerGrpName ); + + int aMarkerId = 0; + std::string aMarkerFile; + VTK::MarkerTexture aMarkerTexture; + + if( string( markerGrpName ).substr( 0, 6 ) == string( "Marker" ) ) { + aTopGroup = new HDFgroup( markerGrpName, aFile ); + aTopGroup->OpenOnDisk(); + + aMarkerId = atoi( string( markerGrpName ).substr( 6 ).c_str() ); + if( aMarkerId < 1 ) + continue; + + if( aTopGroup->ExistInternalObject( "File" ) ) { + aDataset = new HDFdataset( "File", aTopGroup ); + aDataset->OpenOnDisk(); + aSize = aDataset->GetSize(); + char* aFileName = new char[ aSize ]; + aDataset->ReadFromDisk( aFileName ); + aMarkerFile = aFileName; + delete [] aFileName; + aDataset->CloseOnDisk(); + } + + if( aTopGroup->ExistInternalObject( "Texture" ) ) { + aDataset = new HDFdataset( "Texture", aTopGroup ); + aDataset->OpenOnDisk(); + aSize = aDataset->GetSize(); + int* aTextureData = new int[ aSize ]; + aDataset->ReadFromDisk( aTextureData ); + for( int j = 0; j < aSize; j++ ) + aMarkerTexture.push_back( aTextureData[j] ); + delete [] aTextureData; + aDataset->CloseOnDisk(); + } + + aTopGroup->CloseOnDisk(); + } + + if( aMarkerId > 0 ) + aMarkerMap[ aMarkerId ] = VTK::MarkerData( aMarkerFile, aMarkerTexture ); + } + + aFile->CloseOnDisk(); + delete aFile; + + return true; + } + + //---------------------------------------------------------------------------- + bool + SaveMarkerMap(SALOMEDS::Study_ptr theStudy, + const char* theURL, + bool theIsMultiFile, + bool theIsASCII, + const StudyId2MarkerMap& theStudyId2MarkerMap, + std::string& theMarkerMapFileName, + std::string& theMarkerMapFile) + { + VISU::StudyId2MarkerMap::const_iterator aMainIter = theStudyId2MarkerMap.find( theStudy->StudyId() ); + if( aMainIter == theStudyId2MarkerMap.end() ) + return false; + + const VTK::MarkerMap& aMarkerMap = aMainIter->second; + if( aMarkerMap.empty() ) + return false; + + std::string aPrefix; + if( theIsMultiFile ) { + CORBA::String_var anURL = theStudy->URL(); + aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in()); + } + + theMarkerMapFileName = aPrefix + "_textures"; + theMarkerMapFile = string( theURL ) + theMarkerMapFileName; + + HDFfile* aFile; + HDFdataset* aDataset; + HDFgroup* aTopGroup; + HDFgroup* aGroup; + HDFgroup* aSubGroup; + HDFgroup* aSubSubGroup; + hdf_size aSize[ 1 ]; + + aFile = new HDFfile( (char*)theMarkerMapFile.c_str() ); + aFile->CreateOnDisk(); + + VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.begin(); + for( ; aMarkerIter != aMarkerMap.end(); aMarkerIter++ ) { + int aMarkerId = aMarkerIter->first; + const VTK::MarkerData& aMarkerData = aMarkerIter->second; + std::string aMarkerFile = aMarkerData.first; + VTK::MarkerTexture aMarkerTexture = aMarkerData.second; + + char markerGrpName[30]; + sprintf( markerGrpName, "Marker %d", aMarkerId ); + aTopGroup = new HDFgroup( markerGrpName, aFile ); + + aTopGroup->CreateOnDisk(); + + aSize[ 0 ] = aMarkerFile.length() + 1; + aDataset = new HDFdataset( "File", aTopGroup, HDF_STRING, aSize, 1 ); + aDataset->CreateOnDisk(); + aDataset->WriteOnDisk( ( char* )( aMarkerFile.c_str() ) ); + aDataset->CloseOnDisk(); + + int* aTextureData = new int[ aMarkerTexture.size() ]; + VTK::MarkerTexture::const_iterator anIter = aMarkerTexture.begin(); + for( int i = 0; anIter != aMarkerTexture.end(); anIter++, i++ ) + aTextureData[i] = *anIter; + + aSize[0] = aMarkerTexture.size(); + aDataset = new HDFdataset( "Texture", aTopGroup, HDF_INT32, aSize, 1 ); + aDataset->CreateOnDisk(); + aDataset->WriteOnDisk( aTextureData ); + aDataset->CloseOnDisk(); + delete [] aTextureData; + + aTopGroup->CloseOnDisk(); + } + + aFile->CloseOnDisk(); + delete aFile; + + if( theIsASCII && !HDFascii::ConvertFromHDFToASCII( const_cast( theMarkerMapFile.c_str() ), true ) ) + return false; + + return true; + } + + //---------------------------------------------------------------------------- VISU_Gen_i ::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, @@ -323,13 +500,13 @@ namespace VISU //---------------------------------------------------------------------------- CORBA::Boolean - VISU_Gen_i - ::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile & theStream, - const char* theURL, - CORBA::Boolean theIsMultiFile) + LoadWithMarkerMap(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + CORBA::Boolean theIsMultiFile, + CORBA::Boolean theIsASCII, + StudyId2MarkerMap& theStudyId2MarkerMap) { - Mutex mt(myMutex); SALOMEDS::Study_var aStudy = theComponent->GetStudy(); SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); @@ -340,15 +517,41 @@ namespace VISU CorrectSObjectType(aSObject, aStudyBuilder); } - VISU_TMP_DIR = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, VISU_TMP_DIR, theIsMultiFile); myIsMultiFile = theIsMultiFile; + + // load textures of custom point markers + Result_i::TFileNames aTMPFileNames; + std::string aMarkerMapFileName, aMarkerMapFile; + if( LoadMarkerMap( aStudy, theURL, theIsMultiFile, theIsASCII, + theStudyId2MarkerMap, aMarkerMapFileName, aMarkerMapFile ) ) { + aTMPFileNames.push_back( aMarkerMapFileName ); + } + + if(!theIsMultiFile && !aTMPFileNames.empty()) { + SALOMEDS::ListOfFileNames_var aListOfTMPFileNames = GetListOfFileNames(aTMPFileNames); + SALOMEDS_Tool::RemoveTemporaryFiles(VISU_TMP_DIR, aListOfTMPFileNames, true ); + } + return true; } + //---------------------------------------------------------------------------- + CORBA::Boolean + VISU_Gen_i + ::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + CORBA::Boolean theIsMultiFile) + { + Mutex mt(myMutex); + return LoadWithMarkerMap(theComponent, theStream, theURL, theIsMultiFile, false, myMarkerMap); + } + + //---------------------------------------------------------------------------- CORBA::Boolean VISU_Gen_i @@ -357,7 +560,8 @@ namespace VISU const char* theURL, bool theIsMultiFile) { - return Load(theComponent, theStream, theURL, theIsMultiFile); + Mutex mt(myMutex); + return LoadWithMarkerMap(theComponent, theStream, theURL, theIsMultiFile, true, myMarkerMap); } @@ -410,6 +614,16 @@ namespace VISU } if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.size() - "<StudyId(); + + VTK::MarkerTexture aMarkerTexture; + if( !VTK::LoadTextureData( theTextureFile, VTK::MS_NONE, aMarkerTexture ) ) + return 0; + + VTK::MarkerMap& aMarkerMap = myMarkerMap[ aStudyId ]; + int aMarkerId = VTK::GetUniqueId( aMarkerMap ); + + VTK::MarkerData& aMarkerData = aMarkerMap[ aMarkerId ]; + aMarkerData.first = theTextureFile; + aMarkerData.second = aMarkerTexture; + + return aMarkerId; + } } diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 951688c9..216f0601 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -34,10 +34,16 @@ #include "VISU_ColoredPrs3d_i.hh" #include "VISU_ClippingPlaneMgr.hxx" +#include + +#include #include namespace VISU { + //---------------------------------------------------------------------------- + typedef std::map StudyId2MarkerMap; + //---------------------------------------------------------------------------- class VISU_Gen_i : public virtual POA_VISU::VISU_Gen, public virtual ::Engines_Component_i, @@ -46,6 +52,8 @@ namespace VISU SALOMEDS::Study_var myStudyDocument; VISU_ClippingPlaneMgr myClippingPlaneMgr; + StudyId2MarkerMap myMarkerMap; + VISU_Gen_i(const VISU::VISU_Gen_i &); public: VISU_Gen_i(CORBA::ORB_ptr theORB, @@ -413,6 +421,10 @@ namespace VISU const char* theMeshName, const VISU::double_array& theTStamps); + /* Load texture from file */ + virtual CORBA::Long LoadTexture(const char* theTextureFile); + + StudyId2MarkerMap& GetMarkerMap() { return myMarkerMap; } }; } diff --git a/src/VISU_I/VISU_PointMap3d_i.cc b/src/VISU_I/VISU_PointMap3d_i.cc index f0533c30..0bda5dbb 100644 --- a/src/VISU_I/VISU_PointMap3d_i.cc +++ b/src/VISU_I/VISU_PointMap3d_i.cc @@ -727,6 +727,29 @@ void VISU::PointMap3d_i::GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, COR theDz = myOffset[2]; } +void VISU::PointMap3d_i::SetMarkerStd(VISU::MarkerType, VISU::MarkerScale) +{ +} + +void VISU::PointMap3d_i::SetMarkerTexture(CORBA::Long) +{ +} + +VISU::MarkerType VISU::PointMap3d_i::GetMarkerType() +{ + return VISU::MT_NONE; +} + +VISU::MarkerScale VISU::PointMap3d_i::GetMarkerScale() +{ + return VISU::MS_NONE; +} + +CORBA::Long VISU::PointMap3d_i::GetMarkerTexture() +{ + return 0; +} + CORBA::Float VISU::PointMap3d_i::GetMemorySize() { CORBA::Float aSize = GetSpecificPL()->GetMemorySize(); diff --git a/src/VISU_I/VISU_PointMap3d_i.hh b/src/VISU_I/VISU_PointMap3d_i.hh index 547191d8..252c00e7 100644 --- a/src/VISU_I/VISU_PointMap3d_i.hh +++ b/src/VISU_I/VISU_PointMap3d_i.hh @@ -77,6 +77,13 @@ namespace VISU //! Gets offset parameters for the 3D presentation virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz); + //! Do nothing, just for compilability + virtual void SetMarkerStd(VISU::MarkerType, VISU::MarkerScale); + virtual void SetMarkerTexture(CORBA::Long); + virtual VISU::MarkerType GetMarkerType(); + virtual VISU::MarkerScale GetMarkerScale(); + virtual CORBA::Long GetMarkerTexture(); + //! Gets memory size actually used by the presentation (Mb). virtual CORBA::Float GetMemorySize(); diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 17468de9..ac0058d5 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -26,6 +26,7 @@ // #include "VISU_Prs3d_i.hh" #include "VISU_Prs3dUtils.hh" +#include "VISU_Gen_i.hh" #include "VISU_PipeLine.hxx" #include "VISU_Result_i.hh" @@ -35,6 +36,8 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_MessageBox.h" +#include + #include #include #include @@ -59,6 +62,11 @@ VISU::Prs3d_i::Prs3d_i() : if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<Delete(); + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + myMarkerType = (VISU::MarkerType)aResourceMgr->integerValue("VISU", "type_of_marker", 1); // dot + myMarkerScale = (VISU::MarkerScale)aResourceMgr->integerValue("VISU", "marker_scale", 9); // 5 pixels + myMarkerId = 0; } @@ -73,6 +81,10 @@ VISU::Prs3d_i GetPipeLine()->SameAs(anOrigin->GetPipeLine()); anOrigin->GetOffset(myOffset); + myMarkerType = anOrigin->GetMarkerType(); + myMarkerScale = anOrigin->GetMarkerScale(); + myMarkerId = anOrigin->GetMarkerTexture(); + SetForcedHidden(anOrigin->IsForcedHidden()); } } @@ -312,6 +324,9 @@ VISU::Prs3d_i myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat(); myOffset[1] = VISU::Storable::FindValue(theMap,"myOffset[1]").toFloat(); myOffset[2] = VISU::Storable::FindValue(theMap,"myOffset[2]").toFloat(); + myMarkerType = VISU::MarkerType(VISU::Storable::FindValue(theMap,"myMarkerType").toInt()); + myMarkerScale = VISU::MarkerScale(VISU::Storable::FindValue(theMap,"myMarkerScale").toInt()); + myMarkerId = VISU::Storable::FindValue(theMap,"myMarkerId").toInt(); myParamsTime.Modified(); return this; } @@ -327,6 +342,9 @@ VISU::Prs3d_i Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] ); Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] ); Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] ); + Storable::DataToStream( theStr, "myMarkerType", int(myMarkerType) ); + Storable::DataToStream( theStr, "myMarkerScale", int(myMarkerScale) ); + Storable::DataToStream( theStr, "myMarkerId", myMarkerId ); } @@ -498,6 +516,15 @@ VISU::Prs3d_i theActor->SetPrs3d(this); theActor->SetShrinkFactor(aResourceMgr->integerValue("VISU", "shrink_factor", 80)/100.); theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]); + + if( myMarkerType != VISU::MT_USER ) + theActor->SetMarkerStd( (VTK::MarkerType)myMarkerType, (VTK::MarkerScale)myMarkerScale ); + else if( myMarkerId > 0 ) { + VTK::MarkerTexture aMarkerTexture; + if( LoadMarkerTexture( myMarkerId, aMarkerTexture ) ) + theActor->SetMarkerTexture( myMarkerId, aMarkerTexture ); + } + theActor->SetPipeLine(GetActorPipeLine()); if(theActor->GetPipeLine() != GetPipeLine()){ // To decrease actor'ss pipeline reference counter @@ -546,6 +573,15 @@ VISU::Prs3d_i if(VISU_Actor* anActor = dynamic_cast(theActor)){ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<