⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atlasuimap.js

📁 《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含的源代码.非常经典的一本asp.net2.0的书籍
💻 JS
📖 第 1 页 / 共 4 页
字号:
                return "r";
        }
    }
    
    this._createActivationBehavior = function(popupBehavior) {
        var showHandler;
        var hideHandler = function() {
            popupBehavior.hide();
        }
        
        var behavior;
        if (_pushpinActivation == Web.UI.ActivationType.Hover) {
            showHandler = function() {
                popupBehavior.show();
            }
            behavior = new Web.UI.HoverBehavior();
                        behavior.set_unhoverDelay(500);
            behavior.set_hoverElement(popupBehavior.control.element);
            behavior.hover.add(showHandler);
            behavior.unhover.add(hideHandler);
        }
        else {
            showHandler = function() {
                if (popupBehavior.control.get_visible()) {
                    popupBehavior.hide();
                }
                else {
                    popupBehavior.show();
                }
            }
            behavior = new Web.UI.ClickBehavior();
            behavior.click.add(showHandler);
        }
        return behavior;
    }
    
    this._addPushpin = function(pushpin, dataItem) {
                if (_map == null) {
            return;
        }
    
        var latitude = pushpin.get_latitude();
        if (!latitude) {
            latitude = this.get_latitude();
        }
        var longitude = pushpin.get_longitude();
        if (!longitude) {
            longitude = this.get_longitude();
        }
        var width = pushpin.get_imageWidth();
        if (!width) {
            width = _pushpinImageWidth;
        }
        var height = pushpin.get_imageHeight();
        if (!height) {
            height = _pushpinImageHeight;
        }
        if (!pushpin.get_imageURL()) {
            pushpin.set_imageURL(_pushpinImageURL);
        }
        
        var pushpinElement = _map.AddPushpin(pushpin.get_value(), latitude, longitude,
            width, height, _pushpinCssClass, pushpin.get_innerHtml(), 1000);
        
        var popupBehavior, popupContentElement;
        if (_pushpinActivation != Web.UI.ActivationType.None) {
                        var popupElement = document.createElement("div");
            popupElement.className = _popupCssClass;
            this.element.appendChild(popupElement);
            var popupControl = new Web.UI.Control(popupElement);
            popupBehavior = new Web.UI.PopupBehavior();
            popupBehavior.set_parentElement(pushpinElement);
            popupBehavior.set_positioningMode(_popupPositioningMode);
            popupControl.get_behaviors().add(popupBehavior);
            popupBehavior.initialize();
            popupControl.initialize();
            popupContentElement = _popupTemplate.createInstance(popupElement, dataItem).instanceElement;
            
                        var pushpinControl = new Web.UI.Control(pushpinElement);
            pushpinControl.initialize();
            
            var behavior = this._createActivationBehavior(popupBehavior);
            pushpinControl.get_behaviors().add(behavior);
            behavior.initialize();
        }
        
        pushpin._popup = popupBehavior;
        pushpin._popupTemplate = popupContentElement;
    }
    
    this._createPushpin = function(dataItem) {
        var innerHtml;
        var id;
        var imageURL;
        var imageWidth;
        var imageHeight;
        var text = "";
        if (_dataValueField) {
            id = dataItem[_dataValueField];
        }
        if (_dataImageURLField) {
            imageURL = String.format(_dataImageURLFormatString, dataItem[_dataImageURLField]);
        }
        if (!imageURL || imageURL.length == 0) {
            imageURL = _pushpinImageURL;
            imageWidth = _pushpinImageWidth;
            imageHeight = _pushpinImageHeight;
        }
        else {
            if (_dataImageWidthField) {
                imageWidth = dataItem[_dataImageWidthField];
            }
            if (_dataImageHeightField) {
                imageHeight = dataItem[_dataImageHeightField];
            }
        }
        if (_dataTextField) {
            text = String.format(_dataTextFormatString, dataItem[_dataTextField]);
        }
        
        var pushpin = new Web.UI.Pushpin();
        pushpin.set_value(id);
        pushpin.set_imageURL(imageURL);
        pushpin.set_imageWidth(imageWidth);
        pushpin.set_imageHeight(imageHeight);
        pushpin.set_text(text);
        pushpin.set_latitude(dataItem[_dataLatitudeField]);
        pushpin.set_longitude(dataItem[_dataLongitudeField]);
        pushpin.initialize();
        return pushpin;
    }
}
Type.registerSealedClass('Web.UI.VirtualEarthMap', Web.UI.Control);
Web.TypeDescriptor.addType('script', 'virtualEarthMap', Web.UI.VirtualEarthMap);
Web.UI.Pushpin = function() {
    Web.UI.Pushpin.initializeBase(this, [true]);
    
    var _map;
    var _value;
    var _latitude;
    var _longitude;
    var _imageURL;
    var _imageWidth;
    var _imageHeight;
    var _text;
    
    this.get_value = function() {
        return _value;
    }
    
    this.set_value = function(value) {
        _value = value;
    }
    
    this.get_latitude = function() {
        return _latitude;
    }
    
    this.set_latitude = function(value) {
        _latitude = value;
    }
    
    this.get_longitude = function() {
        return _longitude;
    }
    
    this.set_longitude = function(value) {
        _longitude = value;
    }
    
    this.get_imageURL = function() {
        return _imageURL;
    }
    
    this.set_imageURL = function(value) {
        _imageURL = value;
    }
    
    this.get_imageWidth = function() {
        return _imageWidth;
    }
    
    this.set_imageWidth = function(value) {
        _imageWidth = value;
    }
    
    this.get_imageHeight = function() {
        return _imageHeight;
    }
    
    this.set_imageHeight = function(value) {
        _imageHeight = value;
    }
    
    this.get_text = function() {
        return _text;
    }
    
    this.set_text = function(value) {
        _text = value;
    }
    
    this.get_innerHtml = function() {
        if (_imageURL && _imageURL.length > 0) {
                                    return String.format("<img src=\"{0}\" alt=\"{1}\" title=\"{2}\" />", _imageURL, _text, _text);
        }
        else {
                        return _text;
        }
    }
    
    this.initialize = function() {
        Web.UI.Pushpin.callBaseMethod(this, 'initialize');
        if (_map) {
            _map._addPushpin(this);
        }
    }
    
    this.getDescriptor = function() {
        var td = Web.UI.Pushpin.callBaseMethod(this, 'getDescriptor');
        td.addProperty('value', String);
        td.addProperty('latitude', Number);
        td.addProperty('longitude', Number);
        td.addProperty('imageURL', String);
        td.addProperty('imageWidth', Number);
        td.addProperty('imageHeight', Number);
        td.addProperty('text', String);
        return td;
    }
    
    this.setOwner = function(map) {
        _map = map;
    }
}
Type.registerSealedClass('Web.UI.Pushpin', Web.Component);
Web.TypeDescriptor.addType('script', 'pushpin', Web.UI.Pushpin);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -