presentations on fields. </li>
<li> \subpage evolution_page - tracing of temporal evolution of a
variable at a given point.</li>
+<li> \subpage point_marker_page - allows to change the representation
+of points, using standard or custom markers.</li>
<li> \subpage translate_presentation_page - displacement of
presentations in the viewer.</li>
<li> \subpage recording_page - allows to dump user actions in an AVI
--- /dev/null
+/*!
+
+\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
+
+<br>
+
+\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:
+
+<pre>
+00111100
+00111100
+11111111
+11111111
+11111111
+11111111
+00111100
+00111100
+</pre>
+
+\image html point_marker_dlg2.png
+
+<br>
+
+\image html custom_point_marker.png "Presentation with custom point markers"
+
+
+Our TUI Scripts provide you with \subpage tui_point_marker_page script.
+
+*/
+
--- /dev/null
+/*!
+
+\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
+
+*/
shrink_factor.png
- <b>Edge Color</b> - 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.
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.
*/
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).
*/
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
<parameter name="show_non_manifold_edges" value="false"/>
<parameter name="feature_edges_coloring" value="false"/>
<parameter name="edge_color" value="255, 255, 255"/>
+ <parameter name="type_of_marker" value="1"/>
+ <parameter name="marker_scale" value="9"/>
<parameter name="scalar_bar_horizontal_height" value="0.08"/>
<parameter name="scalar_bar_horizontal_width" value="0.8" />
<parameter name="scalar_bar_horizontal_x" value="0.1"/>
return myVisuGen->VTK2MED(theVTKFiles, theMEDFile, theMeshName, theTStamps);
}
+ /* Load texture from file */
+ CORBA::Long VISU_Gen_i::LoadTexture(const char* theTextureFile)
+ {
+ return myVisuGen->LoadTexture(theTextureFile);
+ }
};
const char* theMEDFile,
const char* theMeshName,
const VISU::double_array& theTStamps );
+
+ /* Load texture from file */
+ virtual CORBA::Long LoadTexture(const char* theTextureFile);
};
};
#include "VISU_UnstructuredGridPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include <vtkDataSetMapper.h>
+#include <VTKViewer_DataSetMapper.h>
+
#include <vtkObjectFactory.h>
#include <vtkImplicitBoolean.h>
#include <SALOME_ExtractGeometry.h>
//----------------------------------------------------------------------------
VISU_DataSetActor
::VISU_DataSetActor():
- myMapper(vtkDataSetMapper::New()),
+ myMapper(VTKViewer_DataSetMapper::New()),
myExtractor(SALOME_ExtractGeometry::New()),
myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
myFunction(vtkImplicitBoolean::New())
#include "VISU_Actor.h"
class vtkDataSetMapper;
+class VTKViewer_DataSetMapper;
class SALOME_ExtractGeometry;
class SALOME_ExtractPolyDataGeometry;
class vtkImplicitBoolean;
SetMapperInput(vtkDataSet* theDataSet);
//----------------------------------------------------------------------------
- vtkSmartPointer<vtkDataSetMapper> myMapper;
+ vtkSmartPointer<VTKViewer_DataSetMapper> myMapper;
vtkSmartPointer<SALOME_ExtractGeometry> myExtractor;
vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
vtkSmartPointer<vtkImplicitBoolean> myFunction;
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 );
+}
virtual void
SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+ virtual
+ void
+ SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
+
+ virtual
+ void
+ SetMarkerTexture( int, VTK::MarkerTexture );
protected:
VISU_MeshAct();
#include <vtkImageData.h>
-//============================================================================
-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<VISU_PointsDeviceActor*>( 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;
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);
myEdgeActor->GetMapper()->ScalarVisibilityOff();
- myPointsActor->DoMapperShallowCopy( thePipeLine->GetMapper(), false );
-
+ VISU::CopyMapper( myPointsActor->GetMapper(), thePipeLine->GetMapper(), false );
VISU::CopyMapper( mySurfaceActor->GetMapper(), thePipeLine->GetMapper(), false );
}
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
Superclass::DeepCopy(theActor);
SetBarVisibility(anActor->GetBarVisibility());
- myPointsActor->DeepCopy( anActor->myPointsActor );
SetShading(anActor->IsShading());
}
}
{
Superclass::AddToRender(theRenderer);
- myPointsActor->SetInteractor( myInteractor );
-
if(myScalarBar)
theRenderer->AddActor2D(myScalarBar);
}
return 1;
}
-//----------------------------------------------------------------------------
-unsigned long int
-VISU_ScalarMapAct
-::GetMemorySize()
-{
- unsigned long int aSize = Superclass::GetMemorySize();
-
- aSize += myPointsActor->GetMemorySize();
-
- return aSize;
-}
-
//----------------------------------------------------------------------------
VISU_Actor::EQuadratic2DRepresentation
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 );
+}
#include "VISU_DataSetActor.h"
class VISU_ScalarBarActor;
-class VISU_PointsDeviceActor;
-
//----------------------------------------------------------------------------
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();
bool myBarVisibility;
VISU_ScalarBarActor* myScalarBar;
- VISU_PointsDeviceActor* myPointsActor;
+ SVTK_DeviceActor* myPointsActor;
SVTK_DeviceActor* mySurfaceActor;
SVTK_DeviceActor* myEdgeActor;
};
<source>VISU_LOGARITHMIC_SCALING</source>
<translation>Logarithmic</translation>
</message>
+ <message>
+ <source>VISU_MARKER_SCALE</source>
+ <translation>Scale of marker</translation>
+ </message>
<message>
<source>VISU_MAX</source>
<translation>Max:</translation>
<source>VISU_TITLE</source>
<translation>Title</translation>
</message>
+ <message>
+ <source>VISU_TYPE_OF_MARKER</source>
+ <translation>Type of marker</translation>
+ </message>
<message>
<source>QUADRATIC_REPRESENT_MODE</source>
<translation>Representation of the 2D quadratic elements</translation>
<source>MEN_POINT_SELECTION</source>
<translation>Point Selection</translation>
</message>
+ <message>
+ <source>MEN_POINT_MARKER</source>
+ <translation>Point Marker</translation>
+ </message>
<message>
<source>MEN_POINTS</source>
<translation>Points</translation>
//#include "SVTK_MainWindow.h"
#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_MarkerDlg.h"
#include "SPlot2d_ViewModel.h"
#include "VisuGUI_SetupPlot2dDlg.h"
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<VISU::Prs3d_i*> 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<SVTK_ViewWindow>( this ) )
+ vw->Repaint();
+}
+
//----------------------------------------------------------------------------
void
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()));
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 );
"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
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<QVariant> aMarkerTypeIndicesList;
+ QList<QVariant> 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<QVariant> 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 );
void OnChangeWireframeColor();
void OnChangeOpacity();
void OnChangeLines();
+ void OnChangePointMarker();
void OnChangeShrinkFactor();
void OnShowTable();
#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
theServant->GetOffset(x,y,z);
theStr<<thePrefix<<theName<<".SetOffset("<<x<<", "<<y<<", "<<z<<")"<<endl;
SetClippingPlane(theServant, theName, theStr, thePrefix);
+
+ VISU::MarkerType aMarkerType = theServant->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<<thePrefix<<theName<<".SetMarkerStd(VISU."<<aParam1<<", VISU."<<aParam2<<")"<<endl;
+ }
+ else {
+ int aMarkerTexture = theServant->GetMarkerTexture();
+ if( aMarkerTexture >= 0 )
+ theStr<<thePrefix<<theName<<".SetMarkerTexture(texture_map["<<aMarkerTexture<<"])"<<endl;
+ }
+ }
}
//---------------------------------------------------------------------------
}
+ void
+ DumpTextureMapToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ std::string thePrefix,
+ const StudyId2MarkerMap& theMarkerMap)
+ {
+ if(!theIsPublished)
+ return;
+
+ if(CORBA::is_nil(theStudy))
+ return;
+
+ StudyId2MarkerMap::const_iterator anIter = theMarkerMap.find(theStudy->StudyId());
+ if(anIter == theMarkerMap.end())
+ return;
+
+ theStr<<thePrefix<<"texture_map = {}"<<endl<<endl;
+
+ const VTK::MarkerMap& aMarkerMap = anIter->second;
+ VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.begin();
+ for(; aMarkerIter != aMarkerMap.end(); aMarkerIter++) {
+ int aMarkerId = aMarkerIter->first;
+ std::string aMarkerTexture = aMarkerIter->second.first;
+ theStr<<thePrefix<<"texture_map["<<aMarkerId<<"] = aVisu.LoadTexture(\""<<aMarkerTexture<<"\")"<<endl;
+ }
+ theStr<<endl;
+ }
+
+
//---------------------------------------------------------------------------
Engines::TMPFile*
VISU_Gen_i::
aPrefix,
myClippingPlaneMgr);
+ VISU::DumpTextureMapToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aPrefix,
+ myMarkerMap);
VISU::DumpChildrenToPython(aStudy,
theIsPublished,
#include "VISU_Actor.h"
+#include "HDFOI.hxx"
#include "HDFascii.hxx"
#include "SALOMEDS_Tool.hxx"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include "VTKViewer_MarkerUtils.h"
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
#include "SALOME_Event.h"
}
+ //----------------------------------------------------------------------------
+ bool
+ LoadMarkerMap(SALOMEDS::Study_ptr theStudy,
+ const char* theURL,
+ bool theIsMultiFile,
+ bool theIsASCII,
+ StudyId2MarkerMap& theStudyId2MarkerMap,
+ std::string& theMarkerMapFileName,
+ std::string& theMarkerMapFile)
+ {
+ std::string aPrefix;
+ if( theIsMultiFile ) {
+ CORBA::String_var anURL = theStudy->URL();
+ aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ }
+
+ theMarkerMapFileName = aPrefix + "_textures";
+ theMarkerMapFile = VISU_TMP_DIR + theMarkerMapFileName;
+
+ if( theIsASCII && !HDFascii::ConvertFromASCIIToHDF( const_cast<char*>( 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<char*>( theMarkerMapFile.c_str() ), true ) )
+ return false;
+
+ return true;
+ }
+
+
//----------------------------------------------------------------------------
VISU_Gen_i
::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA,
//----------------------------------------------------------------------------
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);
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
const char* theURL,
bool theIsMultiFile)
{
- return Load(theComponent, theStream, theURL, theIsMultiFile);
+ Mutex mt(myMutex);
+ return LoadWithMarkerMap(theComponent, theStream, theURL, theIsMultiFile, true, myMarkerMap);
}
}
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.size() - "<<aFileNames.size());
+ // save textures of custom point markers
+ Result_i::TFileNames aTMPFileNames;
+ std::string aMarkerMapFileName, aMarkerMapFile;
+ if( SaveMarkerMap( aStudy, theURL, theIsMultiFile, false,
+ myMarkerMap, aMarkerMapFileName, aMarkerMapFile ) ) {
+ aTMPFileNames.push_back( aMarkerMapFileName );
+ aFileNames.push_back( aMarkerMapFileName );
+ aFiles.push_back( aMarkerMapFile );
+ }
+
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
if(aFileNames.empty())
return aStreamFile._retn();
else
aStreamFile = SALOMEDS_Tool::PutFilesToStream(aListOfFiles.in(), aListOfFileNames.in());
+ if(!theIsMultiFile && !aTMPFileNames.empty()) {
+ SALOMEDS::ListOfFileNames_var aListOfTMPFileNames = GetListOfFileNames(aTMPFileNames);
+ SALOMEDS_Tool::RemoveTemporaryFiles(theURL, aListOfTMPFileNames, true);
+ }
+
return aStreamFile._retn();
}
}
if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - aFileNames.size() - "<<aFileNames.size());
+ // save textures of custom point markers
+ std::string aMarkerMapFileName, aMarkerMapFile;
+ if( SaveMarkerMap( aStudy, anURL.c_str(), theIsMultiFile, true,
+ myMarkerMap, aMarkerMapFileName, aMarkerMapFile ) ) {
+ aFileNames.push_back( aMarkerMapFileName );
+ aFiles.push_back( aMarkerMapFile );
+ }
+
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
if(aFileNames.empty())
return aStreamFile._retn();
return res == 0;
}
+
+ CORBA::Long
+ VISU_Gen_i
+ ::LoadTexture(const char* theTextureFile)
+ {
+ if( CORBA::is_nil( myStudyDocument ) )
+ return 0;
+
+ int aStudyId = myStudyDocument->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;
+ }
}
#include "VISU_ColoredPrs3d_i.hh"
#include "VISU_ClippingPlaneMgr.hxx"
+#include <VTKViewer_MarkerDef.h>
+
+#include <map>
#include <string>
namespace VISU
{
+ //----------------------------------------------------------------------------
+ typedef std::map<int, VTK::MarkerMap> StudyId2MarkerMap;
+
//----------------------------------------------------------------------------
class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
public virtual ::Engines_Component_i,
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,
const char* theMeshName,
const VISU::double_array& theTStamps);
+ /* Load texture from file */
+ virtual CORBA::Long LoadTexture(const char* theTextureFile);
+
+ StudyId2MarkerMap& GetMarkerMap() { return myMarkerMap; }
};
}
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();
//! 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();
//
#include "VISU_Prs3d_i.hh"
#include "VISU_Prs3dUtils.hh"
+#include "VISU_Gen_i.hh"
#include "VISU_PipeLine.hxx"
#include "VISU_Result_i.hh"
#include "SUIT_ResourceMgr.h"
#include "SUIT_MessageBox.h"
+#include <VTKViewer_MarkerUtils.h>
+
#include <vtkActorCollection.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSet.h>
if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
myOffset[0] = myOffset[1] = myOffset[2] = 0;
myActorCollection->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;
}
GetPipeLine()->SameAs(anOrigin->GetPipeLine());
anOrigin->GetOffset(myOffset);
+ myMarkerType = anOrigin->GetMarkerType();
+ myMarkerScale = anOrigin->GetMarkerScale();
+ myMarkerId = anOrigin->GetMarkerTexture();
+
SetForcedHidden(anOrigin->IsForcedHidden());
}
}
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;
}
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 );
}
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
if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor)){
if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<anActor);
anActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+
+ if( myMarkerType != VISU::MT_USER )
+ anActor->SetMarkerStd( (VTK::MarkerType)myMarkerType, (VTK::MarkerScale)myMarkerScale );
+ else if( myMarkerId > 0 ) {
+ VTK::MarkerTexture aMarkerTexture;
+ if( LoadMarkerTexture( myMarkerId, aMarkerTexture ) )
+ anActor->SetMarkerTexture( myMarkerId, aMarkerTexture );
+ }
+
anActor->ShallowCopyPL(GetPipeLine());
anActor->highlight(anActor->isHighlighted());
}
{
myIsForcedHidden = theFlag;
}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetMarkerStd(VISU::MarkerType theMarkerType, VISU::MarkerScale theMarkerScale)
+{
+ myMarkerType = theMarkerType;
+ myMarkerScale = theMarkerScale;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetMarkerTexture(CORBA::Long theMarkerId)
+{
+ myMarkerType = VISU::MT_USER;
+ myMarkerId = theMarkerId;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+VISU::MarkerType
+VISU::Prs3d_i
+::GetMarkerType()
+{
+ return myMarkerType;
+}
+
+//----------------------------------------------------------------------------
+VISU::MarkerScale
+VISU::Prs3d_i
+::GetMarkerScale()
+{
+ return myMarkerScale;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::Prs3d_i
+::GetMarkerTexture()
+{
+ return myMarkerId;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Prs3d_i
+::LoadMarkerTexture(int theMarkerId, VTK::MarkerTexture& theMarkerTexture)
+{
+ VISU::VISU_Gen_i* aVisuGen = VISU::VISU_Gen_i::GetVisuGenImpl();
+ if( !aVisuGen )
+ return false;
+
+ const VISU::StudyId2MarkerMap& aStudyId2MarkerMap = aVisuGen->GetMarkerMap();
+
+ const SALOMEDS::Study_var& aStudy = GetStudyDocument();
+ if( CORBA::is_nil( aStudy.in() ) )
+ return false;
+
+ int aStudyId = aStudy->StudyId();
+ VISU::StudyId2MarkerMap::const_iterator aStudyId2MarkerIter = aStudyId2MarkerMap.find( aStudyId );
+ if( aStudyId2MarkerIter == aStudyId2MarkerMap.end() )
+ return false;
+
+ VTK::MarkerMap aMarkerMap = aStudyId2MarkerIter->second;
+ VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.find( theMarkerId );
+ if( aMarkerIter == aMarkerMap.end() )
+ return false;
+
+ theMarkerTexture = aMarkerIter->second.second;
+}
CORBA::Float& theDy,
CORBA::Float& theDz);
+ //----------------------------------------------------------------------------
+ //! Set standard point marker for the object
+ virtual
+ void
+ SetMarkerStd(VISU::MarkerType theMarkerType, VISU::MarkerScale theMarkerScale);
+
+ //! Set custom point marker
+ virtual
+ void
+ SetMarkerTexture(CORBA::Long theTextureId);
+
+ //! Get type of the point marker
+ virtual
+ VISU::MarkerType
+ GetMarkerType();
+
+ //! Get scale of the point marker
+ virtual
+ VISU::MarkerScale
+ GetMarkerScale();
+
+ //! Get texture identifier of the point marker
+ virtual
+ CORBA::Long
+ GetMarkerTexture();
+
//----------------------------------------------------------------------------
//! Gets memory size actually used by the presentation (Mb).
virtual
void
CheckDataSet();
+ bool
+ LoadMarkerTexture(int theMarkerId, VTK::MarkerTexture& theMarkerTexture);
+
protected:
vtkTimeStamp myUpdateTime;
vtkTimeStamp myParamsTime;
CORBA::Float myOffset[3];
+ VISU::MarkerType myMarkerType;
+ VISU::MarkerScale myMarkerScale;
+ int myMarkerId;
+
boost::signal0<void> myUpdateActorsSignal;
boost::signal0<void> myRemoveActorsFromRendererSignal;
vtkSmartPointer<vtkActorCollection> myActorCollection;
visu_succcessive_animation.py visu_apply_properties.py visu_apply_properties_successive.py \
batchmode_visu_view.py visu_cache.py visu_pointmap3d.py visu_view3d_parameters.py visu_evolution.py \
VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \
- VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py
+ VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py VISU_Example_08.py
nodist_salomescript_DATA = libVISU_Swig.py
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2008 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
+#
+# Set different point markers for presentation
+#
+import salome
+
+import VISU
+import visu_gui
+
+import os
+import time
+
+data_dir = os.getenv("DATA_DIR")
+sleep_delay = 1
+
+myVisu = visu_gui.myVisu
+myVisu.SetCurrentStudy(salome.myStudy)
+myViewManager = myVisu.GetViewManager()
+myView = myViewManager.Create3DView()
+
+medFile = "fra.med"
+aMeshName ="LE VOLUME"
+anEntity = VISU.NODE
+aFieldName = "VITESSE";
+aTimeStampId = 1
+
+medFile = data_dir + "/MedFiles/" + medFile
+
+print "Build Scalar Map presentation"
+myResult = myVisu.ImportFile(medFile)
+aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,aFieldName,aTimeStampId)
+myView.Display(aScalarMap);
+myView.FitAll();
+
+print "Set representation type to Point"
+myView.SetPresentationType(aScalarMap, VISU.POINT)
+time.sleep(sleep_delay)
+
+print "Set standard marker 1"
+aScalarMap.SetMarkerStd(VISU.MT_PLUS, VISU.MS_10)
+myView.Update()
+time.sleep(sleep_delay)
+
+print "Set standard marker 2"
+aScalarMap.SetMarkerStd(VISU.MT_STAR, VISU.MS_35)
+myView.Update()
+time.sleep(sleep_delay)
+
+print "Set standard marker 3"
+aScalarMap.SetMarkerStd(VISU.MT_O, VISU.MS_25)
+myView.Update()
+time.sleep(sleep_delay)
+
+print "Set custom marker 1"
+texture_1 = myVisu.LoadTexture(os.path.join(data_dir, "Textures", "texture1.dat"))
+aScalarMap.SetMarkerTexture(texture_1)
+myView.Update()
+time.sleep(sleep_delay)
+
+print "Set custom marker 2"
+texture_2 = myVisu.LoadTexture(os.path.join(data_dir, "Textures", "texture2.dat"))
+aScalarMap.SetMarkerTexture(texture_2)
+myView.Update()
+time.sleep(sleep_delay)
+
+print "Set custom marker 3"
+texture_3 = myVisu.LoadTexture(os.path.join(data_dir, "Textures", "texture3.dat"))
+aScalarMap.SetMarkerTexture(texture_3)
+myView.Update()