Kamaelia docs : Kamaelia.Visualisation.PhysicsGraph3D.TopologyViewer3D.TopologyViewer3D

Kamaelia.Visualisation.PhysicsGraph3D.TopologyViewer3D.TopologyViewer3D

For examples and more explanations, see the module level docs.


class TopologyViewer3D(Axon.Component.component)

TopologyViewer3D(...) -> new TopologyViewer3D component.

A component that takes incoming topology (change) data and displays it live using pygame OpenGL. A simple physics model assists with visual layout. Particle types, appearance and physics interactions can be customised.

Keyword arguments (in order):

  • screensize -- (width,height) of the display area (default = (800,600))
  • fullscreen -- True to start up in fullscreen mode (default = False)
  • caption -- Caption for the pygame window (default = "3D Topology Viewer")
  • particleTypes -- dict("type" -> klass) mapping types of particle to classes used to render them (default = {"-":CuboidParticle3D})
  • initialTopology -- (nodes,bonds) where bonds=list((src,dst)) starting state for the topology (default=([],[]))
  • laws -- Physics laws to apply between particles (default = SimpleLaws(bondlength=2))
  • simCyclesPerRedraw -- number of physics sim cycles to run between each redraw (default=1)
  • border -- Minimum distance from edge of display area that new particles appear (default=0)

Inboxes

  • control : Shutdown signalling
  • callback : for the response after a displayrequest
  • inbox : Topology (change) data describing an Axon system
  • events : Place where we recieve events from the outside world

Outboxes

  • outbox : Notification and topology output
  • signal : Control signalling
  • display_signal : Requests to Pygame Display service

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

_generatePos(self, posSpec)

generateXY(posSpec) -> (x,y,z) or raises ValueError

posSpec == "randompos" or "auto" -> random (x,y,z) within the surface (specified border distance in from the edege) posSpec == "(XXX,YYY,ZZZ)" -> specified x,y,z (positive or negative integers) spaces are allowed within the tuple, but quotation is needed in this case. E.g., " ( 0 , 0 , -10 ) "

addListenEvents(self, events)

Sends listening request for pygame events to the display service. The events parameter is expected to be a list of pygame event constants.

addParticle(self, *particles)

Add particles to the system

breakBond(self, source, dest)

Break a bond from source to destination particle, specified by IDs

deselectAll(self)

Deselect all particles.

doCommand(self, msg)

Proceses a topology command tuple: [ "ADD", "NODE", <id>, <name>, <positionSpec>, <particle type> ] [ "DEL", "NODE", <id> ] [ "ADD", "LINK", <id from>, <id to> ] [ "DEL", "LINK", <id from>, <id to> ] [ "DEL", "ALL" ] [ "GET", "ALL" ]

draw(self)

Dummy method reserved for future use

Invoke draw() and save its commands to a newly generated displaylist.

The displaylist name is then sent to the display service via a "DISPLAYLIST_UPDATE" request.

drawParticles(self, *particles)

Sends particles drawing opengl command to the display service.

getParticleLabel(self, node_id)

getParticleLabel(node_id) -> particle's name

Returns the name/label of the specified particle.

getTopology(self)

getTopology() -> list of command tuples that would build the current topology

gotoDisplayLevel(self, dlevel)

Switch to another display level.

handleEvents(self)

Handle events.

handleKeyEvents(self, event)

Handle keyboard events.

handleMouseEvents(self, event)

Handle mouse events.

main(self)

Main loop.

makeBond(self, source, dest)

Make a bond from source to destination particle, specified by IDs

quit(self[, msg])

Cause termination.

removeListenEvents(self, events)

Sends stop listening request for pygame events to the display service. The events parameter is expected to be a list of pygame event constants.

removeParticle(self, *ids)

Remove particle(s) specified by their ids.

Also breaks any bonds to/from that particle.

rotateParticles(self, particles, dAngle)

Rotate the particles around their common centre dAngle degree. Particles is a list; dAngle is a triple tuple of degree. If particles are given an empty list, rotate all particles instead.

scroll(self)

Scroll the surface by resetting gluLookAt.

selectParticle(self, particle)

Select the specified particle.

updateParticleLabel(self, node_id, new_name)

updateParticleLabel(node_id, new_name) -> updates the given nodes name & visual label if it exists

node_id - an id for an already existing node new_name - a string (may include spaces) defining the new node name

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT


Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)