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

Defines a 2-D region where agents are located and may move. More...

Inheritance diagram for Evolife.Graphics.Plot_Area.Ground:
Inheritance graph
[legend]
Collaboration diagram for Evolife.Graphics.Plot_Area.Ground:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, image=None, width=400, height=300, legend=True, EventInterpreter=None, zoom=1)
 Creates a Draw_Area and initializes agents. More...
 
def setToric (self, Toric=True)
 if toric, edges 'touch' each other More...
 
def grid (self)
 Writing maximal values for both axes. More...
 
def coordinates (self, Coord)
 Coord is a tuple. More...
 
def convert (self, Coord)
 process modulo if toric and calls Draw_Area's convert More...
 
def create_agent (self, Name, Coord)
 creates a dot at some location that represents an agent More...
 
def move_agent (self, Name, Coord=None, Position=None, Segment=None, Shape=None)
 moves an agent's representative dot to some new location More...
 
def create_graphic_agent (self, Position, Shape=None)
 creates a graphic agent and returns the Q-reference More...
 
def create_graphic_segment (self, Position, Segment)
 creates a graphic segment and returns the Q-reference More...
 
def remove_agent (self, Name)
 removes an agent from the ground More...
 
def remove_segment (self, Name)
 removes a segment from the ground More...
 
def on_ground (self)
 Returns the identificiation of all agents on the ground. More...
 
def remove_absent (self, Present)
 removes agents that are not in Present More...
 
def scroll (self)
 move agents vertically (not yet used) More...
 
def draw_tailed_blob (self, Coord)
 draws a blob and a segment, as for an agent, but without agent name and without moving and removing options More...
 
def erase (self)
 removes agents and erases Draw_Area More...
 
def redraw (self)
 the whole picture is redrawn when the scale changes More...
 
def restore_agent (self, Name)
 display an agent that is still present in 'positions' and in 'segments', but is graphically dead More...
 
- Public Member Functions inherited from Evolife.Graphics.Plot_Area.Draw_Area
def __init__ (self, image=None, width=400, height=400, EventInterpreter=None, zoom=1)
 Calls Image_Area constructor Initializes Curves. More...
 
def set_margins (self, Left, Right, Bottom, Top)
 surrounding margins (in Image_Area pixels) More...
 
def init_Pens (self)
 Defining one pen and one QPainterPath per curve. More...
 
def grid (self)
 Initial display - to be overloaded. More...
 
def pixel2xy (self, Point)
 converts physical coordinates into logical pixel(between 0 and scaleX) More...
 
def xy2pixel (self, Point)
 converts logical pixel (between 0 and scaleX) into physical coordinates through rescaling More...
 
def convert (self, Point)
 Conversion of logical coordinates into physical coordinates through scaling and margin translation. More...
 
def Q_Convert (self, Point)
 Conversion of Point into Qt point. More...
 
def draw (self, oldpoint, newpoint, Width=3, ColorID=0, Tag='')
 adds a segment on a given curve More...
 
def drawTo (self, newpoint, Width=3, ColorID=0, Drawing=True, Tag='')
 draws an additional segment on a given curve (from the end of the previous one) More...
 
def erase (self)
 erase curves, items and restore grid More...
 
def redraw (self)
 the whole picture is redrawn when the scale changes More...
 
def reframe (self, Point, Anticipation=False)
 performs a change of scale when necessary More...
 
def plot (self, Curve_designation, newpoint, Width=3)
 draws an additional segment on a curve More...
 
def move (self, Curve_designation, newpoint)
 introduces a discontinuity in a curve More...
 
- Public Member Functions inherited from Evolife.Graphics.Plot_Area.Image_Area
def __init__ (self, image=None, width=1000, height=1000, EventInterpreter=None, zoom=1)
 Inherits from QGraphicsScene. More...
 
def resize (self, w, h)
 Stores new dimensions and redraws. More...
 
def dimension ()
 returns dimensions More...
 
def redraw (self)
 the whole scene is redrawn when the scale changes More...
 
def drawPoints (self)
 Unused ---— just for test. More...
 
- Public Member Functions inherited from Evolife.Graphics.Curves.Curves
def __init__ (self)
 Creates a list of curves matching all available Evolife colours. More...
 
def start_Curve (self, Curve_id, location)
 defines where a curve should start More...
 
def CurveAddPoint (self, Curve_id, Point, Draw=True)
 Adds a point to a Curve. More...
 
def Curvenames (self, Names)
 records names for Curves. More...
 
def ActiveCurves (self)
 returns actually used curves More...
 
def Legend (self)
 returns tuples (ID, colour, colourname, curvename, legend) representing active curves More...
 
def dump (self, ResultFileName=None, ResultHeader='', DumpStart=0)
 Saves Curves to a file. More...
 

Public Attributes

 Legend
 
 Toric
 
 positions
 
 segments
 
 shapes
 
 GraphicAgents
 
 KnownShapes
 
- Public Attributes inherited from Evolife.Graphics.Plot_Area.Draw_Area
 OrigineX
 
 OrigineY
 
 scaleX
 
 scaleY
 
 LeftMargin
 
 RightMargin
 
 BottomMargin
 
 TopMargin
 
 Pens
 
 change
 
- Public Attributes inherited from Evolife.Graphics.Plot_Area.Image_Area
 ScaledBoard
 
 Board
 
 fitSize
 
 Canvas
 
 W
 
 H
 
 FrameNumber
 
 EventInterpreter
 
 zoom
 
- Public Attributes inherited from Evolife.Graphics.Curves.Curves
 Colours
 
 Curves
 
 UsedCurves
 

Static Public Attributes

string DEFAULTSHAPE = 'ellipse'
 

Detailed Description

