~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to src/js/Image/JP2Image.js

  • Committer: jeff Stys
  • Date: 2014-10-15 18:56:44 UTC
  • Revision ID: jstys@sesda3.com-20141015185644-mrgwlk83a3t4ai3z
Added two APIs, updated API docs, added database methods to enable movie re-generation, modified data coverage timeline statistics database table, skip missing JP2 files during JPX generation and log missing filenames, updated flowplayer from version 3.2.8 to version 5.4.6, optimized event marker PNG file sizes.

CREATE TABLE `data_coverage_30_min` (
  `date` datetime NOT NULL,
  `sourceId` int(10) unsigned NOT NULL,
  `count` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`,`sourceId`),
  KEY `index1` (`date`),
  KEY `index2` (`sourceId`),
  KEY `index3` (`sourceId`,`date`),
  KEY `index4` (`date`,`sourceId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * @fileOverview JP2 Image class
3
3
 * @author <a href="mailto:keith.hughitt@nasa.gov">Keith Hughitt</a>
4
4
 */
5
 
/*jslint browser: true, white: true, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: true,
 
5
/*jslint browser: true, white: true, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: true, 
6
6
bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxlen: 120, sub: true */
7
7
/*global Class, $ */
8
8
"use strict";
13
13
    /**
14
14
     * @constructs
15
15
     */
16
 
    init: function (hierarchy, sourceId, date, onChange) {
17
 
        this.hierarchy   = hierarchy;
 
16
    init: function (observatory, instrument, detector, measurement, sourceId, date, onChange) {
 
17
        this.observatory = observatory;
 
18
        this.instrument  = instrument;
 
19
        this.detector    = detector;
 
20
        this.measurement = measurement;
18
21
        this.sourceId    = sourceId;
19
22
        this.requestDate = date;
20
23
        this._onChange   = onChange;
21
 
 
 
24
        
22
25
        this._requestImage();
23
26
    },
24
 
 
 
27
    
25
28
    /**
26
29
     * Loads the closest image in time to that requested
27
30
     */
28
31
    _requestImage: function () {
29
32
        var params, dataType;
30
 
 
 
33
        
31
34
        params = {
32
35
            action:   'getClosestImage',
33
36
            sourceId: this.sourceId,
35
38
        };
36
39
        $.get(Helioviewer.api, params, $.proxy(this._onImageLoad, this), Helioviewer.dataType);
37
40
    },
38
 
 
 
41
    
39
42
    /**
40
43
     * Changes image data source
41
44
     */
42
 
    updateDataSource: function (hierarchy, sourceId) {
43
 
        this.hierarchy = hierarchy;
44
 
        this.sourceId  = sourceId;
45
 
 
 
45
    updateDataSource: function (observatory, instrument, detector, measurement, sourceId) {
 
46
        this.observatory = observatory;
 
47
        this.instrument  = instrument;
 
48
        this.detector    = detector;
 
49
        this.measurement = measurement;
 
50
        this.sourceId    = sourceId;
 
51
        
46
52
        this._requestImage();
47
 
    },
48
 
 
 
53
    },        
 
54
    
49
55
    /**
50
56
     * Updates time and loads closest match
51
57
     */
53
59
        this.requestDate = requestDate;
54
60
        this._requestImage();
55
61
    },
56
 
 
 
62
    
57
63
    /**
58
64
     * Checks to see if image has been changed and calls event-handler passed in during initialization
59
65
     * if a new image should be displayed.
60
 
     *
 
66
     * 
61
67
     * The values for offsetX and offsetY reflect the x and y coordinates with the origin
62
68
     * at the bottom-left corner of the image, not the top-left corner.
63
69
     */
70
76
 
71
77
        // Reference pixel offset at the original JP2 image scale (with respect to top-left origin)
72
78
        this.offsetX =   parseFloat((this.refPixelX - (this.width  / 2)).toPrecision(8));
73
 
        this.offsetY = - parseFloat((this.refPixelY - (this.height / 2)).toPrecision(8));
74
 
 
 
79
        this.offsetY = - parseFloat((this.refPixelY - (this.height / 2)).toPrecision(8));        
 
80
        
75
81
        this._onChange();
76
82
    },
77
 
 
 
83
    
78
84
    getLayerName: function () {
79
 
        var layerName = '';
80
 
        $.each( this.hierarchy, function (uiOrder, obj) {
81
 
            layerName += obj['name'] + ',';
82
 
        });
83
 
        return layerName.substring(0, layerName.length-1);
 
85
        return this.observatory + "," + this.instrument + "," +  
 
86
               this.detector + "," + this.measurement;
84
87
    },
85
 
 
 
88
    
86
89
    getSourceId: function () {
87
90
        return this.sourceId;
88
91
    }