<commit_before>/* globals Cesium */

import Component from '@ember/component';

import { transform } from 'ol/proj';

import safeComputed from '../computed/safe-computed';

export default class CesiumPlaneModel extends Component {
  tagName = '';

  scene = null;
  fix = null;
  entity = null;

  @safeComputed('coordinate', coordinate => {
    let lonlat = transform(coordinate, 'EPSG:3857', 'EPSG:4326');
    return Cesium.Cartesian3.fromDegrees(lonlat[0], lonlat[1], lonlat[2]);
  })
  position;

  init() {
    super.init(...arguments);

    this.set(
      'entity',
      Cesium.Model.fromGltf({
        url: '../../3d/AS21.glb',
        scale: 1,
        minimumPixelSize: 64,
        allowPicking: false,
      }),
    );
  }

  didReceiveAttrs() {
    super.didReceiveAttrs(...arguments);
    this.entity.modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
      this.position,
      new Cesium.HeadingPitchRoll(this.heading, 0, 0),
    );
  }
<commit_msg>CesiumPlaneModel: Simplify `entity` assignment<commit_after>/* globals Cesium */

import Component from '@ember/component';

import { transform } from 'ol/proj';

import safeComputed from '../computed/safe-computed';

export default class CesiumPlaneModel extends Component {
  tagName = '';

  scene = null;
  fix = null;

  entity = Cesium.Model.fromGltf({
    url: '../../3d/AS21.glb',
    scale: 1,
    minimumPixelSize: 64,
    allowPicking: false,
  });

  @safeComputed('coordinate', coordinate => {
    let lonlat = transform(coordinate, 'EPSG:3857', 'EPSG:4326');
    return Cesium.Cartesian3.fromDegrees(lonlat[0], lonlat[1], lonlat[2]);
  })
  position;

  didReceiveAttrs() {
    super.didReceiveAttrs(...arguments);
    this.entity.modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
      this.position,
      new Cesium.HeadingPitchRoll(this.heading, 0, 0),
    );
  }

{'fraction_non_alphanumeric': 0.14545454545454545, 'fraction_numerical': 0.0213903743315508, 'mean_word_length': 3.3310185185185186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948778', 'n_tokens_mistral': 662, 'n_tokens_neox': 620, 'n_words': 122}