geom/src/GEOMGUI/GEOM_Displayer.h

194 lines
6.6 KiB
C
Raw Normal View History

2007-10-11 15:49:47 +06:00
// GEOM GEOMGUI : GUI for Geometry component
2004-12-01 15:39:14 +05:00
//
2007-10-11 15:49:47 +06:00
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2007-04-18 21:44:19 +06:00
//
2007-10-11 15:49:47 +06:00
// 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.
2007-04-18 21:44:19 +06:00
//
2007-10-11 15:49:47 +06:00
// 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.
2007-04-18 21:44:19 +06:00
//
2007-10-11 15:49:47 +06:00
// 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
2007-04-18 21:44:19 +06:00
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2004-12-01 15:39:14 +05:00
//
2007-10-11 15:49:47 +06:00
// File : GEOM_Displayer.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
2004-12-01 15:39:14 +05:00
//
2007-10-11 15:49:47 +06:00
#ifndef GEOM_DISPLAYER_H
#define GEOM_DISPLAYER_H
2004-12-01 15:39:14 +05:00
2007-02-07 16:48:21 +05:00
#include "GEOM_GEOMGUI.hxx"
2007-10-11 15:49:47 +06:00
#include <SALOME_InteractiveObject.hxx>
2007-07-04 13:33:41 +06:00
class SALOME_ListIO;
class SALOME_View;
class SALOME_Prs;
class SALOME_OCCPrs;
class SALOME_VTKPrs;
class SALOME_OCCViewType;
2004-12-01 15:39:14 +05:00
#include <TopoDS_Shape.hxx>
#include <Quantity_Color.hxx>
#include <LightApp_Displayer.h>
2007-04-18 21:44:19 +06:00
#include <Aspect_TypeOfMarker.hxx>
2004-12-01 15:39:14 +05:00
#include <list>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
#define GEOM_PREVIEW -2 // Definition for preview selection
#define GEOM_ALLSHAPES -3 // Selection of all shapes is activated
#define GEOM_ALLGEOM -4 // Selection of all geom objects is activated
typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
class TColStd_MapOfInteger;
class LightApp_SelectionMgr;
class SalomeApp_Study;
2005-11-14 18:53:44 +05:00
class SalomeApp_Application;
class SUIT_SelectionFilter;
//class SALOME_Selection;
2005-11-14 18:53:44 +05:00
2007-02-07 16:48:21 +05:00
class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer
2004-12-01 15:39:14 +05:00
{
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
public:
/* Constructor */
2005-11-14 18:53:44 +05:00
GEOM_Displayer( SalomeApp_Study* app );
2004-12-01 15:39:14 +05:00
/* Destructor */
virtual ~GEOM_Displayer();
virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const;
2004-12-01 15:39:14 +05:00
/* Display/Erase object methods */
2004-12-01 15:39:14 +05:00
void Display ( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer = true,
SALOME_View* theViewFrame = 0 );
2004-12-01 15:39:14 +05:00
// This overloaded Display() method can be useful for operations
// not using dialog boxes.
2007-04-18 21:44:19 +06:00
void Display ( GEOM::GEOM_Object_ptr theObj,
2004-12-01 15:39:14 +05:00
const bool updateViewer = true );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer = true );
void Erase ( const Handle(SALOME_InteractiveObject)& theIO,
const bool forced = false,
const bool updateViewer = true,
SALOME_View* theViewFrame = 0 );
2004-12-01 15:39:14 +05:00
void Erase ( GEOM::GEOM_Object_ptr theObj,
const bool forced = false,
2007-04-18 21:44:19 +06:00
const bool updateViewer = true );
2004-12-01 15:39:14 +05:00
/* Display/Erase list of objects methods */
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
void Display ( const SALOME_ListIO& theIOList,
const bool updateViewer = true );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
void Erase ( const SALOME_ListIO& theIOList,
const bool forced = false,
const bool updateViewer = true );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
void Redisplay ( const SALOME_ListIO& theIOList,
const bool updateViewer = true );
/* build presentation accordint to the current viewer type*/
SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
/* Set color for shape displaying. If it is equal -1 then default color is used.
Available values are from Quantity_NameOfColor enumeration */
void SetColor ( const int );
void UnsetColor();
int GetColor () const;
bool HasColor () const;
/* Set width for shape displaying. If it is equal -1 then default width is used. */
void SetWidth ( const double );
void UnsetWidth();
double GetWidth () const;
bool HasWidth () const;
2007-04-18 21:44:19 +06:00
/* Set display mode shape displaying. If it is equal -1 then display mode is used. */
int SetDisplayMode( const int );
int GetDisplayMode() const;
int UnsetDisplayMode();
2004-12-01 15:39:14 +05:00
/* Sets name - for temporary objects only */
2005-11-14 18:53:44 +05:00
void SetName( const char* theName );
void UnsetName();
2004-12-01 15:39:14 +05:00
/* Reimplemented from SALOME_Displayer */
virtual void Update( SALOME_OCCPrs* );
virtual void Update( SALOME_VTKPrs* );
virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& );
virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& );
/* This methos is used for activisation/deactivisation of objects to be displayed*/
void SetToActivate( const bool );
bool ToActivate() const;
/* Activate/Deactivate selection*/
void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
void LocalSelection( const SALOME_ListIO& theIOList, const int );
void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
void GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
2005-11-14 18:53:44 +05:00
SalomeApp_Study* getStudy() const;
2004-12-01 15:39:14 +05:00
protected:
/* internal methods */
/* Builds presentation accordint to the current viewer type */
2005-09-27 12:32:15 +06:00
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
/* Sets interactive object */
2005-11-14 18:53:44 +05:00
void setIO( const Handle(SALOME_InteractiveObject)& theIO );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
/* Sets shape */
2005-11-14 18:53:44 +05:00
void setShape( const TopoDS_Shape& theShape );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
/* Resets internal data */
void internalReset();
void clearTemporary( LightApp_SelectionMgr* theSelMgr );
2004-12-01 15:39:14 +05:00
SUIT_SelectionFilter* getFilter( const int theMode );
2007-04-18 21:44:19 +06:00
2004-12-01 15:39:14 +05:00
protected:
Handle(SALOME_InteractiveObject) myIO;
TopoDS_Shape myShape;
string myName;
int myType;
SALOME_View* myViewFrame;
2004-12-01 15:39:14 +05:00
// Attributes
Quantity_Color myShadingColor;
int myColor;
double myWidth;
bool myToActivate;
int myDisplayMode;
2007-04-18 21:44:19 +06:00
Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker;
private:
2005-11-14 18:53:44 +05:00
SalomeApp_Application* myApp;
2004-12-01 15:39:14 +05:00
};
2007-10-11 15:49:47 +06:00
#endif // GEOM_DISPLAYER_H
2004-12-01 15:39:14 +05:00