[Mapbender-dev] geometry library

Christoph Baudson christoph.baudson at ccgis.de
Tue Nov 14 09:15:32 EST 2006


Hi there,

Today I have committed the first draft of the geometry class. The 
purpose is to have a single module that contains all geometric data 
types and methods required for digitizing and handling geometries from 
wfs requests.

https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/geometry.js?view=auto&rev=818

It contains mainly everything from

mod_geometryArray.js
mod_highlight.php

plus two additional functions.

I have not included point.js, because I think it might be a good idea to 
  include it in index.php rightaway.

Pros:

+ simplifies information exchange between classes and functions (it's 
more convenient handing over a point than an array of x-y-values)

+ saves code in the long run (no more arrays)

+ Possible enhancements: for example adding a boolean representing 
whether the point is a real coordinate or a screen position.

+ when two modules using point.js are in seperate frames, the class 
would have to be loaded twice otherwise.

Cons:

- Memory size of a point. The point object includes functions and data. 
Imagine a geometry with thousands of points.

- despite its small size there is more overhead meaning more traffic 
(we're talking about 2 KB here).

(*Please add your pros/cons!*)

It would be a good idea to vote which new code is allowed in 
map.php/index.php. All members of the Mapbender PSC are eligible to 
vote. But maybe we discuss the topic first, and have a vote next week.

BTW, modularisation already paid off for me:

* the class Highlight is now being used both for highlighting *and* snapping
* Snapping itself is being used in digitizing *and* closing a search 
polygon.
* The function that returns only the part of a line that's visible in 
the mapframe is being used both for digitized *and* highlighted geometries.

It saves a lot of code and is so much easier to maintain.

Cheers, Christoph




More information about the Mapbender_dev mailing list