Skip to content
jorgelf edited this page Dec 7, 2012 · 7 revisions

The XVM was written in JavaScript with an object oriented approach, using JQuery and OpenLayers as core libraries. This OOM was obtained through the creation of a base class with a method Extend that creates subclasses.

Each file usually contains one class, and we have the following ones:

  • XVM.js: contains XVM, a class that acts as a facade for the whole process of creating a map, providing also some attributes for customizing it. See Customization for more details on it.
  • Class.js: the base Class which all others will extend. It provides a very basic structure.
  • XVMUtils.js: this file contains some commodity functions we use repeatedly in other classes.
  • Map.js: the Map that encapsulates an OpenLayers Map and provides an interface for managing it.
  • Loader/Reader.js: Reader is a class used for accessing files and loading their data, may it be actual data or js code.
  • Loader/Config.js: we use Config for loading the global map configuration from the map.options.yaml file. See Customization for more details on it.
  • Loader/Controls.js: Controls serves for loading the list of controls we want to add to the map through the map.controls.yaml file. See Customization for more details on it.
  • Loader/Layers.js: contains Layers, a class we use for loading the map layers with the data configured in the map.layers.yaml file. See Customization for more details on it.
  • Event/EventBus.js: EventBus is a simple event manager used for providing communication between all classes without heavy acoplation.
  • Control/Control.js: Control is the class all XVM Controls should extend. It provides a template with all their mandatory and most common customizable methods.
  • Control/ControlLoader.js: the class used for loading the controls' files. It's called from Loader/Controls.js.

We also have several subfolders inside the Control folder which contain all the specific XVM controls' code. For more info on this, check Creating New Controls.

Clone this wiki locally