Skip to content

Commit

Permalink
Transform jsapi code to ES6 modules
Browse files Browse the repository at this point in the history
  • Loading branch information
gberaudo committed May 6, 2019
1 parent 96acb46 commit b1874fd
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 137 deletions.
22 changes: 12 additions & 10 deletions jsapi/src/layermanager.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
goog.module('lux.LayerManager');

goog.module.declareLegacyNamespace();
const luxUtil = goog.require('lux.util');
const olBase = goog.require('ol');
const olControlControl = goog.require('ol.control.Control');
const olEvents = goog.require('ol.events');
const olCollectionEventType = goog.require('ol.CollectionEventType');

/**
* @module lux.LayerManager
*/
import luxUtil from './util.js';
import olBase from 'ol.js';
import olControlControl from 'ol/control/Control.js';
import olEvents from 'ol/events.js';
import olCollectionEventType from 'ol/CollectionEventType.js';

/**
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.ControlOptions} options Layer manager options.
* @export
*/
exports = function(options) {
const exports = function(options) {
var element = document.createElement('UL');
element.classList.add('lux-layer-manager');

Expand Down Expand Up @@ -80,3 +79,6 @@ exports.prototype.update = function() {
this.element.appendChild(li);
}, this);
};


export default exports;
81 changes: 42 additions & 39 deletions jsapi/src/map.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
goog.module('lux.Map');

goog.module.declareLegacyNamespace();
const luxUtil = goog.require('lux.util');
const luxLayerManager = goog.require('lux.LayerManager');
const luxMyMap = goog.require('lux.MyMap');
const luxPrintManager = goog.require('lux.PrintManager');
const luxStateManager = goog.require('lux.StateManager');
const olBase = goog.require('ol');
const olArray = goog.require('ol.array');
const olMap = goog.require('ol.Map');
const olOverlay = goog.require('ol.Overlay');
const olView = goog.require('ol.View');
const olControlMousePosition = goog.require('ol.control.MousePosition');
const olEvents = goog.require('ol.events');
const olFormatGPX = goog.require('ol.format.GPX');
const olFormatGeoJSON = goog.require('ol.format.GeoJSON');
const olFormatKML = goog.require('ol.format.KML');
const olGeomPoint = goog.require('ol.geom.Point');
const olInteractionSelect = goog.require('ol.interaction.Select');
const olLayerTile = goog.require('ol.layer.Tile');
const olLayerVector = goog.require('ol.layer.Vector');
const olExtent = goog.require('ol.extent');
const olStyleFill = goog.require('ol.style.Fill');
const olStyleStroke = goog.require('ol.style.Stroke');
const olStyleStyle = goog.require('ol.style.Style');
const olStyleCircle = goog.require('ol.style.Circle');
const olSourceVector = goog.require('ol.source.Vector');
const olProj = goog.require('ol.proj');
const olCollection = goog.require('ol.Collection');
const olAsserts = goog.require('ol.asserts');
const olControlAttribution = goog.require('ol.control.Attribution');
const olControl = goog.require('ol.control');
const olCollectionEventType = goog.require('ol.CollectionEventType');
const olMapBrowserEventType = goog.require('ol.MapBrowserEventType');
const olFeature = goog.require('ol.Feature');
const olGeomPolygon = goog.require('ol.geom.Polygon');
const olSourceVectorEventType = goog.require('ol.source.VectorEventType');
/**
* @module lux.Map
*/
import luxUtil from './util.js';
import luxLayerManager from './LayerManager.js';
import luxMyMap from './MyMap.js';
import luxPrintManager from './PrintManager.js';
import luxStateManager from './StateManager.js';
import olBase from 'ol.js';
import olArray from 'ol/array.js';
import olMap from 'ol/Map.js';
import olOverlay from 'ol/Overlay.js';
import olView from 'ol/View.js';
import olControlMousePosition from 'ol/control/MousePosition.js';
import olEvents from 'ol/events.js';
import olFormatGPX from 'ol/format/GPX.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
import olFormatKML from 'ol/format/KML.js';
import olGeomPoint from 'ol/geom/Point.js';
import olInteractionSelect from 'ol/interaction/Select.js';
import olLayerTile from 'ol/layer/Tile.js';
import olLayerVector from 'ol/layer/Vector.js';
import olExtent from 'ol/extent.js';
import olStyleFill from 'ol/style/Fill.js';
import olStyleStroke from 'ol/style/Stroke.js';
import olStyleStyle from 'ol/style/Style.js';
import olStyleCircle from 'ol/style/Circle.js';
import olSourceVector from 'ol/source/Vector.js';
import olProj from 'ol/proj.js';
import olCollection from 'ol/Collection.js';
import olAsserts from 'ol/asserts.js';
import olControlAttribution from 'ol/control/Attribution.js';
import olControl from 'ol/control.js';
import olCollectionEventType from 'ol/CollectionEventType.js';
import olMapBrowserEventType from 'ol/MapBrowserEventType.js';
import olFeature from 'ol/Feature.js';
import olGeomPolygon from 'ol/geom/Polygon.js';
import olSourceVectorEventType from 'ol/source/VectorEventType.js';


