******************************************************************************************
Useful classes are: Usage:
- Image_Area: An area that displays an image
function: display(
- Draw_Area: Basic drawing Area
function: plot(
- Plot_Area: Draw_Area + grid + automatic resizing
function: plot(
- Ground: Defines a 2-D region where agents are located and may move
functions: create_agent(
move_agent(
#self.W = QPlot_Area.AreaView(QPlot_Area.Image_Area)
self.W = QPlot_Area.AreaView(QPlot_Area.Draw_Area)
#self.W = QPlot_Area.AreaView(QPlot_Area.Plot_Area)
self.W.Area.plot(3,(10,10))
self.W.Area.plot(3,(20,40))
self.W.Area.plot(3,(10,22))
******************************************************************************************
Class Image_Area: inherits from PyQt5.QtWidgets.QGraphicsScene
================
Defines a logical Area on which objects are drawn (hidden from screen)
**************************************************************************************
----------------------------------------------------------------------------------
Method Image_Area.__init__:
==========================
Inherits from QGraphicsScene
----------------------------------------------------------------------------------
Arguments:
. image
. width
. height
. EventInterpreter
. zoom
----------------------------------------------------------------------------------
Method Image_Area.resize:
========================
Stores new dimensions and redraws
----------------------------------------------------------------------------------
Arguments:
. w
. h
----------------------------------------------------------------------------------
Method Image_Area.dimension:
===========================
returns dimensions
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Image_Area.redraw:
========================
the whole scene is redrawn when the scale changes
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Image_Area.drawPoints:
============================
Unused ------ just for test
----------------------------------------------------------------------------------
**************************************************************************************
Class Draw_Area: inherits from Evolife.Graphics.Plot_Area.Image_Area, Evolife.Graphics.Curves.Curves
===============
Draw_Area: Basic drawing Area
**************************************************************************************
----------------------------------------------------------------------------------
Method Draw_Area.__init__:
=========================
Calls Image_Area constructor
Initializes Curves
----------------------------------------------------------------------------------
Arguments:
. image
. width
. height
. EventInterpreter
. zoom
----------------------------------------------------------------------------------
Method Draw_Area.set_margins:
============================
surrounding margins (in Image_Area pixels)
----------------------------------------------------------------------------------
Arguments:
. Left
. Right
. Bottom
. Top
----------------------------------------------------------------------------------
Method Draw_Area.init_Pens:
==========================
Defining one pen and one QPainterPath per curve
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Draw_Area.grid:
=====================
Initial display - to be overloaded
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Draw_Area.pixel2xy:
=========================
converts physical coordinates into logical pixel(between 0 and scaleX)
----------------------------------------------------------------------------------
Arguments:
. Point
----------------------------------------------------------------------------------
Method Draw_Area.xy2pixel:
=========================
converts logical pixel (between 0 and scaleX) into physical coordinates through rescaling
----------------------------------------------------------------------------------
Arguments:
. Point
----------------------------------------------------------------------------------
Method Draw_Area.convert:
========================
Conversion of logical coordinates into physical coordinates through scaling and margin translation
----------------------------------------------------------------------------------
Arguments:
. Point
----------------------------------------------------------------------------------
Method Draw_Area.Q_Convert:
==========================
Conversion of Point into Qt point
----------------------------------------------------------------------------------
Arguments:
. Point
----------------------------------------------------------------------------------
Method Draw_Area.draw:
=====================
adds a segment on a given curve
----------------------------------------------------------------------------------
Arguments:
. oldpoint
. newpoint
. Width
. ColorID
. Tag
----------------------------------------------------------------------------------
Method Draw_Area.drawTo:
=======================
draws an additional segment on a given curve (from the end of the previous one)
----------------------------------------------------------------------------------
Arguments:
. newpoint
. Width
. ColorID
. Drawing
. Tag
----------------------------------------------------------------------------------
Method Draw_Area.erase:
======================
erase curves, items and restore grid
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Draw_Area.redraw:
=======================
the whole picture is redrawn when the scale changes
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Draw_Area.reframe:
========================
performs a change of scale when necessary
----------------------------------------------------------------------------------
Arguments:
. Point
. Anticipation
----------------------------------------------------------------------------------
Method Draw_Area.plot:
=====================
draws an additional segment on a curve
----------------------------------------------------------------------------------
Arguments:
. Curve_designation
. newpoint
. Width
----------------------------------------------------------------------------------
Method Draw_Area.move:
=====================
introduces a discontinuity in a curve
----------------------------------------------------------------------------------
Arguments:
. Curve_designation
. newpoint
----------------------------------------------------------------------------------
Method Draw_Area.speck:
======================
draws a spot
----------------------------------------------------------------------------------
Arguments:
. Curve_id
. newpoint
. Size
----------------------------------------------------------------------------------
Method Draw_Area.mouseLocate:
============================
convert mouse position into window coordinates
----------------------------------------------------------------------------------
Arguments:
. MouseEvent
----------------------------------------------------------------------------------
Method Draw_Area.mousePressEvent:
================================
retrieves mouse clicks - added by Gauthier Tallec
----------------------------------------------------------------------------------
Arguments:
. MouseEvent
----------------------------------------------------------------------------------
Method Draw_Area.mouseReleaseEvent:
==================================
retrieves mouse clicks
----------------------------------------------------------------------------------
Arguments:
. MouseEvent
----------------------------------------------------------------------------------
Method Draw_Area.mouseDoubleClickEvent:
======================================
retrieves mouse clicks
----------------------------------------------------------------------------------
Arguments:
. MouseEvent
----------------------------------------------------------------------------------
Method Draw_Area.mouseMoveEvent:
===============================
retrieves mouse movements when button is pressed
----------------------------------------------------------------------------------
Arguments:
. MouseEvent
**************************************************************************************
Class Plot_Area: inherits from Evolife.Graphics.Plot_Area.Draw_Area
===============
Definition of the drawing area, with grid, legend and curves
**************************************************************************************
----------------------------------------------------------------------------------
Method Plot_Area.__init__:
=========================
Calls Draw_Area constructor and sets margins
----------------------------------------------------------------------------------
Arguments:
. image
. width
. height
. EventInterpreter
. zoom
----------------------------------------------------------------------------------
Method Plot_Area.grid:
=====================
Drawing a grid with axes and legend
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Plot_Area.plot:
=====================
A version of PLOT that checks whether the new segment
remains within the frame. If not, the scale is changed
and all curves are replotted
----------------------------------------------------------------------------------
Arguments:
. Curve_id
. newpoint
. Width
**************************************************************************************
Class Ground: inherits from Evolife.Graphics.Plot_Area.Draw_Area
============
Defines a 2-D region where agents are located and may move
**************************************************************************************
----------------------------------------------------------------------------------
Method Ground.__init__:
======================
Creates a Draw_Area and initializes agents
----------------------------------------------------------------------------------
Arguments:
. image
. width
. height
. legend
. EventInterpreter
. zoom
----------------------------------------------------------------------------------
Method Ground.setToric:
======================
if toric, edges ‘touch’ each other
----------------------------------------------------------------------------------
Arguments:
. Toric
----------------------------------------------------------------------------------
Method Ground.grid:
==================
Writing maximal values for both axes
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Ground.coordinates:
=========================
Coord is a tuple.
It has the following form:
(x, y, colour, size, ToX, ToY, segmentColour, segmentThickness, ‘shape=