real time surface

This topic has been viewed 6306 times and has 6 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

real time surface

Post by buzzz »

I try to create a plugin that prints the current surface of all rooms dynamically.

I start learning the compute surface plugin, ok

I succeed in adding a roomlistener and it works. Nevertheless, this callback is called only at the beginning of the creation of a new room.

Can I intercept any other updates like : point moved, drawing finished ?

At present, the last room has a surface of zero. This value is updated only with the correct value when a new room is created
User avatar
bdfd
Posts: 2614
Joined: Sat Mar 29, 2014 7:17 am
Country: LILLE, Les Hauts de France, Western Europa

Re: real time surface

Post by bdfd »

I try to create a plugin that prints the current surface of all rooms dynamically.
I start learning the compute surface plugin, ok
I succeed in adding a roomlistener and it works. Nevertheless, this callback is called only at the beginning of the creation of a new room.
Can I intercept any other updates like : point moved, drawing finished ?
At present, the last room has a surface of zero. This value is updated only with the correct value when a new room is created
Hi,

I'm very interested in your plugin.
Can you add as a test: adds the surface of the room if the button 'Display area' is checked stp ?

Please let us know.

I hope you distribute your plugin. [=D>]
Evil progresses when good people do nothing!
---
SH3D 7.1 and nothing else - W11 64b in 4K
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: real time surface

Post by buzzz »

oui je veux bien le distribuer mais mon soucis n'est pas là

j'ai du mal à savoir comment récuper les mises à jour de la zone de dessin. Apparement le listener de room n'est déclenché que lors du premier clic pour créer le polygone, après je n'ai plus rien

mon idée était de faire une fenêtre qui par affiche la surface totale mais surtout qui la mette dynamiquement a jour

je ne sais pas trop si cela correspond à la philosophie des plugins sweethome. De ce que je vois on les lance et => il effectue une action

ici, en fait, j'essaye de créer un peu l'équivalent de la fenêtre des fournitures qui listent dynamiquement les meubles de l'appartement

mon problème est que l'on peut modifier les sommets des rooms => modification de la surface totale

mais je ne sais pas par quel listener attraper cette modification

je ne suis pas contre un peu d'aide car l'API est vaste :)

désolé, j'ai craqué pour le francais :)
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: real time surface

Post by buzzz »

peux etre veux tu que je le mette d'abord sur github ou qqc comme cela pour voir le code ?
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: real time surface

Post by buzzz »

ok, c'est bon, j'ai trouvé

c'est le plugin 19

bon, il n'est pas aussi dynamique que ce que j'aurais aimé... si vous avez une idée

il me faudrait un evenement lorsque la géométrie d'une room est modifée... mais la...
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: real time surface

Post by Puybaret »

Adding a [font=courier new]CollectionListener<Room>[/font] to home will inform you only on new and deleted rooms, as you noticed. If you want to listen to changes to the room points, you'll have to add a [font=courier new]PropertyChangeListener[/font] on each room (and remove it when the room is deleted), and update your text area when the property name in the event is equal to [font=courier new]Room.Property.POINTS.name()[/font].

[Please continue this thread in English because you started in English]
Emmanuel Puybaret, Sweet Home 3D creator
buzzz
Posts: 54
Joined: Sun Jun 25, 2017 9:02 am
Country: FR

Re: real time surface

Post by buzzz »

ok I succeed

Everything has been sent in the new version of demo plugin 19

I'm not a pure Java Dev, so, code may not be perfect, but the example is there for sweethome users
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest