Commit 0d16388e authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

moved from private repo

parents
[Dolphin]
PreviewsShown=true
SortRole=date
Timestamp=2017,5,23,18,34,17
Version=3
ViewMode=1
// http://stackoverflow.com/questions/9394190/leaflet-map-api-with-google-satellite-layer
// http://leafletjs.com/examples/extending/extending-1-classes.html
// - extend or include
var LeafletObject = function(id,data,options){
var defaults = {
debug: true,
highlight: true,
maxzoom: 21,
zoom: 17,
fov: 30*Math.PI/180,//deg
};
this._settings = $.extend(defaults,options);
this._id = id;
//[40.7233861, -111.9328843];
this.center = [data.camera.latitude,data.camera.longitude];
this.heading = data.camera.heading;
//this.heading = 0;//data.camera.heading;
this.fov = data.camera.fov;
this.initialize();
};
LeafletObject.prototype.initialize = function(){
// https: also suppported.
var Esri_WorldImagery = L.tileLayer(
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
{
maxZoom: this._settings.maxzoom,
attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}
);
var googleSat = L.tileLayer(
'https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
{
maxZoom: this._settings.maxzoom,
attribution: 'Thanks to comrade Google for our happy childhood',
subdomains:['mt0','mt1','mt2','mt3'],
}
);
var OSMTiles = L.tileLayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: this._settings.maxzoom,
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>'
}
);
this._map = L.map(this._id,{
layers:[googleSat]
}).setView(this.center, this._settings.zoom);
var baseMaps = {
"Esri world imagery": Esri_WorldImagery,
"Google": googleSat,
"Open Street Map": OSMTiles
};
L.control.layers(baseMaps).addTo(this._map);
this.drawCamera();
}
LeafletObject.prototype.drawCamera = function(){
this.marker = L.cameraViewMarker(this.center, {
color: '#191',
fillColor: '#0f3',
fillOpacity: 0.5,
radius: 10,
heading: this.heading,
fov: this.fov,
draw_xz: false,
h_control: true,
id: "basecircle"
}).addTo(this._map);
}
LeafletObject.prototype.highlightMarker = function(index){
var style = {color:'#f88',fillColor:"#f30"};
this.marker._measureMarkers[index].setStyle(style).bringToFront();
this.marker._measureMarkers[index]._tooltip.bringToFront();
this.marker._measureLines[index].setStyle(style).bringToFront();
}
LeafletObject.prototype.dehighlightMarker = function(index){
var style = {color:'#1f1',fillColor:"#0f3"};
this.marker._measureMarkers[index].setStyle(style);
this.marker._measureLines[index].setStyle(style);
}
LeafletObject.prototype.toggleMarker = function(index){
//console.log("Toggling "+index);
if (!this.marker._measureMarkers[index]._selected){
this.marker._measureMarkers[index]._selected = true;
}else{
this.marker._measureMarkers[index]._selected = false;
}
//console.log(this.marker._measureMarkers[index]._selected);
}
LeafletObject.prototype.deleteMarker = function(index){
this.marker.removeMeasureMarker(index);
}
This diff is collapsed.
function align_init(){
$("#align_button").on("click",function(){
align_heading();
});
}
function align_heading(){
// find selected markers
// pick the first one?
// align?!
console.log("heading");
var map_markers = Map.marker._measureMarkers;
var selected_markers = [];
map_markers.forEach(function(c,i){
if (selected_markers.length<2){
if (c._selected){
selected_markers.push(c);
}
}
});
if (selected_markers.length<2){
console.log("select 2 markers");
Scene.showMessage("messagewindow","error: select 2 markers","red");
}
console.log(selected_markers);
}
function align_roll(){
console.log("roll");
}
function align_tilt(){
console.log("tilt");
}
function help_init(){
/*
var help_content = `
<div>
<table>
<tr>
<td>asdfasdfadfasdfasdfasfHelp!</td>
</tr>
</table>
</div>
`;
var help = $("<div>",{id:"help-content"}).css({
display:"none"
}).html(help_content);
*/
var help = $("#help-content");
help.hide();
$("#help_button").on("click",function(){
help.show();
});
help.on('click',function(){
help.hide();
});
}
\ No newline at end of file
[Dolphin]
PreviewsShown=true
SortRole=date
Timestamp=2017,5,30,10,40,30
Version=3
ViewMode=1
This diff is collapsed.
body{
padding: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 0px;
overflow:hidden;
}
#x3d_id{
border: 0px;
}
#x3dom_logdiv{
position: absolute;
left: 0px;
bottom:0px;
width:99%;
}
.x3dom-canvas{
cursor:pointer;
}
body {
padding: 0;
margin: 0;
}
html, body, #x3d_wrapper {
height: 100vh;
width: 100vw;
}
#map_wrapper{
position: absolute;
right: 2px;
bottom: 2px;
width: 500px;
height: 400px;
border: 2px solid white;
border-radius: 2px;
z-index: 10000;
}
#leaflet_map{
width: 500px;
height: 400px;
}
.measurementtooltip{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0px 3px;
/* margin:20px 0px 0px 7px; */
font-weight: normal;
border-radius: 1px;
font-size: 16px;
display:block;
position:absolute;
top: 16px;
left: 3px;
}
.leaflet-tooltip-left.measurementtooltip::before {
border: 0px;
border-left-color: cyan;
}
.leaflet-tooltip-right.measurementtooltip::before {
border: 0px;
border-right-color: cyan;
}
#infowindow, #infowindow div{
z-index:10;
background:rgba(220,220,220,1);
border:0px solid rgba(100,100,100,0.5);
border-radius: 2px;
color:black;
font-size:20px;
}
#window-info, #window-info div{
z-index:10;
background:rgba(220,220,220,1);
border:0px solid rgba(100,100,100,0.5);
border-radius: 2px;
color:black;
/* font-size:20px; */
}
#map_resizer_handle{
position:absolute;
top:-8px;
left:-8px;
width:16px;
height:16px;
border-radius:8px;
background-color:white;
z-index:1000;
cursor:move;
}
.leaflet-tooltip-pane { z-index: 350; }
.leaflet-control-zoom-in, .leaflet-control-zoom-out{
user-select:none;
}
.leaflet-control-zoom{
user-select:none;
}
.leaflet-interactive img{
user-select:none;
pointer-events: none;
}
.leaflet-interactive path{
user-select:none;
pointer-events: none;
}
#help_wrapper{
position:absolute;
top:2px;
right:2px;
/* width:30%;
height:100%;*/
/* background: rgba(200,100,100,0.5); */
z-index: 1000;
}
#help_button{
background: white;
border: 0px solid white;
border-radius: 2px;
font-size: 20px;
font-weight: bold;
padding: 5px 10px;
margin-bottom: 2px;
}
#help_button:focus {outline:0;}
#help_button:hover {
background: rgba(240,240,240,1);
}
#help-content, #menu-content{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border-radius:2px;
border: 0px solid gray;
color:white;
font-size:16px;
padding: 20px 100px;
background:rgba(50,50,50,0.9);
overflow:auto;
display:none;
z-index:10000;
}
#menu_button{
background-image:url('images/settings.png');
background-size: 32px 32px;
background-repeat: no-repeat;
background-color:white;
width: 32px;
height: 32px;
border: 0px solid white;
border-radius: 2px;
margin-bottom: 2px;
}
#menu_button:hover {
/* background-image:url('images/settings.png'); */
background-color: rgba(240,240,240,1);
}
.my-check-box {
width:25px;
height:25px;
}
#align_button{
background-image:url('images/align.png');
background-size: 32px 32px;
background-repeat: no-repeat;
background-color:white;
width: 32px;
height: 32px;
border: 0px solid white;
border-radius: 2px;
margin-bottom: 2px;
}
#align_button:hover {
/* background-image:url('images/align.png'); */
background-color: rgba(240,240,240,1);
}
.crosshair{
background: rgba(50,200,50,0.5);
display:none;
}
#crosshair_h{
position:absolute;
width: 512px;
height: 2px;
}
#crosshair_v{
position:absolute;
height: 512px;
width: 2px;
}
#window-info{
display:block;
font-size: 16px;
}
#window-viewinfo{
z-index: 10;
background: rgba(220,220,220,1);
border: 0px solid rgba(100,100,100,0.5);
border-radius: 1px;
color: black;
font-size: 16px;
margin-top: 2px;
}
#window-viewinfo td{
text-align:center;
}
.input{
text-align: right;
width: 100px;
height: 20px;
font-size: 16px;
border-radius: 2px;
}
.hcontrol-button{
background-color: red;
}
.hcontrol-button:hover{
background-color: red;
}
#info-wrapper{
position: absolute;
left:2px;
bottom:2px;
}
This diff is collapsed.
/*
*
* Copyright (C) 2017 Elphel Inc.
* License: GPLv3
*
*/
var X3L = function(options){
var defaults = {
x: 0,
y: 0,
z: 0,
latitude: 0,
longitude: 0,
altitude: 0,
heading: 0,
tilt: 90,
roll: 0,
fov: 0
};
this._data = $.extend(defaults,options);
this.x = this._data.x;
this.y = this._data.y;
this.z = this._data.z;
this.longitude = this._data.longitude;
this.latitude = this._data.latitude;
this.altitude = this._data.altitude;
this.heading = this._data.heading;
this.tilt = this._data.tilt;
this.roll = this._data.roll;
this.fov = this._data.fov;
};
[Dolphin]
PreviewsShown=true
SortRole=date
Timestamp=2017,5,23,18,34,26
Version=3
ViewMode=1
(function (window, document, undefined) {
"use strict";
//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);
}
}(this,document));
This diff is collapsed.
This diff is collapsed.
(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.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
function menu_init(){
// init checkboxes
for (var setting in SETTINGS){
if (typeof SETTINGS[setting] === 'boolean'){
if (SETTINGS[setting]){
$("#"+setting).prop("checked",true);
}else{
$("#"+setting).prop("checked",false);
}
}else{
//number?
$("#"+setting).val(SETTINGS[setting]);
}
}
// init options menu
var menu = $("#menu-content");
$("#menu_button").on("click",function(){
menu.show();
});
// changing a checkbox will not close menu
menu.on('click',function(e){
var class1 = $(e.target).hasClass("my-check-box");
var class2 = $(e.target).hasClass("input");
if (!class1&&!class2){
menu.hide();
}
});
// change checkbox
$(".my-check-box").on('click',function(e){
var state = $(this).prop("checked");
var id = $(this).attr("id");
if (state==true){
SETTINGS[id] = true;
}else{
SETTINGS[id] = false;
}
});
crosshair_init();
shiftspeed_init();
}
function crosshair_init(){
if (SETTINGS.crosshair){