Commit 6e8ea621 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev
Browse files

edit mode on/off and errors displaying

parent 6ce3a7a8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -9,10 +9,14 @@
            var name = "leaflet-control-heel";

            var div = L.DomUtil.create('div', name+' leaflet-bar');
            div.id = "location_control";

            L.DomEvent.disableClickPropagation(div);

            var title = "Camera approximate location control";
            var title = [
              'Camera approximate heading and location control.',
              'Move the base marker around and rotate.'
            ].join('\n');

            //var label = "&#9760";
            //var label = "&#128681";
+5 −1
Original line number Diff line number Diff line
@@ -119,10 +119,14 @@ LeafletObject.prototype.drawCamera = function(){
        fov: this.fov,
        draw_xz: false,
        h_control: true,
        l_control: SETTINGS.edit,
        l_control: true,
        id: "basecircle"
    }).addTo(this._map);

    // the id is buried in the leaflet plugin
    $("#location_control").addClass("edit");
    controls_showhide();

}

LeafletObject.prototype.highlightMarker = function(index){
+10 −0
Original line number Diff line number Diff line
@@ -255,6 +255,16 @@ html, body, #x3d_wrapper {
    text-align:center;
}

#window-error{
    z-index: 10;
    background: rgba(256,256,256,1);
    border: 0px solid rgba(100,100,100,0.5);
    border-radius: 1px;
    color: red;
    font-size: 16px;
    margin-top: 2px;
}

.input{
    text-align: right;
    width: 100px;
+52 −5
Original line number Diff line number Diff line
/*

  Copyright (C) 2017 Elphel Inc.

  License: GPL-3.0

  https://www.elphel.com

*/
/**
 * @file -
 * @brief -
 *
 * @copyright Copyright (C) 2017 Elphel Inc.
 * @author Oleg Dzhimiev <oleg@elphel.com>
 *
 * @licstart  The following is the entire license notice for the
 * JavaScript code in this page.
 *
 *   The JavaScript code in this page is free software: you can
 *   redistribute it and/or modify it under the terms of the GNU
 *   General Public License (GNU GPL) as published by the Free Software
 *   Foundation, either version 3 of the License, or (at your option)
 *   any later version.  The code is distributed WITHOUT ANY WARRANTY;
 *   without even the implied warranty of MERCHANTABILITY or FITNESS
 *   FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
 *
 *   As additional permission under GNU GPL version 3 section 7, you
 *   may distribute non-source (e.g., minimized or compacted) forms of
 *   that code without the copy of the GNU GPL normally required by
 *   section 4, provided you include this license notice and a URL
 *   through which recipients can access the Corresponding Source.
 *
 *  @licend  The above is the entire license notice
 *  for the JavaScript code in this page.
 */

function align_init(){

@@ -23,6 +59,7 @@ function check_markers(){

  var c1,c2;
  var result = true;
  var msg = [];

  for(var i=0;i<Data.markers.length;i++){

@@ -30,17 +67,22 @@ function check_markers(){
    c2 = Data.markers[i].d_x3d;

    if (c1.toString().indexOf("drag")!=-1){
      console.log("error: marker "+i+": drag over map. Mouse over shows a marker info.");
      msg.push("error: marker "+i+": drag over map. Mouse over shows a marker info.");
      //console.log("error: marker "+i+": drag over map. Mouse over shows a marker info.");
      result = false;
    }

    if (c2.toString().indexOf("drag")!=-1){
      console.log("error: marker "+i+": drag over 3D scene. Mouse over shows a marker info.");
      msg.push("error: marker "+i+": drag over 3D scene. Mouse over shows a marker info.");
      result = false;
    }

  }

  if (msg.length!=0){
    ui_showMessage("window-error",msg.join("<br/>"));
  }

  return result;

}
@@ -53,19 +95,24 @@ function x3dom_align_GN(){
  // need at least 3 points
  if (Data.markers != undefined){
    if (Data.markers.length<3){
        console.log("Alignment error: place at least 3 points");
        var msg = "Alignment error: place at least 3 markers";
        ui_showMessage("window-error",msg);
        return -1;
    }
  }else{
    console.log("Alignment error: place at least 3 points");
    var msg = "Alignment error: place at least 3 markers";
    ui_showMessage("window-error",msg);
    return -1;
  }

  if (!check_markers()){
    console.log("Alignment error: marker has not been moved over 3D or Map");
    //var msg = "Alignment error: marker has not been moved over 3D or Map";
    //ui_showMessage("window-error",msg);
    return -2;
  }

  ui_hideMessage("window-error");

  // initial approximation:
  var x0 = Data.camera.kml.latitude;
  var y0 = Data.camera.kml.longitude;
+4 −3
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ var SETTINGS = {
    'path'   : "1487451413_967079",
    'version': "v1",
    'experimental': false,
    'edit': true,
    'edit': false,
    'files': {
      'x3d':"",
      'x3d_background':"",
@@ -99,8 +99,9 @@ $(function(){
    parseURL();

    SETTINGS.files.x3d = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path+".x3d";
    SETTINGS.files.x3d_background = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path+"-texture-bgnd-ext.jpeg"
    SETTINGS.files.kml = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.path+".kml";
    SETTINGS.files.x3d_background = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path+"-texture-bgnd-ext.jpeg";
    // always reload kml
    SETTINGS.files.kml = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.path+".kml?"+Date.now();

    title_init();
    help_init();
Loading