Ejemplo n.º 1
0
void KVIDentifier::CloneScaleStore(Int_t newzt, Int_t newar, Double_t dy, Double_t sx, Double_t sy)
{
   // Create a new line from the selected one
   // with a new Z and A (optional)
   // this new line is scale from the selected one with a vertical sy
   // and horizontal sx (optional) factor
   // you need to undraw and draw the grid to see its implementation

   TClass* cl = new TClass(this->IsA()->GetName());
   KVIDentifier* idbis = (KVIDentifier*)cl->New();
   Double_t xx, yy;
   for (Int_t nn = 0; nn < this->GetN(); nn += 1) {
      this->GetPoint(nn, xx, yy);
      idbis->SetPoint(nn, xx, yy + dy);
   }
   idbis->SetOnlyZId(OnlyZId());
   idbis->SetZ(newzt);
   idbis->SetMassFormula(GetMassFormula());
   idbis->SetEditable(IsEditable());
   if (newar != -1) {
      idbis->SetA(newar);
   }
   if ((sx > 0.) && (sy > 0.)) idbis->Scale(sx, sy);
   this->GetParent()->AddIdentifier(idbis);

   this->GetParent()->UnDraw();
   this->GetParent()->Draw();


   delete cl;
}
Ejemplo n.º 2
0
//______________________________________________________________________________
Int_t KVIDentifier::ContinueDrawing()
{
   // Continue to draw an existing the line
   if (!GetEditable()) return -2;

   KVIDentifier* gr = (KVIDentifier*)this->IsA()->New();
   gr->WaitForPrimitive();
   ChechHierarchy(gr);

   Int_t np = gr->GetN();

   Double_t last, first, yy;
   gr->GetPoint(np - 1, last, yy);
   gr->GetPoint(0, first, yy);

   Double_t xmax = fX[fNpoints - 1];
   Double_t xmin = fX[0];

   Info("ContinueDrawing", "Existing Line %lf %lf, Added line %lf %lf", xmin, xmax, last, first);

   if (first > xmax) {
      //A rajouter apres (a droite) de la ligne existante
      Double_t xx;
      for (Int_t ii = 0; ii < np; ii += 1) {
         gr->GetPoint(ii, xx, yy);
         this->SetPoint(fNpoints, xx, yy);
      }
   } else if (last < xmin) {
      //A rajouter avant (a gauche) la ligne existante
      Double_t xx;
      for (Int_t ii = 0; ii < fNpoints; ii += 1) {
         this->GetPoint(ii, xx, yy);
         gr->SetPoint(gr->GetN(), xx, yy);
      }

      for (Int_t ii = 0; ii < gr->GetN(); ii += 1) {
         gr->GetPoint(ii, xx, yy);
         this->SetPoint(ii, xx, yy);
      }
   } else {
      Info("ContinueDrawing", "Faire une extension a droite ou a gauche\nsans recouvrement avec la ligne existante");
   }

   delete gr;
   gPad->Modified();

   return np;
}