Defines a 2-D region where agents are located and may move.

Definition at line 451 of file Plot_Area.py.

Constructor & Destructor Documentation

◆ __init__()

def Evolife.Graphics.Plot_Area.Ground.__init__ (   self,
  image = None,
  width = 400,
  height = 300,
  legend = True,
  EventInterpreter = None,
  zoom = 1 
)

Creates a Draw_Area and initializes agents.

Reimplemented from Evolife.Graphics.Plot_Area.Draw_Area.

Definition at line 458 of file Plot_Area.py.

Member Function Documentation

◆ convert()

def Evolife.Graphics.Plot_Area.Ground.convert (   self,
  Coord 
)

process modulo if toric and calls Draw_Area's convert

Reimplemented from Evolife.Graphics.Plot_Area.Draw_Area.

Definition at line 514 of file Plot_Area.py.

◆ coordinates()

def Evolife.Graphics.Plot_Area.Ground.coordinates (   self,
  Coord 
)

Coord is a tuple.

It has 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)

'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. 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)

Definition at line 490 of file Plot_Area.py.

◆ create_agent()

def Evolife.Graphics.Plot_Area.Ground.create_agent (   self,
  Name,
  Coord 
)

creates a dot at some location that represents an agent

Definition at line 521 of file Plot_Area.py.

◆ create_graphic_agent()

def Evolife.Graphics.Plot_Area.Ground.create_graphic_agent (   self,
  Position,
  Shape = None 
)

creates a graphic agent and returns the Q-reference

Definition at line 590 of file Plot_Area.py.

◆ create_graphic_segment()

def Evolife.Graphics.Plot_Area.Ground.create_graphic_segment (   self,
  Position,
  Segment 
)

creates a graphic segment and returns the Q-reference

Definition at line 624 of file Plot_Area.py.

◆ draw_tailed_blob()

def Evolife.Graphics.Plot_Area.Ground.draw_tailed_blob (   self,
  Coord 
)

draws a blob and a segment, as for an agent, but without agent name and without moving and removing options

Definition at line 666 of file Plot_Area.py.

◆ erase()

def Evolife.Graphics.Plot_Area.Ground.erase (   self)

removes agents and erases Draw_Area

Reimplemented from Evolife.Graphics.Plot_Area.Draw_Area.

Definition at line 684 of file Plot_Area.py.

◆ grid()

def Evolife.Graphics.Plot_Area.Ground.grid (   self)

Writing maximal values for both axes.

Reimplemented from Evolife.Graphics.Plot_Area.Draw_Area.

Definition at line 479 of file Plot_Area.py.

◆ move_agent()

def Evolife.Graphics.Plot_Area.Ground.move_agent (   self,
  Name,
  Coord = None,
  Position = None,
  Segment = None,
  Shape = None 
)

moves an agent's representative dot to some new location

Definition at line 526 of file Plot_Area.py.

◆ on_ground()

def Evolife.Graphics.Plot_Area.Ground.on_ground (   self)

Returns the identificiation of all agents on the ground.

Definition at line 648 of file Plot_Area.py.

◆ redraw()

def Evolife.Graphics.Plot_Area.Ground.redraw (   self)

the whole picture is redrawn when the scale changes

Reimplemented from Evolife.Graphics.Plot_Area.Draw_Area.

Definition at line 692 of file Plot_Area.py.

◆ remove_absent()

def Evolife.Graphics.Plot_Area.Ground.remove_absent (   self,
  Present 
)

removes agents that are not in Present

Definition at line 653 of file Plot_Area.py.

◆ remove_agent()

def Evolife.Graphics.Plot_Area.Ground.remove_agent (   self,
  Name 
)

removes an agent from the ground

Definition at line 633 of file Plot_Area.py.

◆ remove_segment()

def Evolife.Graphics.Plot_Area.Ground.remove_segment (   self,
  Name 
)

removes a segment from the ground

Definition at line 641 of file Plot_Area.py.

◆ restore_agent()

def Evolife.Graphics.Plot_Area.Ground.restore_agent (   self,
  Name 
)

display an agent that is still present in 'positions' and in 'segments', but is graphically dead

Definition at line 701 of file Plot_Area.py.

◆ scroll()

def Evolife.Graphics.Plot_Area.Ground.scroll (   self)

move agents vertically (not yet used)

Definition at line 659 of file Plot_Area.py.

◆ setToric()

def Evolife.Graphics.Plot_Area.Ground.setToric (   self,
  Toric = True 
)

if toric, edges 'touch' each other

Definition at line 474 of file Plot_Area.py.

Member Data Documentation

◆ DEFAULTSHAPE

string Evolife.Graphics.Plot_Area.Ground.DEFAULTSHAPE = 'ellipse'
static

Definition at line 455 of file Plot_Area.py.

◆ GraphicAgents

Evolife.Graphics.Plot_Area.Ground.GraphicAgents

Definition at line 471 of file Plot_Area.py.

◆ KnownShapes

Evolife.Graphics.Plot_Area.Ground.KnownShapes

Definition at line 472 of file Plot_Area.py.

◆ Legend

Evolife.Graphics.Plot_Area.Ground.Legend

Definition at line 461 of file Plot_Area.py.

◆ positions

Evolife.Graphics.Plot_Area.Ground.positions

Definition at line 468 of file Plot_Area.py.

◆ segments

Evolife.Graphics.Plot_Area.Ground.segments

Definition at line 469 of file Plot_Area.py.

◆ shapes

Evolife.Graphics.Plot_Area.Ground.shapes

Definition at line 470 of file Plot_Area.py.

◆ Toric

Evolife.Graphics.Plot_Area.Ground.Toric

Definition at line 462 of file Plot_Area.py.


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