// @(#)root/gl:$Id$
// Author:  Richard Maunder  25/05/2005

#include "TGLLogicalShape.h"
#include "TGLPhysicalShape.h"
#include "TGLRnrCtx.h"
#include "TGLScene.h"
#include "TGLCamera.h"
#include "TGLSelectRecord.h"
#include "TGLContext.h"
#include "TGLIncludes.h"

#include "TBuffer3D.h"
#include "TClass.h"
#include "TContextMenu.h"


//==============================================================================
// TGLLogicalShape
//==============================================================================

//______________________________________________________________________________
//
// Abstract logical shape - a GL 'drawable' - base for all shapes -
// faceset sphere etc. Logical shapes are a unique piece of geometry,
// described in it's local frame - e.g if we have three spheres in :
// Sphere A - Radius r1, center v1
// Sphere B - Radius r2, center v2
// Sphere C - Radius r1, center v3
//
// Spheres A and C can share a common logical sphere of radius r1 - and
// place them with two physicals with translations of v1 & v2.  Sphere B
// requires a different logical (radius r2), placed with physical with
// translation v2.
//
// Physical shapes know about and can share logicals. Logicals do not
// about (aside from reference counting) physicals or share them.
//
// This sharing of logical shapes greatly reduces memory consumption and
// scene (re)build times in typical detector geometries which have many
// repeated objects placements.
//
// TGLLogicalShapes have reference counting, performed by the client
// physical shapes which are using it.
//
// Display list information is also stored here, possibly per LOD
// level. Most classes do not support LOD (only sphere and tube) and
// therefore reasonable defaults are encoded in the following virtual
// functions:
//
// * ELODAxes SupportedLODAxes()  { return kLODAxesNone; }
// * Int_t    DLCacheSize()       { return 1; }
// * UInt_t   DLOffset(lod);      // Transform lod into DL offset.
// * Short_t  QuantizeShapeLOD(); // Quantize lod.
//
// Classes that have per-LOD display-lists than override these functions.
// 'UShort_t fDLValid' is used as a bit-field determining validity of
// each quantized LOD-level; hopefully one will not have more than 16
// LOD levels per class.
// See also: TGLPhysicalShape::CalculateShapeLOD() where LOD is calculated.
//
// See base/src/TVirtualViewer3D for description of common external 3D
// viewer architecture and how external viewer clients use it.
//

ClassImp(TGLLogicalShape);

Bool_t TGLLogicalShape::fgIgnoreSizeForCameraInterest = kFALSE;

//______________________________________________________________________________
TGLLogicalShape::TGLLogicalShape() :
   fRef           (0),
   fFirstPhysical (0),
   fExternalObj   (0),
   fScene         (0),
   fDLBase        (0),
   fDLSize        (1),
   fDLValid       (0),
   fDLCache       (kTRUE),
   fRefStrong     (kFALSE),
   fOwnExtObj     (kFALSE)
{
   // Constructor.
}

//______________________________________________________________________________
TGLLogicalShape::TGLLogicalShape(TObject* obj) :
   fRef           (0),
   fFirstPhysical (0),
   fExternalObj   (obj),
   fScene         (0),
   fDLBase        (0),
   fDLSize        (1),
   fDLValid       (0),
   fDLCache       (kTRUE),
   fRefStrong     (kFALSE),
   fOwnExtObj     (kFALSE)
{
   // Constructor with external object.
}

//______________________________________________________________________________
TGLLogicalShape::TGLLogicalShape(const TBuffer3D & buffer) :
   fRef           (0),
   fFirstPhysical (0),
   fExternalObj   (buffer.fID),
   fScene         (0),
   fDLBase        (0),
   fDLSize        (1),
   fDLValid       (0),
   fDLCache       (kTRUE),
   fRefStrong     (kFALSE),
   fOwnExtObj     (kFALSE)
{
   // Constructor from TBuffer3D.

   // Use the bounding box in buffer if valid
   if (buffer.SectionsValid(TBuffer3D::kBoundingBox)) {
      fBoundingBox.Set(buffer.fBBVertex);
   } else if (buffer.SectionsValid(TBuffer3D::kRaw)) {
   // otherwise use the raw points to generate one
      fBoundingBox.SetAligned(buffer.NbPnts(), buffer.fPnts);
   }

   // If the logical is created without an external object reference,
   // we create a generic  here and delete it during the destruction.
   if (fExternalObj == 0)
   {
      fExternalObj = new TNamed("Generic object", "Internal object created for bookkeeping.");
      fOwnExtObj = kTRUE;
   }
}

//______________________________________________________________________________
TGLLogicalShape::~TGLLogicalShape()
{
   // Destroy logical shape.

   // Physicals should have been cleared elsewhere as they are managed
   // by the scene. But this could change.
   if (fRef > 0) {
      Warning("TGLLogicalShape::~TGLLogicalShape", "some physicals still lurking around.");
      DestroyPhysicals();
   }
   DLCachePurge();
   if (fOwnExtObj)
   {
      delete fExternalObj;
   }
}


/**************************************************************************/
// Physical shape ref-counting, replica management
/**************************************************************************/

//______________________________________________________________________________
void TGLLogicalShape::AddRef(TGLPhysicalShape* phys) const
{
   // Add reference to given physical shape.

   phys->fNextPhysical = fFirstPhysical;
   fFirstPhysical = phys;
   ++fRef;
}

//______________________________________________________________________________
void TGLLogicalShape::SubRef(TGLPhysicalShape* phys) const
{
   // Remove reference to given physical shape, potentially deleting
   // *this* object when hitting zero ref-count (if fRefStrong is
   // true).

   assert(phys != 0);

   Bool_t found = kFALSE;
   if (fFirstPhysical == phys) {
      fFirstPhysical = phys->fNextPhysical;
      found = kTRUE;
   } else {
      TGLPhysicalShape *shp1 = fFirstPhysical, *shp2;
      while ((shp2 = shp1->fNextPhysical) != 0) {
         if (shp2 == phys) {
            shp1->fNextPhysical = shp2->fNextPhysical;
            found = kTRUE;
            break;
         }
         shp1 = shp2;
      }
   }
   if (found == kFALSE) {
      Error("TGLLogicalShape::SubRef", "Attempt to un-ref an unregistered physical.");
      return;
   }

   if (--fRef == 0 && fRefStrong)
      delete this;
}

//______________________________________________________________________________
void TGLLogicalShape::DestroyPhysicals()
{
   // Destroy all physicals attached to this logical.

   TGLPhysicalShape *curr = fFirstPhysical, *next;
   while (curr)
   {
      next = curr->fNextPhysical;
      curr->fLogicalShape = 0;
      --fRef;
      delete curr;
      curr = next;
   }
   assert (fRef == 0);
   fFirstPhysical = 0;
}

//______________________________________________________________________________
UInt_t TGLLogicalShape::UnrefFirstPhysical()
{
   // Unreference first physical in the list, returning its id and
   // making it fit for destruction somewhere else.
   // Returns 0 if there are no replicas attached.

   if (fFirstPhysical == 0) return 0;

   TGLPhysicalShape *phys = fFirstPhysical;
   UInt_t            phid = phys->ID();
   fFirstPhysical = phys->fNextPhysical;
   phys->fLogicalShape = 0;
   --fRef;
   return phid;
}


/**************************************************************************/
// Bounding-boxes
/**************************************************************************/

//______________________________________________________________________________
void TGLLogicalShape::UpdateBoundingBoxesOfPhysicals()
{
   // Update bounding-boxed of all dependent physicals.

   TGLPhysicalShape* pshp = fFirstPhysical;
   while (pshp)
   {
      pshp->UpdateBoundingBox();
      pshp = pshp->fNextPhysical;
   }
}


/**************************************************************************/
// Display-list cache
/**************************************************************************/

//______________________________________________________________________________
Bool_t TGLLogicalShape::SetDLCache(Bool_t cache)
{
   // Modify capture of draws into display list cache kTRUE - capture,
   // kFALSE direct draw. Return kTRUE is state changed, kFALSE if not.

   if (cache == fDLCache)
      return kFALSE;

   if (fDLCache)
      DLCachePurge();
   fDLCache = cache;
   return kTRUE;
}

//______________________________________________________________________________
Bool_t TGLLogicalShape::ShouldDLCache(const TGLRnrCtx& rnrCtx) const
{
   // Returns kTRUE if draws should be display list cached
   // kFALSE otherwise.
   //
   // Here we check that:
   // a) fScene is set (Scene manages link to GL-context);
   // b) secondary selection is not in progress as different
   //    render-path is usually taken in this case.
   //
   // Otherwise we return internal bool.
   //
   // Override this in sub-class if different behaviour is required.

   if (!fDLCache || !fScene   ||
       (rnrCtx.SecSelection() && SupportsSecondarySelect()))
   {
      return kFALSE;
   }
   return kTRUE;
}

//______________________________________________________________________________
void TGLLogicalShape::DLCacheClear()
{
   // Clear all entries for all LODs for this drawable from the
   // display list cache but keeping the reserved ids from GL context.

   fDLValid = 0;
}

//______________________________________________________________________________
void TGLLogicalShape::DLCacheDrop()
{
   // Drop all entries for all LODs for this drawable from the display
   // list cache, WITHOUT returning the reserved ids to GL context.
   //
   // This is called by scene if it realized that the GL context was
   // destroyed.

   fDLBase  = 0;
   fDLValid = 0;
}

//______________________________________________________________________________
void TGLLogicalShape::DLCachePurge()
{
   // Purge all entries for all LODs for this drawable from the
   // display list cache, returning the reserved ids to GL context.
   //
   // If you override this function:
   // 1. call the base-class version from it;
   // 2. call it from the destructor of the derived class!

   if (fDLBase != 0)
   {
      PurgeDLRange(fDLBase, fDLSize);
      fDLBase  = 0;
      fDLValid = 0;
   }
}

//______________________________________________________________________________
void TGLLogicalShape::PurgeDLRange(UInt_t base, Int_t size) const
{
   // Purge given display-list range.
   // Utility function.

   if (fScene)
   {
      fScene->GetGLCtxIdentity()->RegisterDLNameRangeToWipe(base, size);
   }
   else
   {
      Warning("TGLLogicalShape::PurgeDLRange", "Scene unknown, attempting direct deletion.");
      glDeleteLists(base, size);
   }
}

//______________________________________________________________________________
Short_t TGLLogicalShape::QuantizeShapeLOD(Short_t shapeLOD,
                                          Short_t /*combiLOD*/) const
{
   // Logical shapes usually support only discreet LOD values,
   // especially in view of display-list caching.
   // This function should be overriden to perform the desired quantization.
   // See TGLSphere.

   return shapeLOD;
}

//______________________________________________________________________________
void TGLLogicalShape::Draw(TGLRnrCtx& rnrCtx) const
{
   // Draw the GL drawable, using draw flags. If DL caching is enabled
   // (see SetDLCache) then attempt to draw from the cache, if not found
   // attempt to capture the draw - done by DirectDraw() - into a new cache entry.
   // If not cached just call DirectDraw() for normal non DL cached drawing.

   // Debug tracing
   if (gDebug > 4) {
      Info("TGLLogicalShape::Draw", "this %ld (class %s) LOD %d", (Long_t)this, IsA()->GetName(), rnrCtx.ShapeLOD());
   }

entry_point:
   // If shape is not cached, or a capture to cache is already in
   // progress perform a direct draw DL can be nested, but not created
   // in nested fashion. As we only build DL on draw demands have to
   // protected against this here.
   // MT: I can't see how this could happen right now ... with
   // rendering from a flat drawable-list.

   if (!ShouldDLCache(rnrCtx) || rnrCtx.IsDLCaptureOpen())
   {
      DirectDraw(rnrCtx);
      return;
   }

   if (fDLBase == 0)
   {
      fDLBase = glGenLists(fDLSize);
      if (fDLBase == 0)
      {
         Warning("TGLLogicalShape::Draw", "display-list registration failed.");
         fDLCache = kFALSE;
         goto entry_point;
      }
   }

   Short_t lod = rnrCtx.ShapeLOD();
   UInt_t  off = DLOffset(lod);
   if ((1<<off) & fDLValid)
   {
      glCallList(fDLBase + off);
   }
   else
   {
      rnrCtx.OpenDLCapture();
      glNewList(fDLBase + off, GL_COMPILE_AND_EXECUTE);
      DirectDraw(rnrCtx);
      glEndList();
      rnrCtx.CloseDLCapture();
      fDLValid |= (1<<off);
   }
}

//______________________________________________________________________________
void TGLLogicalShape::DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* pshp, Int_t lvl) const
{
   // Draw the logical shape in highlight mode.
   // If lvl argument is less than 0 (-1 by default), the index into color-set
   // is taken from the physical shape itself.

   if (lvl < 0) lvl = pshp->GetSelected();

   glColor4ubv(rnrCtx.ColorSet().Selection(lvl).CArr());
   TGLUtil::LockColor();
   Draw(rnrCtx);
   TGLUtil::UnlockColor();
}

