00001
00002 #include <iostream>
00003 #include <TString.h>
00004 #include <TPad.h>
00005
00006 #include "BesVisLib/BesMarker2D.h"
00007 #include "BesVisLib/BesView.h"
00008
00009 using namespace std;
00010
00011 #ifndef __CINT__
00012 ClassImp(BesMarker2D)
00013 #endif
00014
00015
00016
00017
00018
00019
00020 BesMarker2D::BesMarker2D() {
00021
00022
00023 if ( gDebug ) cout << "BesMarker2D ctor called" << endl;
00024 }
00025
00026
00027
00028 BesMarker2D::BesMarker2D(const char* name, const char* title, Float_t x, Float_t y, Float_t z) : TMarker(0,0,3) {
00029
00030
00031 if ( gDebug ) cout << "BesMarker2D normal ctor called" << endl;
00032 fName = name;
00033 fTitle = title;
00034 fWCX = x;
00035 fWCY = y;
00036 fWCZ = z;
00037 this->SetMarkerColor(kGreen);
00038 this->SetMarkerSize(1);
00039 this->SetMarkerSizeMultiple(4);
00040 TAttMarker::Modify();
00041
00042 }
00043
00044
00045
00046 BesMarker2D::BesMarker2D(const char* name, const char* title, Double_t x, Double_t y, Double_t z) : TMarker(0,0,3) {
00047
00048
00049 if ( gDebug ) cout << "BesMarker2D normal ctor called" << endl;
00050 fName = name;
00051 fTitle = title;
00052 fWCX = (Float_t)x;
00053 fWCY = (Float_t)y;
00054 fWCZ = (Float_t)z;
00055 this->SetMarkerColor(kGreen);
00056 this->SetMarkerSize(1);
00057 this->SetMarkerSizeMultiple(4);
00058 TAttMarker::Modify();
00059
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 void BesMarker2D::GetCenterPixel(Int_t &px, Int_t &py) {
00082
00083 if (TestBit(kMarkerNDC)) {
00084 px = gPad->UtoPixel(fX);
00085 py = gPad->VtoPixel(fY);
00086 } else {
00087 px = gPad->XtoAbsPixel(gPad->XtoPad(fX));
00088 py = gPad->YtoAbsPixel(gPad->YtoPad(fY));
00089 }
00090 }
00091
00092
00093
00094 void BesMarker2D::Draw(Option_t *option) {
00095
00096
00097 AppendPad(option);
00098 }
00099
00100
00101
00102 void BesMarker2D::Paint(Option_t *option) {
00103
00104
00105
00106
00107 BesView *view = (BesView*)gPad->GetView();
00108
00109
00110 this->SetMarkerSize(view->GetMarkerSize() * this->GetMarkerSizeMultiple());
00111
00112
00113
00114 Float_t WC[3],NDC[3];
00115 WC[0]=fWCX;
00116 WC[1]=fWCY;
00117 WC[2]=fWCZ;
00118 view->WCtoNDC(WC,NDC);
00119 this->SetX(NDC[0]);
00120 this->SetY(NDC[1]);
00121
00122
00123
00124 TMarker::Paint(option);
00125
00126 }
00127
00128
00129
00130 BesMarker2D::~BesMarker2D() {
00131
00132
00133 if ( gDebug ) cout << "BesMarker2D default dtor called" << endl;
00134 }
00135
00136
00137
00138 char *BesMarker2D::GetObjectInfo(Int_t px, Int_t py) const {
00139
00140 BesView *view = (BesView*)gPad->GetView();
00141 if (view) return view->GetObjectInfo(px, py);
00142 else return TObject::GetObjectInfo(px, py);
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 }
00153
00154
00155
00156 void BesMarker2D::SetParameter(const char* name, const char* title, Float_t x, Float_t y, Float_t z) {
00157
00158
00159 fName = name;
00160 fTitle = title;
00161 fWCX = x;
00162 fWCY = y;
00163 fWCZ = z;
00164 }
00165