[OpenLayers-Dev] Vector Diffs

Christopher Schmidt crschmidt at metacarta.com
Thu Mar 15 00:26:38 EDT 2007


Tonight, I went through 
svn diff http://svn.openlayers.org/trunk/openlayers/lib/
http://svn.openlayers.org/sandbox/vector-2.4/lib/  and looked at every
line.

Follows is a summary of changes to the existing OpenLayers code. The only
non-documentation/functional changes to existing files were: 

Events:
OpenLayers/Events.js
Added registerPriority function, which puts a listener at the beginning of 
the list.

OpenLayers/Control.js
 * Added activate/deactivate methods which set active flag and return
   true or false depending on whether the state has changed.
 * Calculate a default displayClass:
   this.displayClass = this.CLASS_NAME.replace("OpenLayers.",
                                    "ol").replace(".","");
 * Added OpenLayers.Control.TYPE_BUTTON, TYPE_TOOL constants for 
   building toolbar controls.
 * setMap will now call setMap on any handler property on the control. 

OpenLayers/Map.js
default controls changed from using MouseDefaults to using Navigation
control. 

OpenLayers/Ajax.js
If given a 'postBody' parameter, the content-type is no longer set to
x-www-form-encoded. This allows us to post WFS data. x-www-form-encoded
data can still be passed using parameters and setting 'method' to 'post'.   

OpenLayers/BaseTypes.js
Add an 'extend' method to Bounds().

OpenLayers/Layer/WFS.js -- still working on this one. 

The rest of the changes are either: 
 * New files
 * Only documentation changes.

In total, changes in existing files account for only ~50 lines of code.
The rest of the changes are described here.


Controls:


OpenLayers/Control/EditingToolbar.js -- New file.
OpenLayers/Control/DrawFeature.js -- New file.
OpenLayers/Control/DragPan.js -- new file. Used by navigation control.
OpenLayers/Control/ZoomToMaxExtent.js -- new file. demo of 'button' functionality.
OpenLayers/Control/SelectFeature.js -- new file. 
OpenLayers/Control/ZoomBox.js -- new file. used by Navigation control. 
OpenLayers/Control/Panel.js -- new file. Used for building toolbars
                               (navtoolbar,editingtoolbar) 

OpenLayers/Control/MouseDefaults.js -- added deprecation warning.
OpenLayers/Control/MouseToolbar.js -- added deprecation warning.

OpenLayers/Control/Scale.js
OpenLayers/Control/OverviewMap.js
OpenLayers/Control/MousePosition.js 
OpenLayers/Control/Permalink.js
Modified classNames to use new 'this.displayClass', so constants like
'olControlOverviewMapElement' can now be overridden by setting displayClass 
as an option on the layer. No functional changes.

OpenLayers/Control/KeyboardDefaults.js 
Refactored to use Handlers. (Since this has never been released, changing
the internals is not painful.)

OpenLayers/Control/Navigation.js -- replaces MouseDefaults.
OpenLayers/Control/NavToolbar.js -- replaces MouseToolbar.


OpenLayers/Renderer.js
OpenLayers/Renderer/Elements.js
OpenLayers/Renderer/SVG.js
OpenLayers/Renderer/VML.js
New files to support vector drawing. Used by Layer.Vector and its
subclasses. Renderer/Elements is a subclass of SVG/VML, used to capture the
similiarities inherent in element-based renderers. 


Handlers: 

OpenLayers/Handler.js
OpenLayers/Handler/Polygon.js
OpenLayers/Handler/Box.js
OpenLayers/Handler/Keyboard.js
OpenLayers/Handler/Path.js
OpenLayers/Handler/Point.js
OpenLayers/Handler/Drag.js
OpenLayers/Handler/Select.js
OpenLayers/Handler/MouseWheel.js

As part of evaluation of the MouseListener code, we realized that there is
a level of abstraction that was not really well defined in the code.
Essentially, there are a number of core events -- like drawing a box,
dragging the mouse, and drawing point/path/polygon features -- below the level
of the "Controls". In order to make developing controls more modular and
easier, we've migrated this functionality into a set of handlers which
encapsulates these methods. As described in a mailing list post, this has
made things like MouseDefaults a trivial control using these handlers.

-- http://trac.openlayers.org/wiki/Handlers


Formats:

OpenLayers/Format.js
OpenLayers/Format/GML.js -- full read/write
OpenLayers/Format/WFS.js -- subclass of GML, WFS-T writing
OpenLayers/Format/KML.js -- read only
OpenLayers/Format/GeoRSS.js -- write only

Formats define two methods: a 'read' and 'write'. read takes some data --
string, XML document, etc. -- and returns a list of features. KML and
GeoRSS are partial implementations as part of a proof of concept, and can
be finished via interested parties. Formats are new in the vector-2.4
branch.   

Geometries:

OpenLayers/Geometry.js
OpenLayers/Geometry/Curve.js
OpenLayers/Geometry/MultiPoint.js
OpenLayers/Geometry/Rectangle.js
OpenLayers/Geometry/Polygon.js
OpenLayers/Geometry/Surface.js
OpenLayers/Geometry/MultiLineString.js
OpenLayers/Geometry/Point.js
OpenLayers/Geometry/LinearRing.js
OpenLayers/Geometry/Collection.js
OpenLayers/Geometry/LineString.js
OpenLayers/Geometry/MultiPolygon.js

Geometries store geographic information. Features have geometries. (You
can't draw a geometry: you draw a feature, which has a geometry and style.)


OpenLayers/Feature/Vector.js
Subclass of Feature specifically for Vector rendering. 

Layers: 
OpenLayers/Layer/Vector.js -- Simple base class. Allows for drawing of
 features directly.  
OpenLayers/Layer/GML.js -- Load remote data, parse it based on the chosen
  parser, and display it as vectors. (This means it is also Layer.KML,
  by changing the format in use.) 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list