CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
plotting.PlotTextBox Class Reference

Public Member Functions

def __init__
 
def addText
 
def Draw
 
def move
 
def width
 

Private Attributes

 _currenty
 
 _fillColor
 
 _lineheight
 
 _pave
 
 _textArgs
 
 _texts
 
 _transparent
 
 _xmax
 
 _xmin
 
 _ymax
 
 _ymin
 

Detailed Description

Class for drawing text and a background box.

Definition at line 1394 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotTextBox.__init__ (   self,
  xmin,
  ymin,
  xmax,
  ymax,
  lineheight = 0.04,
  fillColor = ROOT.kWhite,
  transparent = True,
  kwargs 
)
Constructor

Arguments:
xmin        -- X min coordinate of the box (NDC)
ymin        -- Y min coordinate of the box (NDC) (if None, deduced automatically)
xmax        -- X max coordinate of the box (NDC)
ymax        -- Y max coordinate of the box (NDC)
lineheight  -- Line height
fillColor   -- Fill color of the box
transparent -- Should the box be transparent? (in practive the TPave is not created)

Keyword arguments are forwarded to constructor of PlotText

Definition at line 1396 of file plotting.py.

1397  def __init__(self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, **kwargs):
1398  """Constructor
1399 
1400  Arguments:
1401  xmin -- X min coordinate of the box (NDC)
1402  ymin -- Y min coordinate of the box (NDC) (if None, deduced automatically)
1403  xmax -- X max coordinate of the box (NDC)
1404  ymax -- Y max coordinate of the box (NDC)
1405  lineheight -- Line height
1406  fillColor -- Fill color of the box
1407  transparent -- Should the box be transparent? (in practive the TPave is not created)
1408 
1409  Keyword arguments are forwarded to constructor of PlotText
1410  """
1411  # ROOT.TPave Set/GetX1NDC() etc don't seem to work as expected.
1412  self._xmin = xmin
1413  self._xmax = xmax
1414  self._ymin = ymin
1415  self._ymax = ymax
1416  self._lineheight = lineheight
1417  self._fillColor = fillColor
1418  self._transparent = transparent
1419  self._texts = []
1420  self._textArgs = {}
1421  self._textArgs.update(kwargs)
1423  self._currenty = ymax

Member Function Documentation

def plotting.PlotTextBox.addText (   self,
  text 
)
Add text to current position

Definition at line 1424 of file plotting.py.

References plotting.PlotTextBox._currenty, plotting.PlotTextBox._lineheight, plotting.PlotTextBox._textArgs, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, and plotting.PlotTextBox._xmin.

1425  def addText(self, text):
1426  """Add text to current position"""
1427  self._currenty -= self._lineheight
1428  self._texts.append(PlotText(self._xmin+0.01, self._currenty, text, **self._textArgs))
def plotting.PlotTextBox.Draw (   self,
  options = "" 
)
Draw the box and the text to the current TPad.

Arguments:
options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects

Definition at line 1458 of file plotting.py.

References plotting.PlotTextBox._transparent, fftjetcms::LookupTable2d.ymin(), PixelClusterizerBase::AccretionCluster.ymin, Exhume::Event.ymin, cscdqm::AddressBox.ymin, AccretionCluster.ymin, and TrackerMap.ymin.

1459  def Draw(self, options=""):
1460  """Draw the box and the text to the current TPad.
1461 
1462  Arguments:
1463  options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects
1464  """
1465  if not self._transparent:
1466  ymin = self.ymin
1467  if ymin is None:
1468  ymin = self.currenty - 0.01
1469  self._pave = ROOT.TPave(self.xmin, self.ymin, self.xmax, self.ymax, 0, "NDC")
1470  self._pave.SetFillColor(self.fillColor)
1471  self._pave.Draw(options)
1472  for t in self._texts:
1473  t.Draw(options)
def plotting.PlotTextBox.move (   self,
  dx = 0,
  dy = 0,
  dw = 0,
  dh = 0 
)
Move the box and the contained text objects

Arguments:
dx -- Movement in x (positive is to right)
dy -- Movement in y (positive is to up)
dw -- Increment of width (negative to decrease width)
dh -- Increment of height (negative to decrease height)

dx and dy affect to both box and text objects, dw and dh
affect the box only.

Definition at line 1432 of file plotting.py.

References plotting.PlotTextBox._texts, MEGeom._xmax, HistoParams< T >._xmax, HistoParams< TH2F >._xmax, HistoParams< TProfile2D >._xmax, plotting.PlotTextBox._xmax, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, plotting.PlotTextBox._xmin, MEGeom._ymax, HistoParams< T >._ymax, HistoParams< TH2F >._ymax, HistoParams< TProfile2D >._ymax, plotting.PlotTextBox._ymax, MEGeom._ymin, HistoParams< T >._ymin, HistoParams< TH2F >._ymin, HistoParams< TProfile2D >._ymin, and plotting.PlotTextBox._ymin.

Referenced by Vispa.Gui.PortConnection.PointToPointConnection.updateConnection().

1433  def move(self, dx=0, dy=0, dw=0, dh=0):
1434  """Move the box and the contained text objects
1435 
1436  Arguments:
1437  dx -- Movement in x (positive is to right)
1438  dy -- Movement in y (positive is to up)
1439  dw -- Increment of width (negative to decrease width)
1440  dh -- Increment of height (negative to decrease height)
1441 
1442  dx and dy affect to both box and text objects, dw and dh
1443  affect the box only.
1444  """
1445  self._xmin += dx
1446  self._xmax += dx
1447  if self._ymin is not None:
1448  self._ymin += dy
1449  self._ymax += dy
1450 
1451  self._xmax += dw
1452  if self._ymin is not None:
1453  self._ymin -= dh
1454 
1455  for t in self._texts:
1456  t._x += dx
1457  t._y += dy
def plotting.PlotTextBox.width (   self)

Definition at line 1429 of file plotting.py.

References MEGeom._xmax, HistoParams< T >._xmax, HistoParams< TH2F >._xmax, HistoParams< TProfile2D >._xmax, plotting.PlotTextBox._xmax, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, and plotting.PlotTextBox._xmin.

Referenced by Vispa.Main.MainWindow.MainWindow._saveIni(), Vispa.Views.PropertyView.PropertyView.resizeEvent(), Vispa.Views.PropertyView.PropertyView.sectionResized(), and Vispa.Main.MainWindow.MainWindow.updateStartupScreenGeometry().

1430  def width(self):
1431  return self._xmax-self._xmin

Member Data Documentation

plotting.PlotTextBox._currenty
private

Definition at line 1422 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._fillColor
private

Definition at line 1416 of file plotting.py.

plotting.PlotTextBox._lineheight
private

Definition at line 1415 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._pave
private

Definition at line 1468 of file plotting.py.

plotting.PlotTextBox._textArgs
private

Definition at line 1419 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

plotting.PlotTextBox._texts
private

Definition at line 1418 of file plotting.py.

Referenced by plotting.PlotTextBox.move().

plotting.PlotTextBox._transparent
private

Definition at line 1417 of file plotting.py.

Referenced by plotting.PlotTextBox.Draw().

plotting.PlotTextBox._xmax
private

Definition at line 1412 of file plotting.py.

Referenced by plotting.PlotTextBox.move(), and plotting.PlotTextBox.width().

plotting.PlotTextBox._xmin
private

Definition at line 1411 of file plotting.py.

Referenced by plotting.PlotTextBox.addText(), plotting.PlotTextBox.move(), and plotting.PlotTextBox.width().

plotting.PlotTextBox._ymax
private

Definition at line 1414 of file plotting.py.

Referenced by plotting.PlotTextBox.move().

plotting.PlotTextBox._ymin
private

Definition at line 1413 of file plotting.py.

Referenced by plotting.PlotTextBox.move().