Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: visualising located entities

New Message Reply Date view Thread view Subject view Author view

Subject: Re: visualising located entities
From: Paul Guyot (paul.guyot@lip6.fr)
Date: Mon Oct 10 2005 - 13:50:09 CEST

Le 10 oct. 05 à 11:53, Geraldine Abrami a écrit :

> Hello everybody
>
> I think I have already seen some models where located entities
> could be represented by user defined images instead of the polygons
> of the "define observation" window.
> Does anybody know how it is possible?

The entities are sent the displayOn:at: message to be displayed.
By default, instances of ObjectLocation are always drawn as polygons,
the code doesn't allow custom images unless you override
displayOn:at: method. This surely is a bug and the method should be
factorized with Agent's method anyway.
Also by default, instances of Agent are drawn with the object
returned by the image message of the Agent class. If this object is a
direct instance of EntityImage, it is sent color: with the color of
the agent before being sent displayOn:at:.

Consequently, there are two ways to represent located entites with
bitmap images:
1/ override displayOn:at: in the entity and do the work of displaying
the image yourself.
2/ (for instances of Agent only), get a bitmap image and set it as
the image class variable by sending the image: message.

Depending on your Cormas installation, if Jun is present, this is as
simple as adding the following snippet in some class method:

self image: ((JunGifImageStream on: ('pathtotheimage.gif' asFilename)
readStream) nextImage).

(you can also use JunJpegImageStream, JunBmpImageStream, etc.).

Such an image will not be customized for a given color but nothing
will be displayed if no color is set. Also, please note that you
should make your best to not call this very often. A way to achieve
this is to put something like the following code in the init instance
method:

(self class image isKindOf: Image) ifFalse: [
     self class image: (JunGifImageStream on: ('pathtotheimage.gif'
asFilename) readStream nextImage).
]

Paul

-- 
「名前はまだ無い。」
Thésard UPMC/LIP6/POLEIA/OASIS/MIRIAD
Site Scott, Bureau C929B - Tél: 01442 75480 - Fax: 01442 77000
http://www-poleia.lip6.fr/~guyot/

New Message Reply Date view Thread view Subject view Author view
 

Back to home