/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/view.php

  • Committer: Suren A. Chilingaryan
  • Date: 2020-02-06 06:07:51 UTC
  • Revision ID: csa@suren.me-20200206060751-n4lbi25y4wh10f3u
Generalize data filtering/resampling in the VIEWs and provide common tools for secondary time series plots (based on work of Jalal)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
 
 
3
require($ADEI_ROOTDIR . "/classes/resampler.php");
 
4
 
3
5
interface VIEWInterface {
4
6
 function IsApplicable();
5
7
 function GetOptions();
211
213
    $window_end = $iv->GetWindowEnd();
212
214
 
213
215
    $rescfg = array(
214
 
        'limit' => $this->max_points,
 
216
        'limit' => $this->max_points
215
217
    );
216
218
 
217
219
    $gid = 0;
223
225
            continue;
224
226
        }
225
227
 
226
 
 
227
 
 
228
228
        if ($flags&VIEW::GET_RAW_DATA) {
229
229
            $points = $cachewrap->GetAllPoints($this->ivl, $this->max_points);
230
230
            $operation_info = array("resolution" => 0);
245
245
            $points = $cachewrap->GetIntervals($iv, $rescfg, CACHE::TRUNCATE_INTERVALS);
246
246
            $operation_info = $points->GetOperationInfo();
247
247
        }
248
 
        
249
248
 
250
249
        foreach ($ids[$gid] as $i => $id) {
251
 
            $info[$i] = $operation_info;
 
250
            $info[$gpos + $i] = $operation_info;
252
251
        }
253
252
 
254
253
        foreach($points as $t => $v) {
263
262
            }
264
263
        }
265
264
 
 
265
        $gpos += sizeof($ids[$gid]); 
266
266
        $gid++;
267
 
        $gpos += sizeof($ids[$i]); 
268
267
    }
269
 
    
 
268
 
 
269
    $info['n_channels'] = $gpos;
270
270
    return array("info" => $info, "data" => $data);
271
271
 }
272
272
 
 
273
 function ResampleData($data, $resampler, $sampling = false, $flags = 0) {
 
274
    if (!($resampler instanceof RESAMPLER))
 
275
        $resampler = RESAMPLER::GetResampler($this->req, $resampler, $sampling);
 
276
 
 
277
    return $resampler->Resample($data, $flags);
 
278
 }
 
279
 
 
280
 function GetResampledData($params, INTERVAL $iv = NULL, $resampler, $sampling = false, $flags = 0) {
 
281
    $data = $this->GetData($params, $iv, $flags);
 
282
    return $this->ResampleData($data, $resampler, $sampling, $flags);
 
283
 }
 
284
 
273
285
 function MergeViewInfo(&$view, $info, $flags = 0) {
274
286
    $done = false;
275
287
    foreach ($view as &$v) {