Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11625 closed enhancement (fixed)

Add MapView hooks required by OpenGL plugin.

Reported by: michael2402 Owned by: team
Priority: normal Milestone: 15.09
Component: Core Version:
Keywords: Cc:

Description

The following changes are made to JOSM:

  • Access to MapView#layers/temporaryLayers is synchronized. Synchronisation is a bit tricky here, because many Listeners do a invoke and wait on the AWT event thread, which might cause dead locks. There should be none in main JSOM, but I don't really know what crazy things plugin developers are doing...
  • A hardcoded MapView#redraw(...) is used in many places. I added a listener to intercept those calls and redraw the OpenGL view instead.
  • Selection uses a temporary layer to draw the polygon/rectangle. I found no more uses of NavigatableComponent.requestPaintRect/Poly(...) and the related methods, so they could be reoved/marked as deprecated. I don't really think that that is nice coding style, we have temporary layers for that. Those selection changes should also fix some mouse button issues and make e.g. the right mouse button work when lasso-selecting. (#10218, #11094)
  • The current cursor also allows multiple listeners.
  • The zoom/scrolling got its new class.
  • I don't really want to blow up the MapView much more. Together with NavigationComponent, it has almost 3k lines. This is why I moved the cursor management and the zoom/center to new classes.
  • Fixed #11496

Some documentation additions and other minor changes are also included.

A full diff is here:
https://github.com/michaelzangl/josm/compare/mirror...gsoc-opengl

Attachments (0)

Change History (7)

comment:1 by bastiK, 10 years ago

Thanks, great patch! I like the idea to refactor the navigation code and move it to another class. But having all in one huge diff file, makes it hard to see, what part of the code is just copied and what has been changed. I would appreciate if you could split the patch in (at least) 2 parts: One which moves code to other classes, but has minimal changes otherwise and one with all the rest. If you are fixing separate issues, it would be better to attach a patch to the corresponding ticket (when appropriate).

Other comments:

  • You can merge GlobalSoM with the SystemOfMeasurement class.
  • Add @deprecated to the things you just leave for backward compatibility.
  • EastNorth: I'd rather keep it the way it is now (easier, more efficient). But leave the Javadoc! :)
  • NavigationModel.WeakZoomChangeListener: Have a look at Main.fireProjectionChanged. This forces use of WeakReference, so is more foolproof.

comment:2 by michael2402, 10 years ago

Hi,

Thanks for all those comments. I am currently splitting up the patches and adding separate tickets for the changes.

I had a look at the projection change listeners before. Holding weak references without notifying the user - and not even a javadoc node in the addListener method) leads to bugs you can not trace easily (Why is my listener not firing after xxx seconds?) I know that JOSM often uses the active Object as listener. But many programmers (like me ;-)) like to put all code that is related to the listener into a new class and just register that class. If you do not support unloading (plugins, ...) you don't need to keep a reference to that listener.

comment:3 by michael2402, 10 years ago

Summary: [Patch] Add MapView hooks required by OpenGL plugin.Add MapView hooks required by OpenGL plugin.

comment:4 by michael2402, 10 years ago

Split up into #11627 #11628 #11629 #11630 #11631 #11632 #11633 #11634 #11635 #11636 #11637 (best to apply in this order, but should have few dependencies).

comment:5 by michael2402, 9 years ago

Resolution: fixed
Status: newclosed

comment:6 by michael2402, 9 years ago

Ticket closed since most of the smaller patches are accepted.

comment:7 by Don-vip, 9 years ago

Milestone: 15.09

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.