头盔互动的widget重构

widget图像

使用qml文件进行画图,每类widget在一个文件中

配置文件

采用json文件,同样采取每类widget一个配置文件,配置文件中,一个widget一个部分 json到qml需要一层翻译层,所以需要一个HudConfig.js文件进行格式之类的转换

配置文件格式

{
  "vector": {
    "waterline1": {
      "config": {
        "shape": "waterline",
        "source": "/tf",
        "depth": 0.0,
        "outerWidth": 0.04,
        "innerGap": 0.02,
        "dropDown": -0.02,
        "thickness3d": 0.003
      }
    },
    "fpm1": {
      "config": {
        "shape": "fpm",
        "source": "screen-center reference vector",
        "forwardRadius": 5000,
        "symbolRadius": 35,
        "ringSegmentCount": 24,
        "fpmThickness": 10
      }
    },
    "poles1": {
      "config": {
        "shape": "poles",
        "source": "/tf",
        "poleRadius": 5000,
        "poleSize": 150,
        "poleThickness": 10,
        "poleColor": "#ff0000"
      }
    },
    "destination1": {
      "config": {
        "shape": "destination",
        "source": "exo/proc/destination_vector",
        "destinationCueRadius": 8000,
        "destinationColor": "#ffa200",
        "destinationLineWidth": 2.0
      }
    }
  }
}

widget类型,名称,配置项进行创建

没有写的配置项直接调用基类的默认值,和基类不同时在写相关配置项


本文章使用limfx的vscode插件快速发布