Пример #1
0
		this._tileset.tileVisible.addEventListener(function(tile) {
			if (tile._content instanceof Cesium.PointCloud3DTileContent) {
				tile._content._pointSize = 3;
			}
			if (!(tile._content instanceof Cesium.Batched3DModel3DTileContent))
				return;
			var features = tile._content._features;
			var featuresLength = tile._content.featuresLength;
			for (var k = 0; k < featuresLength; k++) {
				if (Cesium.defined(features)) {
					var object = features[k];
					
					var idArray = object._content._batchTable.batchTableJson.id;
					if (!Cesium.defined(idArray))
						return;					
					var objectId = idArray[object._batchId];
					
					if (scope.isInHighlightedList(objectId) && !Cesium.Color.equals(object.color, scope._highlightColor)) {
						scope.highlightObject(object)
					}
					
					if (!scope.isInHighlightedList(objectId) && Cesium.Color.equals(object.color, scope._highlightColor)) {
						scope.unHighlightObject(object);
					}
					
					if (scope.isInHiddenList(objectId)) {
						scope.hideObject(object);
					}
					else {
						scope.showObject(object);
					}
				}
			}	
		});
Пример #2
0
 	okButton.onclick = function() {
         if (Cesium.defined(resizeCallback) && Cesium.defined(window.removeEventListener)) {
             window.removeEventListener('resize', resizeCallback, false);
         }
         element.removeChild(overlay);
         if (Cesium.defined(yesBtnCallback)) {
         	yesBtnCallback.call(this);
         }  
     };
Пример #3
0
			set : function(value) {
				if (Cesium.defined(this._activeLayer)) {
					if (this._activeLayer.id != value.id) {
						this._activeLayer = value;
					}
				}
				else {
					this._activeLayer = value;
				}
			}
Пример #4
0
	Cesium3DTilesDataLayer.prototype.getObjectById = function(objectId){
		var objects = [];
		var loadedTiles = this._tileset._selectedTiles;
		for (var i = 0; i < loadedTiles.length; i++) {
			if (!(loadedTiles[i]._content instanceof Cesium.Batched3DModel3DTileContent))
				continue;
			
			var idArray = loadedTiles[i]._content.batchTable.batchTableJson.id;
			if (!Cesium.defined(idArray))
				break;
			
			var index = idArray.indexOf(objectId);
			if (index > -1 && Cesium.defined(loadedTiles[i]._content._features)) {
				var object = loadedTiles[i]._content._features[index];
				objects.push(object);
			}
		}
		return objects;
	};
Пример #5
0
	Cesium3DTilesDataLayer.prototype.highlightObject = function(object){
		if (object == null)
			return;
		
		if (!(object._content instanceof Cesium.Batched3DModel3DTileContent))
			return;
		
		var idArray = object._content._batchTable.batchTableJson.id;
		if (!Cesium.defined(idArray))
			return;
		
		var objectId = idArray[object._batchId];		
		var highlightColor = this._highlightedObjects[objectId];
		if (highlightColor) {
			if (!Cesium.defined(object.getProperty("originalColorValue"))) {
				object.setProperty("originalColorValue", Cesium.Color.clone(object.color));
			}			
			object.color = highlightColor;
		}	
	};
Пример #6
0
		scope.registerEventHandler("MOUSEIN", function(object) {	
			if (!(object._content instanceof Cesium.Batched3DModel3DTileContent))
				return;
			
			var idArray = object._content._batchTable.batchTableJson.id;
			if (!Cesium.defined(idArray))
				return;					
			var objectId = idArray[object._batchId];
			
			if (scope.isInHighlightedList(objectId))
				return;
			
			object.setProperty("originalColorValue", Cesium.Color.clone(object.color));
			object.color = mouseOverhighlightColor;
		});
Пример #7
0
		scope.registerEventHandler("CTRLCLICK", function(object) {
			if (!(object._content instanceof Cesium.Batched3DModel3DTileContent))
				return;
			
			var idArray = object._content._batchTable.batchTableJson.id;
			if (!Cesium.defined(idArray))
				return;					
			var objectId = idArray[object._batchId];
	 		
			if (scope.isInHighlightedList(objectId)) {
				scope.unHighlight([objectId]);
			}else {
				var highlightThis = {};				
				highlightThis[objectId] = highlightColor;
				scope.highlight(highlightThis); 
			}								
		});
