Potku  1.0.0
Class Documentation
 All Classes Namespaces Functions
Modules.Selection.Selection Class Reference

Public Member Functions

def __init__
 
def add_point
 
def undo_last
 
def get_points
 
def get_first
 
def get_last
 
def count
 
def end_selection
 
def delete
 
def draw
 
def set_color
 
def reset_color
 
def save_string
 
def transpose
 
def point_inside
 

Public Attributes

 id
 
 masses
 
 element_colormap
 
 settings
 
 default_color
 
 type
 
 element
 
 weight_factor
 
 element_scatter
 
 is_closed
 
 points
 
 axes
 
 axes_limits
 

Static Public Attributes

string LINE_STYLE = '-'
 
string LINE_MARKER = 'o'
 
float LINE_MARKER_SIZE = 3.0
 
int GLOBAL_ID = 0
 

Detailed Description

Selection object which knows all selection points.

Constructor & Destructor Documentation

def Modules.Selection.Selection.__init__ (   self,
  axes,
  masses,
  element_colormap,
  settings,
  element = None,
  isotope = None,
  element_type = "ERD",
  color = None,
  points = None,
  scatter = None,
  weight_factor = 1,
  transposed = False 
)
Inits Selection class.

Args:
    axes: Matplotlib FigureCanvas's subplot
    masses: Reference to element masses object of main program.
    element_colormap: Default colors for new element selections.
    settings: Measurement's settings to which selector belongs. 
      (for selection dialog)
    element: String representing element
    isotope: String representing isotope
    element_type: "ERD" or "RBS"
    color: String representing color for the element
    points: String list representing points in selection.
    "X1, X2, X3;Y1, Y2, Y3"
    scatter: String representing scatter element. 
    weight_factor: Weight factor for the element.
    transposed: Boolean representing if axes are transposed.

Member Function Documentation

def Modules.Selection.Selection.add_point (   self,
  point 
)
Adds a point to selection.

Adds a point to selection. If selection is closed, do nothing.

Args:
    point: Point (x, y) to be added to selection.

Return:
    0: Point was added.
    -1: If selection is closed.
def Modules.Selection.Selection.count (   self)
Get count of points in selection

Return
    Integer: Count of points in selection
def Modules.Selection.Selection.delete (   self)
Delete this selection.
def Modules.Selection.Selection.draw (   self)
Draw selection points into graph (matplotlib) axes
def Modules.Selection.Selection.end_selection (   self,
  canvas = None 
)
End selection.

Ends selection. If selection is open and canvas is not None, it will 
show dialog to select element information and draws into canvas 
before opening the dialog.

Args:
    canvas: Matplotlib's FigureCanvas or None when we don't want 
    to new selection window. None, when loading selections 
    so we do not want to open new selection settings dialog.

Return:
    True: Selection was completed
    False: Selection settings was not set (cancel button)
def Modules.Selection.Selection.get_first (   self)
Get first point in selection

Return:
    None: If no point in selection
    (x, y): Otherwise
def Modules.Selection.Selection.get_last (   self)
Get last point in selection

Return:
    None: If no point in selection
    (x, y): Otherwise
def Modules.Selection.Selection.get_points (   self)
Get points in selection 

Get points in selection in list. Format: ((x1,y1), (x2,y2), ...). 
If no points, empty list is returned

Return:
   ((x1, y1), (x2, y2), ...)
def Modules.Selection.Selection.point_inside (   self,
  point 
)
Check if point is inside selection.

Args:
    point: [X, Y] representing a point.
    
Return:
    Returns True if point is within selection. False otherwise.
def Modules.Selection.Selection.reset_color (   self)
Reset selection color to default color.
def Modules.Selection.Selection.save_string (   self,
  is_transposed 
)
Get selection in string format for selectiong file save.

Args:
    is_transposed: Boolean representing if axes are transposed.
    
Return:
    String representing current selection object.
def Modules.Selection.Selection.set_color (   self,
  color 
)
Set selection color

Args:
    color: String representing color. 
   Format is whatever QtGui.QColor(string) understands.
def Modules.Selection.Selection.transpose (   self,
  transpose 
)
Transpose selection points.

Args:
    transpose: Boolean representing whether to transpose selection points.
def Modules.Selection.Selection.undo_last (   self)
Undo last point in selection.

Return:
    1: If selection is closed or there are no points in selection.
    0: If everything is ok.

The documentation for this class was generated from the following file: