#ifndef ROOT_TGLScene
#define ROOT_TGLScene
#ifndef ROOT_TGLBoundingBox
#include "TGLBoundingBox.h"
#endif
#ifndef ROOT_TError
#include "TError.h"
#endif
#ifndef ROOT_TGLDrawFlags
#include "TGLDrawFlags.h"
#endif
#ifndef ROOT_TGLTransManip
#include "TGLTransManip.h"
#endif
#ifndef ROOT_TGLScaleManip
#include "TGLScaleManip.h"
#endif
#ifndef ROOT_TGLRotateManip
#include "TGLRotateManip.h"
#endif
#include <map>
#include <vector>
#include <string>
class TGLCamera;
class TGLDrawable;
class TGLLogicalShape;
class TGLPhysicalShape;
class TGLClip;
class TGLClipPlane;
class TGLClipBox;
class TGLCameraMarkupStyle;
class TGLScene
{
public:
enum ELock { kUnlocked,
kDrawLock,
kSelectLock,
kModifyLock };
private:
mutable ELock fLock;
typedef std::map<ULong_t, TGLLogicalShape *> LogicalShapeMap_t;
typedef LogicalShapeMap_t::value_type LogicalShapeMapValueType_t;
typedef LogicalShapeMap_t::iterator LogicalShapeMapIt_t;
typedef LogicalShapeMap_t::const_iterator LogicalShapeMapCIt_t;
LogicalShapeMap_t fLogicalShapes;
typedef std::map<ULong_t, TGLPhysicalShape *> PhysicalShapeMap_t;
typedef PhysicalShapeMap_t::value_type PhysicalShapeMapValueType_t;
typedef PhysicalShapeMap_t::iterator PhysicalShapeMapIt_t;
typedef PhysicalShapeMap_t::const_iterator PhysicalShapeMapCIt_t;
PhysicalShapeMap_t fPhysicalShapes;
typedef std::vector<const TGLPhysicalShape *> DrawList_t;
typedef DrawList_t::iterator DrawListIt_t;
DrawList_t fDrawList;
Bool_t fDrawListValid;
Bool_t fInSmartRefresh;
mutable LogicalShapeMap_t fSmartRefreshCache;
mutable TGLBoundingBox fBoundingBox;
mutable Bool_t fBoundingBoxValid;
TGLPhysicalShape * fSelectedPhysical;
TGLPhysicalShape * fSelectionResult;
Int_t fNPrimHits;
Int_t fNSecHits;
Bool_t fTrySecSelect;
Bool_t fTriedSecSelect;
std::vector<UInt_t> fSelectBuffer;
std::vector<std::pair<UInt_t, UInt_t*> > fSortedHits;
TGLClipPlane * fClipPlane;
TGLClipBox * fClipBox;
TGLClip * fCurrentClip;
TGLCameraMarkupStyle * fCameraMarkup;
TGLTransManip fTransManip;
TGLScaleManip fScaleManip;
TGLRotateManip fRotateManip;
TGLManip * fCurrentManip;
struct DrawStats_t {
TGLDrawFlags fFlags;
UInt_t fOpaque;
UInt_t fTrans;
UInt_t fPixelLOD;
std::map<std::string, UInt_t> fByShape;
} fDrawStats;
void SortDrawList();
static Bool_t ComparePhysicalVolumes(const TGLPhysicalShape * shape1, const TGLPhysicalShape * shape2);
void DrawPass(const TGLCamera & camera, const TGLDrawFlags & sceneFlags,
Double_t timeout, const std::vector<TGLPlane> * clipPlanes = 0);
void DrawGuides(const TGLCamera & camera, Int_t axesType, const TGLVertex3 * reference) const;
void DrawNumber(Double_t num, const TGLVertex3 & center) const;
void ResetDrawStats(const TGLDrawFlags & flags);
void UpdateDrawStats(const TGLPhysicalShape & shape, const TGLDrawFlags & flags);
void DumpDrawStats();
TGLScene(const TGLScene &);
TGLScene & operator=(const TGLScene &);
public:
TGLScene();
virtual ~TGLScene();
const TGLBoundingBox & BoundingBox() const;
void Draw(const TGLCamera & camera, TGLDrawFlags sceneFlags,
Double_t timeout, Int_t axesType, const TGLVertex3 * reference,
Bool_t forSelect = kFALSE);
Bool_t Select(const TGLCamera & camera, const TGLDrawFlags & sceneFlags);
void AdoptLogical(TGLLogicalShape & shape);
Bool_t DestroyLogical(ULong_t ID);
UInt_t DestroyLogicals();
void PurgeNextLogical() {};
TGLLogicalShape * FindLogical(ULong_t ID) const;
void AdoptPhysical(TGLPhysicalShape & shape);
Bool_t DestroyPhysical(ULong_t ID);
UInt_t DestroyPhysicals(Bool_t incModified, const TGLCamera * camera = 0);
TGLPhysicalShape * FindPhysical(ULong_t ID) const;
void BeginSmartRefresh();
void EndSmartRefresh();
TGLLogicalShape * FindLogicalSmartRefresh(ULong_t ID) const;
TGLPhysicalShape * GetSelected() const { return fSelectedPhysical; }
TGLPhysicalShape * GetSelectionResult() const { return fSelectionResult; }
Int_t GetNPrimHits() const { return fNPrimHits; }
Int_t GetNSecHits() const { return fNSecHits; }
Bool_t GetTrySecSelect() const { return fTrySecSelect; }
void ActivateSecSelect() { fTrySecSelect = kTRUE; }
Bool_t GetTriedSecSelect() const { return fTriedSecSelect; }
std::pair<UInt_t, UInt_t*> GetHitRecord(Int_t i) const { return fSortedHits[i]; }
void ApplySelection();
Bool_t SetSelectedColor(const Float_t rgba[17]);
Bool_t SetColorOnSelectedFamily(const Float_t rgba[17]);
Bool_t SetSelectedGeom(const TGLVertex3 & trans, const TGLVector3 & scale);
void SetupClips();
void ClearClips();
void GetClipState(EClipType type, Double_t data[6]) const;
void SetClipState(EClipType type, const Double_t data[6]);
void GetCurrentClip(EClipType & type, Bool_t & edit) const;
void SetCurrentClip(EClipType type, Bool_t edit);
TGLCameraMarkupStyle* GetCameraMarkup() const { return fCameraMarkup; }
void SetCameraMarkup(TGLCameraMarkupStyle* m) { fCameraMarkup = m; }
void SetCurrentManip(EManipType type);
Bool_t HandleButton(const Event_t & event, const TGLCamera & camera);
Bool_t HandleMotion(const Event_t & event, const TGLCamera & camera);
Bool_t TakeLock(ELock lock) const;
Bool_t ReleaseLock(ELock lock) const;
Bool_t IsLocked() const;
ELock CurrentLock() const;
static const char * LockName(ELock lock);
static Bool_t LockValid(ELock lock);
void Dump() const;
UInt_t SizeOf() const;
ClassDef(TGLScene,0)
};
inline Bool_t TGLScene::HandleButton(const Event_t & event, const TGLCamera & camera)
{
return fCurrentManip->HandleButton(event, camera);
}
inline Bool_t TGLScene::HandleMotion(const Event_t & event, const TGLCamera & camera)
{
if (fCurrentManip->HandleMotion(event, camera, BoundingBox())) {
fBoundingBoxValid = kFALSE;
return kTRUE;
}
return kFALSE;
}
inline Bool_t TGLScene::TakeLock(ELock lock) const
{
if (LockValid(lock) && fLock == kUnlocked) {
fLock = lock;
if (gDebug>3) {
Info("TGLScene::TakeLock", "took %s", LockName(fLock));
}
return kTRUE;
}
Error("TGLScene::TakeLock", "Unable take %s, already %s", LockName(lock), LockName(fLock));
return kFALSE;
}
inline Bool_t TGLScene::ReleaseLock(ELock lock) const
{
if (LockValid(lock) && fLock == lock) {
fLock = kUnlocked;
if (gDebug>3) {
Info("TGLScene::ReleaseLock", "released %s", LockName(lock));
}
return kTRUE;
}
Error("TGLScene::ReleaseLock", "Unable release %s, is %s", LockName(lock), LockName(fLock));
return kFALSE;
}
inline Bool_t TGLScene::IsLocked() const
{
return (fLock != kUnlocked);
}
inline TGLScene::ELock TGLScene::CurrentLock() const
{
return fLock;
}
inline const char * TGLScene::LockName(ELock lock)
{
static const std::string names[5]
= { "Unlocked",
"DrawLock",
"SelectLock",
"ModifyLock",
"UnknownLock" };
if (lock < 4) {
return names[lock].c_str();
} else {
return names[4].c_str();
}
}
inline Bool_t TGLScene::LockValid(ELock lock)
{
switch(lock) {
case kDrawLock:
case kSelectLock:
case kModifyLock:
return kTRUE;
default:
return kFALSE;
}
}
#endif // ROOT_TGLScene
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.