-
-
Save ghelobytes/7db54a94e0b62e8bc19b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Map Panel</title> | |
<!-- ExtJS --> | |
<script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/4.2.1/examples/shared/include-ext.js"></script> | |
<script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/4.2.1/examples/shared/options-toolbar.js"></script> | |
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext/gpl/4.2.1/examples/shared/example.css" /> | |
<!-- Local OpenLayers 3 stylesheet --> | |
<link href='ol.css' rel="stylesheet"> | |
</head> | |
<body> | |
<!-- Local OpenLayers 3 js --> | |
<script src="ol.js"></script> | |
<script src="map.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global Ext, ol */ | |
/* jshint browser:true, devel:true, indent: 4 */ | |
Ext.application({ | |
name: 'OL3EXT4', | |
launch: function () { | |
var mappanel = Ext.create('Ext.panel.Panel', { | |
title: "Test Map", | |
layout: 'fit', | |
html: "<div id='test-map'></div>", // The map will be drawn inside | |
listeners: { | |
afterrender: function () { | |
var osm_source = new ol.source.OSM({ | |
url: 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png' | |
}); | |
var osmLayer = new ol.layer.Tile({ | |
source: osm_source | |
}); | |
this.map = new ol.Map({ | |
target: 'test-map', | |
renderer: 'canvas', | |
layers: [osmLayer], | |
view: new ol.View2D({ | |
center: [-10764594.0, 4523072.0], | |
zoom: 5 | |
}) | |
}); | |
}, | |
// The resize handle is necessary to set the map! | |
resize: function () { | |
var size = [document.getElementById(this.id + "-body").offsetWidth, document.getElementById(this.id + "-body").offsetHeight]; | |
console.log(size); | |
this.map.setSize(size); | |
} | |
} | |
}); | |
Ext.create('Ext.container.Viewport', { | |
layout: 'fit', | |
items: [ | |
mappanel | |
] | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment