CesiumGS / CesiumGS/cesium

Allow user to override draw function in GridImageryProvider

Open
#8,282 5 comments 6 reactions 0 assignees View on GitHub
category - terrain and imagery type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

This came up in https://github.com/AnalyticalGraphicsInc/cesium/pull/8280. The idea is to make it easy for the developer to create effects like this hexagonal grid by allowing them to override the draw function in the `GridImageryProvider`:

```
Cesium.Viewer('container', {
imageryProvider: Cesium.GridImageryProvider({
cells: 3,
drawGrid: function(context) {
// `context` is the canvas 2d context,
// you can use it to draw what you want.
}
})
});
```

![grid](https://user-images.githubusercontent.com/1711126/66756675-882a6500-ee68-11e9-9b89-17d2cea61425.png)

Is this something you would use in your application? If so, please :+1: or describe your use case in this issue. Right now this is still possible to do by creating a custom imagery provider based off of the `GridImageryProvider` in your application.

Contributor guide

Open the contributing guide

Research direction

Locate the GridImageryProvider entry point and inspect how its canvas drawing currently works, then review the linked pull request for the motivating hexagonal-grid example. Done means developers can supply a drawGrid callback that receives the canvas 2D context and the existing grid behavior remains available when no callback is provided; add or update the relevant tests if the project has coverage for this provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.