LoginSignup
0
0

More than 1 year has passed since last update.

【Harmoware-VIS】組込みの移動データフォーマットを使用せず外部データで再生する方法

Last updated at Posted at 2021-12-09

Harmoware-VIS とは

組込みの移動データフォーマットを使用せず外部データで再生する方法

処理イメージ

各インターフェース

setTimeBegin

Harmoware-VIS既存の関数です。処理開始日時(timeBegin)をUNIX時間(秒)で設定します。

setTimeLength

Harmoware-VIS既存の関数です。処理時間長(timeLength)を秒数で設定します。

setExtractedDataFunc

Harmoware-VIS新規の関数です。任意表示データ生成処理(getExtractedDataFunc)をHarmoware-VISに登録(オーバライド)します。
登録されるとフレーム毎のデータ作成時にオーバライドされた当該関数がコールされます。

任意表示データ生成処理(getExtractedDataFunc)の書式

<P>(nextprops: P) => any

戻り値:任意のデータ
そのまま、Harmoware-VIS 内にて ExtractedData に格納されます。

引数:nextprops
Harmoware-VISのルートプロパティ及びアプリでルートに追加したプロパティです。
但し、内容は次のフレームデータを作成するための内容に変更されています。(settimeなど)

コード例

//アプリのルートクラス
class App extends Container {
  constructor(props) {
    super(props);
    //任意表示データ生成処理に登録
    this.props.actions.setExtractedDataFunc(this.getExtractedDataFunc.bind(this));
    ・・・
  }
  ・・・
  //Harmoware-VISにオーバライドする関数
  getExtractedDataFunc(props){
    const {settime} = props; //経過時間の抽出
    return getExtractedData(settime); //経過時間に対応する表示データを抽出する内部処理など
  }
  ・・・
  render() {
    const { actions, viewport, ExtractedData } = this.props;
    const { GridCellLayerData } = ExtractedData;
    return (
    <div>
        <div className="harmovis_area">
          <HarmoVisLayers
            viewport={viewport} actions={actions}
            mapboxApiAccessToken={MAPBOX_TOKEN}
            layers={[
              GridCellLayerData && (GridCellLayerData.length > 0) ?
                return new GridCellLayer({
                  id: 'GridCellLayer-ExtractedData',
                  data: GridCellLayerData, //データをレイヤーに渡す
                }):null
            ]}
          />
       </div>
    </div>
  );
}

・・・

//外部データの取得処理
getExternaldataLoad(){
  const { actions } = this.props;
  ・・・ // 外部のデータをreaddataに取得する処理
  const {Externaldata, startTime, endTime} = readdata;
  // Externaldataは後で抽出できるように保存
  actions.setTimeBegin(startTime); //処理開始日時設定
  actions.setTimeLength(endTime - startTime) //処理時間長設定
  ・・・
}

timeBegintimeLengthは外部データロード時でなくてもOK
双方を設定したと同時に再生が開始します。
再生処理中に変更することも可能なので外部データに追加があったタイミングで処理時間長を延長するなども可能

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0