Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CutController Class Reference

#include <CutController.h>

Collaboration diagram for CutController:

Collaboration graph
[legend]
List of all members.

Detailed Description

A singleton class that handles the application logic for cuts.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 39 of file CutController.h.

Public Member Functions

void addCut (PlotterBase *cut_plotter, PlotterBase *plotter)
 Adds a cut (associated with the given cut plotter) to a Plotter.
PlotterBaseaddCut (PlotterBase *plotter, std::vector< std::string > &bindings)
 Adds a cut to the plotter.
Cut1DPlotteraddCut (PlotterBase *plotter, const std::string &label)
 Adds a one dimension cut to the plotter.
void appendToWeb (const std::vector< PlotterBase * > &cutters, PlotterList_t &web)
 Appends to web all the targets of each cutters.
void appendToWeb (CutPlotter *cutter, PlotterList_t &web)
 Appends to the web the cutter if it is not already in it.
void appendToWeb (PlotterBase *plotter, PlotterList_t &web)
 Appends to the web the plotter and any cuts targeting the contained active data rep.
void connectDataRep (const std::list< ViewBase * > &targets, const std::vector< const ViewBase * > &views)
 Connects the DataRep objects to its appropriate (cut) PlotterBase.
PlotterBasecreateCut (const std::string &name, const DataSource *ntuple, const std::vector< std::string > &bindings, const Color &color=Color::yellow) const
 Creates a new cut plotter.
void fillCutList (const DataRep *data_rep, std::vector< PlotterBase * > &)
 Clears and fills the cut_list with the CutPlotter objects that target the data_rep.
void fillCutList (const std::vector< PlotterBase * > &plotter_list, std::vector< CutPlotter * > &cut_list)
 Clears and fills the cut_list with those PlotterBase objects in plotter_list that are CutPlotter objects.
void fillCutWeb (const std::vector< PlotterBase * > &plotters, std::vector< PlotterBase * > &web)
 Clears and fills the web with the PlotterBase objects in plotters, each of their CutPlotter objects that target them, and all of their targets.
void fillTupleCutList (const std::vector< const ViewBase * > &views, std::vector< const TupleCut * > &cut_list)
 Fills the cut_map with the TupleCut objects contained the list of views, if any.
PlotterBasefindPlotter (const DataRep *data_rep)
 Finds and returns the PlotterBase object containing the data_rep.
const std::vector< PlotterBase * > & getCutList (const std::vector< PlotterBase * > &, const DataSource *rep) const
 Returns a list of CutPlotter objects that are in PlotterBase list and which use the same DataSource as rep.
const std::vector< const TupleCut * > & getCutList (const DataRep *rep) const
 Returns a list of TupleCut objects that are used by the DataRep.
bool isZoomPan (const PlotterBase *cut_plotter, hippodraw::Axes::Type axis) const
 Returns true if plotter is in zoom/pan list.
void linkCutAndRep (CutPlotter *cut_plotter, DataRep *targetrep)
 Adds cut (associated with the given cut plotter)to the projector of target rep and registers targetrep as the target of the cut_plotter for cut plotter.
void linkCutAndRep (PlotterBase *cut_plotter, DataRep *targetrep)
 Adds cut (associated with the given cut plotter) to the projector of target rep and registers targetrep as the target of the cut_plotter for a 1D/2D cutplotter.
void removeCut (PlotterBase *cut_plotter, PlotterBase *plotter)
 Removes the cut from the plotter.
void setAxisBinding (PlotterBase *display, const std::string &axis, const std::string &label)
 Sets the axis binding of the display and cut.
void setZoomPan (PlotterBase *plotter, hippodraw::Axes::Type axis, bool yes)
 Sets the zoom/pan status of plotter.

Static Public Member Functions

static CutControllerinstance ()
 Returns the pointer to the singleton instance.

Protected Member Functions

 CutController ()
 A default constructor for avoiding creation except by itself or with derived classes.

