OSM enyo 2.7.0
OSM on enyo test
by EDWIN MAURICIO QUISHPE MALDONADO
HTML
<script src="https://openlayers.org/api/OpenLayers.js"></script>
JavaScript
var Control = require('enyo/Control');
var ready = require('enyo/ready');
var FittableRows = require('layout/FittableRows');
var Toolbar = require('onyx/Toolbar');
var kind = require('enyo/kind')
//var OpenLayers = OneKind = require('./onekind');
var OL = kind({
name: 'nbt.OpenLayers',
fit: true,
options: null,
//kind: 'Control',
published: {
map: null
},
events: {
onReady: ""
},
components: [
{ name: 'map', style: 'height: 100%' }
],
constructor: function(options) {
this.inherited(arguments);
this.options = options ? options : { };
},
create: function() {
this.inherited(arguments);
if (this.options && this.options.div !== undefined) {
this.$.map.setId(this.options.div);
}
},
rendered: function() {
this.inherited(arguments);
if (this.options && !this.options.div) {
this.options.div = this.$.map.getId();
}
this.map = new OpenLayers.Map(this.options);
this.doReady();
}
});
var myApp = Control.kind({
name : "App",
components : [ {
kind : FittableRows,
classes : "enyo-fit",
components : [ {
kind : Toolbar,
//layoutKind : "FittableColumnsLayout",
style : "text-align: center",
components : [ {
content : "NBT OpenLayers Control Demo for Enyo 2.7.0"
} ]
}, {
name : "theMap",
kind : OL,
onReady : "onMapReady",
fit : true
}, ]
}, ],
onMapReady : function(inSender) {
map = inSender.getMap();
var markers = new OpenLayers.Layer.Markers("marker");
epsg4326 = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
// projection
projectTo = map.getProjectionObject(); // The map projection
// (Spherical Mercator)
var osm = new OpenLayers.Layer.OSM();
osm.attribution = "";
var zoom = 5;
map.addLayer(osm);
map.addControl(new...