00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTablePoints
00013 #define ROOT_TTablePoints
00014
00015 #include "TPoints3DABC.h"
00016 #include "TTableSorter.h"
00017 #include "TTable.h"
00018
00019 class TTablePoints : public TPoints3DABC
00020 {
00021 protected:
00022 TTableSorter *fTableSorter;
00023 const void *fKey;
00024 Int_t fFirstRow;
00025 Int_t fSize;
00026 void *fRows;
00027
00028 virtual void SetTablePointer(void *table);
00029 TTablePoints();
00030 public:
00031 TTablePoints(TTableSorter *sorter,const void *key,Option_t *opt="");
00032 TTablePoints(TTableSorter *sorter, Int_t keyIndex,Option_t *opt="");
00033 ~TTablePoints(){}
00034 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
00035 virtual Int_t GetLastPosition()const;
00036 virtual Float_t GetX(Int_t idx) const = 0;
00037 virtual Float_t GetY(Int_t idx) const = 0;
00038 virtual Float_t GetZ(Int_t idx) const = 0;
00039 virtual void *GetTable();
00040 virtual Option_t *GetOption() const { return 0;}
00041 virtual Int_t Indx(Int_t sortedIndx) const;
00042 virtual Int_t SetLastPosition(Int_t idx);
00043 virtual void SetOption(Option_t *){;}
00044 virtual Int_t SetPoint(Int_t, Float_t, Float_t, Float_t ){return -1;}
00045 virtual Int_t SetPoints(Int_t , Float_t *, Option_t *){return -1;}
00046 virtual Int_t Size() const;
00047 ClassDef(TTablePoints,0)
00048 };
00049
00050
00051 inline void TTablePoints::SetTablePointer(void *table){ fRows = table;}
00052
00053
00054
00055 inline Int_t TTablePoints::Indx(Int_t sortedIndx) const
00056 {return fTableSorter?fTableSorter->GetIndex(fFirstRow+sortedIndx):-1;}
00057
00058
00059 inline void *TTablePoints::GetTable(){
00060 void *ret = 0;
00061 if (fTableSorter) {
00062 TTable *t = fTableSorter->GetTable();
00063 if (t) ret = t->GetArray();
00064 }
00065 return ret;
00066 }
00067
00068 inline Int_t TTablePoints::Size() const { return fSize;}
00069
00070 inline Int_t TTablePoints::GetLastPosition() const {return Size()-1;}
00071
00072
00073 inline Int_t TTablePoints::SetLastPosition(Int_t idx)
00074 {
00075 Int_t pos = GetLastPosition();
00076 fSize = TMath::Min(pos,idx)+1;
00077 return pos;
00078 }
00079
00080 #endif
00081