proj4.defs('EPSG:2169', '+proj=tmerc +lat_0=49.83333333333334 +lon_0=6.166666666666667 +k=1 +x_0=80000 +y_0=100000 +ellps=intl +towgs84=-189.681,18.3463,-42.7695,-0.33746,-3.09264,2.53861,0.4598 +units=m +no_defs');
Expand Down Expand Up @@ -77,7 +77,7 @@ _paq.push(['setSiteId', 22]);
* @export
* @api stable
*/
exports = function(options) {
const exports = function(options) {
/**
* @private
* @type {Array}
Expand Down Expand Up @@ -1870,3 +1870,6 @@ exports.findLayerByName_ = function(name, layers) {
}
return;
};


export default exports;
72 changes: 37 additions & 35 deletions jsapi/src/mymap.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
goog.module('lux.MyMap');

goog.module.declareLegacyNamespace();
const luxUtil = goog.require('lux.util');
const ngeoInteractionMeasure = goog.require('ngeo.interaction.Measure');
const ngeoProfileD3Elevation = goog.require('ngeo.profile.d3Elevation');
const olFormatGeoJSON = goog.require('ol.format.GeoJSON');
const olInteractionSelect = goog.require('ol.interaction.Select');
const olLayerVector = goog.require('ol.layer.Vector');
const olStyleFill = goog.require('ol.style.Fill');
const olStyleIcon = goog.require('ol.style.Icon');
const olStyleRegularShape = goog.require('ol.style.RegularShape');
const olStyleStyle = goog.require('ol.style.Style');
const olStyleStroke = goog.require('ol.style.Stroke');
const olStyleText = goog.require('ol.style.Text');
const olSourceVector = goog.require('ol.source.Vector');
const olFormatKML = goog.require('ol.format.KML');
const olFormatGPX = goog.require('ol.format.GPX');
const olStyleCircle = goog.require('ol.style.Circle');
const olEvents = goog.require('ol.events');
const olObj = goog.require('ol.obj');
const olOverlay = goog.require('ol.Overlay');
const olEventsEventType = goog.require('ol.events.EventType');
const olGeomLineString = goog.require('ol.geom.LineString');
const olGeomPolygon = goog.require('ol.geom.Polygon');
const olGeomMultiPoint = goog.require('ol.geom.MultiPoint');
const olGeomPoint = goog.require('ol.geom.Point');
const olGeomGeometryType = goog.require('ol.geom.GeometryType');
const olMapBrowserEventType = goog.require('ol.MapBrowserEventType');
const olGeomGeometryLayout = goog.require('ol.geom.GeometryLayout');
const olFeature = goog.require('ol.Feature');
const olExtent = goog.require('ol.extent');
const olGeomMultiLineString = goog.require('ol.geom.MultiLineString');

/**
* @module lux.MyMap
*/
import luxUtil from './util.js';
import ngeoInteractionMeasure from 'ngeo/interaction/Measure.js';
import ngeoProfileD3Elevation from 'ngeo/profile/d3Elevation.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
import olInteractionSelect from 'ol/interaction/Select.js';
import olLayerVector from 'ol/layer/Vector.js';
import olStyleFill from 'ol/style/Fill.js';
import olStyleIcon from 'ol/style/Icon.js';
import olStyleRegularShape from 'ol/style/RegularShape.js';
import olStyleStyle from 'ol/style/Style.js';
import olStyleStroke from 'ol/style/Stroke.js';
import olStyleText from 'ol/style/Text.js';
import olSourceVector from 'ol/source/Vector.js';
import olFormatKML from 'ol/format/KML.js';
import olFormatGPX from 'ol/format/GPX.js';
import olStyleCircle from 'ol/style/Circle.js';
import olEvents from 'ol/events.js';
import olObj from 'ol/obj.js';
import olOverlay from 'ol/Overlay.js';
import olEventsEventType from 'ol/events/EventType.js';
import olGeomLineString from 'ol/geom/LineString.js';
import olGeomPolygon from 'ol/geom/Polygon.js';
import olGeomMultiPoint from 'ol/geom/MultiPoint.js';
import olGeomPoint from 'ol/geom/Point.js';
import olGeomGeometryType from 'ol/geom/GeometryType.js';
import olMapBrowserEventType from 'ol/MapBrowserEventType.js';
import olGeomGeometryLayout from 'ol/geom/GeometryLayout.js';
import olFeature from 'ol/Feature.js';
import olExtent from 'ol/extent.js';
import olGeomMultiLineString from 'ol/geom/MultiLineString.js';

/**
* @classdesc
Expand All @@ -41,7 +40,7 @@ const olGeomMultiLineString = goog.require('ol.geom.MultiLineString');
* @param {luxx.MyMapOptions} options The options.
* @api stable
*/
exports = function(options) {
const exports = function(options) {

/**
* @type {string}
Expand Down Expand Up @@ -1194,3 +1193,6 @@ exports.prototype.orderFeaturesForGpx_ = function(features) {

return points.concat(lines, others);
};


export default exports;
10 changes: 7 additions & 3 deletions jsapi/src/piwik.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
goog.module('lux.Piwik');

goog.module.declareLegacyNamespace();
/**
* @module lux.Piwik
*/
let exports = {};

/**
* @typedef {{push: function(Array<string>)}}
*/
exports;


export default exports;
56 changes: 29 additions & 27 deletions jsapi/src/printmanager.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
goog.module('lux.PrintManager');

goog.module.declareLegacyNamespace();
const olBase = goog.require('ol');
const olColor = goog.require('ol.color');
const olFormatGeoJSON = goog.require('ol.format.GeoJSON');
const olGeomGeometryType = goog.require('ol.geom.GeometryType');
const olLayerImage = goog.require('ol.layer.Image');
const olLayerTile = goog.require('ol.layer.Tile');
const olLayerVector = goog.require('ol.layer.Vector');
const olMath = goog.require('ol.math');
const olSize = goog.require('ol.size');
const olSourceImageWMS = goog.require('ol.source.ImageWMS');
const olSourceTileWMS = goog.require('ol.source.TileWMS');
const olSourceVector = goog.require('ol.source.Vector');
const olSourceWMTS = goog.require('ol.source.WMTS');
const olStyleCircle = goog.require('ol.style.Circle');
const olStyleRegularShape = goog.require('ol.style.RegularShape');
const olStyleStyle = goog.require('ol.style.Style');
const olTilegridWMTS = goog.require('ol.tilegrid.WMTS');
const olObj = goog.require('ol.obj');
const olFeature = goog.require('ol.Feature');
const olGeomPoint = goog.require('ol.geom.Point');
const olStyleIcon = goog.require('ol.style.Icon');
const olLayerGroup = goog.require('ol.layer.Group');

/**
* @module lux.PrintManager
*/
import olBase from 'ol.js';
import olColor from 'ol/color.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
import olGeomGeometryType from 'ol/geom/GeometryType.js';
import olLayerImage from 'ol/layer/Image.js';
import olLayerTile from 'ol/layer/Tile.js';
import olLayerVector from 'ol/layer/Vector.js';
import olMath from 'ol/math.js';
import olSize from 'ol/size.js';
import olSourceImageWMS from 'ol/source/ImageWMS.js';
import olSourceTileWMS from 'ol/source/TileWMS.js';
import olSourceVector from 'ol/source/Vector.js';
import olSourceWMTS from 'ol/source/WMTS.js';
import olStyleCircle from 'ol/style/Circle.js';
import olStyleRegularShape from 'ol/style/RegularShape.js';
import olStyleStyle from 'ol/style/Style.js';
import olTilegridWMTS from 'ol/tilegrid/WMTS.js';
import olObj from 'ol/obj.js';
import olFeature from 'ol/Feature.js';
import olGeomPoint from 'ol/geom/Point.js';
import olStyleIcon from 'ol/style/Icon.js';
import olLayerGroup from 'ol/layer/Group.js';

/**
* @classdesc
Expand All @@ -32,7 +31,7 @@ const olLayerGroup = goog.require('ol.layer.Group');
* @constructor
* @export
*/
exports = function(url, map) {
const exports = function(url, map) {
/**
* @type {lux.Map}
* @private
Expand Down Expand Up @@ -977,3 +976,6 @@ exports.prototype.rgbArrayToHex = function(rgb) {
exports.prototype.colorZeroPadding = function(hex) {
return hex.length == 1 ? '0' + hex : hex;
};


export default exports;
20 changes: 11 additions & 9 deletions jsapi/src/statemanager.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
goog.module('lux.StateManager');

goog.module.declareLegacyNamespace();
const luxUtil = goog.require('lux.util');
const olCollectionEventType = goog.require('ol.CollectionEventType');
const olEvents = goog.require('ol.events');
const olObj = goog.require('ol.obj');

/**
* @module lux.StateManager
*/
import luxUtil from './util.js';
import olCollectionEventType from 'ol/CollectionEventType.js';
import olEvents from 'ol/events.js';
import olObj from 'ol/obj.js';

/**
* @classdesc
* @constructor
*/
exports = function() {
const exports = function() {

/**
* @type {lux.Map}
Expand Down Expand Up @@ -136,3 +135,6 @@ exports.prototype.updateState = function(object) {
exports.prototype.getUrl = function() {
return this.url_;
};


export default exports;
32 changes: 18 additions & 14 deletions jsapi/src/util.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
goog.module('lux.util');

goog.module.declareLegacyNamespace();
const olEvents = goog.require('ol.events');
const olEventsEventType = goog.require('ol.events.EventType');
const olProj = goog.require('ol.proj');
const olLayerTile = goog.require('ol.layer.Tile');
const olSourceWMTS = goog.require('ol.source.WMTS');
const olSourceWMTSRequestEncoding = goog.require('ol.source.WMTSRequestEncoding');
const olString = goog.require('ol.string');
const olTilegridWMTS = goog.require('ol.tilegrid.WMTS');
const olLayerImage = goog.require('ol.layer.Image');
const olSourceImageWMS = goog.require('ol.source.ImageWMS');
const olCoordinate = goog.require('ol.coordinate');
/**
* @module lux.util
*/
let exports = {};
import olEvents from 'ol/events.js';
import olEventsEventType from 'ol/events/EventType.js';
import olProj from 'ol/proj.js';
import olLayerTile from 'ol/layer/Tile.js';
import olSourceWMTS from 'ol/source/WMTS.js';
import olSourceWMTSRequestEncoding from 'ol/source/WMTSRequestEncoding.js';
import olString from 'ol/string.js';
import olTilegridWMTS from 'ol/tilegrid/WMTS.js';
import olLayerImage from 'ol/layer/Image.js';
import olSourceImageWMS from 'ol/source/ImageWMS.js';
import olCoordinate from 'ol/coordinate.js';

/**
* @type {string}
Expand Down Expand Up @@ -657,3 +658,6 @@ exports.getElevation = function(coordinate) {
return resp.json();
});
};


export default exports;

0 comments on commit b1874fd

Please sign in to comment.