Commit 866509ce authored by Jérémie Garcia's avatar Jérémie Garcia
Browse files

cleaning ongoing (Init + VIEW OK)

parent 6feefa71
WOB/qr_code.png

631 Bytes | W: | H:

WOB/qr_code.png

627 Bytes | W: | H:

WOB/qr_code.png
WOB/qr_code.png
WOB/qr_code.png
WOB/qr_code.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -983,7 +983,7 @@ var def_server = global.interface.serverRow(default_traj_server);
//global.interface.trajectoiresPage = fs.readFileSync( './server/interfaces/Trajectoires.html', ['utf-8'] );
//OLD FUNCTIONS WITH IP ADDRESS INSTEAD OF COMPUTER'S NAME
/*
var interfaces = os.networkInterfaces();
var addresses = [];
for (var k in interfaces) {
......@@ -995,9 +995,9 @@ var def_server = global.interface.serverRow(default_traj_server);
}
}
var server_ip = addresses[0];
*/
var server_ip = os.hostname();
// var server_ip = os.hostname();
var link = 'http://' + server_ip + ':8080/Trajectoires.html';
//URL DISPLAY
......@@ -1005,7 +1005,7 @@ var div_text = "<a href=\"" +link + "\" target=\"_blank\">"+ link +"</a>" ;
var target_div = $('#target-url').html( div_text );
//QR CODE
var code = qr.image(link, { type: 'png' });
var code = qr.image(link, { type: 'png' });
var code_path = 'qr_code.png';
var output = fs.createWriteStream(code_path);
code.pipe(output);
......
<!DOCTYPE html>
<html>
<string name="app_name">Trajectoires</string>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height = device-height" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" href="libs/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.css">
<script type="text/javascript" src='interface.js'></script>
<script type="text/javascript" src="libs/fastclick.min.js"></script>
<script type="text/javascript" src="libs/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="libs/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link type="text/css" rel="stylesheet" href="libs/jquery.nstSlider.css">
<script type="text/javascript" src="js/OSCManager.js"></script>
<script type="text/javascript" src="js/rotations.js"></script>
<title>Trajectoires</title>
</head>
<body onresize="javascript:traj_initCanvas()">
<!-- Start of first page -->
<div id="main-page" data-role="page" data-theme="a">
<div id=footer data-role="footer">
</div>
<!-- /footer -->
</div>
<!-- /page -->
<script type="text/javascript">
app.initialize();
$.mobile.loading().hide();
</script>
</body>
</html>
\ No newline at end of file
......@@ -21,7 +21,7 @@
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/TimedCurve.js"></script>
<script type="text/javascript" src="js/Session.js"></script>
<script type="text/javascript" src="js/OSC.js"></script>
<script type="text/javascript" src="js/OSC-spat.js"></script>
<script type="text/javascript" src="js/TrajManager.js"></script>
<script type="text/javascript" src="js/Utils.js"></script>
<script type="text/javascript" src="js/View.js"></script>
......@@ -30,8 +30,6 @@
<script type="text/javascript" src="js/HTMLFunction.js"></script>
<script type="text/javascript" src="libs/hammer.js"></script>
<title>Trajectoires</title>
</head>
......@@ -46,12 +44,6 @@
<h1>Settings</h1>
<!-- <label>Zoom: </label>
<div data-role="controlgroup" data-type="horizontal">
<a onClick="javascript:setCanvasZoom(0.8);" data-role="button" data-theme="a" data-inline="true"> - </a>
<a onClick="javascript:setCanvasZoom(1.2);" data-role="button" data-theme="a" data-inline="true"> + </a>
</div> -->
<label> Undo: </label>
<div>
<a onClick="javascript:Trajectoires.State.undo();" data-role="button" data-theme="a" data-icon="back" data-inline="true"></a>
......@@ -93,7 +85,7 @@
</form>
<form>
<label for="flip-timeSlider">Show Z Slider:</label>
<label for="flip-zSlider">Show Z Slider:</label>
<select name="flip-zSlider" id="flip-zSlider" data-role="slider" data-theme="b" onchange="javascript:setZSliderMode()">
<option value="off" selected="selected">Off</option>
<option value="on">On</option>
......@@ -156,7 +148,7 @@
<div id='drawZone' data-role="none">
<svg width="100" height="160" xmlns="http://www.w3.org/2000/svg">
<svg id="drawzoneSVG" width="100" height="160" xmlns="http://www.w3.org/2000/svg">
<g>
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<ellipse id='drawZoneEl' ry="90" rx="61" id="svg_8" cy="86" cx="25" fill-opacity='0.6' fill="#ccf2a7" />
......@@ -165,16 +157,6 @@
<img id='drawZoneImg' src="libs/crayon.jpg" alt="image crayon" />
</div>
<div id='drawZoneRight' data-role="none">
<svg width="100" height="160" xmlns="http://www.w3.org/2000/svg">
<g>
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<ellipse id='drawZoneElRight' ry="90" rx="61" id="svg_8" cy="86" cx="80" fill-opacity='0.6' fill="#ccf2a7" />
</g>
</svg>
<img id='drawZoneImgRight' src="libs/crayon.jpg" alt="image crayon" />
</div>
<div id="divCurveMenu" class="left">
......@@ -297,25 +279,13 @@
</div>
<!-- <div id="tapHoldMenu" data-role="controlgroup">
<FORM NAME="myform" ACTION="" METHOD="GET">
Enter something in the box: <BR>
<INPUT TYPE="text" NAME="inputbox" VALUE=" 1"><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)">
</FORM> -->
<!-- <a href="#" class="ui-btn ui-corner-all">Options</a>
<a href="#" class="ui-btn ui-corner-all">Copy</a>
<a href="#" class="ui-btn ui-corner-all">Paste</a>
<a id="selectButton" data-role="button">Select</a>
</div>-->
<div id="contextMenu" style="position:absolute;top:100px;left 300px">
<button id="newButton"> New </button>
<button id="circularButton"> Circular </button>
<button id="concatButton"> Concat </button>
<button id="circularButton" class="contextualButton" >Circular</button>
<button id="concatButton" class="contextualButton" >Concat</button>
</div>
<div id="longTouchMenu" style="position:absolute;top:100px;left 300px">
<a href="#" onClick="javascript:deleteCurrentCurve();" data-mini="true" data-role="button" data-icon="delete">Remove</a>
<a href="#" onClick="javascript:modeSelectEdit();" data-mini="true" data-role="button" data-icon="edit">Select and redraw</a>
......
......@@ -85,31 +85,6 @@ body {
opacity: 0.7;
}
/* OLD */
/*#sourceSelect {
position: absolute;
bottom: 10px;
height: 200px;
width: 200px;
}
.buttonSource {
position:absolute;
top:20px;
left:5px;
height: 30px;
width:30px;
border-radius: 20px;
z-index: 5;
}
.sourceInput {
width: 20px;
height: 20px;
margin: 10px;
}*/
/* NEW */
.sourceButton{
margin : -3px;
......@@ -379,7 +354,12 @@ a.curveMenuButton {
}
.contextualButton{
background-color: white;
border: 1px solid black;
opacity: 0.8;
font-size: 10px;
}
.circularButton {
z-index: 5!important;
......
This diff is collapsed.
......@@ -7,70 +7,70 @@ function sendTrigger(message) {}
//Functions called from Html interface
function deleteCurrentCurve() {
Trajectoires.TrajManager.deleteCurve(Trajectoires.TrajManager.currentCurveIndex);
Trajectoires.EventManager.hideLongTouchMenu();
Traj.TrajManager.deleteCurve(Traj.TrajManager.currentCurveIndex);
Traj.EventManager.hideLongTouchMenu();
}
function selectNextCurve() {
Trajectoires.TrajManager.selectCurve((Trajectoires.TrajManager.currentCurveIndex + 1) % Trajectoires.TrajManager.trajectories.length);
Traj.TrajManager.selectCurve((Traj.TrajManager.currentCurveIndex + 1) % Traj.TrajManager.trajectories.length);
}
function selectPreviousCurve() {
Trajectoires.TrajManager.selectCurve((Trajectoires.TrajManager.currentCurveIndex - 1 + Trajectoires.TrajManager.trajectories.length) % Trajectoires.TrajManager.trajectories.length);
Traj.TrajManager.selectCurve((Traj.TrajManager.currentCurveIndex - 1 + Traj.TrajManager.trajectories.length) % Traj.TrajManager.trajectories.length);
}
function sendTriggerPlay() {
Trajectoires.OSC.sendPlay("Play");
Traj.OSC.sendPlay("Play");
}
function sendTriggerRecord() {
Trajectoires.OSC.sendRecord("Record");
Traj.OSC.sendRecord("Record");
}
//Getters and Setters
function setCanvasZoom(factor) {
//if (logger) writtraj_canvasog("traj_canvas Zoom " + factor);
Trajectoires.View.scaleFactor = Trajectoires.View.scaleFactor / factor;
Trajectoires.View.pixToValue = Trajectoires.View.scaleFactor / Trajectoires.View.minWH;
Trajectoires.View.repaintAll();
Traj.View.scaleFactor = Traj.View.scaleFactor / factor;
Traj.View.pixToValue = Traj.View.scaleFactor / Traj.View.minWH;
Traj.View.repaintAll();
}
function setDrawCurvesInBackground() {
Trajectoires.View.backgroundCurve = document.getElementById("flip-curvesinback").value == 'on';
Trajectoires.View.traj_repaint();
Trajectoires.View.dyn_repaint();
Traj.View.backgroundCurve = document.getElementById("flip-curvesinback").value == 'on';
Traj.View.traj_repaint();
Traj.View.dyn_repaint();
}
function setLoopMode() {
Trajectoires.Player.loopMode = document.getElementById("flip-loop").value == 'on';
Traj.Player.loopMode = document.getElementById("flip-loop").value == 'on';
}
function setOrientationMode() {
Trajectoires.EventManager.stream_orientation = document.getElementById("flip-orientation").value == 'on';
Traj.EventManager.stream_orientation = document.getElementById("flip-orientation").value == 'on';
}
function setHpDistance() {
Trajectoires.View.SPEAKER_DIST = document.getElementById("speaker_dist").value;
Trajectoires.View.bg_repaint();
Traj.View.SPEAKER_DIST = document.getElementById("speaker_dist").value;
Traj.View.bg_repaint();
}
function exportCurrentCurve(){
exportCurrentCurveAsAntescofoNIM();
if(Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex]){
if(Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex].X.length <1000){
Trajectoires.OSC.sendCurveSingleMessageOSC(Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex], Trajectoires.TrajManager.currentCurveIndex);
if(Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex]){
if(Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex].X.length <1000){
Traj.OSC.sendCurveSingleMessageOSC(Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex], Traj.TrajManager.currentCurveIndex);
}else{
Trajectoires.OSC.sendCurveOSC(Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex], Trajectoires.TrajManager.currentCurveIndex);
Traj.OSC.sendCurveOSC(Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex], Traj.TrajManager.currentCurveIndex);
}
}
Trajectoires.Session.saveInSelectedSession();
Traj.Session.saveInSelectedSession();
}
function exportCurrentCurveAsAntescofoNIM(){
var manager = Trajectoires.TrajManager;
var manager = Traj.TrajManager;
if(manager.trajectories[manager.currentCurveIndex]){
Trajectoires.OSC.saveAntescofo(manager.trajectories[manager.currentCurveIndex], manager.currentCurveIndex, Trajectoires.Session.currentSession);
Traj.OSC.saveAntescofo(manager.trajectories[manager.currentCurveIndex], manager.currentCurveIndex, Traj.Session.currentSession);
}
}
......@@ -85,53 +85,53 @@ function setTimeSliderMode() {
}
function simplifyCurrentCurve(tolerance) {
var currentCurve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var currentCurve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (currentCurve != undefined) {
var newCurve = Trajectoires.Utils.simplifyCurve(currentCurve,tolerance);
Trajectoires.TrajManager.trajectories.push(newCurve);
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.trajectories.length-1);
var newCurve = Traj.Utils.simplifyCurve(currentCurve,tolerance);
Traj.TrajManager.trajectories.push(newCurve);
Traj.TrajManager.selectCurve(Traj.TrajManager.trajectories.length-1);
}
}
function changeSourceControled() {
var curveIdx = Trajectoires.TrajManager.currentCurveIndex;
var curve = Trajectoires.TrajManager.trajectories[curveIdx];
var curveIdx = Traj.TrajManager.currentCurveIndex;
var curve = Traj.TrajManager.trajectories[curveIdx];
if (curve != undefined) {
var source = Number(document.getElementById("sourceControled").value);
curve.changeSource(source);
Trajectoires.View.current_repaint();
Trajectoires.View.traj_repaint();
Trajectoires.View.dyn_repaint();
Traj.View.current_repaint();
Traj.View.traj_repaint();
Traj.View.dyn_repaint();
}
}
function activeMultiPlay() {
var curveIdx = Trajectoires.TrajManager.currentCurveIndex;
if (Trajectoires.TrajManager.trajectories[curveIdx]) {
Trajectoires.TrajManager.trajectories[curveIdx].multiPlay = document.getElementById("checkPlay").checked;
Trajectoires.TrajManager.multiPlayChanged(0);
var curveIdx = Traj.TrajManager.currentCurveIndex;
if (Traj.TrajManager.trajectories[curveIdx]) {
Traj.TrajManager.trajectories[curveIdx].multiPlay = document.getElementById("checkPlay").checked;
Traj.TrajManager.multiPlayChanged(0);
}
}
function removeMultiPlay() {
var trajectories = Trajectoires.TrajManager.trajectories;
var trajectories = Traj.TrajManager.trajectories;
for (var k=0;k<trajectories.length;k++) {
trajectories[k].multiPlay = false;
}
Trajectoires.TrajManager.playedCurves = [];
Trajectoires.EventManager.refreshCurveInfo();
Trajectoires.TrajManager.multiPlayChanged();
Traj.TrajManager.playedCurves = [];
Traj.EventManager.refreshCurveInfo();
Traj.TrajManager.multiPlayChanged();
}
function modeSelectEdit() {
var curveIdx = Trajectoires.TrajManager.currentCurveIndex;
if (Trajectoires.TrajManager.trajectories[curveIdx]) {
Trajectoires.EventManager.initSlider(true)
var curveIdx = Traj.TrajManager.currentCurveIndex;
if (Traj.TrajManager.trajectories[curveIdx]) {
Traj.EventManager.initSlider(true)
$("#divCurveOptions").hide();
$("#divCurveOptions").removeClass( "show" ).addClass( "hide" );
$("#playDiv").show();
Trajectoires.View.bg_repaint(true);
Traj.View.bg_repaint(true);
}
Trajectoires.EventManager.hideLongTouchMenu();
Traj.EventManager.hideLongTouchMenu();
}
function setZSliderMode() {
......@@ -145,7 +145,7 @@ function setZSliderMode() {
function changeScale(axis,scale) {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
if (axis == 'x') {
curve.changeXScale(scale);
......@@ -154,66 +154,66 @@ function changeScale(axis,scale) {
} else if (axis == 'z') {
curve.changeZScale(scale);
}
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.currentCurveIndex);
Traj.TrajManager.selectCurve(Traj.TrajManager.currentCurveIndex);
}
}
function changeTime() {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
var inputTime = document.getElementById('timeStretch');
curve.changeTotalTime(Number(inputTime.value));
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.currentCurveIndex);
Trajectoires.EventManager.initSlider(false);
Traj.TrajManager.selectCurve(Traj.TrajManager.currentCurveIndex);
Traj.EventManager.initSlider(false);
}
}
function translateCurve() {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
var inputX = document.getElementById('xOriPos').value;
var inputY = document.getElementById('yOriPos').value;
var inputZ = document.getElementById('zOriPos').value;
curve.translate(Number(inputX),Number(inputY),Number(inputZ));
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.currentCurveIndex);
Traj.TrajManager.selectCurve(Traj.TrajManager.currentCurveIndex);
}
}
function copyCurrentCurve() {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
Trajectoires.TrajManager.copyCurrentCurve(0,curve.X.length-1);
Trajectoires.EventManager.hideLongTouchMenu();
Traj.TrajManager.copyCurrentCurve(0,curve.X.length-1);
Traj.EventManager.hideLongTouchMenu();
}
}
function pasteInCurrentCurve() {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
var beginTime = Trajectoires.EventManager.getSliderValue();
var beginIdx = Trajectoires.Utils.findPointIdx(beginTime,curve);
Trajectoires.TrajManager.pasteInCurve(curve,beginIdx,beginIdx);
Trajectoires.EventManager.hideLongTouchMenu();
//Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.trajectories.length-1);
var beginTime = Traj.EventManager.getSliderValue();
var beginIdx = Traj.Utils.findPointIdx(beginTime,curve);
Traj.TrajManager.pasteInCurve(curve,beginIdx,beginIdx);
Traj.EventManager.hideLongTouchMenu();
//Traj.TrajManager.selectCurve(Traj.TrajManager.trajectories.length-1);
}
}
function duplicateCurrentCurve() {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
var newCurve = curve.clone();
var XYZ = [newCurve.X[0]+0.1,newCurve.Y[0]-0.1,newCurve.Z[0]];
newCurve.translate(XYZ[0],XYZ[1],XYZ[2]);
Trajectoires.TrajManager.trajectories.push(newCurve);
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.trajectories.length-1);
Trajectoires.EventManager.hideLongTouchMenu();
Traj.TrajManager.trajectories.push(newCurve);
Traj.TrajManager.selectCurve(Traj.TrajManager.trajectories.length-1);
Traj.EventManager.hideLongTouchMenu();
}
}
function mirror(type) {
var curve = Trajectoires.TrajManager.trajectories[Trajectoires.TrajManager.currentCurveIndex];
var curve = Traj.TrajManager.trajectories[Traj.TrajManager.currentCurveIndex];
if (curve != undefined) {
if (type == 'x') {
curve.xMiror();
......@@ -224,7 +224,7 @@ function mirror(type) {
} else if (type == 't') {
curve.tMiror();
}
Trajectoires.TrajManager.selectCurve(Trajectoires.TrajManager.currentCurveIndex);
Traj.TrajManager.selectCurve(Traj.TrajManager.currentCurveIndex);
}
}
////////////////////////////////////////////////////////////
///////////////////////// OSC /////////////////////////////
Traj.OSC = {
//OSC Protocol
spat_address : '/spat',
traj_address : '/traj',
pos_address : '/traj/posxyz',
trajpoint_address : '/traj/trajpoint',
traj_new_address : '/traj/newtraj',
traj_suffix : '/traj',
play_address : '/traj/play',
record_address : '/traj/record',
orientation_address : '/traj/orientation',
draw_address : '/traj/draw',
// SENDING MESSAGES
isInteger : function(value) {
if ((undefined === value) || (null === value)) {
return false;
}
return value % 1 == 0;
},
getTypeForElement : function(elem){
var type = typeof elem;
switch (type) {
case 'string':
return 's';
break;
case 'boolean':
return 'b';
break;
case 'number':
return Traj.OSC.isInteger(elem) ? 'i' : 'f';;
break;
default:
return 'f';
}
},
getTypesForArgs : function(args){
var tt = '';
if(typeof args === 'string')
return 's';
for(var i = 0; i < args.length; i++) {
tt += Traj.OSC.getTypeForElement(args[i]);
}
return tt;
},
sendMessage : function(address, msg) {
var tt = Traj.OSC.getTypesForArgs(msg);
Interface.OSC.send(address, tt, msg );
},
//RECEIVING MESSAGE
processMessages : function(msg) {
var address = msg.address;
var split = address.split('/');
//test for the correct namespace
console.log(split[1]);
if(split[1].indexOf("spat") != -1 ){
console.log(split[2]);
if(split[2].indexOf("source") != -1){
var nb = (split[2].replace("source",""));
var sourcenb = Number(nb);
var curve = new TimedCurve();
for (var k =0; k<msg.parameters.length/4;k++) {
curve.addTimedPoint(msg.parameters[4*k],msg.parameters[4*k+1],msg.parameters[4*k+2],msg.parameters[4*k+3]);
}
var manager = Traj.TrajManager;
manager.trajectories.push(curve);
curve.changeSource(sourcenb); // care : to change the source of a curve, the curve need to be already pushed in trajectories
Traj.View.traj_repaint();
//manager.selectCurve(manager.trajectories.length-1);
}
}
},
//FACILITIES
sendPosxyzMsg : function(msg) {
Traj.OSC.sendMessage(Traj.OSC.pos_address, msg);
},
sendSpatMessage: function(msg){
Traj.OSC.sendMessage(Traj.OSC.spat_address,msg);
},
sendTrajPoint : function(msg) {
Traj.OSC.sendMessage(Traj.OSC.trajpoint_address, msg);
},