Private Types

typedef std::vector< PlotterBase * > PlotterList_t
 The type of standard C++ container used to hold PlotterBase objects.

Private Member Functions

void connectDataRep (const TupleCut *cut, DataRep *rep, const std::vector< const ViewBase * > &views)
 Connects the DataRep object to appropriate Cut Plotter.
void connectDataRep (DataRep *rep, const std::vector< const ViewBase * > &views)
 Connects the DataRep object to its appropriate Cut Plotter.
 CutController (const CutController &)
 A private copy constructor in order to avoid copying.

Private Attributes

std::vector< PlotterBase * > m_cut_list
 A temporary list of selected (cut) PlotterBase objects.
std::vector< std::stringm_cut_strings
 A temporary list of string corresponding to cuts.
std::list< std::pair< PlotterBase *,
hippodraw::Axes::Type > > 
m_zoom_pan
 A list of cutplotter-axis pair that have been placed in zoom/pan mode.

Static Private Attributes

static CutControllers_instance = 0
 The pointer to the singleton object.


Member Typedef Documentation

typedef std::vector< PlotterBase * > CutController::PlotterList_t [private]
 

The type of standard C++ container used to hold PlotterBase objects.

Definition at line 47 of file CutController.h.


Constructor & Destructor Documentation

CutController::CutController const CutController  )  [private]
 

A private copy constructor in order to avoid copying.

CutController::CutController  )  [protected]
 

A default constructor for avoiding creation except by itself or with derived classes.

Definition at line 55 of file CutController.cxx.

Referenced by instance().


Member Function Documentation

void CutController::addCut PlotterBase cut_plotter,
PlotterBase plotter
 

Adds a cut (associated with the given cut plotter) to a Plotter.

Todo:
Should return a bool if successful so that application can display error message.
Not needed for now since application will not attempt to add Cut when it wouldn't be successful.

Definition at line 95 of file CutController.cxx.

References PlotterBase::activePlotIndex(), PlotterBase::getDataRep(), FunctionController::getUniqueNonFunctionIndex(), FunctionController::instance(), and linkCutAndRep().

PlotterBase * CutController::addCut PlotterBase plotter,
std::vector< std::string > &  bindings
 

Adds a cut to the plotter.

Adds a simple one/two dimensional cut to the plotter. The cut uses the same NTuple as the plotter and is bound to the column with label binding. Returns the cut plotter object that was added.

Definition at line 80 of file CutController.cxx.

References addCut(), createCut(), DisplayController::getNTuple(), and DisplayController::instance().

Cut1DPlotter * CutController::addCut PlotterBase plotter,
const std::string label
 

Adds a one dimension cut to the plotter.

The cut uses the same NTuple as the plotter and is bound to the column with label label.

Note:
This function is only here for the SIP Python module so that SIP will wrap Cut1DPlotter instead of PlotterBase.

Definition at line 69 of file CutController.cxx.

Referenced by addCut().

void CutController::appendToWeb const std::vector< PlotterBase * > &  cutters,
PlotterList_t web
 

Appends to web all the targets of each cutters.

Definition at line 343 of file CutController.cxx.

References appendToWeb().

void CutController::appendToWeb CutPlotter cutter,
PlotterList_t web
 

Appends to the web the cutter if it is not already in it.

Definition at line 321 of file CutController.cxx.

References appendToWeb(), std::find(), and findPlotter().

void CutController::appendToWeb PlotterBase plotter,
PlotterList_t web
 

Appends to the web the plotter and any cuts targeting the contained active data rep.

Definition at line 299 of file CutController.cxx.

References fillCutList(), and std::find().

Referenced by appendToWeb(), and fillCutWeb().

void CutController::connectDataRep const std::list< ViewBase * > &  targets,
const std::vector< const ViewBase * > &  views
 

