// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveProjectionBases
#define ROOT_TEveProjectionBases

#include "Rtypes.h"
#include <list>
#include <set>

class TEveElement;
class TEveProjection;
class TEveProjected;
class TEveProjectionManager;

class TClass;

////////////////////////////////////////////////////////////////
//                                                            //
// TEveProjectable                                            //
//                                                            //
// Abstract base class for non-linear projectable objects.    //
//                                                            //
////////////////////////////////////////////////////////////////

class TEveProjectable
{
private:
   TEveProjectable(const TEveProjectable&);            // Not implemented
   TEveProjectable& operator=(const TEveProjectable&); // Not implemented

public:
   typedef std::list<TEveProjected*>            ProjList_t;
   typedef std::list<TEveProjected*>::iterator  ProjList_i;

protected:
   ProjList_t       fProjectedList; // references to projected instances.

public:
   TEveProjectable();
   virtual ~TEveProjectable();

   virtual TClass* ProjectedClass(const TEveProjection* p) const = 0;

   virtual Bool_t HasProjecteds() const { return ! fProjectedList.empty(); }

   ProjList_i   BeginProjecteds()       { return  fProjectedList.begin(); }
   ProjList_i   EndProjecteds()         { return  fProjectedList.end();   }

   virtual void AddProjected(TEveProjected* p)    { fProjectedList.push_back(p); }
   virtual void RemoveProjected(TEveProjected* p) { fProjectedList.remove(p);   }

   virtual void AnnihilateProjecteds();
   virtual void ClearProjectedList();

   virtual void AddProjectedsToSet(std::set<TEveElement*>& set);

   virtual void PropagateVizParams(TEveElement* el=0);
   virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children);
   virtual void PropagateMainColor(Color_t color, Color_t old_color);
   virtual void PropagateMainTransparency(Char_t t, Char_t old_t);

   ClassDef(TEveProjectable, 0); // Abstract base class for classes that can be transformed with non-linear projections.
};


////////////////////////////////////////////////////////////////
//                                                            //
// TEveProjected                                              //
//                                                            //
// Abstract base class for non-linear projected objects.      //
//                                                            //
////////////////////////////////////////////////////////////////

class TEveProjected
{
private:
   TEveProjected(const TEveProjected&);            // Not implemented
   TEveProjected& operator=(const TEveProjected&); // Not implemented

protected:
   TEveProjectionManager *fManager;       // manager
   TEveProjectable       *fProjectable;   // link to original object
   Float_t                fDepth;         // z coordinate

   void         SetDepthCommon(Float_t d, TEveElement* el, Float_t* bbox);
   virtual void SetDepthLocal(Float_t d);

public:
   TEveProjected();
   virtual ~TEveProjected();

   TEveProjectionManager* GetManager()     const { return fManager; }
   TEveProjectable*       GetProjectable() const { return fProjectable; }
   Float_t                GetDepth()       const { return fDepth; }

   virtual void SetProjection(TEveProjectionManager* mng, TEveProjectable* model);
   virtual void UnRefProjectable(TEveProjectable* assumed_parent, bool notifyParent = true);

   virtual void UpdateProjection() = 0;
   virtual TEveElement* GetProjectedAsElement();

   virtual void SetDepth(Float_t d);

   ClassDef(TEveProjected, 0); // Abstract base class for classes that hold results of a non-linear projection transformation.
};

