Event handling
I am having a problem regarding event handling, and I haven't yet been able to figure out the cause of the problem. Any assistance you could provide in this regard would be greatly appreciated.
I created a PlaceMarkerEvt class to handle mouse click events, which allows users to create three points in a given map environment (and a fourth click removes all created points). The application allows users to change the map environment by typing on the keyboard, and each map environment utilizes the PlaceMarkerEvt class. The problem is that the PlaceMarkerEvt class works without flawlessly in the initial map environment; however, when the map environment is changed, it no longer works the way it is supposed to work. Output: # Initial map environment 1: [-21.214298248291016, 13.693742752075195, 96.99993896484375, '2013-03-28 10:59:15.947000'] 2: [27.049070358276367, -7.507974147796631, 95.81939697265625, '2013-03-28 10:59:16.397000'] 3: [-22.711130142211914, -32.831119537353516, 91.01387786865234, '2013-03-28 10:59:16.847000'] 4: Remove points removeShapes() - POINTS REMOVED # Map environment is changed -- duplicates coordinates recordings and does not remove points 1: [-31.70626449584961, 2.459872245788574, 94.83840942382812, '2013-03-28 10:59:20.997000'] 1: [-31.70626449584961, 2.459872245788574, 94.83840942382812, '2013-03-28 10:59:20.998000'] 2: [7.19222354888916, -4.607730865478516, 99.53379821777344, '2013-03-28 10:59:21.381000'] 2: [7.19222354888916, -4.607730865478516, 99.53379821777344, '2013-03-28 10:59:21.382000'] 3: [-2.733815908432007, -18.645051956176758, 97.84542846679688, '2013-03-28 10:59:21.814000'] 3: [-2.733815908432007, -18.645051956176758, 97.84542846679688, '2013-03-28 10:59:21.815000'] 4: Remove points removeShapes() - POINTS REMOVED 4: Remove points removeShapes() - POINTS REMOVED Code:
import viz |
It's not exactly clear to me what the issue is. However, I noticed that you are creating a new instance of PlaceMarkerEvt when the environment is changed, but you are not removing the previous instance. This might be the cause of your problems.
|
Thank you so much! I was able to fix the problem by deleting instance of PlaceMarkerEvt.
|
All times are GMT -7. The time now is 07:08 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC