Transformed
This commit is contained in:
+23
-23
@@ -1,27 +1,27 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.interaction.Draw');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.source.OSM');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Icon');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_geom_Point_ from '../src/ol/geom/Point.js';
|
||||
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
import _ol_source_Vector_ from '../src/ol/source/Vector.js';
|
||||
import _ol_style_Icon_ from '../src/ol/style/Icon.js';
|
||||
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
var raster = new _ol_layer_Tile_({
|
||||
source: new _ol_source_OSM_()
|
||||
});
|
||||
|
||||
var source = new ol.source.Vector();
|
||||
var source = new _ol_source_Vector_();
|
||||
|
||||
var styleFunction = function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
var styles = [
|
||||
// linestring
|
||||
new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
new _ol_style_Style_({
|
||||
stroke: new _ol_style_Stroke_({
|
||||
color: '#ffcc33',
|
||||
width: 2
|
||||
})
|
||||
@@ -33,9 +33,9 @@ var styleFunction = function(feature) {
|
||||
var dy = end[1] - start[1];
|
||||
var rotation = Math.atan2(dy, dx);
|
||||
// arrows
|
||||
styles.push(new ol.style.Style({
|
||||
geometry: new ol.geom.Point(end),
|
||||
image: new ol.style.Icon({
|
||||
styles.push(new _ol_style_Style_({
|
||||
geometry: new _ol_geom_Point_(end),
|
||||
image: new _ol_style_Icon_({
|
||||
src: 'data/arrow.png',
|
||||
anchor: [0.75, 0.5],
|
||||
rotateWithView: true,
|
||||
@@ -46,21 +46,21 @@ var styleFunction = function(feature) {
|
||||
|
||||
return styles;
|
||||
};
|
||||
var vector = new ol.layer.Vector({
|
||||
var vector = new _ol_layer_Vector_({
|
||||
source: source,
|
||||
style: styleFunction
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
var map = new _ol_Map_({
|
||||
layers: [raster, vector],
|
||||
target: 'map',
|
||||
view: new ol.View({
|
||||
view: new _ol_View_({
|
||||
center: [-11000000, 4600000],
|
||||
zoom: 4
|
||||
})
|
||||
});
|
||||
|
||||
map.addInteraction(new ol.interaction.Draw({
|
||||
map.addInteraction(new _ol_interaction_Draw_({
|
||||
source: source,
|
||||
type: 'LineString'
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user