Commit 61b1083a authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. pass zooom and lat;lng from index to viewer and back

2. center on dblclick, no center on click
3. minor error fix
parent e7e176f7
...@@ -14,7 +14,7 @@ $(function(){ ...@@ -14,7 +14,7 @@ $(function(){
init_maps(); init_maps();
init_help(); init_help();
var url = 'list.php?rating='+SETTINGS.rating; var url = 'list.php?rating='+SETTINGS.rating+'&basepath='+SETTINGS.basepath;
if (SETTINGS.showall){ if (SETTINGS.showall){
url += "?showall"; url += "?showall";
...@@ -42,7 +42,8 @@ var SETTINGS = { ...@@ -42,7 +42,8 @@ var SETTINGS = {
'lat': 44.92980751, 'lat': 44.92980751,
'lng': -118.25683594, 'lng': -118.25683594,
'zoom': 7, 'zoom': 7,
'model': undefined 'model': undefined,
'basepath': 'models/all'
}; };
var Dragged = false; var Dragged = false;
...@@ -139,11 +140,50 @@ function parseURL(){ ...@@ -139,11 +140,50 @@ function parseURL(){
case "lat": SETTINGS.lat = parseFloat(parameters[i][1]); break; case "lat": SETTINGS.lat = parseFloat(parameters[i][1]); break;
case "lng": SETTINGS.lng = parseFloat(parameters[i][1]); break; case "lng": SETTINGS.lng = parseFloat(parameters[i][1]); break;
case "zoom": SETTINGS.zoom = parseFloat(parameters[i][1]); break; case "zoom": SETTINGS.zoom = parseFloat(parameters[i][1]); break;
case "model": SETTINGS.model = parameters[i][1]; break; // selected model
case "model": SETTINGS.model = parameters[i][1]; break;
case "basepath": SETTINGS.basepath = parameters[i][1]; break;
} }
} }
} }
function update_links(){
// a. update links for selected only?
// b. update all - won't take long
// List
$('.arow').each(function(){
var arow = this;
$(List).find('model[name="'+$(arow).attr("title")+'"]').each(function(){
var name = $(this).attr("name");
var vlist = "";
$(this).find("version").each(function(i,v){
var comments = $(this).find("comments").text();
var link_url = "viewer.html?path="+name+"&ver="+$(this).attr("name")+"&rating="+SETTINGS.rating;
link_url += "&basepath="+SETTINGS.basepath;
var center = map.getCenter();
var zoom = map.getZoom();
link_url += "&lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom;
var link = "<a title='"+comments+"' href='"+link_url+"'>"+$(this).attr("name")+"</a>,&nbsp;";
vlist += link;
});
vlist = vlist.slice(0,-7);
$(arow).attr("vlist",vlist);
markers[$(arow).attr("index")][0].vlist = vlist;
var tmp = popup_message(markers[$(arow).attr("index")]);
markers[$(arow).attr("index")][0]._popup.setContent(tmp);
});
});
}
function parse_list(res){ function parse_list(res){
var index = 0; var index = 0;
...@@ -155,12 +195,13 @@ function parse_list(res){ ...@@ -155,12 +195,13 @@ function parse_list(res){
var thumb = $(this).attr("thumb"); var thumb = $(this).attr("thumb");
if (thumb.length!=""){ if (thumb.length!=""){
srcpath ="models/"+name+"/thumb.jpeg"; srcpath = SETTINGS.basepath+"/"+name+"/thumb.jpeg";
}else{ }else{
srcpath ="js/images/thumb_na.jpeg"; srcpath ="js/images/thumb_na.jpeg";
} }
row.append("<td class='acell' title='"+name+"' ><div><img src='"+srcpath+"'></img></div></td>"); row.append("<td class='acell' title='"+name+"' ><div><img src='"+srcpath+"'></img></div></td>");
row.attr('title',name);
//row.append("<td class='acell' valign='top'>"+name+"</td>"); //row.append("<td class='acell' valign='top'>"+name+"</td>");
...@@ -170,6 +211,13 @@ function parse_list(res){ ...@@ -170,6 +211,13 @@ function parse_list(res){
var comments = $(this).find("comments").text(); var comments = $(this).find("comments").text();
var link_url = "viewer.html?path="+name+"&ver="+$(this).attr("name")+"&rating="+SETTINGS.rating; var link_url = "viewer.html?path="+name+"&ver="+$(this).attr("name")+"&rating="+SETTINGS.rating;
link_url += "&basepath="+SETTINGS.basepath;
var center = map.getCenter();
var zoom = map.getZoom();
link_url += "&lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom;
var link = "<a title='"+comments+"' href='"+link_url+"'>"+$(this).attr("name")+"</a>,&nbsp;"; var link = "<a title='"+comments+"' href='"+link_url+"'>"+$(this).attr("name")+"</a>,&nbsp;";
vlist += link; vlist += link;
...@@ -247,6 +295,14 @@ function register_row_events(elem){ ...@@ -247,6 +295,14 @@ function register_row_events(elem){
console.log("double click"); console.log("double click");
// put double click actions here // put double click actions here
var index = $(this).attr("index");
var list = $(List).find("model");
var item = list[index];
var lat = $($(item).find("latitude")[0]).text();
var lng = $($(item).find("longitude")[0]).text();
map.panTo(new L.LatLng(lat, lng));
$(this).click();
}); });
$(elem).on("click",function(e){ $(elem).on("click",function(e){
...@@ -271,7 +327,6 @@ function register_row_events(elem){ ...@@ -271,7 +327,6 @@ function register_row_events(elem){
var lng = $($(item).find("longitude")[0]).text(); var lng = $($(item).find("longitude")[0]).text();
BLOCK_MOVEEND = true; BLOCK_MOVEEND = true;
map.panTo(new L.LatLng(lat, lng));
if (markers[index]!=undefined){ if (markers[index]!=undefined){
...@@ -410,7 +465,9 @@ function init_maps(){ ...@@ -410,7 +465,9 @@ function init_maps(){
var center = map.getCenter(); var center = map.getCenter();
var zoom = map.getZoom(); var zoom = map.getZoom();
window.history.pushState("", "x3d models index", "?lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom+"&rating="+SETTINGS.rating); window.history.pushState("", "x3d models index", "?lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom+"&rating="+SETTINGS.rating+"&basepath="+SETTINGS.basepath);
update_links();
if (!BLOCK_MOVEEND){ if (!BLOCK_MOVEEND){
......
...@@ -135,6 +135,11 @@ function parseURL(){ ...@@ -135,6 +135,11 @@ function parseURL(){
case "manualposor": SETTINGS.manualposor = true; break; case "manualposor": SETTINGS.manualposor = true; break;
case "experimental": SETTINGS.experimental = true; break; case "experimental": SETTINGS.experimental = true; break;
// to recover the index position
case "lat" : SETTINGS.lat = parameters[i][1]; break;
case "lng" : SETTINGS.lng = parameters[i][1]; break;
case "zoom" : SETTINGS.zoom = parameters[i][1]; break;
// case "kml": SETTINGS.kml = parameters[i][1]; break; // case "kml": SETTINGS.kml = parameters[i][1]; break;
} }
} }
......
...@@ -64,7 +64,17 @@ function menu_init(){ ...@@ -64,7 +64,17 @@ function menu_init(){
var origin = window.location.origin; var origin = window.location.origin;
var path = window.location.pathname; var path = window.location.pathname;
path = path.substr(0,path.lastIndexOf("/")); path = path.substr(0,path.lastIndexOf("/"));
window.location.href = origin+path+"?model="+SETTINGS.path+"&rating="+SETTINGS.rating; //var index_url = origin+path+"?model="+SETTINGS.path+"&rating="+SETTINGS.rating;
var index_url = [
origin+path,
"?lat="+SETTINGS.lat,
"&lng="+SETTINGS.lng,
"&zoom="+SETTINGS.zoom,
"&rating="+SETTINGS.rating,
"&basepath="+SETTINGS.basepath,
"&model="+SETTINGS.path
].join("");
window.location.href = index_url;
}); });
$("#download_button").on("click",function(){ $("#download_button").on("click",function(){
......
...@@ -1185,7 +1185,10 @@ X3DOMObject.displayInfo = function(e){ ...@@ -1185,7 +1185,10 @@ X3DOMObject.displayInfo = function(e){
} }
//var dist = 1115; //var dist = 1115;
var dist = parseFloat($(".GroupTop").attr("bboxSize").trim().split(" ")[2]); var dist = 1115;
if ($(".GroupTop").attr("bboxSize")!=undefined){
dist = parseFloat($(".GroupTop").attr("bboxSize").trim().split(" ")[2]);
}
$("#window-info").css({"font-size":"20px"}); $("#window-info").css({"font-size":"20px"});
......
<?php <?php
$base = "models"; if (isset($_GET['basepath'])){
$base = $_GET['basepath'];
}else{
$base = "models/all";
}
$THUMBNAME = "thumb.jpeg"; $THUMBNAME = "thumb.jpeg";
$RATINGFILE = "rating.txt"; $RATINGFILE = "rating.txt";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment