本文整理汇总了C++中TView::GetRange方法的典型用法代码示例。如果您正苦于以下问题:C++ TView::GetRange方法的具体用法?C++ TView::GetRange怎么用?C++ TView::GetRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TView
的用法示例。
在下文中一共展示了TView::GetRange方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddGrid
//_______________________________________________________________________________________
static void AddGrid()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
TList *list = thisPad->GetListOfPrimitives();
TString histName = thisPad->GetName();
TH2F *m_DummyHist = 0;
const Char_t *dummyName = "Axis3D";
histName += dummyName;
m_DummyHist = list->FindObject(histName.Data());
if (!m_DummyHist) {
m_DummyHist = new TH2F(histName.Data(),"",1,min[0],max[0],1,min[1],max[1]);
m_DummyHist->SetDirectory(0);
m_DummyHist->Draw("surf,same");
}
m_DummyHist->GetXaxis()->SetLimits(min[0],max[0]);
m_DummyHist->GetYaxis()->SetLimits(min[1],max[1]);
m_DummyHist->GetZaxis()->SetLimits(min[2],max[2]);
thisPad->Modified();
thisPad->Update();
}
}
示例2: MakeFourView
//_______________________________________________________________________________________
void MakeFourView(TVirtualPad *pad=0)
{
// Creates 4 pads view of the pad (or qPad)
// ------------------------------
// | | |
// | | |
// | | |
// | Front | Top |
// | view | view |
// | | |
// | | |
// | | |
// ---------------+-------------
// | | |
// | | |
// | | |
// | Side | Spacial |
// | view | view |
// | | |
// | | |
// | | |
// ------------------------------
// begin_html <P ALIGN=CENTER> <IMG SRC="gif/FourStarView.gif" ></P> end_html
//
TVirtualPad *thisPad = pad;
if (!thisPad) thisPad = qPad();
TView *view = 0;
TList *thisPrimitives = 0;
if (thisPad && (thisPrimitives = thisPad->GetListOfPrimitives()) && (view = thisPad->GetView()) )
{
Double_t min[3],max[3];
view->GetRange(min,max);
Int_t system = view->GetSystem();
TCanvas *c = new TCanvas(" 4 views", thisPad->GetTitle(),600,600);
c->Divide(2,2);
TIter *next= new TIter(thisPrimitives);
for (int i =1; i <= 4; i++) {
c->cd(i);
TList *newPrimitives = qPad()->GetListOfPrimitives();
TObject *obj = 0;
while (obj = next->Next()) newPrimitives->Add(obj);
TView *newView = new TView(system);
newView->SetRange(min,max);
next->Reset();
}
delete next;
// set separate view;
// Fron view
Int_t j = 1;
c->cd(j++); FrontView();
c->cd(j++); TopView();
c->cd(j++); SideView();
c->cd(j++); RotateView(-30.0,60.0,0);
c->Modified();
c->Update();
}
}
示例3: qPad
//_______________________________________________________________________________________
static void Inscrease3DScale()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
int i;
for (i=0;i<3; i++) {max[i] *= 0.8; min[i]=max[i]*0.1;}
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}
示例4: AdjustScales
//_______________________________________________________________________________________
static void AdjustScales()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
int i;
Double_t maxSide = 0;
// Find the largest side
for (i=0;i<3; i++) maxSide = TMath::Max(maxSide,max[i]-min[i]);
//Adjust scales:
for (i=0;i<3; i++) max[i] += maxSide - (max[i]-min[i]);
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}
示例5: setCanvas
void RootWImage::setCanvas(TCanvas* myCanvas) {
if (myCanvas_) delete myCanvas_;
myCanvas_ = (TCanvas*)myCanvas->DrawClone();
std::ostringstream canvasName("");
//int myNumber = imageNameCounter_[name_]++; //##########
canvasName << "canvas" << setfill('0') << setw(3) << imageCounter_;
myCanvas_->SetName(canvasName.str().c_str());
TView* myView = myCanvas->GetView();
if (myView) {
TView* newView = myCanvas_->GetView();
if (newView) {
double min[3], max[3];
Int_t irep;
newView->SetView(myView->GetLongitude(),
myView->GetLatitude(),
myView->GetPsi(), irep);
myView->GetRange(min, max);
newView->SetRange(min, max);
}
}
}
示例6: xtruSamples
//.........这里部分代码省略.........
worldnode->cd();
// Canonical shape ... gets further modified by scale factors
// to create convex (and malformed) versions
Float_t x[] = { -0.50, -1.20, 1.20, 0.50, 0.50, 1.20, -1.20, -0.50 };
Float_t y[] = { -0.75, -2.00, -2.00, -0.75, 0.75, 2.00, 2.00, 0.75 };
Float_t z[] = { -0.50, -1.50, -1.50, 1.50, 1.50, 0.50 };
Float_t s[] = { 0.50, 1.00, 1.50, 1.50, 1.00, 0.50 };
Int_t nxy = sizeof(x)/sizeof(Float_t);
Float_t convexscale[] = { 7.0, -1.0, 1.5 };
Int_t icolor[] = { 1, 2, 3, 2, 2, 2, 4, 2, 6 };
// xycase and zcase: 0=convex, 1=malformed, 2=concave
// this will either create a 2x2 matrix of shapes
// or a 3x3 array (if displaying malformed versions)
for (Int_t zcase = 0; zcase<3; zcase++) {
if (zcase == 1 && !domalformed) continue;
for (Int_t xycase = 0; xycase<3; xycase++) {
if (xycase == 1 && !domalformed) continue;
Char_t *name = "txtruXYZ";
sprintf(name,"txtru%1d%1d%1d",xycase,zcase,zseg);
TXTRU* mytxtru = new TXTRU(name,name,"void",8,2);
Int_t i, j;
Float_t xsign = (makecw) ? -1 : 1;
Float_t zsign = (reversez) ? -1 : 1;
// set the vertex points
for (i=0; i<nxy; i++) {
Float_t xtmp = x[i]*xsign;
Float_t ytmp = y[i];
if (i==0||i==3||i==4||i==7) xtmp *= convexscale[xycase];
if (xycase==2) xtmp *=2;
mytxtru->DefineVertex(i,xtmp,ytmp);
}
// set the z segment positions and scales
for (i=0, j=0; i<zseg; i++) {
Float_t ztmp = z[i]*zsign;
if (i==0||i==5) ztmp *= convexscale[zcase];
if (zcase==2) ztmp *= 2.5;
if (zseg>2 && zcase!=2 && (i==1||i==4)) continue;
mytxtru->DefineSection(j,ztmp,s[i]);
j++;
}
TNode* txtrunode = new TNode(name,name,mytxtru);
txtrunode->SetLineColor(icolor[3*zcase+xycase]);
Float_t pos_scale = (domalformed) ? 10 : 6;
Float_t xpos = (xycase-1)*pos_scale*unit;
Float_t ypos = (zcase-1)*pos_scale*unit;
txtrunode->SetPosition(xpos,ypos,0.);
}
}
// Some extra shapes to show the direction of "z"
Float_t zhalf = 0.5*bigdim;
Float_t rmax = 0.03*bigdim;
TCONE* zcone = new TCONE("zcone","zcone","void",zhalf,0.,rmax,0.,0.);
zcone->SetVisibility(extravis);
TNode* zconenode = new TNode("zconenode","zconenode",zcone);
zconenode->SetLineColor(3);
Float_t dzstub = 2*rmax;
TBRIK* zbrik = new TBRIK("zbrik","zbrik","void",rmax,rmax,dzstub);
zbrik->SetVisibility(extravis);
TNode* zbriknode = new TNode("zbriknode","zbriknode",zbrik);
zbriknode->SetPosition(0.,0.,zhalf+dzstub);
zbriknode->SetLineColor(3);
// geom->ls();
geom->Draw();
// Tweak the pad so that it displays the entire geometry undistorted
TVirtualPad *thisPad = gPad;
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3],center[3];
view->GetRange(min,max);
int i;
// Find the boxed center
for (i=0;i<3; i++) center[i] = 0.5*(max[i]+min[i]);
Double_t maxSide = 0;
// Find the largest side
for (i=0;i<3; i++) maxSide = TMath::Max(maxSide,max[i]-center[i]);
file://Adjust scales:
for (i=0;i<3; i++) {
max[i] = center[i] + maxSide;
min[i] = center[i] - maxSide;
}
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}