CesiumGS / CesiumGS/cesium

Better support for custom `PositionProperty` implementations

Open
#9,491 1 comment 1 reaction 0 assignees View on GitHub
category - architecture / api category - entity category - typescript type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

I wrote my own `PositionProperty` class. (It's very simple, it just wraps a collection of timestamped locations and gives the most recent one at or before the requested time -- kind of like `TimeIntervalCollectionPositionProperty` but less complex.)

I looked at the code for most of the other implementations, and in all cases `getValue` is implemented as a call to `getValueInReferenceFrame`, which calls `PositionProperty.convertToReferenceFrame`. This function is marked `@private` in the JSDoc, and not included in the TypeScript typings.

My first suggestion would be to remove this `@private` decoration and add type information to the method. Implementing classes generally want to use this method to translate to the correct reference frame after determining the (probably fixed-frame) "initial" value.

My second suggestion is to convert the `PositionProperty` class-like to a real inheritable (ES6) base class, [using abstract-like conventions](https://stackoverflow.com/a/30560792/26286), and refactor common implementations up into it. I think you've been avoiding real classes, which is fine, but it would be nice to reduce the workload for subclasses.

Contributor guide

Open the contributing guide

Research direction

Start by reading PositionProperty and the getValue, getValueInReferenceFrame, and convertToReferenceFrame entry points described in the issue, along with the existing implementations that call them. Determine whether the intended direction is exposing typed conversion support or introducing an inheritable base class; done requires an agreed design and corresponding support for custom PositionProperty subclasses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.