diff --git a/frontend-js/src/main/js/GuiConnector.js b/frontend-js/src/main/js/GuiConnector.js index fd67dfe09eb02a46d8eaadcd979f00e9b746a72f..23b69ecb1468445b95b80458e183ec0ccf543dbc 100644 --- a/frontend-js/src/main/js/GuiConnector.js +++ b/frontend-js/src/main/js/GuiConnector.js @@ -129,21 +129,6 @@ GuiConnector.getImgPrefix = function() { return "resources/images/"; }; -/** - * Returns main google maps div tag placed on the webpage. - */ -GuiConnector.getGoogleMapElement = function() { - return document.getElementById(ServerConnector.formIdentifier + ":gmapElement"); -}; - -/** - * Shows main google map (by default map is hidden, because it doesn't point to - * our data from the beginning). - */ -GuiConnector.showGoogleMap = function() { - GuiConnector.getGoogleMapElement().style.visibility = "visible"; -}; - /** * Shows legend. */ diff --git a/frontend-js/src/main/js/map/AbstractCustomMap.js b/frontend-js/src/main/js/map/AbstractCustomMap.js index 6c4e6043f56f63abc438fa16ad79c80c5a4add1d..1866931254600bfa050037074f185f2cdb031b45 100644 --- a/frontend-js/src/main/js/map/AbstractCustomMap.js +++ b/frontend-js/src/main/js/map/AbstractCustomMap.js @@ -26,7 +26,6 @@ function AbstractCustomMap(model, options) { throw Error("Model must be defined"); } - this.setGoogleMap(options.getMap()); this.setModel(model); // this array contains elements that are presented on a specific layout (set diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js index 0379938160a34c7ca98c2d6e2bb506a2e1ed6cd9..d9833aa81b2d358c0c7108bb060f4275de8336ca 100644 --- a/frontend-js/src/main/js/map/CustomMap.js +++ b/frontend-js/src/main/js/map/CustomMap.js @@ -43,21 +43,7 @@ function CustomMap(options) { this.setProject(options.getProject()); // set config parameters - this.setGoogleMap(options.getMap()); - - if (options.isCustomTouchInterface()) { - this._touchInterface = new TouchMap(this); - } - - // create function that override primefaces fitBounds with default google - // implementation - var fitBounds = function(bounds) { - var tmp = this.fitBounds; - this.fitBounds = google.maps.Map.prototype.fitBounds; - this.fitBounds(bounds); - this.fitBounds = tmp; - }; - this.getGoogleMap().fitBounds2 = fitBounds; +// this.setGoogleMap(options.getMap()); this.buttons = []; @@ -65,12 +51,12 @@ function CustomMap(options) { this.selectedLayouts = []; - this.setupLayouts(); + this.customizeGoogleMapView(options.getFitMapBounds(),options.getMapDiv()); this.createBelt(); - - this.customizeGoogleMapView(options.getFitMapBounds()); - + + this.createMapMenu(); + this.createMapChangedCallbacks(); this.createClientServerListeners(); @@ -88,6 +74,11 @@ function CustomMap(options) { var commentDialog = new CommentDialog(document.getElementById("feedbackContent"), this); this.setCommentDialog(commentDialog); + + if (options.isCustomTouchInterface()) { + this._touchInterface = new TouchMap(this); + } + } CustomMap.prototype = Object.create(AbstractCustomMap.prototype); @@ -577,11 +568,7 @@ CustomMap.prototype.refreshOverlayMarkers = function(overlay) { var map = this.getSubmodelById(mapId).getGoogleMap(); bounds = boundsArray[mapId]; if (map !== undefined && !bounds.isEmpty()) { - if (typeof map.fitBounds2 !== "undefined") { - map.fitBounds2(bounds); - } else { map.fitBounds(bounds); - } } } } @@ -626,11 +613,11 @@ CustomMap.prototype.openSubmodel = function(id, htmlTag, jsVar) { }; -CustomMap.prototype.customizeGoogleMapView = function(fitMapBounds) { - var mapOptions = this.creatMapOptions(); - this.getGoogleMap().setOptions(mapOptions); - - this.createMapMenu(); +CustomMap.prototype.customizeGoogleMapView = function(fitMapBounds, div) { + logger.debug(div); + var mapOptions = this.creatMapOptions(this.getLayouts().length); + this.setGoogleMap(new google.maps.Map(div, mapOptions)); + this.setupLayouts(); this.registerMapClickEvents(); @@ -646,11 +633,7 @@ CustomMap.prototype.customizeGoogleMapView = function(fitMapBounds) { bounds.extend(this.getTopLeftLatLng()); bounds.extend(this.getBottomRightLatLng()); - if (typeof this.getGoogleMap().fitBounds2 !== undefined) { - this.getGoogleMap().fitBounds2(bounds); - } else { this.getGoogleMap().fitBounds(bounds); - } } }; @@ -1442,11 +1425,7 @@ CustomMap.prototype.renderOverlayCollection = function(overlayCollection, fitBou var map = self.getSubmodelById(mapId).getGoogleMap(); var bounds = boundsArray[mapId]; if (map !== undefined && !bounds.isEmpty()) { - if (typeof map.fitBounds2 !== "undefined") { - map.fitBounds2(bounds); - } else { map.fitBounds(bounds); - } } } } diff --git a/frontend-js/src/main/js/map/CustomMapOptions.js b/frontend-js/src/main/js/map/CustomMapOptions.js index a5a1b42b75cccd00e6cf27da330ff41697f60101..76ace9547391298949cc193dffbdc48ed8f7664f 100644 --- a/frontend-js/src/main/js/map/CustomMapOptions.js +++ b/frontend-js/src/main/js/map/CustomMapOptions.js @@ -7,10 +7,10 @@ var logger = require('./../logger'); * objects. */ function CustomMapOptions(params) { - if (params.map === undefined) { - throw new Error("map must be defined"); + if (params.mapDiv === undefined) { + throw new Error("mapDiv must be defined"); } - this.setMap(params.map); + this.setMapDiv(params.mapDiv); if (params.project === undefined) { throw new Error("project must be defined"); @@ -53,21 +53,21 @@ function CustomMapOptions(params) { if (params.customTouchInterface !== undefined) { if (typeof params.customTouchInterface === "boolean") { - this._customTouchInterface = params.customTouchInterface; + this.setCustomTouchInterface (params.customTouchInterface); } else { logger.warn("customTouchInterface must be of type boolean"); - this._customTouchInterface = false; + this.setCustomTouchInterface (false); } } else { - this._customTouchInterface = false; + this.setCustomTouchInterface (false); } this.setDebug(params.debug); this.setFitMapBounds(params.debug); } -CustomMapOptions.prototype.getMap = function() { - return this._map; +CustomMapOptions.prototype.getMapDiv = function() { + return this._mapDiv; }; CustomMapOptions.prototype.isMarkerOptimization = function() { @@ -106,12 +106,16 @@ CustomMapOptions.prototype.setFitMapBounds = function(fitMapBounds) { this._fitMapBounds = fitMapBounds; }; +CustomMapOptions.prototype.setCustomTouchInterface = function(customTouchInterface) { + this._customTouchInterface = customTouchInterface; +}; + CustomMapOptions.prototype.getFitMapBounds = function() { return this._fitMapBounds; }; -CustomMapOptions.prototype.setMap = function(map) { - this._map = map; +CustomMapOptions.prototype.setMapDiv = function(mapDiv) { + this._mapDiv = mapDiv; }; CustomMapOptions.prototype.getFitMapBounds = function() { diff --git a/frontend-js/src/main/js/map/Submap.js b/frontend-js/src/main/js/map/Submap.js index 85b8ba79b560a4d456af9b6262c749ec4812c2cd..e28643596bbcc6f1e7f2e900110ac1bad2b677ca 100644 --- a/frontend-js/src/main/js/map/Submap.js +++ b/frontend-js/src/main/js/map/Submap.js @@ -18,7 +18,7 @@ function Submap(customMap, model) { this.setCustomMap(customMap); AbstractCustomMap.call(this, model, new CustomMapOptions({ - map : null, + mapDiv : customMap.getGoogleMap().getDiv(), hideDiV : customMap.getHideDiv(), overviewDiv : customMap.getOverviewDiv(), markerOptimization : customMap.isMarkerOptimization(), diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js index be06d31a772f9c463f86ab0a28f51013cc3312ac..529efa1d1768a8108068454ccd840ceef7e80b85 100644 --- a/frontend-js/src/main/js/minerva.js +++ b/frontend-js/src/main/js/minerva.js @@ -76,9 +76,6 @@ function create(params) { var result = new CustomMap(params); ServerConnector.setCustomMap(result); - GuiConnector.setCustomMap(result); - - GuiConnector.showGoogleMap(); if (params.dataCollections !== undefined) { for (var i = 0; i < params.dataCollections.length; i++) { diff --git a/frontend-js/src/test/js/helper.js b/frontend-js/src/test/js/helper.js index 6ae843322d5a65c8ad10548c9b8b023d2a32abe5..eb73cec45e667f93371900a058d63fdb2f520121 100644 --- a/frontend-js/src/test/js/helper.js +++ b/frontend-js/src/test/js/helper.js @@ -249,13 +249,13 @@ Helper.prototype.createReaction = function(map) { return result; }; -Helper.prototype.createOptions = function() { - var map = this.createGoogleMap(); - - var project = this.createProject(); +Helper.prototype.createOptions = function(project) { + if (project === undefined) { + project = this.createProject(); + } var options = { - map : map, + mapDiv : testDiv, project : project, dataCollections : [ { name : "testCollection" + this.idCounter++, @@ -301,11 +301,11 @@ Helper.prototype.createGoogleMap = function() { Helper.prototype.createCustomMapOptions = function() { var project = this.createProject(); - var map = this.createGoogleMap(); + var result = new CustomMapOptions({ markerOptimization : true, project : project, - map : map + mapDiv : testDiv }); return result; diff --git a/frontend-js/src/test/js/map/CustomMapOptions-test.js b/frontend-js/src/test/js/map/CustomMapOptions-test.js index d15a95921739a39fd3f5ac13eaef5b9b78557885..42060a7a44e36631fc111176f01d16e09d59e02c 100644 --- a/frontend-js/src/test/js/map/CustomMapOptions-test.js +++ b/frontend-js/src/test/js/map/CustomMapOptions-test.js @@ -23,14 +23,14 @@ describe('CustomMapOptions', function() { }); assert.ok(false); } catch (exception) { - assert.ok(exception.message.indexOf("map must be defined") >= 0); + assert.ok(exception.message.indexOf("mapDiv must be defined") >= 0); } }); it("contructor with invalid arg 3", function() { try { new CustomMapOptions({ - map : {}, + mapDiv : testDiv, }); } catch (exception) { assert.ok(exception.message.indexOf("project must be defined") >= 0); @@ -40,7 +40,7 @@ describe('CustomMapOptions', function() { it("contructor with valid arg 2", function() { var project = helper.createProject(); new CustomMapOptions({ - map : {}, + mapDiv : testDiv, project : project, debug : false, }); diff --git a/frontend-js/src/test/js/map/overlay/ReactionOverlay-test.js b/frontend-js/src/test/js/map/overlay/ReactionOverlay-test.js index 1ac17e4338d7c67e4407e36ff88a3ccad1792eb6..09e2e7664f4641a96710fc738b918712a6c85981 100644 --- a/frontend-js/src/test/js/map/overlay/ReactionOverlay-test.js +++ b/frontend-js/src/test/js/map/overlay/ReactionOverlay-test.js @@ -33,7 +33,7 @@ describe('ReactionOverlay', function() { }); it("show", function() { - var map = helper.createAbstractCustomMap(); + var map = helper.createCustomMap(); var reaction = helper.createReaction(map); var layoutReaction = helper.createLayoutReaction(reaction); diff --git a/frontend-js/src/test/js/minerva-test.js b/frontend-js/src/test/js/minerva-test.js index 496986420595c0d8019e9d6cdec42f91ec357524..756314ee7f9f06569659c960e506ebbbaed3b693 100644 --- a/frontend-js/src/test/js/minerva-test.js +++ b/frontend-js/src/test/js/minerva-test.js @@ -71,13 +71,7 @@ describe('minerva global', function() { GuiConnector.getParams["layout"] = layoutName; - var options = { - map : map, - project : project, - dataCollections : [ { - name : "testCollection" - } ], - }; + var options = helper.createOptions(project); return minerva.create(options).then(function(result) { assert.ok(result); @@ -102,13 +96,7 @@ describe('minerva global', function() { GuiConnector.getParams["layout"] = layoutName; - var options = { - map : map, - project : project, - dataCollections : [ { - name : "testCollection" - } ], - }; + var options = helper.createOptions(project); return minerva.create(options).then(function(result) { assert.ok(result); @@ -121,15 +109,11 @@ describe('minerva global', function() { it('create with comment overlay', function() { var project = helper.createProject(); project.getModel().setId(15781); - var map = helper.createGoogleMap(); - var options = { - map : map, - project : project, - dataCollections : [ { - name : "comment" - } ], - }; + var options = helper.createOptions(project); + options.dataCollections.push({ + name : "comment" + }); return minerva.create(options).then(function(result) { assert.ok(result); @@ -139,40 +123,41 @@ describe('minerva global', function() { it('create with search overlay', function() { var project = helper.createProject(); project.getModel().setId(15781); - var map = helper.createGoogleMap(); - var options = { - map : map, - project : project, - dataCollections : [ { - name : "search" - } ], - }; + var options = helper.createOptions(project); + options.dataCollections.push({ + name : "search" + }); return minerva.create(options).then(function(result) { assert.ok(result); }); }); - + it('create with search overlay and GET search param', function() { - GuiConnector.getParams["search"]="s1"; - + GuiConnector.getParams["search"] = "s1"; + var project = helper.createProject(); project.getModel().setId(15781); - var map = helper.createGoogleMap(); - var options = { - map : map, - project : project, - dataCollections : [ { - name : "search" - } ], - }; + var options = helper.createOptions(project); + options.dataCollections.push({ + name : "search" + }); return minerva.create(options).then(function(result) { return result.getOverlayByName("search").getIdentifiedElements(); - }).then(function(elements){ - assert.ok(elements.length>0); + }).then(function(elements) { + assert.ok(elements.length > 0); }); }); + + it("contructor with touch enabled", function() { + var options = helper.createCustomMapOptions(); + options.setCustomTouchInterface(true); + return minerva.create(options).then(function(result) { + assert.ok(result); + }); + }); + }); diff --git a/web/src/main/webapp/WEB-INF/components/map/map.xhtml b/web/src/main/webapp/WEB-INF/components/map/map.xhtml index c5923d23abedf32f9ede94e41e5fab66b70c13c9..9631e5438aea5faa97208c7df912e37294eb95ac 100644 --- a/web/src/main/webapp/WEB-INF/components/map/map.xhtml +++ b/web/src/main/webapp/WEB-INF/components/map/map.xhtml @@ -13,7 +13,6 @@ <p:remoteCommand name="_setModelZoomLevel" actionListener="#{mapMB.setModelZoomLevel}"/> - <p:gmap id="gmapElement" widgetVar="gmtls" center="49.502430, 5.948763" zoom="6" type="terrain" styleClass="mapClass"/> <p:galleria id="legend" styleClass="legendBox" panelWidth="600" panelHeight="480"> <h:panelGroup layout="block" rendered ="#{not empty configurationMB.legendFile1}"> <img src="#{configurationMB.legendFile1}" alt="legend 1/4"/> @@ -29,15 +28,13 @@ </h:panelGroup> </p:galleria> - <p:contextMenu id="contextMenu" model="#{exportMB.contextMenu}" for="gmapElement"/> - <p:contextMenu id="selectionContextMenu" model="#{exportMB.imageExportMenu}" for="gmapElement"/> + <p:contextMenu id="contextMenu" model="#{exportMB.contextMenu}" /> + <p:contextMenu id="selectionContextMenu" model="#{exportMB.imageExportMenu}" /> <h:inputHidden id="selectedPolygon" value="#{exportMB.selectedPolygon}"/> <h:inputHidden id="exportModelId" value="#{exportMB.selectedModelId}"/> <h:inputHidden id="selectedDrugPolygon" value="#{drugMB.polygon}"/> - <p:remoteCommand name="_actualizeParams" actionListener="#{mapMB.actualizeParams}"/> - <h:panelGroup layout="block" id="submodelDialogGroup"> </h:panelGroup> @@ -62,16 +59,6 @@ <h:inputHidden id="systemMaxColor" value="#{configurationMB.maxColor}"/> </h:form> - <h:form id="accessLightAliasForm"> - <p:remoteCommand name="_retreiveLightAliases" actionListener="#{mapMB.retreiveLightAliases}" /> - </h:form> - <h:form id="accessFullAliasForm"> - <p:remoteCommand name="_retreiveFullAliases" actionListener="#{mapMB.retreiveFullAliases}" /> - </h:form> - <h:form id="accessReactionForm"> - <p:remoteCommand name="_retreiveLightReactions" actionListener="#{mapMB.retreiveLightReactions}" /> - </h:form> - <h:form id="accessReferenceGenomeForm"> <p:remoteCommand name="_sendReferenceGenomeDetailRequest" actionListener="#{referenceGenomeMB.requestJavasciptGenomeDetails}" /> </h:form> diff --git a/web/src/main/webapp/index.xhtml b/web/src/main/webapp/index.xhtml index 74ee3a98d692c340a14b8c3f5e9765f2f3415d15..57c7c3c03a17f062031b67a5dc695bfc84af5672 100644 --- a/web/src/main/webapp/index.xhtml +++ b/web/src/main/webapp/index.xhtml @@ -33,13 +33,13 @@ //<![CDATA[ function initMap(){ + var mapDiv = document.getElementById('mapElement'); minerva.GuiConnector.init(); - var mapElement = gmtls.getMap(); minerva.ServerConnector.getProject(minerva.GuiConnector.getParams['id']).then(function(project){ var windowsTouchInterface = ((navigator.appVersion.indexOf("Win")!=-1) && ('ontouchstart' in document.documentElement)); var overviewDiv = document.getElementById("overviewDiv"); return minerva.create({ - map : mapElement, + mapDiv : mapDiv, project : project, hideDiv : document.getElementById('leftPanel'), markerOptimization : !windowsTouchInterface, @@ -75,15 +75,9 @@ function initMap(){ <h:outputScript library="primefaces" name="jquery/jquery.js" target="head" /> <div class = "containerClass"> - <div id="leftPanel" class ="leftPanelClass"> + <div id="leftPanel" class ="leftPanelClass" style="float: left;"> <ui:include src="/WEB-INF/components/admin/header.xhtml" /> - -<!-- <div class="tabNavigation"> - <a href="javascript:;" onclick="GuiConnector.tabNaviShow('prev');" class="naviLeft"><i class="fa fa-chevron-left"></i></a> - <a href="javascript:;" onclick="GuiConnector.tabNaviShow('next');" class="naviRight"><i class="fa fa-chevron-right"></i></a> - </div> ---> <p:tabView id="tabView" widgetVar="_tabViewVar" styleClass="leftTabView" activeIndex="0" > <p:tab id="searchTab" title="<div class='tngContainer'><div class='tng'></div></div><div class='maintabdiv'><i class='fa fa-search maintab'></i><br>SEARCH</div>" styleClass="leftTab"> @@ -123,9 +117,11 @@ function initMap(){ </div> </div> - <div> - <ui:include src="/WEB-INF/components/map/map.xhtml" /> + <div style="display: table-cell;height:100%;width:100%;"> + <div id="mapElement" class="mapClass"/> </div> + <ui:include src="/WEB-INF/components/map/map.xhtml" /> + </div> <!--<ui:include src="/WEB-INF/components/map/footer.xhtml" />--> diff --git a/web/src/main/webapp/resources/css/global.css b/web/src/main/webapp/resources/css/global.css index 8080336ac0e8d1eeaf8d2fd5b16f545fe5fed3ab..590a342ea0280743f246b33c720732a1ecc61945 100644 --- a/web/src/main/webapp/resources/css/global.css +++ b/web/src/main/webapp/resources/css/global.css @@ -29,6 +29,30 @@ -webkit-border-vertical-spacing: 2px; } +.mapClass { + border:none; + height:100%; + width:100%; + border-left:1px solid #e1e1e1; +} + +.containerClass { + display: table; + background-color: #ffffff; + height: 100%; + width: 100%; + margin: 0; +} + +.leftPanelClass { + display: table-cell; + border:none; + background-color: #ffffff; + width: 357px; + height: 100%; +} + + /* twitter typeahead */ .tt-query /* UPDATE: newer versions use tt-input instead of tt-query */ { diff --git a/web/src/main/webapp/resources/css/map.css b/web/src/main/webapp/resources/css/map.css index 24d5e1d8f99346cf52aaa8a8f6539f271efc6318..5afa17e756b8663a3ac51ddd4cb343a10d6559a6 100644 --- a/web/src/main/webapp/resources/css/map.css +++ b/web/src/main/webapp/resources/css/map.css @@ -27,4 +27,4 @@ table.mapInfoBoxResultsTable, table.mapInfoBoxResultsTable th, table.mapInfoBoxR margin: 1px; width: 360px; background-color: #C0C0C0; -} \ No newline at end of file +} diff --git a/web/src/main/webapp/resources/css/style.css b/web/src/main/webapp/resources/css/style.css index eb6c9c14064a0194f52708012e0b389887bede06..88f02e9ba1e3c8b464a05d73586f3d83f28537f5 100644 --- a/web/src/main/webapp/resources/css/style.css +++ b/web/src/main/webapp/resources/css/style.css @@ -21,46 +21,10 @@ html,body { margin: 0; } -.smallCheckbox { - -} .smallIcon { width:18px; } -.searchTextClass { - width:100%; -} -.mapClass { - border:none; - position: absolute; - top: 0px; - bottom: 0px; - left: 357px; - right: 0px; - visibility: hidden; - float: left; - border-left:1px solid #e1e1e1; -} - -.containerClass { - background-color: #ffffff; - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0; -} - -.leftPanelClass { - position: absolute; - border:none; - background-color: #ffffff; - width: 357px; - left:0px; - top:0px; - bottom:72px; - float: left; -} .footerDivClass { position: relative; top:0px;