|
调用js 打开页面报错,希望大神们能提供思路
下面是js代码怎么改啊?
define(function(require){
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
require("../system/lib/OpenLayers.js");
var Model = function(){
this.callParent();
var map;
var vectorLayer;
var markers;
id = this.getIDByXID("OLdiv");
AutoSizeAnchored = OpenLayers.Class(OpenLayers.Popup.Anchored, {
'autoSize': true
});
OpenLayers.Popup.FramedCloud.prototype.autoSize = false;
AutoSizeFramedCloud = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true
});
AutoSizeFramedCloudMinSize = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true,
'minSize': new OpenLayers.Size(300, 230)
});
function init() {
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {
styleMap: new OpenLayers.StyleMap({
'default': {
strokeColor: "#00FF00",
strokeOpacity: 0,
strokeWidth: 1,
fillOpacity: 0,
pointRadius: 6,
pointerEvents: "visiblePainted",
fontColor: "${favColor}",
fontSize: "12px",
fontFamily: "Courier New, monospace",
fontWeight: "bold",
},
'select': {
strokeColor: "#FFF68F",
strokeOpacity: 1,
strokeWidth: 1,
fillOpacity: 0
}
}),
renderers: renderer
});
//var graphic = new OpenLayers.Layer.Image(
// 'City Lights',
// 'img/bn0318.jpg',
// new OpenLayers.Bounds(-680, -808.759, 680, 368.759),
// new OpenLayers.Size(1580, 1288),
// { numZoomLevels: 6 }
//);
var proj = 'EPSG:3857';
var mapResolutions = [8.466683600033868, 4.2333418000169338, 2.1166709000084669, 1.0583354500042335, 0.52916772500211673];
var tileSize = new OpenLayers.Size(256, 256);
var agsTileOrigin = new OpenLayers.LonLat(-5573300, 6799400);
var mapExtent = new OpenLayers.Bounds(59305.75, 79513.75, 76185.75, 96783.75);
var aerialsUrl = 'http://10.18.1.208:8087/_alllayers/';
var aerialsUrl2 = 'http://10.18.1.208:8087/ybkg2_ImageServer/_alllayers/';
var graphic = new OpenLayers.Layer.ArcGISCache('Aerials', aerialsUrl, {
tileOrigin: agsTileOrigin,
resolutions: mapResolutions,
sphericalMercator: false,
maxExtent: mapExtent,
useArcGISServer: false,
isBaseLayer: true,
type: 'png',
projection: proj
});
var graphic2 = new OpenLayers.Layer.ArcGISCache('Aerials2', aerialsUrl2, {
tileOrigin: agsTileOrigin,
resolutions: mapResolutions,
sphericalMercator: false,
maxExtent: mapExtent,
useArcGISServer: false,
isBaseLayer: false,
type: 'png',
projection: proj,
opacity:0.4
});
vlayer = new OpenLayers.Layer.Vector("Editable");
map = new OpenLayers.Map(id, {
maxExtent: mapExtent,
eventListeners: {
featureover: function (e) {
e.feature.renderIntent = "select";
e.feature.layer.drawFeature(e.feature);
},
featureout: function (e) {
e.feature.renderIntent = "default";
e.feature.layer.drawFeature(e.feature);
},
featureclick: function (e) {
}
},
controls: [
// new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.EditingToolbar(vlayer)
]
});
map.addLayers([graphic]);
map.addLayers([graphic2]);
map.addLayers([vectorLayer]);
map.zoomToMaxExtent();
}
};
|
|