//______________________________________________________________________________
void TGLLogicalShape::ProcessSelection(TGLRnrCtx& /*rnrCtx*/, TGLSelectRecord& rec)
{
   // Virtual method called-back after a secondary selection hit
   // is recorded (see TGLViewer::HandleButton(), Ctrl-Button1).
   // The ptr argument holds the GL pick-record of the closest hit.
   //
   // This base-class implementation simply prints out the result.

   printf("TGLLogicalShape::ProcessSelection %d names on the stack (z1=%g, z2=%g).\n",
          rec.GetN(), rec.GetMinZ(), rec.GetMaxZ());
   printf("  Names: ");
   for (Int_t j=0; j<rec.GetN(); ++j) printf ("%u ", rec.GetItem(j));
   printf("\n");
}

//______________________________________________________________________________
void TGLLogicalShape::InvokeContextMenu(TContextMenu& menu, UInt_t x, UInt_t y) const
{
   // Invoke popup menu or our bound external TObject (if any), using passed
   // 'menu' object, at location 'x' 'y'
   if (fExternalObj) {
      menu.Popup(x, y, fExternalObj);
   }
}

//______________________________________________________________________________
Bool_t TGLLogicalShape::IgnoreSizeForOfInterest() const
{
   // Return true if size of this shape should be ignored when determining if
   // the object should be drawn. In this base-class we simply return state of
   // static flag fgIgnoreSizeForCameraInterest.
   //
   // Several sub-classes override this virtual function.

   return fgIgnoreSizeForCameraInterest;
}

//______________________________________________________________________________
Bool_t TGLLogicalShape::GetIgnoreSizeForCameraInterest()
{
   // Get state of static fgIgnoreSizeForCameraInterest flag.
   // When this is true all objects, also very small, will be drawn by GL.

   return fgIgnoreSizeForCameraInterest;
}