#endif
 TEveProjectionBases.h:1
 TEveProjectionBases.h:2
 TEveProjectionBases.h:3
 TEveProjectionBases.h:4
 TEveProjectionBases.h:5
 TEveProjectionBases.h:6
 TEveProjectionBases.h:7
 TEveProjectionBases.h:8
 TEveProjectionBases.h:9
 TEveProjectionBases.h:10
 TEveProjectionBases.h:11
 TEveProjectionBases.h:12
 TEveProjectionBases.h:13
 TEveProjectionBases.h:14
 TEveProjectionBases.h:15
 TEveProjectionBases.h:16
 TEveProjectionBases.h:17
 TEveProjectionBases.h:18
 TEveProjectionBases.h:19
 TEveProjectionBases.h:20
 TEveProjectionBases.h:21
 TEveProjectionBases.h:22
 TEveProjectionBases.h:23
 TEveProjectionBases.h:24
 TEveProjectionBases.h:25
 TEveProjectionBases.h:26
 TEveProjectionBases.h:27
 TEveProjectionBases.h:28
 TEveProjectionBases.h:29
 TEveProjectionBases.h:30
 TEveProjectionBases.h:31
 TEveProjectionBases.h:32
 TEveProjectionBases.h:33
 TEveProjectionBases.h:34
 TEveProjectionBases.h:35
 TEveProjectionBases.h:36
 TEveProjectionBases.h:37
 TEveProjectionBases.h:38
 TEveProjectionBases.h:39
 TEveProjectionBases.h:40
 TEveProjectionBases.h:41
 TEveProjectionBases.h:42
 TEveProjectionBases.h:43
 TEveProjectionBases.h:44
 TEveProjectionBases.h:45
 TEveProjectionBases.h:46
 TEveProjectionBases.h:47
 TEveProjectionBases.h:48
 TEveProjectionBases.h:49
 TEveProjectionBases.h:50
 TEveProjectionBases.h:51
 TEveProjectionBases.h:52
 TEveProjectionBases.h:53
 TEveProjectionBases.h:54
 TEveProjectionBases.h:55
 TEveProjectionBases.h:56
 TEveProjectionBases.h:57
 TEveProjectionBases.h:58
 TEveProjectionBases.h:59
 TEveProjectionBases.h:60
 TEveProjectionBases.h:61
 TEveProjectionBases.h:62
 TEveProjectionBases.h:63
 TEveProjectionBases.h:64
 TEveProjectionBases.h:65
 TEveProjectionBases.h:66
 TEveProjectionBases.h:67
 TEveProjectionBases.h:68
 TEveProjectionBases.h:69
 TEveProjectionBases.h:70
 TEveProjectionBases.h:71
 TEveProjectionBases.h:72
 TEveProjectionBases.h:73
 TEveProjectionBases.h:74
 TEveProjectionBases.h:75
 TEveProjectionBases.h:76
 TEveProjectionBases.h:77
 TEveProjectionBases.h:78
 TEveProjectionBases.h:79
 TEveProjectionBases.h:80
 TEveProjectionBases.h:81
 TEveProjectionBases.h:82
 TEveProjectionBases.h:83
 TEveProjectionBases.h:84
 TEveProjectionBases.h:85
 TEveProjectionBases.h:86
 TEveProjectionBases.h:87
 TEveProjectionBases.h:88
 TEveProjectionBases.h:89
 TEveProjectionBases.h:90
 TEveProjectionBases.h:91
 TEveProjectionBases.h:92
 TEveProjectionBases.h:93
 TEveProjectionBases.h:94
 TEveProjectionBases.h:95
 TEveProjectionBases.h:96
 TEveProjectionBases.h:97
 TEveProjectionBases.h:98
 TEveProjectionBases.h:99
 TEveProjectionBases.h:100
 TEveProjectionBases.h:101
 TEveProjectionBases.h:102
 TEveProjectionBases.h:103
 TEveProjectionBases.h:104
 TEveProjectionBases.h:105
 TEveProjectionBases.h:106
 TEveProjectionBases.h:107
 TEveProjectionBases.h:108
 TEveProjectionBases.h:109
 TEveProjectionBases.h:110
 TEveProjectionBases.h:111
 TEveProjectionBases.h:112
 TEveProjectionBases.h:113
 TEveProjectionBases.h:114
 TEveProjectionBases.h:115
 TEveProjectionBases.h:116