Changeset 19370


Ignore:
Timestamp:
Nov 10, 2018, 6:40:14 PM (4 months ago)
Author:
tbretz
Message:
Implemented the FAMOUS camera as an option, be a bit more specific in error messages when calling the index.php fails.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/www/viewer/index.js

    r17942 r19370  
    22
    33// ==========================================================================
     4
     5var camera_type = "FAMOUS";
     6
     7var scale = camera_type=="FACT" ?   83 : 22;
     8var npix  = camera_type=="FACT" ? 1440 : 64;
    49
    510function onRightMouseClick(event)
     
    387392function onFilelistReceived(result)
    388393{
     394    if (result.indexOf("<?php")>=0)
     395    {
     396        alert("Call to 'index.php' returned its contents.\n"+
     397              "It seems the web-server does not support php.\n"+
     398              "Accessing data files not possible.");
     399        return;
     400    }
     401
     402    if (result=="V8Js missing")
     403    {
     404        alert("The php module V8Js is missing or not properly installed.\n"+
     405              "Check here for details: https://github.com/phpv8/v8js");
     406        return;
     407    }
    389408    //var dbg = document.getElementById("debug");
    390409
     
    570589        return;
    571590    }
     591
     592    debug(rc.command);
    572593
    573594    var evt = rc.event;
     
    12001221var map = new Array(1440);
    12011222
    1202 function initPixelMap()
     1223function initPixelMapFACT()
    12031224{
    12041225    var codedMap = "966676:6:A;68656364626Y?\\?;A=A<AGADAN4K4i5g5h5o506W?Z?]?_?>A@A?AJAIAFACAM4J4H4f5d5e5l5m5n516X?[?^?N?P?AA1ABAVAUAKAHAEAO4L4I4G4E4c5a5b5M6j5k5V6Y6\\6_6G?J?O?Q?S?2A4A3AYAXAWAbA_AnAkAhA3404F4D4B4`5^5_5J6K6L6S6T6W6Z6]6E?H?K?M?R?T?V?5A7A6A\\A[AZAeAdAaA^AmAjAgA24o3m3C4A4?4]5[5\\5G6H6I6P6Q6R6U6X6[6^6F?I?L?<?>?U?;@=@8Ah@9AMALA]ABCACfAcA`AoAlAiA4414n3l3<4@4>425Z5X5Y5D6E6F698N6O608E8H8K8H>K>N>?>B>=???A?<@>@@@i@k@j@PAOANAECDCCC<C9CZCWCTC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O2G2F2D2O3N3M3J3H3a6b6e6f6g6I7J7K7R8S8397989V9Y9Z9[9f9^:a:d:4;1;n:=;:;7;O;L;I;F;C;@;@<B<0<4<U<V<X<`=]=\\=S=U=W=]>_>`>8B7B6BZBXBWB_CaC`CFDEDDDlDgDoEmE>FAFDFGFJFMF90<0?0003060714121a0^0]0G1C1B1N2L2E2C2B2@2L3I3`6d6E7F7G7H7O8Q8192969T9U9X96;3;0;?;<;9;Q;N;K;H;E;B;W<Y<^=_=a=T=V=X=\\B[BYBdCcCbCHDGD?FBFEFHFKFNF:0=0@0104070F1E1A1M2K2J2I2A2D7L8M8N8P809495961b:";
     
    12141235    }
    12151236    if (sum!=0)
    1216         alert("Pixel mapping table corrupted!");
    1217 }
    1218 
    1219 initPixelMap();
     1237        alert("Pixel mapping table corrupted ["+sum+"]!");
     1238}
     1239
     1240function initPixelMapFAMOUS()
     1241{
     1242    var codedMap = "C0D0B0J0I0H0E0\\0=0<07080L0K0h0k0^0]0[0Y0@0>0:0403060M0O0N0g0i0l0a0b0_0Z0X0U0V0A0?0;09010002050P0S0R0Q0f0j0m0n0d0e0c0`0W0T0o01101213141516171F0G0";
     1243    // first: decode the pixel mapping!
     1244    var sum = 2556;
     1245    for (var i=0; i<72; i++)
     1246    {
     1247        var d0 = codedMap.charCodeAt(i*2)  -48;
     1248        var d1 = codedMap.charCodeAt(i*2+1)-48;
     1249
     1250        map[i] = d0 | (d1<<6);
     1251        sum -= map[i];
     1252    }
     1253    if (sum!=0)
     1254        alert("Pixel mapping table corrupted ["+sum+"]!");
     1255}
     1256
     1257if (camera_type=="FACT")
     1258    initPixelMapFACT();
     1259else
     1260    initPixelMapFAMOUS();
    12201261
    12211262// ================================== Camera Display ================================================
    12221263
    12231264var coord = new Array(1440);
    1224 function initCameraCoordinates()
     1265function initCameraCoordinatesFACT()
    12251266{
    12261267    coord[0] = [0, 0];
     
    12451286}
    12461287
    1247 initCameraCoordinates();
     1288function initCameraCoordinatesFAMOUS()
     1289{
     1290    var pos;
     1291
     1292    coord[0] = [0,0];
     1293    var cnt = 1;
     1294    for (var ring=1; ring<5; ring++)
     1295    {
     1296        for (var s=0; s<6; s++)
     1297        {
     1298            for (var i=1; i<=ring; i++)
     1299            {
     1300                pos = new Position(s, ring, i);
     1301                coord[cnt++] = [ pos.x, -pos.y];
     1302            }
     1303        }
     1304    }
     1305
     1306    pos = new Position(3, 6, 2);
     1307    coord[cnt++] = [pos.x, -pos.y];
     1308    pos = new Position(4, 6, 4);
     1309    coord[cnt++] = [pos.x, -pos.y];
     1310    pos = new Position(0, 6, 2);
     1311    coord[cnt++] = [pos.x, -pos.y];
     1312}
     1313
     1314if (camera_type=="FACT")
     1315    initCameraCoordinatesFACT();
     1316else
     1317    initCameraCoordinatesFAMOUS();
     1318
    12481319
    12491320function getIndex(id, mouse)
    12501321{
    12511322    var canv = document.getElementById(id);
    1252 
    1253     var scale = 83;
    12541323
    12551324    var w = Math.min(canv.width/scale, canv.height/scale);
     
    12671336    mouse.x -= -0.5;
    12681337
    1269     for (var i=0; i<1440; i++)
     1338    for (var i=0; i<npix; i++)
    12701339        if (isInside(coord[i][0], coord[i][1], mouse))
    12711340            return i;
     
    13901459    var max = (canv.zmax-canv.min)/canv.max;
    13911460
    1392     var scale = 83;
    1393 
    13941461    var w = Math.min(canv.width/scale, canv.height/scale);
    13951462
     
    14061473        ctx.lineWidth = 0.02;
    14071474        ctx.strokeStyle = "#000";
    1408         for (var i=0; i<1440; i++)
     1475        for (var i=0; i<npix; i++)
    14091476            drawHex(ctx, i);
    14101477    }
     
    14121479    var hasData = false;
    14131480    if (max>=min)
    1414         for (var i=0; i<1440; i++)
     1481        for (var i=0; i<npix; i++)
    14151482            hasData |= fillHex(ctx, i, data[i], min, max);
    14161483
Note: See TracChangeset for help on using the changeset viewer.