ROOT logo
// @(#)root/eve:$Id: TEveStraightLineSet.h 36938 2010-11-25 13:57:45Z matevz $
// 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_TEveStraightLineSet
#define ROOT_TEveStraightLineSet

#include "TEveUtil.h"

#include <Gtypes.h>
#include "TNamed.h"
#include "TQObject.h"
#include "TAtt3D.h"
#include "TAttMarker.h"
#include "TAttLine.h"
#include "TAttBBox.h"

#include "TEveUtil.h"
#include "TEveElement.h"
#include "TEveProjectionBases.h"
#include "TEveChunkManager.h"
#include "TEveTrans.h"

class TRandom;

class TEveStraightLineSet : public TEveElement,
                            public TEveProjectable,
                            public TNamed,
                            public TQObject,
                            public TAtt3D,
                            public TAttLine,
                            public TAttMarker,
                            public TAttBBox
{
private:
   TEveStraightLineSet(const TEveStraightLineSet&);            // Not implemented
   TEveStraightLineSet& operator=(const TEveStraightLineSet&); // Not implemented

public:
   struct Line_t
   {
      Int_t          fId;
      Float_t        fV1[3];
      Float_t        fV2[3];
      TRef           fRef;

      Line_t(Float_t x1, Float_t y1, Float_t z1,
             Float_t x2, Float_t y2, Float_t z2) : fId(-1), fRef()
      {
         fV1[0] = x1, fV1[1] = y1, fV1[2] = z1;
         fV2[0] = x2, fV2[1] = y2, fV2[2] = z2;
      }
   };

   struct Marker_t
   {
      Float_t      fV[3];
      Int_t        fLineId;
      TRef         fRef;

      Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id), fRef()
      {
         fV[0] = x, fV[1] = y, fV[2] = z;
      }
   };

protected:
   TEveChunkManager  fLinePlex;
   TEveChunkManager  fMarkerPlex;

   Bool_t            fOwnLinesIds;    // Flag specifying if id-objects are owned by the line-set
   Bool_t            fOwnMarkersIds;  // Flag specifying if id-objects are owned by the line-set

   Bool_t            fRnrMarkers;
   Bool_t            fRnrLines;

   Bool_t            fDepthTest;

   Line_t*           fLastLine; //!

public:
   TEveStraightLineSet(const char* n="StraightLineSet", const char* t="");
   virtual ~TEveStraightLineSet() {}

   virtual void SetLineColor(Color_t col) { SetMainColor(col); }

   Line_t*   AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
   Line_t*   AddLine(const TEveVector& p1, const TEveVector& p2);
   Marker_t* AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
   Marker_t* AddMarker(const TEveVector& p, Int_t line_id=-1);
   Marker_t* AddMarker(Int_t line_id, Float_t pos);

   void      SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
   void      SetLine(int idx, const TEveVector& p1, const TEveVector& p2);

   TEveChunkManager& GetLinePlex()   { return fLinePlex;   }
   TEveChunkManager& GetMarkerPlex() { return fMarkerPlex; }

   virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
   virtual Bool_t GetRnrLines()   { return fRnrLines;   }
   virtual Bool_t GetDepthTest()  { return fDepthTest;   }

   virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
   virtual void SetRnrLines(Bool_t x)   { fRnrLines   = x; }
   virtual void SetDepthTest(Bool_t x)  { fDepthTest   = x; }
   
   virtual void CopyVizParams(const TEveElement* el);
   virtual void WriteVizParams(ostream& out, const TString& var);

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

   virtual void ComputeBBox();
   virtual void Paint(Option_t* option="");

   ClassDef(TEveStraightLineSet, 1); // Set of straight lines with optional markers along the lines.
};


/******************************************************************************/

class TEveStraightLineSetProjected : public TEveStraightLineSet,
                                     public TEveProjected
{
private:
   TEveStraightLineSetProjected(const TEveStraightLineSetProjected&);            // Not implemented
   TEveStraightLineSetProjected& operator=(const TEveStraightLineSetProjected&); // Not implemented

protected:
   virtual void SetDepthLocal(Float_t d);

public:
   TEveStraightLineSetProjected();
   virtual ~TEveStraightLineSetProjected() {}

   virtual void SetProjection(TEveProjectionManager* mng, TEveProjectable* model);
   virtual void UpdateProjection();
   virtual TEveElement* GetProjectedAsElement() { return this; }

   ClassDef(TEveStraightLineSetProjected, 1); // Projected copy of a TEveStraightLineSet.
};

