Move terrain grid implementation to a component so the editor can use it (Feature #1597)