From e2aefda183de4f1c1256d97f7ce09f8bee5477db Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Tue, 9 May 2017 14:24:20 -0400 Subject: [ONAP-rebase] Rebase as 1.1.0-SNAPSHOT Consolidate into a single maven project; no more separate model and client jars. Change-Id: Ibbba982250b74c0dfd09ee1c65c0fb6c158dd632 Signed-off-by: Christopher Lott Signed-off-by: Christopher Lott (cl778h) --- .../webapp/static/fusion/raptor/js/nova_button.js | 1184 -------------------- 1 file changed, 1184 deletions(-) delete mode 100644 dcae_dmaapbc_webapp/src/main/webapp/static/fusion/raptor/js/nova_button.js (limited to 'dcae_dmaapbc_webapp/src/main/webapp/static/fusion/raptor/js/nova_button.js') diff --git a/dcae_dmaapbc_webapp/src/main/webapp/static/fusion/raptor/js/nova_button.js b/dcae_dmaapbc_webapp/src/main/webapp/static/fusion/raptor/js/nova_button.js deleted file mode 100644 index 75dc28a..0000000 --- a/dcae_dmaapbc_webapp/src/main/webapp/static/fusion/raptor/js/nova_button.js +++ /dev/null @@ -1,1184 +0,0 @@ -function NovaButton() { - -} - -NovaButton.prototype = new GControl(); - -NovaButton.globals = { - currentButton: null, - layerOptionContainer: null, - layerOptionVisible: false, - searchOptionContainer: null, - searchOptionVisible: false, - //new changes - searchResultContainer: null, - //new changes - searchTabSelected: null, - map: null, - originalLayerState: null -}; - -NovaButton.globals.dragzoom = { - cornerTopDiv: null, - cornerRightDiv: null, - cornerBottomDiv: null, - cornerLeftDiv: null, - mapPosition: null, - outlineDiv: null, - mapWidth: 0, - mapHeight: 0, - mapRatio: 0, - startX: 0, - startY: 0, - zoomArea: null, - moving: false -}; - -// Creates a one DIV for each of the buttons and places them in a container -// DIV which is returned as our control element. -NovaButton.prototype.initialize = function(map) { - var container = document.createElement("div"); - container.style.zIndex = "150"; - var that = this; - - // "Cursor" button - var cursorDiv = document.createElement("div"); - cursorDiv.id = "cursorDiv"; - NovaButton.globals.currentButton = "cursorDiv"; - this.setButtonStyle(cursorDiv, true); - cursorDiv.style.fontWeight = "bold"; - cursorDiv.appendChild(document.createTextNode("Cursor")); - GEvent.addDomListener(cursorDiv, "click", function() { - var globals = NovaButton.globals; - if (globals.currentButton == "cursorDiv") { - return; - } - - this.style.fontWeight = "bold"; - globals.currentButton = "cursorDiv"; - if (!map.draggingEnabled()) { - map.enableDragging(); - } - document.getElementById("detailDiv").style.fontWeight = "normal"; - document.getElementById("zoomRectangleDiv").style.fontWeight = "normal"; - - that.resetDragZoom(); - }); - - // "detail" button - var detailDiv = document.createElement("div"); - detailDiv.id = "detailDiv"; - this.setButtonStyle(detailDiv, true); - detailDiv.appendChild(document.createTextNode("Detail")); - GEvent.addDomListener(detailDiv, "click", function() { - var globals = NovaButton.globals; - if (globals.currentButton == "detailDiv") { - return; - } - - this.style.fontWeight = "bold"; - globals.currentButton = "detailDiv"; - if (map.draggingEnabled()) { - map.disableDragging(); - } - document.getElementById("cursorDiv").style.fontWeight = "normal"; - document.getElementById("zoomRectangleDiv").style.fontWeight = "normal"; - - that.resetDragZoom(); - }); - - // zoom rectangle button - var zoomRectangleDiv = document.createElement("div"); - zoomRectangleDiv.id = "zoomRectangleDiv"; - this.setButtonStyle(zoomRectangleDiv, true); - zoomRectangleDiv.appendChild(document.createTextNode("Zoom Rect.")); - GEvent.addDomListener(zoomRectangleDiv, "click", function() { - var globals = NovaButton.globals; - if (globals.currentButton == "zoomRectangleDiv") { - return; - } - - this.style.fontWeight = "bold"; - globals.currentButton = "zoomRectangleDiv"; - - if (map.draggingEnabled()) { - map.disableDragging(); - } - document.getElementById("cursorDiv").style.fontWeight = "normal"; - document.getElementById("detailDiv").style.fontWeight = "normal"; - - that.initCover(); - }); - - // "Zoom In" button - var zoomInDiv = document.createElement("div"); - this.setButtonStyle(zoomInDiv, true); - zoomInDiv.appendChild(document.createTextNode("Zoom In")); - // The "true" argument in the zoomIn() method allows continuous zooming - GEvent.addDomListener(zoomInDiv, "click", function() { - //map.zoomIn(null,null,true); - map.zoomIn(); - }); - - // "Zoom Out" button - var zoomOutDiv = document.createElement("div"); - this.setButtonStyle(zoomOutDiv, true); - zoomOutDiv.style.borderTop = 0+'px'; - zoomOutDiv.appendChild(document.createTextNode("Zoom Out")); - // The "true" argument in the zoomOut() method allows continuous zooming - GEvent.addDomListener(zoomOutDiv, "click", function() { - //map.zoomOut(null,true); - map.zoomOut(); - }); - - // "Default View" button - var defaultViewDiv = document.createElement("div"); - this.setButtonStyle(defaultViewDiv, true); - defaultViewDiv.appendChild(document.createTextNode("Default View")); - GEvent.addDomListener(defaultViewDiv, "click", function(e) { - that.defaultViewClickEvent(); - }); - - // "layer" button - var showLayerDiv = document.createElement("div"); - this.setButtonStyle(showLayerDiv, true); - showLayerDiv.appendChild(document.createTextNode("Layers")); - GEvent.addDomListener(showLayerDiv, "click", function(e) { - that.showLayerClickEvent(e); - }); - - // initialize layer option - var layerOptionContainer = document.createElement("div"); - this.setMenuContainerStyle(layerOptionContainer); - this.initializeLayerDiv(layerOptionContainer); - - // "search" button - var searchDiv = document.createElement("div"); - this.setButtonStyle(searchDiv, true); - searchDiv.appendChild(document.createTextNode("Search")); - GEvent.addDomListener(searchDiv, "click", function(e) { - that.searchClickEvent(e); - }); - - var searchOptionContainer = document.createElement("div"); - searchOptionContainer.style.position = "absolute"; - searchOptionContainer.style.left = "100px"; - searchOptionContainer.style.top = "100px"; - searchOptionContainer.style.display = "none"; - this.initializeSearchDiv(searchOptionContainer); - - var buttonContainer = document.createElement("div"); - buttonContainer.appendChild(cursorDiv); - buttonContainer.appendChild(detailDiv); - //buttonContainer.appendChild(zoomRectangleDiv); - //buttonContainer.appendChild(zoomInDiv); - //buttonContainer.appendChild(zoomOutDiv); - //buttonContainer.appendChild(defaultViewDiv); - //buttonContainer.appendChild(showLayerDiv); - //buttonContainer.appendChild(searchDiv); - - // zoom area div - var zoomAreaDiv = document.createElement("div"); - this.setZoomAreaStyle(zoomAreaDiv); - var DIVS_TO_CREATE = ['outlineDiv', 'cornerTopDiv', 'cornerLeftDiv', 'cornerRightDiv', 'cornerBottomDiv']; - for (var i=0; i= 0; i--) { - resultContainer.removeChild(resultContainer.lastChild); - } - - var table = resultContainer.appendChild(document.createElement("table")); - var tbody = table.appendChild(document.createElement("tbody")); - var list = jsonData.list; - - if (list == null) { - var tr = tbody.appendChild(document.createElement("tr")); - var td = tr.appendChild(document.createElement("td")); - td.appendChild(document.createTextNode("Not Found")); - td.style.fontSize = "12px"; - td.style.textDecoration = "none"; - td.font = "Arial,Helvetica,sans-serif"; - td.style.fontWeight = "normal"; - } - else { - for (var i = 0; i < list.length; i++) { - var tr = tbody.appendChild(document.createElement("tr")); - var td = tr.appendChild(document.createElement("td")); - - td.appendChild(document.createTextNode(list[i].type + "(" + list[i].numberOfT1 + - "): " + list[i].id)); - td.style.fontSize = "12px"; - td.style.textDecoration = "underline"; - td.style.color = "blue"; - td.style.fontWeight = "normal"; - td.style.cursor = "pointer"; - td.font = "Arial,Helvetica,sans-serif"; - td.id = list[i].latitude + ">>" + list[i].longitude; - - td.onmouseover = function() { - this.style.fontWeight = "bold"; - } - - td.onmouseout = function() { - this.style.fontWeight = "normal"; - } - - td.onclick = function() { - this.style.color = "red"; - var latitudeLongitude = this.id.split(">>"); - var latlng = new GLatLng(latitudeLongitude[0], latitudeLongitude[1]); - map.setCenter(latlng, 17); - updateImage(0); - } - } - } - - resultContainer.style.display = ""; -} -//new changes end -NovaButton.prototype.initializeLayerDiv = function(layerDiv) { - for (var i = layerDiv.childNodes.length - 1; i >= 0; i--) { - layerDiv.removeChild(layerDiv.lastChild); - } - - var colorList = document.getElementById("colorList").value; - var selectedLayerList = document.getElementById("selectedLayerList").value; - var colorArray = colorList.split("~!"); - var selectedColorArray = selectedLayerList.split("~!"); - //layerDiv.style.background = "white"; - var table = layerDiv.appendChild(document.createElement("table")); - table.width="100%"; - table.height="100%"; - //this.setMenuStyle(table); - /****Creating the data table****/ - var tbody = table.appendChild(document.createElement("tbody")); - var tr; - var td; - var originalLayerState = new Array(); - for (i = 0; i < colorArray.length; i++) { - tr = tbody.appendChild(document.createElement("tr")); - tr.style.height="20px"; - var colorItem = colorArray[i].split(","); - - td = tr.appendChild(document.createElement("td")); - var chkbox = document.createElement("input"); - chkbox.type="checkbox"; - chkbox.name = "" + colorItem[0] + "chk"; - chkbox.value = colorItem[0]; - chkbox.id = colorItem[0] + "chk"; - if (this.checkIfColorSelected(selectedColorArray, colorItem[0]) == true){ - chkbox.defaultChecked=true; - originalLayerState[i] = "true," + colorArray[i]; - } - else { - originalLayerState[i] = "false," + colorArray[i]; - } - td.appendChild(chkbox); - - td = tr.appendChild(document.createElement("td")); - td.width="75%"; - td.appendChild(document.createTextNode(colorItem[0])); - td.style.fontFamily = "Verdana"; - td.style.fontSize = "12px"; - - td = tr.appendChild(document.createElement("td")); - td.width="10%"; - //td.style.background = colorItem[1]; - td.innerHTML="" - tbody.appendChild(tr); - } - - NovaButton.globals.originalLayerState = originalLayerState; - - /**to get rid of extra space**/ - /*var layerHeight = layerDiv.style.height.substring(0, layerDiv.style.height.length -2); - if (colorArray.length * 30 < layerHeight){ - tr = tbody.appendChild(document.createElement("tr")); - tr.height= (layerHeight - (colorArray.length * 40 ) ) + "px"; - td = tr.appendChild(document.createElement("td")); - }*/ - - - tr = tbody.appendChild(document.createElement("tr")); - tr.vAlign="bottom"; - tr.style.height="20px"; - td = tr.appendChild(document.createElement("td")); - td.colSpan="3"; - var buttonTable = td.appendChild(document.createElement("table")); - buttonTable.height="100%"; - buttonTable.width="100%"; - - var buttonBody = buttonTable.appendChild(document.createElement("tbody")); - tr = buttonBody.appendChild(document.createElement("tr")); - td = tr.appendChild(document.createElement("td")); - td.width="20%"; - td = tr.appendChild(document.createElement("td")); - td.appendChild(document.createTextNode("OK")); - td.onclick = function () - { - var selectedLayers = ""; - var colorList = ""; - var changed = false; - var originalLayerState = NovaButton.globals.originalLayerState; - //saving the user selected choices - for (i = 0; i < colorArray.length; i++) { - var colorItem = colorArray[i].split(","); - //saving the selected layers - var temp; // variable to hold changes value - if (document.getElementById("" + colorItem[0] + "chk").checked == true){ - selectedLayers = selectedLayers + "~!" + colorItem[0]; - temp = "true," + colorItem[0]; - } - else { - temp = "false," + colorItem[0]; - } - //saving the colours of all the layers - var userSelectedColor = document.getElementById("" + colorItem[0] + "colorbx").value; - if (userSelectedColor.charAt(0) == '#') { - userSelectedColor = userSelectedColor.substring(1); - } - colorList = colorList + "~!" + colorItem[0] + "," + userSelectedColor; - temp = temp + "," + userSelectedColor; - - //check to see if there is anything change and update - // originalLayerState to reflect the changes - if (changed) { - originalLayerState[i] = temp; - } - else if (originalLayerState[i] != temp) { - changed = true; - originalLayerState[i] = temp; - } - } - selectedLayers = selectedLayers.substring(2, selectedLayers.length); - colorList = colorList.substring(2, colorList.length); - document.getElementById("selectedLayerList").value = selectedLayers; - document.getElementById("colorList").value = colorList; - - // update if there is anything change - if (changed) { - updateImage(0); - } - - //to remove the layer - NovaButton.prototype.showLayerClickEvent(); - }; - td.width="25%"; - this.setButtonStyle(td, true); - td.style.cursor = "hand"; - - td = tr.appendChild(document.createElement("td")); - td.appendChild(document.createTextNode("Cancel")); - td.width="25%"; - this.setButtonStyle(td, true); - td.style.cursor = "hand"; - td.onclick = function () - { - //remove all the contents - layerDiv.innerHTML=""; - //re-initiate the layers to original values - NovaButton.prototype.initializeLayerDiv(layerDiv); - NovaButton.prototype.showLayerClickEvent(); - }; - td = tr.appendChild(document.createElement("td")); - td.width="10%"; - -} - -NovaButton.prototype.checkIfColorSelected= function(selectedColorArray, colorItem) { - for (j = 0; j < selectedColorArray.length; j++) { - if (selectedColorArray[j] == colorItem){ - return true; - } - } - return false; -} - -NovaButton.prototype.setMenuContainerStyle = function(menuContainer) { - menuContainer.style.position = "absolute"; - menuContainer.style.background = "#FFFFF0" - menuContainer.style.overflow = "auto"; - menuContainer.style.scrolling="yes"; - menuContainer.style.display = "none"; - menuContainer.style.width = "300px"; - menuContainer.style.height = "300px"; -} - -NovaButton.prototype.setMenuStyle = function(menu) { - menu.style.width = "300px"; - menu.style.height = "300px"; - menu.style.background = "#FFF"; -} - -NovaButton.prototype.setMenuItemStyle = function(menuItem) { - menuItem.style.padding = "4px 3px 4px 33px"; - menuItem.style.fontFamily = "Vardana, Arial, Helvetica, sans-serif" ; - menuItem.style.fontSize = "10pt"; - menuItem.style.color = "#333" ; - menuItem.style.cursor = "default" ; - menuItem.style.background = "no-repeat left center" ; -} - -NovaButton.prototype.showLayerOption = function(posX, posY) { - var globals = NovaButton.globals; - - //position the menu at the given location - if(typeof posX == "number") { - globals.layerOptionContainer.style.left = posX + "px"; - } - - if(typeof posY == "number") { - globals.layerOptionContainer.style.top = posY + "px"; - } - //new chanes start - var resultContainer = globals.searchResultContainer; - resultContainer.style.display = "none"; - //nw changes end - //display the menu - globals.layerOptionContainer.style.display = "block"; -} - -NovaButton.prototype.showSearchOption = function(posX, posY) { - var globals = NovaButton.globals; - - //position the menu at the given location - if(typeof posX == "number") { - globals.searchOptionContainer.style.left = posX + "px"; - } - - if(typeof posY == "number") { - globals.searchOptionContainer.style.top = posY + "px"; - } - - //display the menu - globals.searchOptionContainer.style.display = "inline"; -} - -NovaButton.prototype.defaultViewClickEvent = function() { - var defaultZoomLevel = document.getElementById("defaultZoomLevel").value * 1; - map.setCenter(new GLatLng(document.getElementById("defaultCenterLatitude").value, - document.getElementById("defaultCenterLongitude").value), - defaultZoomLevel); - updateImage(0); -} - -NovaButton.prototype.showLayerClickEvent = function(e) { - if (NovaButton.globals.layerOptionVisible) { - //to remove the color picker - cancel(); - NovaButton.globals.layerOptionVisible = false; - NovaButton.globals.layerOptionContainer.style.display = "none"; - return; - } - - if (NovaButton.globals.searchOptionContainer.style.display != "none"){ - NovaButton.prototype.searchClickEvent(); - } - if (CingularButton.globals.listOptionContainer.style.display != "none"){ - currentMonthClickEvent(); - } - - if (!e) { - e = window.event; - } - - e.cancelBubble = true; - - if (e.stopPropagation) { - e.stopPropagation(); - } - - var button = Event.element(e); - var posX = button.offsetLeft; - var posY = button.offsetTop; - this.showLayerOption(posX, posY + button.offsetHeight); - NovaButton.globals.layerOptionVisible = true; -} - -NovaButton.prototype.searchClickEvent = function(e) { - if (NovaButton.globals.searchOptionVisible) { - NovaButton.globals.searchOptionVisible = false; - NovaButton.globals.searchOptionContainer.style.display = "none"; - return; - } - - if (NovaButton.globals.layerOptionContainer.style.display != "none"){ - NovaButton.prototype.showLayerClickEvent(); - } - if (CingularButton.globals.listOptionContainer.style.display != "none"){ - currentMonthClickEvent(); - } - - if (!e) { - e = window.event; - } - - e.cancelBubble = true; - - if (e.stopPropagation) { - e.stopPropagation(); - } - - var button = Event.element(e); - var posX = button.offsetLeft; - var posY = button.offsetTop; - this.showSearchOption(posX, posY + button.offsetHeight + 3); - NovaButton.globals.searchOptionVisible = true; -} - -NovaButton.prototype.submitSearchClickEvent = function(e) { - if (NovaButton.globals.searchTabSelected == "nodeTab") { - var input = document.getElementById("nodeSearchInput").value.trim(); - - if (input.length == 0) { - alert("Input field required"); - return; - } - - var searchType; - // ie bug - var searchByNodeId = document.getElementById("searchByNodeId"); - - if (searchByNodeId.checked) { - searchType = searchByNodeId.value; - } - else { - searchType = document.getElementById("searchByLocation").value; - } - - var checkbox = document.getElementById("exactMatch"); - - searchObject(input, searchType, checkbox.checked, e.clientX, e.clientY); - } - else { - var address = document.getElementById("addressSearchInput").value.trim(); - - if (address.length == 0) { - alert("Address field required"); - return; - } - - geocoder.getLatLng( - address, - function(ll) { - if (ll != null) { - if (addressMarker == null) { - addressMarker = new GMarker(ll); - map.addOverlay(addressMarker); - GEvent.addListener(addressMarker, "click", marker_onclick); - } - else { - addressMarker.setLatLng(ll); - } - - map.setCenter(ll); - updateImage(0); - } - } - ); - } - - this.searchClickEvent(e); -} - -function marker_onclick() { - map.removeOverlay(addressMarker); - addressMarker = null; -} - -// start drag zoom function -NovaButton.prototype.initCover = function() { - var dragZoomGlobals = NovaButton.globals.dragzoom; - dragZoomGlobals.mapPosition = NovaButtonUtils.getElementPosition(NovaButton.globals.map.getContainer()); - this.setDimensions(); - - dragZoomGlobals.zoomArea.style.display = "block"; - dragZoomGlobals.zoomArea.style.background = "#000"; - - dragZoomGlobals.outlineDiv.style.width = "0px"; - dragZoomGlobals.outlineDiv.style.height = "0px"; -}; - -NovaButton.prototype.initZoomAreaStyles = function(){ - var dragZoomGlobals = NovaButton.globals.dragzoom; - dragZoomGlobals.zoomArea.style.background = "#000"; - dragZoomGlobals.zoomArea.style.opacity = "0.2"; - dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerTopDiv.style.background = "#000"; - dragZoomGlobals.cornerTopDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerTopDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerRightDiv.style.background = "#000"; - dragZoomGlobals.cornerRightDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerRightDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerBottomDiv.style.background = "#000"; - dragZoomGlobals.cornerBottomDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerBottomDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerLeftDiv.style.background = "#000"; - dragZoomGlobals.cornerLeftDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerLeftDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.outlineDiv.style.border = "2px solid blue"; -}; - -NovaButton.prototype.resetDragZoom = function() { - var dragZoomGlobals = NovaButton.globals.dragzoom; - dragZoomGlobals.zoomArea.style.display = "none"; - dragZoomGlobals.zoomArea.style.opacity = "0.2"; - dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerTopDiv.style.display = "none"; - dragZoomGlobals.cornerTopDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerTopDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerRightDiv.style.display = "none"; - dragZoomGlobals.cornerRightDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerRightDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerBottomDiv.style.display = "none"; - dragZoomGlobals.cornerBottomDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerBottomDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.cornerLeftDiv.style.display = "none"; - dragZoomGlobals.cornerLeftDiv.style.opacity = "0.2"; - dragZoomGlobals.cornerLeftDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')'; - - dragZoomGlobals.outlineDiv.style.display = 'none'; -}; - -NovaButton.prototype.setZoomAreaStyle = function(zoomArea) { - zoomArea.style.position = "absolute"; - zoomArea.style.display = "none"; - zoomArea.style.overflow = "hidden"; - zoomArea.style.cursor = "crosshair"; - zoomArea.style.zIndex = "101"; -} - -NovaButton.prototype.getRectangle = function(startX, startY, pos){ - var left = false; - var top = false; - var dX = pos.left - startX; - var dY = pos.top - startY; - if (dX < 0) { - dX = dX * -1; - left = true; - } - if (dY < 0) { - dY = dY * -1; - top = true; - } - delta = dX > dY ? dX : dY; - - return { - startX: startX, - startY: startY, - endX: startX + dX, - endY: startY + dY, - width: dX, - height: dY, - left:left, - top:top - } -}; - -NovaButton.prototype.mouseDown = function(e) { - if (NovaButton.globals.currentButton != "zoomRectangleDiv") { - return; - } - - var dragZoomGlobals = NovaButton.globals.dragzoom; - var pos = this.getRelPos(e); - dragZoomGlobals.startX = pos.left; - dragZoomGlobals.startY = pos.top; - - dragZoomGlobals.zoomArea.style.background = "transparent"; - dragZoomGlobals.zoomArea.style.opacity = "1"; - dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=100)'; - - dragZoomGlobals.outlineDiv.style.left = dragZoomGlobals.startX + "px"; - dragZoomGlobals.outlineDiv.style.top = dragZoomGlobals.startY + "px"; - dragZoomGlobals.outlineDiv.style.display = "block"; - dragZoomGlobals.outlineDiv.style.width = "1px"; - dragZoomGlobals.outlineDiv.style.height = "1px"; - - dragZoomGlobals.cornerTopDiv.style.top = (dragZoomGlobals.startY - dragZoomGlobals.mapHeight) + 'px'; - dragZoomGlobals.cornerTopDiv.style.display ='block'; - dragZoomGlobals.cornerLeftDiv.style.left = (dragZoomGlobals.startX - dragZoomGlobals.mapWidth) +'px'; - dragZoomGlobals.cornerLeftDiv.style.top = dragZoomGlobals.startY + 'px'; - dragZoomGlobals.cornerLeftDiv.style.display = 'block'; - - dragZoomGlobals.cornerRightDiv.style.left = dragZoomGlobals.startX + 'px'; - dragZoomGlobals.cornerRightDiv.style.top = dragZoomGlobals.startY + 'px'; - dragZoomGlobals.cornerRightDiv.style.display = 'block'; - dragZoomGlobals.cornerBottomDiv.style.left = dragZoomGlobals.startX + 'px'; - dragZoomGlobals.cornerBottomDiv.style.top = dragZoomGlobals.startY + 'px'; - dragZoomGlobals.cornerBottomDiv.style.width = '0px'; - dragZoomGlobals.cornerBottomDiv.style.display = 'block'; - - dragZoomGlobals.moving = true; - - return false; -} - -NovaButton.prototype.mouseMove = function(e) { - var dragZoomGlobals = NovaButton.globals.dragzoom; - - if(dragZoomGlobals.moving) { - var pos = this.getRelPos(e); - var rect = this.getRectangle(dragZoomGlobals.startX, dragZoomGlobals.startY, pos); - - if (rect.left) { - addX = -rect.width; - } else { - addX = 0; - } - - if (rect.top) { - addY = -rect.height; - } else { - addY = 0; - } - - dragZoomGlobals.outlineDiv.style.left = dragZoomGlobals.startX + addX + "px"; - dragZoomGlobals.outlineDiv.style.top = dragZoomGlobals.startY + addY + "px"; - dragZoomGlobals.outlineDiv.style.display = "block"; - dragZoomGlobals.outlineDiv.style.width = rect.width + "px"; - dragZoomGlobals.outlineDiv.style.height = rect.height + "px"; - - dragZoomGlobals.cornerTopDiv.style.height = ((dragZoomGlobals.startY + addY) - (dragZoomGlobals.startY - dragZoomGlobals.mapHeight)) + 'px'; - dragZoomGlobals.cornerLeftDiv.style.top = (dragZoomGlobals.startY + addY) + 'px'; - dragZoomGlobals.cornerLeftDiv.style.width = ((dragZoomGlobals.startX + addX) - (dragZoomGlobals.startX - dragZoomGlobals.mapWidth)) + 'px'; - dragZoomGlobals.cornerRightDiv.style.top = dragZoomGlobals.cornerLeftDiv.style.top; - dragZoomGlobals.cornerRightDiv.style.left = (dragZoomGlobals.startX + addX + rect.width + 4) + 'px'; - dragZoomGlobals.cornerBottomDiv.style.top = (dragZoomGlobals.startY + addY + rect.height + 4) + 'px'; - dragZoomGlobals.cornerBottomDiv.style.left = (dragZoomGlobals.startX - dragZoomGlobals.mapWidth + ((dragZoomGlobals.startX + addX) - (dragZoomGlobals.startX - dragZoomGlobals.mapWidth))) + 'px'; - dragZoomGlobals.cornerBottomDiv.style.width = (rect.width + 4) + 'px'; - - return false; - } -} - -NovaButton.prototype.mouseUp = function(e) { - var dragZoomGlobals = NovaButton.globals.dragzoom; - var map = NovaButton.globals.map; - - if (dragZoomGlobals.moving) { - var pos = this.getRelPos(e); - dragZoomGlobals.moving = false; - - var rect = this.getRectangle(dragZoomGlobals.startX, dragZoomGlobals.startY, pos); - - if (rect.left) { - rect.endX = rect.startX - rect.width; - } - - if (rect.top) { - rect.endY = rect.startY - rect.height; - } - - this.resetDragZoom(); - - if (rect.width >= 0 && rect.height >= 0) { - var nwpx = new GPoint(rect.startX, rect.startY); - var nepx = new GPoint(rect.endX, rect.startY); - var sepx = new GPoint(rect.endX, rect.endY); - var swpx = new GPoint(rect.startX, rect.endY); - var nw = NovaButton.globals.map.fromContainerPixelToLatLng(nwpx); - var ne = NovaButton.globals.map.fromContainerPixelToLatLng(nepx); - var se = NovaButton.globals.map.fromContainerPixelToLatLng(sepx); - var sw = NovaButton.globals.map.fromContainerPixelToLatLng(swpx); - - var zoomAreaPoly = new GPolyline([nw, ne, se, sw, nw], "blue", 3, .4); - var polyBounds = zoomAreaPoly.getBounds(); - var ne = polyBounds.getNorthEast(); - var sw = polyBounds.getSouthWest(); - var se = new GLatLng(sw.lat(), ne.lng()); - var nw = new GLatLng(ne.lat(), sw.lng()); - var zoomLevel = map.getBoundsZoomLevel(polyBounds); - var center = polyBounds.getCenter(); - map.setCenter(center, zoomLevel); - } - - this.initCover(); - } -} - -NovaButton.prototype.setDimensions = function() { - var dragZoomGlobals = NovaButton.globals.dragzoom; - var mapSize = NovaButton.globals.map.getSize(); - dragZoomGlobals.mapWidth = mapSize.width; - dragZoomGlobals.mapHeight = mapSize.height; - dragZoomGlobals.mapRatio = dragZoomGlobals.mapHeight / dragZoomGlobals.mapWidth; - // set left:0px in next
s in case we inherit text-align:center from map
in IE. - dragZoomGlobals.zoomArea.style.top = "0px"; - dragZoomGlobals.zoomArea.style.left = "0px"; - dragZoomGlobals.zoomArea.style.width = dragZoomGlobals.mapWidth + "px"; - dragZoomGlobals.zoomArea.style.height = dragZoomGlobals.mapHeight + "px"; - - dragZoomGlobals.cornerTopDiv.style.top = "0px"; - dragZoomGlobals.cornerTopDiv.style.left = "0px"; - dragZoomGlobals.cornerTopDiv.style.width = dragZoomGlobals.mapWidth + "px"; - dragZoomGlobals.cornerTopDiv.style.height = dragZoomGlobals.mapHeight + "px"; - - dragZoomGlobals.cornerRightDiv.style.top = "0px"; - dragZoomGlobals.cornerRightDiv.style.left = "0px"; - dragZoomGlobals.cornerRightDiv.style.width = dragZoomGlobals.mapWidth + "px"; - dragZoomGlobals.cornerRightDiv.style.height = dragZoomGlobals.mapHeight + "px"; - - dragZoomGlobals.cornerBottomDiv.style.top = "0px"; - dragZoomGlobals.cornerBottomDiv.style.left = "0px"; - dragZoomGlobals.cornerBottomDiv.style.width = dragZoomGlobals.mapWidth + "px"; - dragZoomGlobals.cornerBottomDiv.style.height = dragZoomGlobals.mapHeight + "px"; - - dragZoomGlobals.cornerLeftDiv.style.top = "0px"; - dragZoomGlobals.cornerLeftDiv.style.left = "0px"; - dragZoomGlobals.cornerLeftDiv.style.width = dragZoomGlobals.mapWidth + "px"; - dragZoomGlobals.cornerLeftDiv.style.height = dragZoomGlobals.mapHeight + "px"; -}; - -NovaButton.prototype.getRelPos = function(e) { - var pos = NovaButtonUtils.getMousePosition(e); - var dragZoomGlobals = NovaButton.globals.dragzoom; - return {top: (pos.top - dragZoomGlobals.mapPosition.top), - left: (pos.left - dragZoomGlobals.mapPosition.left)}; -}; -// end drag zoom function - -var NovaButtonUtils = { -}; - -NovaButtonUtils.getElementPosition = function(element) { - var leftPos = element.offsetLeft; // initialize var to store calculations - var topPos = element.offsetTop; // initialize var to store calculations - var parElement = element.offsetParent; // identify first offset parent element - while (parElement != null ) { // move up through element hierarchy - leftPos += parElement.offsetLeft; // appending left offset of each parent - topPos += parElement.offsetTop; - parElement = parElement.offsetParent; // until no more offset parents exist - } - return {left: leftPos, top: topPos}; -}; - -NovaButtonUtils.getMousePosition = function(e) { - var posX = 0; - var posY = 0; - if (!e) var e = window.event; - if (e.pageX || e.pageY) { - posX = e.pageX; - posY = e.pageY; - } else if (e.clientX || e.clientY){ - posX = e.clientX + - (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); - posY = e.clientY + - (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); - } - return {left: posX, top: posY}; -}; \ No newline at end of file -- cgit 1.2.3-korg