1.0.30 • Published 2 years ago

@cpvrt/cp-record-player v1.0.30

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

CpvrtRecordPlayer

Install

使用npm installyarn install进行依赖包安装.
使用tsc进行打包, 生成文件位于./dist/下, 更多见./tsconfig.json.

Usage

在项目中使用npm或者yarn进行安装

npm install @cpvrt/cp-record-player

yarn add @cpvrt/cp-record-player

从包中引用, 例如:

import {Component, Prop, Ref, Vue} from "vue-property-decorator";
import {getCarTypeInfos, getMapTypeInfos, getTestRecordData} from "../../api/data";
import {
  RecordPlayerArgs,
  RecordPlayer,
  Map,
  Car,
  DataStruct,
  Progress
} from "@cpvrt/cp-record-player";

@Component({})
export default class CpvrtRecordPlayer extends Vue {
  private playerArgs: RecordPlayerArgs;
  private player: RecordPlayer;
  @Ref('canvas')
  private readonly canvas: HTMLCanvasElement;
  @Ref('canvas_parent')
  private readonly canvasParent: HTMLDivElement;

  @Prop({default: 12781537, type: Number, required: true})
  recordId: number;
  @Prop({default: 1, type: Number, required: false})
  defaultMultiple: number;

  mounted(): void {
    this.canvas.width = this.canvasParent.offsetWidth;
    this.canvas.height = this.canvasParent.offsetHeight;

    getMapTypeInfos().then(map_res => {
      getCarTypeInfos().then(car_res => {
        getTestRecordData().then(res => {
          // 配置静态地图以及车辆变量
          Map.SetMapTypeInfos(map_res.data.fn_data);
          Car.SetCarTypeInfos(car_res.data.fn_data);

          // 创建入参
          this.playerArgs = new RecordPlayerArgs(
            this.canvas,  // canvasNode  或 vue中的this.$refs.canvas
            'subject2',   // 地图名称
            [
              // 车辆信息
              new DataStruct.CarInfo(  
                // 行车记录
                new DataStruct.RecordData(
                  res.data.position_curves,
                  res.data.rotation_curves
                ),
                // 车辆名称
                'default',
                // 是否显示轨迹
                true
              )
            ]);
          this.playerArgs.uiModules = [
            new Progress(40)  // 进度条模块
          ];
          // 设置默认缩放倍数
          this.playerArgs.zoom.multiple = this.defaultMultiple;

          // 实例化播放器
          this.player = new RecordPlayer(this.playerArgs);
        });
      });
    });
  }
}

Develop && Todo list

  • 微信canvas相关适配
  • carInfo & mapInfo 的进一步提取以及完善
  • carTypeInfo & mapTypeInfo 的初始化加载方式优化
  • tip 组件完善
  • 其他 module
  • 轨迹点滤波
  • record 读取自动化
  • 外观相关适配和优化

Publish

注册npm账号并加入cpvrt, 之后再publish. publish之前注意升版本号, 版本号的管理规范暂时没有, 开发人员之间务必做好相互协同.

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.30

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago