// $Header: /data/reve-cvs/reve/gui/GuiPointContainer.cxx,v 1.6 2005/12/07 20:19:26 aljam Exp $

#include "GuiPointContainer.h"
#include "ReveFrame.h"

#include <Reve/Reve.h>

#include <TColor.h>
#include <TPolyMarker3D.h>
#include <TCanvas.h>

using namespace ReveGui;

//______________________________________________________________________
// GuiPointContainer
//

ClassImp(GuiPointContainer);

 void GuiPointContainer::_init()
{
  fMarker  = 0;
  fCol     = 22;
  fRnrSelf = false;
}

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

 void GuiPointContainer::SetColorIdx(Int_t col)
{
  if(fMarker == 0)
    return;

  fCol = col;
  printf("make color %d n", fCol);
  fMarker->SetMarkerStyle(6);
  fMarker->SetMarkerColor(fCol);
}

 void GuiPointContainer::SetColor(Pixel_t pixel)
{
  if(fMarker == 0)
    return;

  // gReveGui->GetCC()->cd();
  printf("Set color %p n", (void*)pixel);
  Int_t r, g, b;
  TColor::Pixel2RGB(pixel, r, g, b);
  printf("rgb (%d %d %d) col %d %dn",r,g,b, TColor::GetColor(r,g,b),TColor::GetColor(pixel));
  fCol = TColor::GetColor(pixel);
  printf("make color %d n", fCol);
  fMarker->SetMarkerColor(fCol);
}

 void GuiPointContainer::SetColorUpdate(Pixel_t pixel)
{
  if(fMarker == 0)
    return;
  SetColor(pixel);
  gReveGui->Redraw3D();
}


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

 void GuiPointContainer::SetRnrSelf(Bool_t rnr)
{
  if(fMarker == 0)
    return;
  if(rnr != fRnrSelf) {
    fRnrSelf = rnr;
    printf("GuiPointContainer::SetRnrSelf %d n", rnr ? 1:0);
    if(! fRnrSelf) {
      TList* list = gReveGui->GetCC()->GetListOfPrimitives();
      TObject* obj = list->FindObject(fMarker);
      list->Remove(obj);
    } else {
    Reve::PadHolder _phold(false, gReveGui->GetCC());
      fMarker->Draw();
    }
    gReveGui->Redraw3D();
  }
}

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

 void GuiPointContainer::CreateMarker()
{
  printf("GuiPointContainer::CreateMarker() %d n", fNPoints);
  if(fMarker == 0) {
    printf("create marker %dn",fNPoints );
    fMarker = new TPolyMarker3D(fNPoints);
    fMarker->SetName(GetName());
    fMarker->SetMarkerStyle(6);
    fMarker->SetMarkerColor(fCol);
    fMarker->SetMarkerSize(0.05);
    for(int i=0; i<fNPoints; ++i) {
      Float_t* p = fPoints + 3*i;
      fMarker->SetPoint(i, p[0], p[1], p[2]);
    }
    fRnrSelf = true;
  }
}

 void GuiPointContainer::Draw(Option_t* opt)
{
  if(fMarker) {
    fMarker->Draw(opt);  
    fRnrSelf = true;
  }
}


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.