#endif
 TEveStraightLineSet.h:1
 TEveStraightLineSet.h:2
 TEveStraightLineSet.h:3
 TEveStraightLineSet.h:4
 TEveStraightLineSet.h:5
 TEveStraightLineSet.h:6
 TEveStraightLineSet.h:7
 TEveStraightLineSet.h:8
 TEveStraightLineSet.h:9
 TEveStraightLineSet.h:10
 TEveStraightLineSet.h:11
 TEveStraightLineSet.h:12
 TEveStraightLineSet.h:13
 TEveStraightLineSet.h:14
 TEveStraightLineSet.h:15
 TEveStraightLineSet.h:16
 TEveStraightLineSet.h:17
 TEveStraightLineSet.h:18
 TEveStraightLineSet.h:19
 TEveStraightLineSet.h:20
 TEveStraightLineSet.h:21
 TEveStraightLineSet.h:22
 TEveStraightLineSet.h:23
 TEveStraightLineSet.h:24
 TEveStraightLineSet.h:25
 TEveStraightLineSet.h:26
 TEveStraightLineSet.h:27
 TEveStraightLineSet.h:28
 TEveStraightLineSet.h:29
 TEveStraightLineSet.h:30
 TEveStraightLineSet.h:31
 TEveStraightLineSet.h:32
 TEveStraightLineSet.h:33
 TEveStraightLineSet.h:34
 TEveStraightLineSet.h:35
 TEveStraightLineSet.h:36
 TEveStraightLineSet.h:37
 TEveStraightLineSet.h:38
 TEveStraightLineSet.h:39
 TEveStraightLineSet.h:40
 TEveStraightLineSet.h:41
 TEveStraightLineSet.h:42
 TEveStraightLineSet.h:43
 TEveStraightLineSet.h:44
 TEveStraightLineSet.h:45
 TEveStraightLineSet.h:46
 TEveStraightLineSet.h:47
 TEveStraightLineSet.h:48
 TEveStraightLineSet.h:49
 TEveStraightLineSet.h:50
 TEveStraightLineSet.h:51
 TEveStraightLineSet.h:52
 TEveStraightLineSet.h:53
 TEveStraightLineSet.h:54
 TEveStraightLineSet.h:55
 TEveStraightLineSet.h:56
 TEveStraightLineSet.h:57
 TEveStraightLineSet.h:58
 TEveStraightLineSet.h:59
 TEveStraightLineSet.h:60
 TEveStraightLineSet.h:61
 TEveStraightLineSet.h:62
 TEveStraightLineSet.h:63
 TEveStraightLineSet.h:64
 TEveStraightLineSet.h:65
 TEveStraightLineSet.h:66
 TEveStraightLineSet.h:67
 TEveStraightLineSet.h:68
 TEveStraightLineSet.h:69
 TEveStraightLineSet.h:70
 TEveStraightLineSet.h:71
 TEveStraightLineSet.h:72
 TEveStraightLineSet.h:73
 TEveStraightLineSet.h:74
 TEveStraightLineSet.h:75
 TEveStraightLineSet.h:76
 TEveStraightLineSet.h:77
 TEveStraightLineSet.h:78
 TEveStraightLineSet.h:79
 TEveStraightLineSet.h:80
 TEveStraightLineSet.h:81
 TEveStraightLineSet.h:82
 TEveStraightLineSet.h:83
 TEveStraightLineSet.h:84
 TEveStraightLineSet.h:85
 TEveStraightLineSet.h:86
 TEveStraightLineSet.h:87
 TEveStraightLineSet.h:88
 TEveStraightLineSet.h:89
 TEveStraightLineSet.h:90
 TEveStraightLineSet.h:91
 TEveStraightLineSet.h:92
 TEveStraightLineSet.h:93
 TEveStraightLineSet.h:94
 TEveStraightLineSet.h:95
 TEveStraightLineSet.h:96
 TEveStraightLineSet.h:97
 TEveStraightLineSet.h:98
 TEveStraightLineSet.h:99
 TEveStraightLineSet.h:100
 TEveStraightLineSet.h:101
 TEveStraightLineSet.h:102
 TEveStraightLineSet.h:103
 TEveStraightLineSet.h:104
 TEveStraightLineSet.h:105
 TEveStraightLineSet.h:106
 TEveStraightLineSet.h:107
 TEveStraightLineSet.h:108
 TEveStraightLineSet.h:109
 TEveStraightLineSet.h:110
 TEveStraightLineSet.h:111
 TEveStraightLineSet.h:112
 TEveStraightLineSet.h:113
 TEveStraightLineSet.h:114
 TEveStraightLineSet.h:115
 TEveStraightLineSet.h:116
 TEveStraightLineSet.h:117
 TEveStraightLineSet.h:118
 TEveStraightLineSet.h:119
 TEveStraightLineSet.h:120
 TEveStraightLineSet.h:121
 TEveStraightLineSet.h:122
 TEveStraightLineSet.h:123
 TEveStraightLineSet.h:124
 TEveStraightLineSet.h:125
 TEveStraightLineSet.h:126
 TEveStraightLineSet.h:127
 TEveStraightLineSet.h:128
 TEveStraightLineSet.h:129
 TEveStraightLineSet.h:130
 TEveStraightLineSet.h:131
 TEveStraightLineSet.h:132
 TEveStraightLineSet.h:133
 TEveStraightLineSet.h:134
 TEveStraightLineSet.h:135
 TEveStraightLineSet.h:136
 TEveStraightLineSet.h:137
 TEveStraightLineSet.h:138
 TEveStraightLineSet.h:139
 TEveStraightLineSet.h:140
 TEveStraightLineSet.h:141
 TEveStraightLineSet.h:142
 TEveStraightLineSet.h:143
 TEveStraightLineSet.h:144
 TEveStraightLineSet.h:145
 TEveStraightLineSet.h:146
 TEveStraightLineSet.h:147
 TEveStraightLineSet.h:148
 TEveStraightLineSet.h:149