//______________________________________________________________________________
void TGLLogicalShape::SetIgnoreSizeForCameraInterest(Bool_t isfci)
{
   // Set state of static fgIgnoreSizeForCameraInterest flag.

   fgIgnoreSizeForCameraInterest = isfci;
}
 TGLLogicalShape.cxx:1
 TGLLogicalShape.cxx:2
 TGLLogicalShape.cxx:3
 TGLLogicalShape.cxx:4
 TGLLogicalShape.cxx:5
 TGLLogicalShape.cxx:6
 TGLLogicalShape.cxx:7
 TGLLogicalShape.cxx:8
 TGLLogicalShape.cxx:9
 TGLLogicalShape.cxx:10
 TGLLogicalShape.cxx:11
 TGLLogicalShape.cxx:12
 TGLLogicalShape.cxx:13
 TGLLogicalShape.cxx:14
 TGLLogicalShape.cxx:15
 TGLLogicalShape.cxx:16
 TGLLogicalShape.cxx:17
 TGLLogicalShape.cxx:18
 TGLLogicalShape.cxx:19
 TGLLogicalShape.cxx:20
 TGLLogicalShape.cxx:21
 TGLLogicalShape.cxx:22
 TGLLogicalShape.cxx:23
 TGLLogicalShape.cxx:24
 TGLLogicalShape.cxx:25
 TGLLogicalShape.cxx:26
 TGLLogicalShape.cxx:27
 TGLLogicalShape.cxx:28
 TGLLogicalShape.cxx:29
 TGLLogicalShape.cxx:30
 TGLLogicalShape.cxx:31
 TGLLogicalShape.cxx:32
 TGLLogicalShape.cxx:33
 TGLLogicalShape.cxx:34
 TGLLogicalShape.cxx:35
 TGLLogicalShape.cxx:36
 TGLLogicalShape.cxx:37
 TGLLogicalShape.cxx:38
 TGLLogicalShape.cxx:39
 TGLLogicalShape.cxx:40
 TGLLogicalShape.cxx:41
 TGLLogicalShape.cxx:42
 TGLLogicalShape.cxx:43
 TGLLogicalShape.cxx:44
 TGLLogicalShape.cxx:45
 TGLLogicalShape.cxx:46
 TGLLogicalShape.cxx:47
 TGLLogicalShape.cxx:48
 TGLLogicalShape.cxx:49
 TGLLogicalShape.cxx:50
 TGLLogicalShape.cxx:51
 TGLLogicalShape.cxx:52
 TGLLogicalShape.cxx:53
 TGLLogicalShape.cxx:54
 TGLLogicalShape.cxx:55
 TGLLogicalShape.cxx:56
 TGLLogicalShape.cxx:57
 TGLLogicalShape.cxx:58
 TGLLogicalShape.cxx:59
 TGLLogicalShape.cxx:60
 TGLLogicalShape.cxx:61
 TGLLogicalShape.cxx:62
 TGLLogicalShape.cxx:63
 TGLLogicalShape.cxx:64
 TGLLogicalShape.cxx:65
 TGLLogicalShape.cxx:66
 TGLLogicalShape.cxx:67
 TGLLogicalShape.cxx:68
 TGLLogicalShape.cxx:69
 TGLLogicalShape.cxx:70
 TGLLogicalShape.cxx:71
 TGLLogicalShape.cxx:72
 TGLLogicalShape.cxx:73
 TGLLogicalShape.cxx:74
 TGLLogicalShape.cxx:75
 TGLLogicalShape.cxx:76
 TGLLogicalShape.cxx:77
 TGLLogicalShape.cxx:78
 TGLLogicalShape.cxx:79
 TGLLogicalShape.cxx:80
 TGLLogicalShape.cxx:81
 TGLLogicalShape.cxx:82
 TGLLogicalShape.cxx:83
 TGLLogicalShape.cxx:84
 TGLLogicalShape.cxx:85
 TGLLogicalShape.cxx:86
 TGLLogicalShape.cxx:87
 TGLLogicalShape.cxx:88
 TGLLogicalShape.cxx:89
 TGLLogicalShape.cxx:90
 TGLLogicalShape.cxx:91
 TGLLogicalShape.cxx:92
 TGLLogicalShape.cxx:93
 TGLLogicalShape.cxx:94
 TGLLogicalShape.cxx:95
 TGLLogicalShape.cxx:96
 TGLLogicalShape.cxx:97
 TGLLogicalShape.cxx:98
 TGLLogicalShape.cxx:99
 TGLLogicalShape.cxx:100
 TGLLogicalShape.cxx:101
 TGLLogicalShape.cxx:102
 TGLLogicalShape.cxx:103
 TGLLogicalShape.cxx:104
 TGLLogicalShape.cxx:105
 TGLLogicalShape.cxx:106
 TGLLogicalShape.cxx:107
 TGLLogicalShape.cxx:108
 TGLLogicalShape.cxx:109
 TGLLogicalShape.cxx:110
 TGLLogicalShape.cxx:111
 TGLLogicalShape.cxx:112
 TGLLogicalShape.cxx:113
 TGLLogicalShape.cxx:114
 TGLLogicalShape.cxx:115
 TGLLogicalShape.cxx:116
 TGLLogicalShape.cxx:117
 TGLLogicalShape.cxx:118
 TGLLogicalShape.cxx:119
 TGLLogicalShape.cxx:120
 TGLLogicalShape.cxx:121
 TGLLogicalShape.cxx:122
 TGLLogicalShape.cxx:123
 TGLLogicalShape.cxx:124
 TGLLogicalShape.cxx:125
 TGLLogicalShape.cxx:126
 TGLLogicalShape.cxx:127
 TGLLogicalShape.cxx:128
 TGLLogicalShape.cxx:129
 TGLLogicalShape.cxx:130
 TGLLogicalShape.cxx:131
 TGLLogicalShape.cxx:132
 TGLLogicalShape.cxx:133
 TGLLogicalShape.cxx:134
 TGLLogicalShape.cxx:135
 TGLLogicalShape.cxx:136
 TGLLogicalShape.cxx:137
 TGLLogicalShape.cxx:138
 TGLLogicalShape.cxx:139
 TGLLogicalShape.cxx:140
 TGLLogicalShape.cxx:141
 TGLLogicalShape.cxx:142
 TGLLogicalShape.cxx:143
 TGLLogicalShape.cxx:144
 TGLLogicalShape.cxx:145
 TGLLogicalShape.cxx:146
 TGLLogicalShape.cxx:147
 TGLLogicalShape.cxx:148
 TGLLogicalShape.cxx:149
 TGLLogicalShape.cxx:150
 TGLLogicalShape.cxx:151
 TGLLogicalShape.cxx:152
 TGLLogicalShape.cxx:153
 TGLLogicalShape.cxx:154
 TGLLogicalShape.cxx:155
 TGLLogicalShape.cxx:156
 TGLLogicalShape.cxx:157
 TGLLogicalShape.cxx:158
 TGLLogicalShape.cxx:159
 TGLLogicalShape.cxx:160
 TGLLogicalShape.cxx:161
 TGLLogicalShape.cxx:162
 TGLLogicalShape.cxx:163
 TGLLogicalShape.cxx:164
 TGLLogicalShape.cxx:165
 TGLLogicalShape.cxx:166
 TGLLogicalShape.cxx:167
 TGLLogicalShape.cxx:168
 TGLLogicalShape.cxx:169
 TGLLogicalShape.cxx:170
 TGLLogicalShape.cxx:171
 TGLLogicalShape.cxx:172
 TGLLogicalShape.cxx:173
 TGLLogicalShape.cxx:174
 TGLLogicalShape.cxx:175
 TGLLogicalShape.cxx:176
 TGLLogicalShape.cxx:177
 TGLLogicalShape.cxx:178
 TGLLogicalShape.cxx:179
 TGLLogicalShape.cxx:180
 TGLLogicalShape.cxx:181
 TGLLogicalShape.cxx:182
 TGLLogicalShape.cxx:183
 TGLLogicalShape.cxx:184
 TGLLogicalShape.cxx:185
 TGLLogicalShape.cxx:186
 TGLLogicalShape.cxx:187
 TGLLogicalShape.cxx:188
 TGLLogicalShape.cxx:189
 TGLLogicalShape.cxx:190
 TGLLogicalShape.cxx:191
 TGLLogicalShape.cxx:192
 TGLLogicalShape.cxx:193
 TGLLogicalShape.cxx:194
 TGLLogicalShape.cxx:195
 TGLLogicalShape.cxx:196
 TGLLogicalShape.cxx:197
 TGLLogicalShape.cxx:198
 TGLLogicalShape.cxx:199
 TGLLogicalShape.cxx:200
 TGLLogicalShape.cxx:201
 TGLLogicalShape.cxx:202
 TGLLogicalShape.cxx:203
 TGLLogicalShape.cxx:204
 TGLLogicalShape.cxx:205
 TGLLogicalShape.cxx:206
 TGLLogicalShape.cxx:207
 TGLLogicalShape.cxx:208
 TGLLogicalShape.cxx:209
 TGLLogicalShape.cxx:210
 TGLLogicalShape.cxx:211
 TGLLogicalShape.cxx:212
 TGLLogicalShape.cxx:213
 TGLLogicalShape.cxx:214
 TGLLogicalShape.cxx:215
 TGLLogicalShape.cxx:216
 TGLLogicalShape.cxx:217
 TGLLogicalShape.cxx:218
 TGLLogicalShape.cxx:219
 TGLLogicalShape.cxx:220
 TGLLogicalShape.cxx:221
 TGLLogicalShape.cxx:222
 TGLLogicalShape.cxx:223
 TGLLogicalShape.cxx:224
 TGLLogicalShape.cxx:225
 TGLLogicalShape.cxx:226
 TGLLogicalShape.cxx:227
 TGLLogicalShape.cxx:228
 TGLLogicalShape.cxx:229
 TGLLogicalShape.cxx:230
 TGLLogicalShape.cxx:231
 TGLLogicalShape.cxx:232
 TGLLogicalShape.cxx:233
 TGLLogicalShape.cxx:234
 TGLLogicalShape.cxx:235
 TGLLogicalShape.cxx:236
 TGLLogicalShape.cxx:237
 TGLLogicalShape.cxx:238
 TGLLogicalShape.cxx:239
 TGLLogicalShape.cxx:240
 TGLLogicalShape.cxx:241
 TGLLogicalShape.cxx:242
 TGLLogicalShape.cxx:243
 TGLLogicalShape.cxx:244
 TGLLogicalShape.cxx:245
 TGLLogicalShape.cxx:246
 TGLLogicalShape.cxx:247
 TGLLogicalShape.cxx:248
 TGLLogicalShape.cxx:249
 TGLLogicalShape.cxx:250
 TGLLogicalShape.cxx:251
 TGLLogicalShape.cxx:252
 TGLLogicalShape.cxx:253
 TGLLogicalShape.cxx:254
 TGLLogicalShape.cxx:255
 TGLLogicalShape.cxx:256
 TGLLogicalShape.cxx:257
 TGLLogicalShape.cxx:258
 TGLLogicalShape.cxx:259
 TGLLogicalShape.cxx:260
 TGLLogicalShape.cxx:261
 TGLLogicalShape.cxx:262
 TGLLogicalShape.cxx:263
 TGLLogicalShape.cxx:264
 TGLLogicalShape.cxx:265
 TGLLogicalShape.cxx:266
 TGLLogicalShape.cxx:267
 TGLLogicalShape.cxx:268
 TGLLogicalShape.cxx:269
 TGLLogicalShape.cxx:270
 TGLLogicalShape.cxx:271
 TGLLogicalShape.cxx:272
 TGLLogicalShape.cxx:273
 TGLLogicalShape.cxx:274
 TGLLogicalShape.cxx:275
 TGLLogicalShape.cxx:276
 TGLLogicalShape.cxx:277
 TGLLogicalShape.cxx:278
 TGLLogicalShape.cxx:279
 TGLLogicalShape.cxx:280
 TGLLogicalShape.cxx:281
 TGLLogicalShape.cxx:282
 TGLLogicalShape.cxx:283
 TGLLogicalShape.cxx:284
 TGLLogicalShape.cxx:285
 TGLLogicalShape.cxx:286
 TGLLogicalShape.cxx:287
 TGLLogicalShape.cxx:288
 TGLLogicalShape.cxx:289
 TGLLogicalShape.cxx:290
 TGLLogicalShape.cxx:291
 TGLLogicalShape.cxx:292
 TGLLogicalShape.cxx:293
 TGLLogicalShape.cxx:294
 TGLLogicalShape.cxx:295
 TGLLogicalShape.cxx:296
 TGLLogicalShape.cxx:297
 TGLLogicalShape.cxx:298
 TGLLogicalShape.cxx:299
 TGLLogicalShape.cxx:300
 TGLLogicalShape.cxx:301
 TGLLogicalShape.cxx:302
 TGLLogicalShape.cxx:303
 TGLLogicalShape.cxx:304
 TGLLogicalShape.cxx:305
 TGLLogicalShape.cxx:306
 TGLLogicalShape.cxx:307
 TGLLogicalShape.cxx:308
 TGLLogicalShape.cxx:309
 TGLLogicalShape.cxx:310
 TGLLogicalShape.cxx:311
 TGLLogicalShape.cxx:312
 TGLLogicalShape.cxx:313
 TGLLogicalShape.cxx:314
 TGLLogicalShape.cxx:315
 TGLLogicalShape.cxx:316
 TGLLogicalShape.cxx:317
 TGLLogicalShape.cxx:318
 TGLLogicalShape.cxx:319
 TGLLogicalShape.cxx:320
 TGLLogicalShape.cxx:321
 TGLLogicalShape.cxx:322
 TGLLogicalShape.cxx:323
 TGLLogicalShape.cxx:324
 TGLLogicalShape.cxx:325
 TGLLogicalShape.cxx:326
 TGLLogicalShape.cxx:327
 TGLLogicalShape.cxx:328
 TGLLogicalShape.cxx:329
 TGLLogicalShape.cxx:330
 TGLLogicalShape.cxx:331
 TGLLogicalShape.cxx:332
 TGLLogicalShape.cxx:333
 TGLLogicalShape.cxx:334
 TGLLogicalShape.cxx:335
 TGLLogicalShape.cxx:336
 TGLLogicalShape.cxx:337
 TGLLogicalShape.cxx:338
 TGLLogicalShape.cxx:339
 TGLLogicalShape.cxx:340
 TGLLogicalShape.cxx:341
 TGLLogicalShape.cxx:342
 TGLLogicalShape.cxx:343
 TGLLogicalShape.cxx:344
 TGLLogicalShape.cxx:345
 TGLLogicalShape.cxx:346
 TGLLogicalShape.cxx:347
 TGLLogicalShape.cxx:348
 TGLLogicalShape.cxx:349
 TGLLogicalShape.cxx:350
 TGLLogicalShape.cxx:351
 TGLLogicalShape.cxx:352
 TGLLogicalShape.cxx:353
 TGLLogicalShape.cxx:354
 TGLLogicalShape.cxx:355
 TGLLogicalShape.cxx:356
 TGLLogicalShape.cxx:357
 TGLLogicalShape.cxx:358
 TGLLogicalShape.cxx:359
 TGLLogicalShape.cxx:360
 TGLLogicalShape.cxx:361
 TGLLogicalShape.cxx:362
 TGLLogicalShape.cxx:363
 TGLLogicalShape.cxx:364
 TGLLogicalShape.cxx:365
 TGLLogicalShape.cxx:366
 TGLLogicalShape.cxx:367
 TGLLogicalShape.cxx:368
 TGLLogicalShape.cxx:369
 TGLLogicalShape.cxx:370
 TGLLogicalShape.cxx:371
 TGLLogicalShape.cxx:372
 TGLLogicalShape.cxx:373
 TGLLogicalShape.cxx:374
 TGLLogicalShape.cxx:375
 TGLLogicalShape.cxx:376
 TGLLogicalShape.cxx:377
 TGLLogicalShape.cxx:378
 TGLLogicalShape.cxx:379
 TGLLogicalShape.cxx:380
 TGLLogicalShape.cxx:381
 TGLLogicalShape.cxx:382
 TGLLogicalShape.cxx:383
 TGLLogicalShape.cxx:384
 TGLLogicalShape.cxx:385
 TGLLogicalShape.cxx:386
 TGLLogicalShape.cxx:387
 TGLLogicalShape.cxx:388
 TGLLogicalShape.cxx:389
 TGLLogicalShape.cxx:390
 TGLLogicalShape.cxx:391
 TGLLogicalShape.cxx:392
 TGLLogicalShape.cxx:393
 TGLLogicalShape.cxx:394
 TGLLogicalShape.cxx:395
 TGLLogicalShape.cxx:396
 TGLLogicalShape.cxx:397
 TGLLogicalShape.cxx:398
 TGLLogicalShape.cxx:399
 TGLLogicalShape.cxx:400
 TGLLogicalShape.cxx:401
 TGLLogicalShape.cxx:402
 TGLLogicalShape.cxx:403
 TGLLogicalShape.cxx:404
 TGLLogicalShape.cxx:405
 TGLLogicalShape.cxx:406
 TGLLogicalShape.cxx:407
 TGLLogicalShape.cxx:408
 TGLLogicalShape.cxx:409
 TGLLogicalShape.cxx:410
 TGLLogicalShape.cxx:411
 TGLLogicalShape.cxx:412
 TGLLogicalShape.cxx:413
 TGLLogicalShape.cxx:414
 TGLLogicalShape.cxx:415
 TGLLogicalShape.cxx:416
 TGLLogicalShape.cxx:417
 TGLLogicalShape.cxx:418
 TGLLogicalShape.cxx:419
 TGLLogicalShape.cxx:420
 TGLLogicalShape.cxx:421
 TGLLogicalShape.cxx:422
 TGLLogicalShape.cxx:423
 TGLLogicalShape.cxx:424
 TGLLogicalShape.cxx:425
 TGLLogicalShape.cxx:426
 TGLLogicalShape.cxx:427
 TGLLogicalShape.cxx:428
 TGLLogicalShape.cxx:429
 TGLLogicalShape.cxx:430
 TGLLogicalShape.cxx:431
 TGLLogicalShape.cxx:432
 TGLLogicalShape.cxx:433
 TGLLogicalShape.cxx:434
 TGLLogicalShape.cxx:435
 TGLLogicalShape.cxx:436
 TGLLogicalShape.cxx:437
 TGLLogicalShape.cxx:438
 TGLLogicalShape.cxx:439
 TGLLogicalShape.cxx:440
 TGLLogicalShape.cxx:441
 TGLLogicalShape.cxx:442
 TGLLogicalShape.cxx:443
 TGLLogicalShape.cxx:444
 TGLLogicalShape.cxx:445
 TGLLogicalShape.cxx:446
 TGLLogicalShape.cxx:447
 TGLLogicalShape.cxx:448
 TGLLogicalShape.cxx:449
 TGLLogicalShape.cxx:450
 TGLLogicalShape.cxx:451
 TGLLogicalShape.cxx:452
 TGLLogicalShape.cxx:453
 TGLLogicalShape.cxx:454
 TGLLogicalShape.cxx:455
 TGLLogicalShape.cxx:456
 TGLLogicalShape.cxx:457
 TGLLogicalShape.cxx:458
 TGLLogicalShape.cxx:459
 TGLLogicalShape.cxx:460
 TGLLogicalShape.cxx:461
 TGLLogicalShape.cxx:462
 TGLLogicalShape.cxx:463
 TGLLogicalShape.cxx:464
 TGLLogicalShape.cxx:465
 TGLLogicalShape.cxx:466
 TGLLogicalShape.cxx:467
 TGLLogicalShape.cxx:468
 TGLLogicalShape.cxx:469
 TGLLogicalShape.cxx:470
 TGLLogicalShape.cxx:471
 TGLLogicalShape.cxx:472
 TGLLogicalShape.cxx:473
 TGLLogicalShape.cxx:474
 TGLLogicalShape.cxx:475
 TGLLogicalShape.cxx:476
 TGLLogicalShape.cxx:477
 TGLLogicalShape.cxx:478
 TGLLogicalShape.cxx:479
 TGLLogicalShape.cxx:480
 TGLLogicalShape.cxx:481
 TGLLogicalShape.cxx:482
 TGLLogicalShape.cxx:483
 TGLLogicalShape.cxx:484
 TGLLogicalShape.cxx:485
 TGLLogicalShape.cxx:486
 TGLLogicalShape.cxx:487
 TGLLogicalShape.cxx:488