Evolife
Evolife has been developed to study Genetic algorithms, Natural evolution and behavioural ecology.
Public Member Functions | Public Attributes | List of all members
Evolife.Graphics.Evolife_Graphic.Field_window Class Reference

A graphic area that displays moving agents #. More...

Inheritance diagram for Evolife.Graphics.Evolife_Graphic.Field_window:
Inheritance graph
[legend]
Collaboration diagram for Evolife.Graphics.Evolife_Graphic.Field_window:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, control=None, Wtitle='', image=None, outputDir='.', width=400, height=300, zoom=1)
 calls the parents' constructor with the appropriate area (QGraphicsScene) type More...
 
def Field_display (self, Layout=None, Photo=0, CurrentFrame=-1, Ongoing=False, Prefix='')
 displays agents at indicated positions If Ongoing is false, agents that are not given positions are removed More...
 
def erase (self)
 calls Area erase More...
 
def adaptscale (self, Layout)
 rescales widget if items land outside (only for max values, not for negative ones) More...
 
def Field_scroll (self)
 
- Public Member Functions inherited from Evolife.Graphics.Evolife_Graphic.Satellite_window
def __init__ (self, AreaType=None, control=None, Wtitle='', image=None, width=400, height=300, zoom=1)
 calls the parents' constructor with the appropriate area (QGraphicsScene) type More...
 
def dimension (self, *geometry)
 sets dimensions More...
 
def keyPressEvent (self, e)
 adds resizing keys (+ and -) to Active_Frame's shortcuts More...
 
def image_display (self, Image, windowResize=True)
 display an image, with possible resizing of the window More...
 
def Zoom (self, ZoomFactor=1.1)
 increase the window's size More...
 
def DeZoom (self, DeZoomFactor=0.91)
 decrease the window's size More...
 
def closeEvent (self, event)
 destroys the window More...
 
- Public Member Functions inherited from Evolife.Graphics.Evolife_Graphic.Active_Frame
def __init__ (self, AreaType=None, parent=None, control=None, image=None, width=400, height=300, zoom=1)
 Creates a window (AreaView) with the appropriate AreaType (Draw_Area, Ground...) More...
 
def keyPressEvent (self, e)
 Definition of keyboard shortcuts. More...
 
def Raise (self)
 puts the window on top of display More...
 
def EventInterpreter (self, Event)
 Does nothing here. More...
 
- Public Member Functions inherited from Evolife.Graphics.Evolife_Graphic.AreaView
def __init__ (self, AreaType=Image_Area, parent=None, image=None, width=400, height=300, zoom=1)
 Defining View: a window (QGraphicsView) that contains a plot area (QGraphicsScene) More...
 
def paintEvent (self, e)
 calls Qt's paintEvent More...
 
def resizeEvent (self, e)
 calls Qt's resizeEvent More...
 
def updateScene (self, L)
 unused More...
 
def photo (self, Name, FrameNumber=-1, outputDir='.', extension='png')
 takes a snapshot and saves it to a new file More...
 
def EventInterpreter (self, Event)
 Does nothing here. More...
 

Public Attributes

 FreeScale
 
 OutputDir
 
- Public Attributes inherited from Evolife.Graphics.Evolife_Graphic.Satellite_window
 Title
 
 minSize
 
 zoomingFactor
 
- Public Attributes inherited from Evolife.Graphics.Evolife_Graphic.Active_Frame
 Area
 
 Parent
 
 Control
 
 control
 
- Public Attributes inherited from Evolife.Graphics.Evolife_Graphic.AreaView
 Area
 
 FrameNumber
 

Detailed Description

A graphic area that displays moving agents #.

Field: A 2D widget that displays agent movements

Definition at line 429 of file Evolife_Graphic.py.

Constructor & Destructor Documentation

◆ __init__()

def Evolife.Graphics.Evolife_Graphic.Field_window.__init__ (   self,
  AreaType = None,
  control = '',
  Wtitle = None,
  image = '.',
  width = 400,
  height = 300,
  zoom = 1 
)

calls the parents' constructor with the appropriate area (QGraphicsScene) type

Reimplemented from Evolife.Graphics.Evolife_Graphic.Satellite_window.

Definition at line 433 of file Evolife_Graphic.py.

Member Function Documentation

◆ adaptscale()

def Evolife.Graphics.Evolife_Graphic.Field_window.adaptscale (   self,
  Layout 
)

rescales widget if items land outside (only for max values, not for negative ones)

Definition at line 523 of file Evolife_Graphic.py.

◆ erase()

def Evolife.Graphics.Evolife_Graphic.Field_window.erase (   self)

calls Area erase

Definition at line 518 of file Evolife_Graphic.py.

◆ Field_display()

def Evolife.Graphics.Evolife_Graphic.Field_window.Field_display (   self,
  Layout = None,
  Photo = 0,
  CurrentFrame = -1,
  Ongoing = False,
  Prefix = '' 
)

displays agents at indicated positions If Ongoing is false, agents that are not given positions are removed

Layout may come with two syntaxes:

  • ((Agent1Id, Coordinates1), (Agent2Id, Coordinates2), ...)
  • (Coordinates1, Coordinates2, ...) The first format allows to move and erase agents The second format is merely used to draw permanent blobs and lines Coordinates have the following form: (x, y, colour, size, ToX, ToY, segmentColour, segmentThickness, 'shape=<form>') (shorter tuples are automatically continued with default values - 'shape=...' can be inserted anywhere) The effect is that an object of size 'size' is drawn at location (x,y) (your coordinates, not pixels) and a segment starting from that blob is drawn to (ToX, ToY) (if these values are given) If you change the coordinates of an agent in the next call, it will be moved. 'size' is in pixels and is not resized in case of zoom. However, if negative, it is interpreted in your coordinates and it will be resized/ 'size' may be a fractional number (float). It is then understood as a fraction of the window size. The value assigned to 'shape' in the string 'shape=...' can be 'ellipse' (=default) or 'rectangle' or any image. If it is an image, 'colour' is interpreted as an angle. The image is scaled to fit 'size' (but aspect ratio is preserved)

These two forms of vectors can be used to draw in two windows: 'Trajectories' and 'Field'. Use the order: record(vector, Window=<'Field'|'Trajectories'>) or: record([vectors], Window=<'Field'|'Trajectories'>) 'Field' is default. The latter order is used to send a list of vectors.

The 'Field' window comes in two modes, 'F' and 'R' (see option F and R at Evolife's start)

  • In the 'F' mode, all agents should be given positions at each call. Missing agents are destroyed from display.
  • In the 'R' ('Region') mode, you may indicates positions only for relevant agents To destroy an agent from display, give a negative value to its colour.

Definition at line 447 of file Evolife_Graphic.py.

◆ Field_scroll()

def Evolife.Graphics.Evolife_Graphic.Field_window.Field_scroll (   self)

Definition at line 533 of file Evolife_Graphic.py.

Member Data Documentation

◆ FreeScale

Evolife.Graphics.Evolife_Graphic.Field_window.FreeScale

Definition at line 439 of file Evolife_Graphic.py.

◆ OutputDir

Evolife.Graphics.Evolife_Graphic.Field_window.OutputDir

Definition at line 444 of file Evolife_Graphic.py.


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