Skip to content

Commit

Permalink
Merge pull request #27 from aodn/issue-24
Browse files Browse the repository at this point in the history
Fixes #24 and Fixes #19 - big code cleanup
  • Loading branch information
Dan Fruehauf committed Jul 16, 2015
2 parents 26b573e + 57d4d56 commit 6fbd53f
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 647 deletions.
421 changes: 126 additions & 295 deletions grails-app/views/finder/_auv_functions_js.gsp

Large diffs are not rendered by default.

169 changes: 70 additions & 99 deletions grails-app/views/finder/_finder_js.gsp
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
<script>
var buff = 10;
// ***** TODO get the bounds from geoserver
var bounds = "" + (112.947 -buff) +","+ (-33.00 -buff)+","+(116.46 + buff)+","+ (0.874 + buff) ;
var buff = 10;
var bounds = "" + (112.947 - buff) + "," + (-33.00 - buff) + "," + (116.46 + buff) + "," + (0.874 + buff);
var mapheight = '323';
var mapheight = '320';
var mapwidth = '400';
var tmptarget = "";
var size = new OpenLayers.Size(30,24);
var offset = new OpenLayers.Pixel(-(size.w/2)+5, -(size.h-1));
//var offset = new OpenLayers.Pixel(-(size.w), -size.h);
var icon = new OpenLayers.Icon('images/auv-marker.png',size,offset);
jQuery(document).ready(function(){
var size = new OpenLayers.Size(30, 24);
var offset = new OpenLayers.Pixel(-(size.w / 2) + 5, -(size.h - 1));
var icon = new OpenLayers.Icon('images/auv-marker.png', size, offset);
jQuery(document).ready(function () {
// set map container size before map exists with jQuery
jQuery("#map").height(mapheight);
jQuery("#map").width(mapwidth);
jQuery("#mapWrapper").height(mapheight).width(mapwidth);
// highlight for the scale and lonlat info
function onOver(){
jQuery("div#mapinfo ").css("opacity","0.9");
function onOver() {
jQuery("div#mapinfo ").css("opacity", "0.9");
}
function onOut(){
jQuery("div#mapinfo ").css("opacity","0.5");
function onOut() {
jQuery("div#mapinfo ").css("opacity", "0.5");
}
//jQuery("div#mapinfo ").css("opacity","0.5");
jQuery("div#mapinfo ").css("opacity","0.5");
jQuery("div#mapinfo").hover(onOver,onOut);
jQuery("div#mapinfo ").css("opacity", "0.5");
jQuery("div#mapinfo").hover(onOver, onOut);
// map legend show and hide
jQuery("#legendToggle").click(function() {
jQuery("#legendToggle").click(function () {
jQuery('div#legend').toggle();
});
jQuery("#legendClose").click(function() {
jQuery("#legendClose").click(function () {
jQuery('div#legend').hide();
});
jQuery('#legend').jqDrag(); // draggable popup like thingy. Nice
Expand All @@ -48,160 +41,138 @@
jQuery('#styleSliderContainer').jqDrag(); // draggable popup like thingy. Nicer
jQuery('button').mouseover(function() {
jQuery('button').mouseover(function () {
jQuery(this).addClass('hover');
});
jQuery('button').hover(function() {
jQuery(this).addClass('hover');
},function() {
jQuery(this).removeClass('hover');
jQuery('button').hover(function () {
jQuery(this).addClass('hover');
}, function () {
jQuery(this).removeClass('hover');
});
// when user selects track from dropdown
jQuery('#trackSelector').change(function() {
jQuery('#trackSelector').change(function () {
if (jQuery(this).val() != "default") {
resetStyleSelect(); // reset the style selector to default
allTracksSelector("#" + jQuery(this).val());
}
});
// track_html contents hyperlink on title
// live will attach events to objects now and in the future
jQuery('.getfeatureTitle').live('mouseover', function() {
// change class
jQuery(this).addClass('.a_hover');
});
jQuery('.getfeatureTitle').live('click', function() {
var code = jQuery(this).siblings('.getfeatureCode').text();
jQuery('.getfeatureTitle').live('click', function () {
hideAllTrackHTML();
var site_code = jQuery(this).siblings('.getfeatureCode').text();
var extent = jQuery(this).siblings('.getfeatureExtent').text();
showHideZoom(code,extent);
showSiteCode(site_code, extent);
});
// slider to change images
jQuery('#slider').slider({
animate: 'normal',
min: 1,
stop: function(event, ui) {
var val = jQuery(this).slider( "value" );
stop: function (event, ui) {
var val = jQuery(this).slider("value");
stepcarousel.moveTo('mygallery', val);
jQuery('#slider').slider( "disable" );
jQuery('#slider').slider("disable");
}
});
resetStyleSelect(); // reset the style selector to default
// showLoader(false);
//jQuery('#mainbody').css('visibility','visible').delay(8000).fadeIn(400);;
mapinit();
<g:if test="${flash.zoom}" >
map.setCenter(new OpenLayers.LonLat(${flash.lon},${flash.lat}), 16);
map.setCenter(new OpenLayers.LonLat(${flash.lon}, ${flash.lat}), 16);
</g:if>
// populate the track dropdown select and hidden track info
// depends on the mapinits openlayers.proxyhost
// populate the track dropdown select and create hidden track info
populateTracks();
// then set layout with the map initialised
jQuery('#mainbody').layout({
//applyDefaultStyles: true,
resizable: true,
west: {
//applyDefaultStyles: true,
minSize: 410,
closable: false
}
});
jQuery('#galleryControls').layout({
applyDefaultStyles: true,
west: {
minSize: 250
}
});
west: {
//applyDefaultStyles: true,
minSize: 410
}
});
jQuery('.trackSort').hide();
jQuery('#galleryControls').layout({
applyDefaultStyles: true,
west: {
minSize: 250
}
});
// hide the gallery. needs to exist for step carousel
jQuery('#mygallery, #stepcarouselcontrols').toggle(false);
// hide the cover over the ugly load
jQuery('#loading_cover').fadeOut();
jQuery('#loading_cover').fadeOut(1000);
}); // end jQuery(document).ready(function()
// timer for jquery slider finction
var checkTime = 0;
function keyPressCheck(){
var currentTime = new Date()
if((currentTime.getTime() - checkTime) > 1000){
checkTime =currentTime.getTime();
function keyPressCheck() {
var currentTime = new Date();
if ((currentTime.getTime() - checkTime) > 1000) {
checkTime = currentTime.getTime();
return true;
}
else {
return false;
}
}
stepcarousel.setup({
stepcarousel.setup({
galleryid: 'mygallery', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
autostep: {enable:false, moveby:1, pause:3000},
panelbehavior: {speed:4500, stepbyspeed:400, wraparound:false, wrapbehavior:'slide', persist:false},
defaultbuttons: {enable: false, moveby: 1, leftnav: ['images/buttonclose.png', 10, 10], rightnav: ['images/buttonopen.png', 10, 10]},
autostep: {enable: false, moveby: 1, pause: 3000},
panelbehavior: {speed: 4500, stepbyspeed: 400, wraparound: false, wrapbehavior: 'slide', persist: false},
defaultbuttons: {
enable: false,
moveby: 1,
leftnav: ['images/buttonclose.png', 10, 10],
rightnav: ['images/buttonopen.png', 10, 10]
},
statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
contenttype: ['inline'], //content setting ['inline'] or ['ajax', 'path_to_external_file']
onslide:function(){
onslide: function () {
var html = "";
var targetpanel = jQuery('#statusA').text().trim()-1;
var targetpanel = jQuery('#statusA').text().trim() - 1;
// set form for ordering images by tracks
html = jQuery('div#auvpanelinf_'+ targetpanel + ' .fk_auv_tracks').text().trim();
jQuery('#this_fk_auv_tracks').html(html);
html = jQuery('div#auvpanelinf_'+ targetpanel + ' .site_code').text().trim();
html = jQuery('div#auvpanelinf_' + targetpanel + ' .fk_auv_tracks').text().trim();
jQuery('#selectedTrackInfo').html(html);
html = jQuery('div#auvpanelinf_' + targetpanel + ' .site_code').text().trim();
jQuery('#this_site_code').html(html);
html = jQuery('div#auvpanelinf_'+ targetpanel + ' .site').text().trim();
html = jQuery('div#auvpanelinf_' + targetpanel + ' .site').text().trim();
jQuery('#sortbytrack span').html("<br>" + ucwords(html));
html = jQuery('div#auvpanelinf_'+ targetpanel + ' .image_filename').text().trim();
html = jQuery('div#auvpanelinf_' + targetpanel + ' .image_filename').text().trim();
jQuery('#this_image_filename').html(html);
// highlight the current selected slide (first left)
jQuery('[id^="auvpanel_"]').css('background-color','transparent');
jQuery('#auvpanel_' + targetpanel).css('background-color','#3399CC');
jQuery('[id^="auvpanel_"]').css('background-color', 'transparent');
jQuery('#auvpanel_' + targetpanel).css('background-color', '#3399CC');
// add/move marker
var lon = jQuery('div#auvpanelinf_'+ targetpanel + ' .lon').text().trim();
var lat = jQuery('div#auvpanelinf_'+ targetpanel + ' .lat').text().trim();
var lon = jQuery('div#auvpanelinf_' + targetpanel + ' .lon').text().trim();
var lat = jQuery('div#auvpanelinf_' + targetpanel + ' .lat').text().trim();
if (lon != "") {
var halfIcon = icon.clone();
markers.clearMarkers();
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(lon,lat),halfIcon));
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(lon, lat), halfIcon));
}
jQuery('#navButtonL, #navButtonR').show();
jQuery('#slider').slider( "enable" );
jQuery('#slider').slider("enable");
}
});
Expand Down
Loading

0 comments on commit 6fbd53f

Please sign in to comment.