Proc code - Solutions - MAP DEFINITION
|
|
Definició
de mapes en temps d'execució
Als widgets MAP, igual que els
altres, tenen un valrep associat el qual és constituït pel
valor
que es passarà al camp quan es selecciona una àrea de la
imatge i la representació que serà una sèrie
de coordenades (en parelles) i separades per comes que descriuen les linies
que formen el polígon que delimita l'àrea activa (hotspot).
Els widgets MAP tenen tres
propietats indocumentades que es poden utilitzar per tal de definir-los
i modificar-los en temps d'execució.
-
PICTURE. Conté el valor
(nom de fitxer -@- o glyph -^-) que s'ha de presentar com a imatge sobre
la que es definirà el mapa. Exemple:
$fieldproperties(my_map) = "PICTURE=@bart.bmp"
-
DEVMODE. Fa referència
a mode que es comportarà el widget quan actuen amb el mouse sobre
ell. Pot tenir tres valors :
-
none
: Funcionament normal. Quan seleccionem una zona del MAP es dispara el
trigger VALUE CHANGED del camp amb el valor associat aquesta zona
-
draw
: Permet dibuixar un polígon sobre el MAP. Quan es tanca el polígon
es dispara el trigger VALUE CHANGED amb un nou valor (HotspotXX).
Així mateix es modifica el "valrep" del camp amb el nou valor i
les coordenades dibuixades.
-
select
: Permet canviar un polígon de lloc dintre del mapa (modificant-se
també el "valrep").
-
TITLE. Conté una "llista"
separada per comes (no <GOLD ;>) amb els identificadors dels hotspots
i el "tooltip" que apareixerà (si tenim activat la propietat TOOLTIP).
Exemple.
Contingut.
El fitxer infoflat.zip
conté un exemple d'utilització d'aquestes funcionalitats
i es composa de :
-
Form : INFOFLAT
-
Model : INFOFLAT (entitats FLAT
i ROOM)
-
Fitxers: 3 bmp per utilitzar
a l'exemple
Funcionament.
A l'entitat FLAT es guarda
el nom del fitxer amb la imatge del mapa i cada ocurrència de ROOM
conté la seva llista de coordenades amb la que s'ha representar
al mapa.
Entreu la informació
del pis i fent servir el botó d'edició del mapa (si no en
teniu cap, us demanarà que entreu un pel que podeu agafar un dels
exemples) i dibuixeu la zona corresponent a una habitació,
una vegada fet això es crearà una nova ocurrència
a la que es posicionarà per tal d'entrar la seva descripció.
Si no esteu en mode d'edició,
fent click a la zona del mapa es posicionarà a la ocurrència
amb la descripció corresponent.
Quan us posicioneu a una ocurrència
de les habitacions apareixerà ressaltada al mapa.
Quan recupereu una ocurrència
gravada i us posicineu sobre el mapa apareixerà una tooltip amb
la descripció de l'àrea i amb el botó dret del mouse
apareixerà un menú per seleccionar-la.
Definición
de mapas en tiempo de ejecución
Los widgets de tipo MAP, igual
que cualquier otro, tienen un valrep asociada el cual se compone por el
valor
del tag que se pasará al caampo cuando se selcciona un area de la
imagen y la representación, que será una serie de pares de
coordenadas y separadas por comas que describen las lineas que forman el
polígono que delimita el area activa (hotspot).
El widget MAP tiene tres propiedades
indocumentadas que se pueden utilizar para definirlos y modificarlos en
tiempo de ejecución:
-
PICTURE. Contiene el valor (nombre
del fichero -@- o glyph -^-) que ha de presentarse como imagen sobre la
que se definirá el mapa. Ejemplo:
$fieldproperties(my_map) = "PICTURE=@bart.bmp"
-
DEVMODE. Se refiere al modo en
que se comportará el widget cuando se actúa con el mouse
sobre el. Puede tener tres valores:
-
none
: Funcionamiento normal. Cuando se seleccioan una zona del MAP se dispara
el trigger VALUE CHANGED del campo con el valor asociado a esta zona.
-
draw
: Permite dibujar un polígono sobre el MAP. Cuando el polígono
se cierra se dispara el trigger VALUE CHANGED con un nuevo valor (HotspotXX).
También se modifica el "valrep" del campo con el nuevo valor i las
coordenadas dibujada como representación de éste.
-
select
: Permite cambiar un polígono de lugar dentro del mapa (modificándose
también el "valrep").
-
TITLE. Contiene una "lista" separada
por comas (no <GOLD ;>) con los identificadores de los hotspots y el
"tooltip" que aparecerá (si tenemos activada la propiedad TOOLTIP).
Ejemplo.
Contenido.
El ficheror infoflat.zip
contiene un ejemplo de utilización de estas funcionalidades y se
compone de :
-
Form : INFOFLAT
-
Modelo : INFOFLAT (entidadess
FLAT y ROOM)
-
Ficheros: 3 bmp para utilizar
en el ejemplo
Funcionamento.
En la entidad FLAT se guarda
el nombre del fichero con la imagen del mapa y en cada ocurrencia de ROOM
se almacena la lista de coordenadas que se utilizará para representarla
en el mapa.
Entrad la información
del piso y utilizando el botón de edición del mapa (si no
habeis informado ninguno os pedirá que seleccioneis un bitmap, para
lo cual podeis utilizar algunos de los ejemplos adjuntos) y dibujad la
zona correspondiente a una habitación, una vez hecho esto se creará
una nueva ocurrencia en la que se posicionará para que informeis
su descripción.
Si no estais en modo de edición,
haciendo click en la zona de mapa se posicionará en la ocurrencia
con la descripción correspondiente.
Cuando os posicionais en una
ocurrencia de las habitaciones, se resaltará su imagen en el mapa.
Si recuperais una ocurrencia
grabada y os posicionais sobre el mapa aparecerá una tooltip con
la descripción del area y con el botón derecho del ratón
aparecerá un menú para seleccionar una area.
Run-time definition for maps widgets
MAP widgets, as other widgets,
are related with a valrep list. The map valrep is composed by the
value
to assign to the field when the image area is selected and the representation
wich is a set of coordinates (in pair) separated by a comma, which correspond
to the points of the polygon in order to delimited the active area (hotspot).
The MAP widgets have two undocumented
properties which we can use when we want to define the map at run-time:
-
PICTURE. Contains the value (file
name -@- or glyph -^-) used as map "background" image. Example:
$fieldproperties(my_map) = "PICTURE=@bart.bmp"
-
DEVMODE. Indicates the widget
behavior when the mouse is over. It can have three values:
-
none
: Normal use. When a hotspot is clicked the VALUE TRIGGER is fired and
the value for this zone is assigned to the field.
-
draw
: Enable drawing a polygon in the MAP. When the polygon is closed the VALUE
TRIGGER is fired, and the field contains a new value not defined, until
now, in the valrep list (HotspotXX).The
valrep list of the field is "selfmodified" with the new value and representation
for this value.
-
select
: Enable changing the polygon in the map.
-
TITLE. Is a "list" separated
by comma (no <GOLD ;>) with the hotspots identifiers and the "tooltip"
to show (the TOOLTIP property must be enabled).
Example.
Contents.
The infoflat.zip
file contains a example about how use this funcionalities :
-
Form : INFOFLAT
-
Model : INFOFLAT (entities FLAT
and ROOM)
-
Files: 3 bmp files to use in
the sample
How it works.
The image file name is stored
in the FLAT entity and every occurrence in the ROOM entity contains the
coordinates to build the valrep of the map.
Enter the information of the
flat and push the Edit button to edit the map (if not image is used you
can select one of the bmp files provided), draw the zone of a room and
you can see that a new occurrence is created in other to enter the its
description.
If you aren't in "edit mode",
clicking the map zone of a (defined) room, the room occurence of the associated
description wiil be selected.
If you select a room occurence
the map zone for this room will be highlighted.
If you retrieve a occurence,
a tooltip is showed when the mouse is over an hotspot. Using the right
button you can access to a pop-up menu in order to select an area.
Copyright © 1999-2003 $UUU All rights reserved.
Disclaimer. |
Site Comments.