📄 atlasuimap.js
字号:
if (_popupTemplate) {
_popupTemplate.dispose();
_popupTemplate = null;
}
if (_pushpins) {
_pushpins.dispose();
_pushpins = null;
}
if (_map) {
_map.onEndContinuousPan = null;
_map.ClearPushpins();
_map = null;
}
Web.UI.VirtualEarthMap.callBaseMethod(this, 'dispose');
}
this.getDescriptor = function() {
var td = Web.UI.VirtualEarthMap.callBaseMethod(this, 'getDescriptor');
td.addProperty('popupPositioningMode', Web.UI.PositioningMode);
td.addProperty('pushpinActivation', Web.UI.ActivationType);
td.addProperty('pushpins', Array, true);
td.addProperty('data', Object);
td.addProperty('popupTemplate', Web.UI.ITemplate);
td.addProperty('pushpinImageURL', String);
td.addProperty('pushpinImageWidth', Number);
td.addProperty('pushpinImageHeight', Number);
td.addProperty('pushpinCssClass', String);
td.addProperty('popupCssClass', String);
td.addProperty('dataValueField', String);
td.addProperty('dataLatitudeField', String);
td.addProperty('dataLongitudeField', String);
td.addProperty('dataImageURLField', String);
td.addProperty('dataImageURLFormatString', String);
td.addProperty('dataImageWidthField', Number);
td.addProperty('dataImageHeightField', Number);
td.addProperty('dataTextField', String);
td.addProperty('dataTextFormatString', String);
td.addProperty('latitude', Number);
td.addProperty('longitude', Number);
td.addProperty('width', Number);
td.addProperty('height', Number);
td.addProperty('zoomLevel', Number);
td.addProperty('mapStyle', Web.UI.MapStyle);
td.addMethod('activatePushpin',
[
Web.TypeDescriptor.createParameter('id', String)
]);
td.addMethod('panBy',
[
Web.TypeDescriptor.createParameter('deltaX', Number),
Web.TypeDescriptor.createParameter('deltaY', Number)
]);
td.addMethod('panTo',
[
Web.TypeDescriptor.createParameter('latitude', Number),
Web.TypeDescriptor.createParameter('longitude', Number)
]);
td.addMethod('continuousPanBy',
[
Web.TypeDescriptor.createParameter('deltaX', Number),
Web.TypeDescriptor.createParameter('deltaY', Number),
Web.TypeDescriptor.createParameter('count', Number)
]);
td.addMethod('stopContinuousPan');
td.addMethod('setViewport',
[
Web.TypeDescriptor.createParameter('lat1', Number),
Web.TypeDescriptor.createParameter('lon1', Number),
Web.TypeDescriptor.createParameter('lat2', Number),
Web.TypeDescriptor.createParameter('lon2', Number)
]);
td.addMethod('setBestMapView',
[
Web.TypeDescriptor.createParameter('locations', Array)
]);
td.addMethod('includePointInViewport',
[
Web.TypeDescriptor.createParameter('latitude', Number),
Web.TypeDescriptor.createParameter('longitude', Number)
]);
td.addMethod('zoomIn');
td.addMethod('zoomOut');
return td;
}
function onDataChanged(sender, args) {
this.render();
}
_dataChangedDelegate = Function.createDelegate(this, onDataChanged);
this.activatePushpin = function(id) {
if (!_pushpins) {
return;
}
var pp;
for (var i = 0; i < _pushpins.length; i++) {
if (_pushpins[i].value == id) {
pp = _pushpins[i];
}
else {
_pushpins[i]._popup.hide();
}
}
if (pp) {
if (_pushpinActivation != Web.UI.ActivationType.None) {
_queuedPushpinID = pp.value;
}
this.panTo(pp.latitude, pp.longitude);
}
}
function activatePushpinHandler() {
if (_queuedPushpinID) {
for (var i = 0; i < _pushpins.length; i++) {
if (_pushpins[i].value == _queuedPushpinID) {
_pushpins[i]._popup.show();
}
else {
_pushpins[i]._popup.hide();
}
}
_queuedPushpinID = null;
}
}
this.panBy = function(deltaX, deltaY) {
_map.PanMap(deltaX, deltaY);
}
this.panTo = function(latitude, longitude) {
_map.PanToLatLong(latitude, longitude);
}
this.continuousPanBy = function(deltaX, deltaY, count) {
_map.ContinuousPan(deltaX, deltaY, count);
}
this.stopContinuousPanBy = function() {
_map.StopContinuousPan();
}
this.setViewport = function(lat1, lon1, lat2, lon2) {
_map.SetViewport(lat1, lon1, lat2, lon2);
}
this.setBestMapView = function(locations) {
_map.SetBestMapView(locations);
}
this.includePointInViewport = function(latitude, longitude) {
_map.IncludePointInViewport(latitude, longitude);
}
this.zoomIn = function() {
_map.ZoomIn();
}
this.zoomOut = function() {
_map.ZoomOut();
}
this._ensureMap = function() {
if (!_map) {
if (!_width) {
if (this.element.offsetWidth > 0) {
_width = this.element.offsetWidth;
} else {
_width = 400;
}
}
if (!_height) {
if (this.element.offsetHeight > 0) {
_height = this.element.offsetHeight;
} else {
_height = 400;
}
}
_map = new VE_MapControl(_latitude, _longitude, _zoomLevel, this._parseMapStyle(_mapStyle), "relative", 0, 0, _width, _height);
_endContinuousPanHandler = Function.createDelegate(this, endContinuousPanHandler);
_map.onEndContinuousPan = _endContinuousPanHandler;
_activatePushpinHandler = Function.createDelegate(this, activatePushpinHandler);
this.endContinuousPan.add(_activatePushpinHandler);
this.element.innerHTML = '';
this.element.appendChild(_map.element);
}
}
function endContinuousPanHandler() {
this.endContinuousPan.invoke(this, Web.EventArgs.Empty);
}
this.render = function() {
if (!this.get_isInitialized()) {
return;
}
this._ensureMap();
var i, element;
if (_pushpins) {
for (i = _pushpins.length - 1; i >= 0; i--) {
element = _pushpins[i]._popupTemplate;
if (_pushpins[i]._isDataItem && element) {
Web.UI.ITemplate.disposeInstance(element);
_map.RemovePushpin(_pushpins[i].get_value());
_pushpins.removeAt(i);
}
}
}
var pushpins = this.get_pushpins();
var items = this.get_data();
var itemLength = items ? items.get_length() : 0;
if (itemLength > 0) {
for (i = 0; i < itemLength; i++) {
var item = items.getItem(i);
var pushpin = this._createPushpin(item.get__rowObject());
pushpin._isDataItem = true;
this._addPushpin(pushpin, item);
pushpins.add(pushpin);
}
}
}
this._parseMapStyle = function(value) {
switch (value) {
case Web.UI.MapStyle.Aerial:
return "a";
case Web.UI.MapStyle.Hybrid:
return "h";
default:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -