Home > beboj

beboj

Beboj is a project mainly written in JAVA and JAVASCRIPT, based on the View license.

Online OpenStreetMap editor (pre-alpha, discontinued)

    Developer Readme
  ====================

I am using GWT 2.2 at the moment (but might work with other versions as well).

Modules

  • Beboj (org.openstreetmap.beboj.Beboj) The main module.

    inherits JOSM

  • JOSM (org.openstreetmap.josm.JOSM) Contains JOSM code that is compiled for client use.

    inherits JavaEmulation

    In sync with


    |            |
    | JOSM r4105 |
    |____________|

    At the moment, the update to a later JOSM version is quite some tedious fiddling, so the sources better stay as close to the original as (sensibly) possible

    Should not (or as little as possible) depend on GWT specific classes.

    This module contains classes that are not present in JOSM, but could go upstream in principle:

    • everything in the org.openstreetmap.josm.beboj package
    • org.openstreetmap.josm.data.osm.QBLevel This is a inner class from QuadBuckets originally. Moved to an extra file as workaround for some GWT bug. (see QuadBuckets for details)
    • org.openstreetmap.josm.gui.NavigationSupport & sub classes Generalizes the zoom handling.
    • org.openstreetmap.josm.io.DiffResultEntry Originally an inner class of DiffResultProcessor. Moved to separate file due to client / server code splitting.

    Porting Java to the GWT subset

    Common things that need fixing:

    • remove @Override for clone(): in GWT, 'Object' does not have a clone() method
    • get rid of String.format: not implemented by GWT
    • no 'Double.doubleToLongBits(d)' - replace by '(int) d' (bad hash) or '(""+d).hashCode()' (expensive)

    Concurrency is not an issue, so AtomicLong can by replaced by long and so forth.

  • JavaEmulation (org.openstreetmap.beboj.emul.JavaEmulation) Partial classpath emulation.

    The code from this module will only run in web mode. In development mode, normal JRE classes are used instead. This is a limitation of the GWT framework. For workaround, one can rename the packages, so they no longer match classpath.

  • OpenLayers (org.openstreetmap.openlayers.OpenLayers) Openlayers library

    Include this module to get the openlayers library into the public path (will be copied to war folder). There is a config file (beboj.cfg), to reduce the size of the library in a custom build (openlayers-minimal.js). If you add more imagery sources / controls, it probably has to be adapted. (For convenience, there is also a full version of the OpenLayers lib in the repository.) At time of writing, the lib is based on svn.openlayers.org r11949.

Server Code

Apart from the modules, there is code that runs on the server, only. It is located in org.openstreetmap.beboj.server and org.openstreetmap.josm_server.

For the latter, package names of the original JOSM classes are changed (josm -> josm_server). In principle, one could have both, client and server code, in separate source folders and keep the package names. However, the Eclipse GWT plugin has a bug that shows bogus warnings when it finds server and client code in the same package. Renaming the packages turned out to be the less annoying alternative.

Significant changes:

  • Credentials are passed explicitly as parameter, no Authenticator is installed.
  • In upload code, diff results are returned, not just the processed primitives. (We have to send the result of the upload from server to client. Consequently we cannot update the OsmPrimitives in place, but have to send the diff results, so the client can update its dataset later.)

Credits

Obviously, most of the code is taken from the JOSM project (http://josm.openstreetmap.de/).

EditMode Mouse Handling is very much inspired by Potlatch 2 (http://www.geowiki.co.uk/).

Includes the Openlayers library (http://openlayers.org/).

Previous:librsync