Connects the DataRep objects to its appropriate (cut) PlotterBase.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding (cut) PlotterBase needs to add it to its target list. In the list views, the appropriate (cut) PlotterBase object should be found.

Definition at line 410 of file CutController.cxx.

References connectDataRep(), PlotterBase::getDataRep(), ViewBase::getPlotter(), and DataRep::hasNTupleBindings().

void CutController::connectDataRep const TupleCut cut,
DataRep rep,
const std::vector< const ViewBase * > &  views
[private]
 

Connects the DataRep object to appropriate Cut Plotter.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding cut Plotter needs to add it to its target list. In the list views, the appropriate cut Plotter object should be found.

Definition at line 460 of file CutController.cxx.

References CutPlotter::addCutTarget(), and ViewBase::getPlotter().

void CutController::connectDataRep DataRep rep,
const std::vector< const ViewBase * > &  views
[private]
 

Connects the DataRep object to its appropriate Cut Plotter.

This method is intended to be used when creating new objects that are copies of old ones If the newly created object contains cuts, then it's corresponding cut Plotter needs to add it to its target list. In the list views, the appropriate Cut Plotter object should be found.

Definition at line 437 of file CutController.cxx.

References NTupleProjector::getCutList(), and DataRep::getProjector().

Referenced by connectDataRep(), and XmlController::getFromDocument().

PlotterBase * CutController::createCut const std::string name,
const DataSource ntuple,
const std::vector< std::string > &  bindings,
const Color color = Color::yellow
const
 

Creates a new cut plotter.

The newly created cut plotter is bound to the ntuple with bindings. Optionally, the color of the shading showing the cut inclusive range can be changed by overriding the default file for color. The name argument is ignored and may be used in the future to create different kinds of cuts. Returns the pointer to the cut plotter.

Definition at line 152 of file CutController.cxx.

References Cut1DPlotter::addDataRep(), Factory< Type >::create(), DataRepController::createDataRep(), PlotterFactory::instance(), DataRepController::instance(), and setAxisBinding().

Referenced by addCut().

void CutController::fillCutList const DataRep data_rep,
std::vector< PlotterBase * > & 
 

Clears and fills the cut_list with the CutPlotter objects that target the data_rep.

Definition at line 261 of file CutController.cxx.

void CutController::fillCutList const std::vector< PlotterBase * > &  plotter_list,
std::vector< CutPlotter * > &  cut_list
 

Clears and fills the cut_list with those PlotterBase objects in plotter_list that are CutPlotter objects.

Definition at line 227 of file CutController.cxx.

Referenced by appendToWeb(), and Inspector::fillCutsOn().

void CutController::fillCutWeb const std::vector< PlotterBase * > &  plotters,
std::vector< PlotterBase * > &  web
 

Clears and fills the web with the PlotterBase objects in plotters, each of their CutPlotter objects that target them, and all of their targets.

If the web could not be created, clears the web.

Definition at line 284 of file CutController.cxx.

References appendToWeb().

void CutController::fillTupleCutList const std::vector< const ViewBase * > &  views,
std::vector< const TupleCut * > &  cut_list
 

Fills the cut_map with the TupleCut objects contained the list of views, if any.

The key of the map is the address of the TupleCut object represented as integer.

Definition at line 386 of file CutController.cxx.

References ViewBase::getPlotter().

Referenced by XmlController::fillTupleCutMap().

PlotterBase * CutController::findPlotter const DataRep data_rep  ) 
 

Finds and returns the PlotterBase object containing the data_rep.

Definition at line 357 of file CutController.cxx.

Referenced by appendToWeb().

const vector< PlotterBase * > & CutController::getCutList const std::vector< PlotterBase * > &  ,
const DataSource rep
const
 

Returns a list of CutPlotter objects that are in PlotterBase list and which use the same DataSource as rep.

Definition at line 487 of file CutController.cxx.

References DisplayController::getNTuple(), DisplayController::instance(), and m_cut_list.

