Changeset 14136 for trunk/FACT++/www/smartfact
- Timestamp:
- 06/09/12 21:32:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/smartfact/index.js
r14121 r14136 1117 1117 { 1118 1118 if (col==65533) 1119 col = 0;1120 1121 var hue = col/128;1119 return HLStoRGB(0); 1120 1121 var hue = (col-1)/127; 1122 1122 return HLStoRGB(hue); 1123 1123 } … … 1360 1360 1361 1361 // --- data --- 1362 if (data.length>1) 1363 { 1362 for (var j=1; j<data.length; j++) 1363 { 1364 if (data[j].length<2) 1365 continue; 1366 1364 1367 ctx.beginPath(); 1365 ctx.moveTo(ml, ch-mb- data.charCodeAt(0)/128*h);1366 for (var i=1; i<data .length; i++)1367 ctx.lineTo(ml+w/(data .length-1)*i, ch-mb-data.charCodeAt(i)/128*h);1368 ctx.moveTo(ml, ch-mb-(data[j].charCodeAt(0)-1)/126*h); 1369 for (var i=1; i<data[j].length; i++) 1370 ctx.lineTo(ml+w/(data[j].length-1)*i, ch-mb-(data[j].charCodeAt(i)-1)/126*h); 1368 1371 1369 1372 // --- finalize data --- … … 1426 1429 } 1427 1430 1431 /* 1432 function drawZd(result) 1433 { 1434 function frac(x) { return(x-Math.floor(x)); } 1435 function Mod(a, b) { return(a-Math.floor(a/b)*b); } 1436 1437 var z = $("body").visiblePage; 1438 var canv = $("canvas"+z); 1439 1440 var ctx = canv.getContext("2d"); 1441 1442 // 16:57:58.210572 - Mrk 421: Ra=11.074266h Dec= 38.208801deg 1443 // 16:57:58.210782 - Mrk 501: Ra=16.897867h Dec= 39.760201deg 1444 // 16:57:58.210941 - 1ES 2344+51.4: Ra=23.784733h Dec= 51.705002deg 1445 // 16:57:58.211060 - PKS 2155-304: Ra=21.981134h Dec=-30.225599deg 1446 // 16:57:58.211189 - Crab: Ra= 5.575539h Dec= 22.014500deg 1447 // 16:57:58.211312 - H 1426+428: Ra=14.475734h Dec= 42.674702deg 1448 // 16:57:58.211429 - 1ES 1959+650: Ra=19.999933h Dec= 65.148499deg 1449 // 16:57:58.211544 - Dark Patch 3: Ra= 3.100000h Dec= 31.183333deg 1450 // 16:57:58.211651 - 1ES 1218+304: Ra=12.356089h Dec= 30.176897deg 1451 1452 var now = new Date(); 1453 1454 var RAD = Math.Pi/180.; 1455 1456 var lon = -(17.+53./60+26.525/3600) * Math.PI/180; 1457 var lat = (28.+45./60+42.462/3600) * Math.PI/180; 1458 1459 var ra = 16.897867 * Math.PI/ 12; //h 1460 var dec = 39.760201 * Math.PI/180; //deg 1461 1462 var arr = ""; 1463 1464 var date = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0); 1465 date /= 86400000; 1466 date += 40587; 1467 1468 var coslat = Math.cos(lat); 1469 var sinlat = Math.sin(lat); 1470 1471 // 21 1472 for (var h=-4*12; h<6*12; h++) 1473 { 1474 var mjd = date + h/(24.*12); // Modified julian date 1475 var t = (mjd-51544.5) / 36525; // Julian centuries since J2000. 1476 1477 // GMST at this UT1 1478 var r = 24110.54841+(8640184.812866+(0.093104-6.2e-6*t)*t)*t; 1479 var sum = r/86400 + frac(mjd); 1480 var gmst = frac(sum)*Math.PI*2; 1481 1482 var lmst = Mod(gmst + lon, Math.PI*2); 1483 var lha = ra - lmst; 1484 1485 var alt = Math.asin(sinlat * Math.sin(dec) + 1486 coslat * Math.cos(dec) * Math.cos(lha)); 1487 alt *= 256/Math.PI; // 128/90*180/Math.Pi 1488 if (alt<0) 1489 alt = 0; 1490 if (alt>127) 1491 alt=127; 1492 1493 arr += String.fromCharCode(alt); 1494 } 1495 1496 var vals = new Array(5);//[] = { 0, 0, 0, 0, 0 }; 1497 vals[1] = "90"; 1498 vals[2] = " 0"; 1499 vals[3] = " "; 1500 vals[4] = " "; 1501 vals[5] = " "; 1502 drawGraph(canv, vals, arr); 1503 } 1504 */ 1505 1428 1506 function process_eventdata(result) 1429 1507 { … … 1441 1519 ctx.clearRect(0, 0, canv.width, canv.height); 1442 1520 1443 var data = result.split('\ n');1444 if ( result.length<4)1445 return; 1446 1447 var len = 0;1448 for (var i=0; i<6; i++)1449 len += data[i].length+1;1521 var data = result.split('\0'); 1522 if (data.length<2) 1523 return; 1524 1525 var header = data[0].split('\n'); 1526 if (header.length<4) 1527 return; 1450 1528 1451 1529 switch (type) … … 1453 1531 //case "camera": drawCam(result); break; 1454 1532 case "hist": 1455 drawGraph(canv, data, result.substr(len));1533 drawGraph(canv, header, data); 1456 1534 break; 1457 1535 case "camera": 1458 drawFullCam( result.substr(len));1459 drawCamLegend(canv, data);1536 drawFullCam(data[1]); 1537 drawCamLegend(canv, header); 1460 1538 break; 1461 1539 }
Note:
See TracChangeset
for help on using the changeset viewer.