Пример #8
0
		scope.registerEventHandler("MOUSEOUT", function(object) {
			if (!(object._content instanceof Cesium.Batched3DModel3DTileContent))
				return;
			
			var idArray = object._content._batchTable.batchTableJson.id;
			if (!Cesium.defined(idArray))
				return;					
			var objectId = idArray[object._batchId];
			
			if (scope.isInHighlightedList(objectId))
				return;
			
			try{
				var originalColor = object.getProperty("originalColorValue");
				object.color = originalColor;				
			}
			catch(e){return;} 			
		});	
Пример #9
0
		scope.registerEventHandler("CLICK", function(object) {	
			if (!(object._content instanceof Cesium.Batched3DModel3DTileContent))
				return;
			
			var idArray = object._content._batchTable.batchTableJson.id;
			if (!Cesium.defined(idArray))
				return;					
			var objectId = idArray[object._batchId];
			
	 		if (scope.isInHighlightedList(objectId))
				return; 
	 		
	 	    // clear all other Highlighting status and just highlight the clicked object...
	 		scope.unHighlightAllObjects();  									
			var highlightThis = {};
			
			highlightThis[objectId] = highlightColor;
			scope.highlight(highlightThis); 						
		});
Пример #10
0
	showAlertWindow: function (mode, title, message, yesBtnCallback, noBtnCallback) {		
		var element = cesiumViewer.cesiumWidget._element;
        var overlay = document.createElement('div');
        overlay.className = 'cesium-widget-errorPanel';

        var content = document.createElement('div');
        content.className = 'cesium-widget-errorPanel-content';
        overlay.appendChild(content);

        var errorHeader = document.createElement('div');
        errorHeader.className = 'cesium-widget-errorPanel-header';
        errorHeader.appendChild(document.createTextNode(title));
        content.appendChild(errorHeader);

        var errorPanelScroller = document.createElement('div');
        errorPanelScroller.className = 'cesium-widget-errorPanel-scroll';
        content.appendChild(errorPanelScroller);
        function resizeCallback() {
        	errorPanelScroller.style.maxHeight = Math.max(Math.round(element.clientHeight * 0.9 - 100), 30) + 'px';
        }
        resizeCallback();
        if (Cesium.defined(window.addEventListener)) {
            window.addEventListener('resize', resizeCallback, false);
        }

        if (Cesium.defined(message)) {
            var errorMessage = document.createElement('div');
            errorMessage.className = 'cesium-widget-errorPanel-message';
            errorMessage.innerHTML = '<p>' + message + '</p>';
            errorPanelScroller.appendChild(errorMessage);
        }

        var buttonPanel = document.createElement('div');
        buttonPanel.className = 'cesium-widget-errorPanel-buttonPanel';
        content.appendChild(buttonPanel);

        if (mode == "YESNO") {
        	var yesButton = document.createElement('button');
            yesButton.setAttribute('type', 'button');
            yesButton.className = 'cesium-button';
            yesButton.appendChild(document.createTextNode('Yes'));
            yesButton.onclick = function() {
                if (Cesium.defined(resizeCallback) && Cesium.defined(window.removeEventListener)) {
                    window.removeEventListener('resize', resizeCallback, false);
                }
                element.removeChild(overlay);
                if (Cesium.defined(yesBtnCallback)) {
                	yesBtnCallback.call(this);
                }  
            };

            var noButton = document.createElement('button');
            noButton.setAttribute('type', 'button');
            noButton.className = 'cesium-button';
            noButton.appendChild(document.createTextNode('No'));
            noButton.onclick = function() {
                if (Cesium.defined(resizeCallback) && Cesium.defined(window.removeEventListener)) {
                    window.removeEventListener('resize', resizeCallback, false);
                }
                element.removeChild(overlay);
                if (Cesium.defined(noBtnCallback)) {
                	noBtnCallback.call(this);
                }                
            };
            
            buttonPanel.appendChild(yesButton);
            buttonPanel.appendChild(noButton);
        }
        else if (mode == "OK") {
        	var okButton = document.createElement('button');
        	okButton.setAttribute('type', 'button');
        	okButton.className = 'cesium-button';
        	okButton.appendChild(document.createTextNode('OK'));
        	okButton.onclick = function() {
                if (Cesium.defined(resizeCallback) && Cesium.defined(window.removeEventListener)) {
                    window.removeEventListener('resize', resizeCallback, false);
                }
                element.removeChild(overlay);
                if (Cesium.defined(yesBtnCallback)) {
                	yesBtnCallback.call(this);
                }  
            };
            buttonPanel.appendChild(okButton);
        }
        
        element.appendChild(overlay);
        
        var showErrorPaneElement = document.getElementsByClassName('cesium-widget-errorPanel-content')[0];
  		showErrorPaneElement.style.width = '400px'; 
	}