const std::vector< const TupleCut * > & CutController::getCutList const DataRep rep  )  const
 

Returns a list of TupleCut objects that are used by the DataRep.

Definition at line 245 of file CutController.cxx.

Referenced by Inspector::getDataCutList().

CutController * CutController::instance  )  [static]
 

Returns the pointer to the singleton instance.

Definition at line 59 of file CutController.cxx.

References CutController(), and s_instance.

Referenced by QtCut::addTarget(), QtCut::addTargets(), PyDataRep::applyCut(), QtCut::createCut(), Inspector::cutAddAll(), Inspector::cutAddSelected(), Inspector::cutNew(), Inspector::cutRemovePushButton_clicked(), Inspector::cutZoomPanCheckBox_clicked(), Inspector::fillCutsOn(), XmlController::fillTupleCutMap(), Inspector::getCutList(), Inspector::getDataCutList(), XmlController::getFromDocument(), Inspector::ntupleChanged(), Inspector::setAllCutsActive(), and Inspector::updateCutControlValues().

bool CutController::isZoomPan const PlotterBase cut_plotter,
hippodraw::Axes::Type  axis
const
 

Returns true if plotter is in zoom/pan list.

Definition at line 536 of file CutController.cxx.

References m_zoom_pan.

void CutController::linkCutAndRep CutPlotter cut_plotter,
DataRep targetrep
 

Adds cut (associated with the given cut plotter)to the projector of target rep and registers targetrep as the target of the cut_plotter for cut plotter.

Definition at line 129 of file CutController.cxx.

References NTupleProjector::addCut(), CutPlotter::addCutTarget(), DataRep::getProjector(), and DataRep::setDirty().

void CutController::linkCutAndRep PlotterBase cut_plotter,
DataRep targetrep
 

Adds cut (associated with the given cut plotter) to the projector of target rep and registers targetrep as the target of the cut_plotter for a 1D/2D cutplotter.

Definition at line 118 of file CutController.cxx.

Referenced by addCut().

void CutController::removeCut PlotterBase cut_plotter,
PlotterBase plotter
 

Removes the cut from the plotter.

If the plotter does not have selected DataRep object, does nothing.

Definition at line 211 of file CutController.cxx.

References setZoomPan(), and hippodraw::Axes::X.

void CutController::setAxisBinding PlotterBase display,
const std::string axis,
const std::string label
 

Sets the axis binding of the display and cut.

Raises an assertion if the display's plotter is not derived from (cut) PlotterBase.

Definition at line 511 of file CutController.cxx.

Referenced by createCut().

void CutController::setZoomPan PlotterBase plotter,
hippodraw::Axes::Type  axis,
bool  yes
 

Sets the zoom/pan status of plotter.

If yes is true, the plotter is put in list of plotters with the zoom pan mode set, otherwise it is removed from the list.

Definition at line 524 of file CutController.cxx.

References m_zoom_pan, and std::make_pair().

Referenced by removeCut().


Member Data Documentation

std::vector< PlotterBase * > CutController::m_cut_list [mutable, private]
 

A temporary list of selected (cut) PlotterBase objects.

The selection is made by the application calling one of the getCutList member functions. A selected (Cut) PlotterBase object can be access by index into this list.

Definition at line 62 of file CutController.h.

Referenced by getCutList().

std::vector< std::string > CutController::m_cut_strings [mutable, private]
 

A temporary list of string corresponding to cuts.

Definition at line 65 of file CutController.h.

std:: list< std::pair< PlotterBase *, hippodraw::Axes::Type > > CutController::m_zoom_pan [private]
 

A list of cutplotter-axis pair that have been placed in zoom/pan mode.

Definition at line 56 of file CutController.h.

Referenced by isZoomPan(), and setZoomPan().

CutController * CutController::s_instance = 0 [static, private]
 

The pointer to the singleton object.

Definition at line 53 of file CutController.cxx.

Referenced by instance().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3