Commit 8bc06769 authored by Rurik Bugdanov's avatar Rurik Bugdanov

remove trailing spaces

parent f888f6f7
......@@ -3,14 +3,14 @@
<head>
<meta charset="utf-8"/>
<title>x3d models index</title>
<script type='text/javascript' src='js/jquery/jquery-3.1.1.js'></script>
<script type='text/javascript' src='js/leaflet/leaflet-src.js'></script>
<script type='text/javascript' src='js/index.js'></script>
<link rel='stylesheet' type='text/css' href='js/leaflet/leaflet.css'></link>
<link rel='stylesheet' type='text/css' href='js/index.css'></link>
</head>
<body>
<div id="table_div">
......
table{
border-collapse:collapse;
}
......
......@@ -6,28 +6,28 @@ var markers = [];
$(function(){
//init();
init_maps();
$.ajax({
url: "list.php",
success: function(response){
List = response;
parse_list(response);
$(".arow")[0].click();
}
});
});
function parse_list(res){
var index = 0;
$(res).find("model").each(function(){
var row = $("<tr class='arow'>");
......@@ -44,60 +44,60 @@ function parse_list(res){
var vlist = "";
$(this).find("version").each(function(i,v){
var comments = $(this).find("comments").text();
var link_url = "test.html?path="+name+"&ver="+$(this).attr("name");
var link = "<a title='"+comments+"' href='"+link_url+"'>"+$(this).attr("name")+"</a>,&nbsp;";
vlist += link;
});
vlist = vlist.slice(0,-7);
row.append("<td class='acell' valign='top'><div>"+vlist+"</div></td>");
row.attr("index",index);
register_row_events(row);
$("#model_table").append(row);
//place markers
$(this).find("Camera").each(function(){
var lat = $(this).find("latitude").text();
var lng = $(this).find("longitude").text();
if (markers[lat+lng]==undefined){
var marker = L.marker([lat, lng]).addTo(map);
marker.bindPopup(name+": "+vlist,{
direction:"top",
});
markers[lat+lng] = marker;
}else{
console.log(markers[lat+lng]);
var content = markers[lat+lng]._popup.getContent();
markers[lat+lng]._popup.setContent(content+"<br/>"+name+": "+vlist);
}
});
index++;
});
}
function register_row_events(elem){
$(elem).on("click",function(){
$(".arow").css({
......@@ -107,30 +107,30 @@ function register_row_events(elem){
$(this).css({
background: "rgba(100,200,255,0.7)"
});
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));
if (markers[lat+lng]!=undefined){
markers[lat+lng].openPopup();
}
});
}
// maps
function init_maps(){
// https: also suppported.
var Esri_WorldImagery = L.tileLayer(
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
{
maxZoom: 21,
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
......@@ -145,35 +145,35 @@ function init_maps(){
subdomains:['mt0','mt1','mt2','mt3'],
}
);
var OSMTiles = L.tileLayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
var OSMTiles = L.tileLayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 21,
attribution: 'Map data and images &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
}
);
map = L.map('leaflet_map',{
layers:[googleSat],
zoomControl:false,
}).setView([40.7233861, -111.9328843], 12);
new L.Control.Zoom({ position: 'topright' }).addTo(map);
var baseMaps = {
"Esri world imagery": Esri_WorldImagery,
"Google": googleSat,
"Open Street Map": OSMTiles
};
//Esri_WorldImagery.addTo(map);
//googleSat.addTo(map);
//custom control:
//http://www.coffeegnome.net/control-button-leaflet/
L.control.layers(baseMaps).addTo(map);
}
......@@ -3,27 +3,27 @@
//from here: https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/master/src/L.RotatedMarker.js
L.DomUtil.TRANSFORM_ORIGIN = L.DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'OTransformOrigin', 'MozTransformOrigin', 'msTransformOrigin']);
L.LatLng.prototype.CoordinatesOf = function(angle,distance){
var d = distance;
var a = angle*Math.PI/180;
var lat1 = this.lat*Math.PI/180;
var lng1 = this.lng*Math.PI/180;
var R = L.CRS.Earth.R;
var lat2 = Math.asin(Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(a));
var y = Math.sin(a)*Math.sin(d/R)*Math.cos(lat1);
var x = Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2);
var lng2 = lng1 + Math.atan2(y,x);
lat2 = lat2*180/Math.PI;
lng2 = lng2*180/Math.PI;
return new L.LatLng(lat2,lng2);
}
......
(function (window, document, undefined) {
"use strict";
L.Control.CameraViewMarkerControls = L.Control.extend({
onAdd: function(map){
var name = "leaflet-control-heel";
var div = L.DomUtil.create('div', name+' leaflet-bar');
L.DomEvent.disableClickPropagation(div);
var title = "Altitude and Elevation control mode";
var label = "&#8645";
//var label = "+";
//var label = "&#54629";
var a = L.DomUtil.create('a','leaflet-control-zoom-in leaflet-interactive');
a.innerHTML = label;
a.title = title;
this._div = div;
this._button = a;
this._state = false;
div.appendChild(a);
this._registerEvents();
return div;
},
onRemove: function(){
// Nothing to do here
},
getState: function(){
return this._state;
},
_registerEvents: function(){
var self = this;
L.DomEvent.on(this._button, 'click', function(){
self._state = !self._state;
self._buttonColor();
}, this._button);
},
_buttonColor: function(){
if (this._state){
this._button.style.backgroundColor = "rgba(136,255,136,1)";
}else{
this._button.removeAttribute("style");
}
}
});
L.control.cameraViewMarkerControls = function (options) {
return new L.Control.CameraViewMarkerControls(options);
};
}(this,document));
\ No newline at end of file
This diff is collapsed.
......@@ -9,14 +9,14 @@
https://www.elphel.com
*/
/**
/**
* @file leaflet.camera-view-marker.measure.js
* @brief extends Leaflet.CameraViewMarker with distance measuring tool
*
*
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @licstart The following is the entire license notice for the
* @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
......@@ -50,30 +50,30 @@
L.CameraViewMarker.include({
createMeasureMarker: function(param,distance){
var latlng = param;
// param is event
if(param.target){
latlng = param.latlng;
}
var p1_ll = this._latlng;
// param was angle then need distance
if (!(latlng instanceof L.LatLng)){
latlng = p1_ll.CoordinatesOf(param,distance);
}
var p2_ll = latlng;
var l_d = Array(p1_ll,p2_ll);
var pll = L.polyline(l_d, {
color: '#1f1',
weight:1,
color: '#1f1',
weight:1,
dashArray:"5,5"
}).addTo(this._layerPaint).bringToBack();
//circle
var tmp_point = new L.CircleMarker(latlng,{
color: '#1f1',
......@@ -82,82 +82,82 @@
fillOpacity: 0.5,
radius: 5,
}).addTo(this._layerPaint);
var distance = latlng.distanceTo(this._latlng).toFixed(1);
tmp_point.bindTooltip(distance+' m',{
permanent:"true",
direction:"right",
className: "measurementtooltip",
offset:[0,0],
}).openTooltip();
tmp_point.on('click',this._measureMarkerClick,this);
tmp_point.on('mousedown',this._dragMeasureMarker,this);
tmp_point._index = this._measureMarkers.length;
this._measureMarkers.push(tmp_point);
this._measureLines.push(pll);
return tmp_point._index;
},
moveMeasureMarker: function(param,index){
var latlng = param;
if (param.target){
index = this.draggedMarker._index;
latlng = param.latlng;
// prevent image getting grabbed by browser
param.originalEvent.preventDefault();
}
var p1_ll = this._latlng;
var p2_ll = latlng;
var l_d = Array(p1_ll,p2_ll);
this._measureMarkers[index].setLatLng(latlng);
this._measureLines[index].setLatLngs(l_d);
var distance = p2_ll.distanceTo(p1_ll).toFixed(1);
this._measureMarkers[index]._tooltip.setContent(distance+' m');
this.draggedMarker = {
_index: index,
_latlng: latlng
};
this._syncMeasureMarkersToBasePoint();
},
removeMeasureMarker: function(param){
var index = param;
if(param.target){
index = param.target._index;
L.DomEvent.stopPropagation(param);
}
this._layerPaint.removeLayer(this._measureMarkers[index]);
this._layerPaint.removeLayer(this._measureLines[index]);
this._measureMarkers.splice(index,1);
this._measureLines.splice(index,1);
this._updateMeasureMarkersIndices();
},
placeSlidingMarker: function(angle,distance){
var p1_ll = this._measureBase;
var p2_ll = p1_ll.CoordinatesOf(angle,distance);
var l_d = Array(p1_ll,p2_ll);
if (this._slidingMarker == undefined){
......@@ -168,43 +168,43 @@
fillOpacity: 0.5,
radius: 5,
}).addTo(this._layerPaint);
this._slidingLine = L.polyline(l_d, {
color: '#1f1',
weight:1,
color: '#1f1',
weight:1,
dashArray:"5,5"
}).addTo(this._layerPaint).bringToBack();
this._slidingMarker.bindTooltip(distance.toFixed(1)+' m',{
permanent:"true",
direction:"right",
className: "measurementtooltip",
offset:[0,0],
}).openTooltip();
}else{
this._slidingMarker.setLatLng(p2_ll);
this._slidingLine.setLatLngs(l_d);
this._slidingMarker._tooltip.setContent(distance.toFixed(1)+' m');
}
},
removeSlidingMarker: function(){
if (this._slidingMarker != undefined){
this._layerPaint.removeLayer(this._slidingMarker);
this._layerPaint.removeLayer(this._slidingLine);
delete this._slidingMarker;
delete this._slidingLine;
}
},
onAdd: function(){
this._initCameraViewMarker();
......@@ -213,18 +213,18 @@
},
_initCVM_M: function(){
this._measuring = false;
this._measureMarkers = Array();
this._measureLines = Array();
this._map.doubleClickZoom.disable();
this._registerEvents_M();
this._measureBase = this._latlng;
this.draggedMarker = {
_index: null,
_latlng: null
......@@ -238,7 +238,7 @@
this._map.on('mousemove',this._mouseMove_M,this);
this._map.on('click', this._toggleMeasureMode, this);
this._map.on('mousemove',this._syncMeasureMarkersToBasePoint, this);
},
_mouseMove_M: function(e){
......@@ -250,22 +250,22 @@
}
},
_toggleMeasureMode: function(e){
if (e.originalEvent.ctrlKey){
this.createMeasureMarker(e);
}
/*
self._measuring = !self._measuring;
if(self._measuring){
self._basePoint.off('mousedown',self._dragCamera, self);
self._map._container.style.cursor = "crosshair";
self._map.on('click', self._placeMeasurePoint, self);
}else{
self._basePoint.on('mousedown',self._dragCamera, self);
self._map._container.style.cursor = "default";
......@@ -273,7 +273,7 @@
}
*/
},
_measureMarkerClick:function(e){
if (e.originalEvent.ctrlKey){
......@@ -281,22 +281,22 @@
}
},
_syncMeasureMarkersToBasePoint: function(e){
if (this._measureMarkers.length!=0){
if (this._measureBase!=this._latlng){
var self = this;
this._measureMarkers.forEach(function(c,i){
var p1_ll = self._latlng;
var p2_ll = c.getLatLng();
var l_d = Array(p1_ll,p2_ll);
self._measureLines[i].setLatLngs(l_d);
var distance = p2_ll.distanceTo(p1_ll).toFixed(1);
c._tooltip.setContent(distance+' m');
});
......@@ -304,54 +304,54 @@
this._measureBase=this._latlng;
}
}
},
_dragMeasureMarker: function(e){
if (!e.originalEvent.ctrlKey){
this.draggedMarker = {
_index: e.target._index,
_latlng: e.target._latlng
};
this._map.dragging.disable();
this._map.off('mousemove',this._mouseMove,this);
this._map.off('click',this._mouseClick,this);
this._map.on('mousemove',this.moveMeasureMarker,this);
this._map.on ('mouseup',this._mouseUp_M,this);
}
},
_mouseUp_M: function(){
this._map.off('mousemove',this.moveMeasureMarker,this);
this._map.dragging.enable();
this._map.on ('mousemove',this._mouseMove,this);
this._map.off ('mouseup',this._mouseUp_M,this);
this.draggedMarker._index = null;
},
_updateMeasureMarkersIndices:function