Commit 090de34d authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

fixed: 1. bug relative to marker deletion 2. testbox

parent ef6a5a1c
......@@ -124,7 +124,7 @@ function manualposor_init(){
var modelname = $(this).html();
var checkbox = $(this).parent().find(".mpr_hide");
if (checkbox.prop("checked")){
$("inline[name=x3d_"+modelname+"]").parent().parent().attr("whichChoice",-1);
$("inline[name=x3d_"+modelname+"]").parent().parent().parent().attr("whichChoice",-1);
}
});
}
......@@ -134,7 +134,7 @@ function manualposor_init(){
$("#window-extrainfo").on('keyup',function(e){
$(this).find(".mpr_modelname").each(function(){
var modelname = $(this).html();
$("inline[name=x3d_"+modelname+"]").parent().parent().attr("whichChoice",0);
$("inline[name=x3d_"+modelname+"]").parent().parent().parent().attr("whichChoice",0);
});
});
......@@ -210,7 +210,7 @@ function load_extra_model(name,version){
function hide_extra_model(name){
//donothing
$("inline[name=x3d_"+name+"]").parent().parent().parent().remove();
$("inline[name=x3d_"+name+"]").parent().parent().parent().parent().remove();
manualposor_refresh_content();
}
......@@ -243,14 +243,9 @@ function parse_load_extra_model(name,version,response){
var p0 = new L.LatLng(Data.camera.kml.latitude,Data.camera.kml.longitude);
var p1 = new L.LatLng(Data.extra_models["x3d_"+name].latitude,Data.extra_models["x3d_"+name].longitude);
var p_w = x3dom_delta_map2scene(p0,p1);
console.log(p0);
console.log(p1);
console.log(p_w);
var tstring = [p_w.x,p_w.y,p_w.z].join(",");
console.log("tstring: "+tstring);
heading = heading*Math.PI/180;
tilt = tilt*Math.PI/180;
roll = roll*Math.PI/180;
......@@ -280,12 +275,16 @@ function parse_load_extra_model(name,version,response){
model_url = SETTINGS.basepath+"/"+name+"/"+version+"/"+name+".x3d";
var mountshift = [SETTINGS.mountshift.x,SETTINGS.mountshift.y,SETTINGS.mountshift.z].join(',');
var model = $([
'<group>',
' <switch whichChoice=\'0\'>',
' <transform rotation=\''+rstring+'\' translation=\''+tstring+'\'>',
' <transform translation=\''+mountshift+'\'>',
' <inline name="x3d_'+name+'" namespacename="x3d_'+name+'" url="'+model_url+'"></inline>',
' </transform>',
' </transform>',
' </switch>',
'</group>'
].join('\n'));
......@@ -328,7 +327,7 @@ function manualposor_refresh_content(){
console.log("Model "+tmpstr+": "+name);
// get rotation and translation
var tra = $(this).parent();
var tra = $(this).parent().parent();
//console.log($(tra).attr("translation")+' vs '+$(tra).attr("rotation"));
// always defined
// 0,0,0 vs 0,0,0,0
......@@ -345,7 +344,8 @@ function manualposor_refresh_content(){
var m = q.toMatrix();
// convert to real world
var R0 = Data.camera.Matrices.R0;
m = m.mult(R0);
//m = m.mult(R0);
m = R0.mult(m);
var htr = x3dom_YawPitchRoll_nc_degs(m);
console.log(htr);
......@@ -454,7 +454,7 @@ function manualposor_update(elem){
var tmp_pp = $(elem).parent().parent();
var tmpname = tmp_pp.find(".mpr_name").html();
var tmptransform = $("inline[name=x3d_"+tmpname+"]").parent();
var tmptransform = $("inline[name=x3d_"+tmpname+"]").parent().parent();
var dp_rw = {
x: parseFloat(tmp_pp.find(".mpr_x").val()),
......@@ -505,7 +505,8 @@ function manualposor_update(elem){
var R1 = T.inverse().mult(R).mult(T);
var R0 = Data.camera.Matrices.R0;
var R_diff = R1.mult(R0.inverse());
//var R_diff = R1.mult(R0.inverse());
var R_diff = R0.inverse().mult(R1);
//var R_diff = R1;
var Q = new x3dom.fields.Quaternion(0, 0, 1, 0);
......
......@@ -68,7 +68,12 @@ var SETTINGS = {
'kml':""
},
'forcehide':[],
'forceshow':[]
'forceshow':[],
'mountshift':{
x: 0,
y: 0,
z: -0.12
}
// 'kml' : "scene.kml"
}
......@@ -222,8 +227,10 @@ function light_init(){
'<group>',
' <switch whichChoice=\'0\'>',
' <transform id=\'x3d_transform\' class=\'inline_wrapper\'>',
' <transform translation=\''+([SETTINGS.mountshift.x,SETTINGS.mountshift.y,SETTINGS.mountshift.z].join(','))+'\'>',
' <inline name="x3d_'+model_name+'" namespacename="x3d_'+model_name+'" url="'+model_url+'"></inline>',
' </transform>',
' </transform>',
' </switch>',
'</group>',
// multiple models in one scene test
......@@ -407,6 +414,7 @@ function deep_init(){
cnt = parseInt(progress_counter[1]);
if (!Scene._X3DOM_SCENE_INIT_BACK_DONE){
//console.log(cnt+" "+background_check());
var bc = background_check();
......@@ -415,6 +423,11 @@ function deep_init(){
Scene._X3DOM_SCENE_INIT_BACK_DONE = true;
}
}else{
//x3dom_testbox();
x3dom_setUpRight();
}
if (!Scene._X3DOM_SCENE_INIT_DONE&&(cnt==0)){
......@@ -430,6 +443,7 @@ function deep_init(){
x3d_setShiftSpeed();
}
};
}
......@@ -679,7 +693,7 @@ function x3d_events(){
if (e.buttons==1){
// upright view
x3dom_setUpRight();
//x3dom_setUpRight();
}
// what is this?
......
......@@ -840,6 +840,16 @@ function x3dom_update_map(){
}
function x3dom_testbox(){
// keep the test cube
var mat = Scene.element.runtime.viewMatrix().inverse();
var Q = new x3dom.fields.Quaternion(0, 0, 1, 0);
Q.setValue(mat);
var AA = Q.toAxisAngle();
var testbox = $("#testbox");
testbox.attr("rotation",AA[0].toString()+" "+AA[1]);
}
// uses globals
function x3dom_setViewpoint(m){
......@@ -852,6 +862,12 @@ function x3dom_setViewpoint(m){
viewpoint.attr("position",m.e3().toString());
viewpoint.attr("centerOfRotation",m.e3().toString());
/*
var viewpoint = $("#viewpoint_transform");
viewpoint.attr("rotation",AA[0].toString()+" "+AA[1]);
viewpoint.attr("translation",m.e3().toString());
*/
// update every time
Data.camera.Matrices.RC_w = m;
......
......@@ -631,6 +631,7 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
Scene.updateMarkersIndices();
Map.deleteMarker(index);
Map.marker.draggedMarker._index = null;
Scene.highlighted_marker_index = null;
}
......
......@@ -59,10 +59,29 @@
<!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' ></Viewpoint>-->
<!-- in x3dom 1.7.2 - bug: zNear does not work properly -->
<!--<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0' zNear='3'></Viewpoint>-->
<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0'></Viewpoint>
<!-- <group>
<inline name="back" namespacename="back" url="models/m1/v1/background.x3d"/>
</group>-->
<group id='viewpoint_group'>
<transform id='viewpoint_transform'>
<Viewpoint fieldOfView='1' position='0 0 0' orientation='0 0 1 0'>
</Viewpoint>
<!--
<transform id="testbox" DEF="boxTrafo" translation='0 0 0'>
<transform translation='0 0 -5.5'>
<shape DEF="boxShape">
<appearance DEF="boxApp">
<material diffuseColor="1 0 0" specularColor="0.7 0 0" />
</appearance>
<box DEF="box" size='0.3,0.3,0.3'></box>
</shape>
</transform>
</transform>
-->
</transform>
</group>
</scene>
</x3d>
</div>
......
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