Skip to content

Commit

Permalink
Rebranded terrain as ctb
Browse files Browse the repository at this point in the history
This better reflects the specificity of the tools and library.
  • Loading branch information
Homme Zwaagstra committed Jul 11, 2014
1 parent d821b96 commit 0016b95
Show file tree
Hide file tree
Showing 36 changed files with 221 additions and 221 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ else()
endif()

# The version number
set(TERRAIN_VERSION_MAJOR 0)
set(TERRAIN_VERSION_MINOR 2)
set(TERRAIN_VERSION_PATCH 2)
set(CTB_VERSION_MAJOR 0)
set(CTB_VERSION_MINOR 2)
set(CTB_VERSION_PATCH 2)

# The tile size (width and height). According to the spec this should always be
# 65
Expand All @@ -38,14 +38,14 @@ configure_file(
include_directories("${PROJECT_BINARY_DIR}")

# Ensure the configuration is installed
install(FILES ${PROJECT_BINARY_DIR}/config.hpp DESTINATION include/terrain)
install(FILES ${PROJECT_BINARY_DIR}/config.hpp DESTINATION include/ctb)

# Perform as many checks as possible on debug builds:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra --pedantic")
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra --pedantic")

# Build and install libterrain
# Build and install libctb
include_directories("${PROJECT_SOURCE_DIR}/src")
add_subdirectory(src)

Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ does *not* provide a way of serving up those tilesets to the browser.

## Command Line Tools

The following tools are built on top of the C++ `libterrain` library:
The following tools are built on top of the C++ `libctb` library:

### `terrain-build`
### `ctb-tile`

This creates gzipped terrain tiles from a GDAL raster representing a
[Digital Elevation Model](http://en.wikipedia.org/wiki/Digital_elevation_model)
Expand All @@ -27,7 +27,7 @@ tiles for all zoom levels between that maximum and zoom level `0` where the
tile extents overlap the raster extents, resampling and subsetting the data as
necessary. E.g.

terrain-build --output-dir ./terrain-tiles dem.tif
ctb-tile --output-dir ./terrain-tiles dem.tif

The input raster should contain data representing elevations relative to sea
level. `NODATA` (null) values are not currently dealt with: these should be
Expand All @@ -43,15 +43,15 @@ provides similar functionality to the
created in either Web Mercator or Global Geodetic projections using the
`--profile` option. e.g.

terrain-build --output-format JPEG --profile mercator \
ctb-tile --output-format JPEG --profile mercator \
--output-dir ./jpeg-tiles RGB-image.tif

An interesting variation on this is to specify `--output-format VRT` in order to
generate GDAL Virtual Rasters: these can be useful for debugging and are easily
modified programatically.

```
Usage: terrain-build [options] GDAL_DATASOURCE
Usage: ctb-tile [options] GDAL_DATASOURCE
Options:
Expand Down Expand Up @@ -87,7 +87,7 @@ Options:

* DEM datasets composed of multiple files can be composited into a single GDAL
[Virtual Raster](http://www.gdal.org/gdal_vrttut.html) (VRT) dataset for use
as input to `terrain-build` and `terrain-extents`. See the
as input to `ctb-tile` and `ctb-extents`. See the
[`gdalbuildvrt`](http://www.gdal.org/gdalbuildvrt.html) tool.

* Setting
Expand All @@ -96,7 +96,7 @@ Options:
[`GDAL_CACHEMAX`](http://trac.osgeo.org/gdal/wiki/ConfigOptions#GDAL_CACHEMAX)
environment variable should be set as high as your system supports it.

* `terrain-build` will resample data from the source dataset when generating
* `ctb-tile` will resample data from the source dataset when generating
tilesets for the various zoom levels. This can lead to performance issues and
datatype overflows at lower zoom levels (e.g. level 0) when the source dataset
is very large. To overcome this the tool can be used on the original dataset
Expand All @@ -111,13 +111,13 @@ Options:
VRT representations of these intermediate tilesets can then be used to create
the final terrain tile output.

### `terrain-info`
### `ctb-info`

This provides various information on a terrain tile, mainly useful for
debugging purposes.

```
Usage: terrain-info [options] TERRAIN_FILE
Usage: ctb-info [options] TERRAIN_FILE
Options:
Expand All @@ -128,7 +128,7 @@ Options:
-t, --no-type hide information about the tile type (i.e. water/land)
```

### `terrain-export`
### `ctb-export`

This exports a terrain tile to [GeoTiff](http://en.wikipedia.org/wiki/GeoTIFF)
format for use in GIS software. Terrain tiles do not contain information
Expand All @@ -139,7 +139,7 @@ Note that the tool does not normalise the terrain data to sea level but
displays it exactly as it is found in the terrain data.

```
Usage: terrain-export -i TERRAIN_FILE -z ZOOM_LEVEL -x TILE_X -y TILE_Y -o OUTPUT_FILE
Usage: ctb-export -i TERRAIN_FILE -z ZOOM_LEVEL -x TILE_X -y TILE_Y -o OUTPUT_FILE
Options:
Expand All @@ -152,15 +152,15 @@ Options:
-o, --output-filename <filename> the output file to create
```

### `terrain-extents`
### `ctb-extents`

Sometimes it is useful to see the extent of coverage of terrain tilesets that
would be produced from a raster. This tool does this by outputting each zoom
level as a [GeoJSON](http://geojson.org/) file containing the tile extents for
that particular zoom level.

```
Usage: terrain-extents GDAL_DATASET
Usage: ctb-extents GDAL_DATASET
Options:
Expand All @@ -175,7 +175,7 @@ Options:

## LibTerrain

The C++ library is called `libterrain`. It is capable of creating terrain
The C++ library is called `libctb`. It is capable of creating terrain
tiles according to the
[heightmap-1.0 terrain format](http://cesiumjs.org/data-and-assets/terrain/formats/heightmap-1.0.html). It
does not provide a way of serving up or storing the resulting tiles: this is
Expand All @@ -184,7 +184,7 @@ application specific. Instead its aim is simply to take a
Terrain Model (DTM) and convert this to terrain tiles.

See the source code for the tools provided with the library
(e.g. `terrain-build`) for examples on how the library is used to achieve
(e.g. `ctb-tile`) for examples on how the library is used to achieve
this.

### Documentation
Expand Down Expand Up @@ -281,7 +281,7 @@ installation issues are encapsulated in the image.
* Add support for the new
[quantized-mesh-1.0 terrain format](http://cesiumjs.org/data-and-assets/terrain/formats/quantized-mesh-1.0.html).

* The `terrain-build` command currently only outputs files to a directory and
* The `ctb-tile` command currently only outputs files to a directory and
as such is subjected to filesystem limits (e.g. inode limits): it should be
able to output tiles in a format that overcomes these limits and which is
still portable and accessible. [SQLite](http://www.sqlite.org/) would appear
Expand All @@ -299,13 +299,13 @@ installation issues are encapsulated in the image.
format.

* Encapsulate the multithreading tile generation functionality currently
implemented in `terrain-build` within the library to make it more widely
implemented in `ctb-tile` within the library to make it more widely
available.

* One of the `terrain-build` recommendations above illustrates a process for
* One of the `ctb-tile` recommendations above illustrates a process for
efficiently creating tilesets at lower zoom levels by resampling an already
generated tileset at the next highest zoom level. This could be built
directly into the `terrain-build` tool. An implementation could create a
directly into the `ctb-tile` tool. An implementation could create a
read-only GDAL `TiledDataset` driver (or use a VRT, if it efficiently supports
the large number of tile files) which accesses the already generated tileset;
this dataset could then be used as an input to the tiler.
Expand Down
2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Libterrain documentation

[Doxygen](http://www.doxygen.org) documentation for the C++ libterrain code can
[Doxygen](http://www.doxygen.org) documentation for the C++ libctb code can
be generated by running the `doxygen` command from this
directory. Documentation in various formats is then generated in this directory
e.g. HTML format in the `html` directory.
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is an Ubuntu derived image containing Cesium Terrain Builder compiled
against a GDAL installation bundled with a broad range of drivers. It is
suitable for getting up and running quickly with the Cesium Terrain Builder
command line tools and/or coding with `libterrain`.
command line tools and/or coding with `libctb`.

## Usage

Expand All @@ -14,7 +14,7 @@ Cesium Terrain Builder available:

You can run the command line utilities from there e.g.

terrain-build --version
ctb-tile --version

You will most likely want to work with data on the host system from within the
docker container, in which case run the container with the -v option. This
Expand All @@ -28,6 +28,6 @@ following command entered at the prompt provided with the previous command will
build a terrain tileset. This assumes `/tmp/source.tiff` is present on the
host system:

mkdir /data/tiles && terrain-build -o /data/tiles /data/source.tiff
mkdir /data/tiles && ctb-tile -o /data/tiles /data/source.tiff

You should now have the tiles available on your host system in `/tmp/tiles`.
18 changes: 9 additions & 9 deletions src/Bounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
*/

#include "Coordinate.hpp"
#include "TerrainException.hpp"
#include "CTBException.hpp"

namespace terrain {
namespace ctb {
template <class T> class Bounds;
}

/// A representation of an extent
template <class T>
class terrain::Bounds {
class ctb::Bounds {
public:

/// Create an empty bounds
Expand Down Expand Up @@ -62,9 +62,9 @@ class terrain::Bounds {
inline void
setBounds(T minx, T miny, T maxx, T maxy) {
if (minx > maxx) {
throw TerrainException("The minimum X value is greater than the maximum X value");
throw CTBException("The minimum X value is greater than the maximum X value");
} else if (miny > maxy) {
throw TerrainException("The minimum Y value is greater than the maximum Y value");
throw CTBException("The minimum Y value is greater than the maximum Y value");
}

bounds[0] = minx;
Expand Down Expand Up @@ -107,7 +107,7 @@ class terrain::Bounds {
inline void
setMinX(T newValue) {
if (newValue > getMaxX())
throw TerrainException("The value is greater than the maximum X value");
throw CTBException("The value is greater than the maximum X value");

bounds[0] = newValue;
}
Expand All @@ -116,7 +116,7 @@ class terrain::Bounds {
inline void
setMinY(T newValue) {
if (newValue > getMaxY())
throw TerrainException("The value is greater than the maximum Y value");
throw CTBException("The value is greater than the maximum Y value");

bounds[1] = newValue;
}
Expand All @@ -125,7 +125,7 @@ class terrain::Bounds {
inline void
setMaxX(T newValue) {
if (newValue < getMinX())
throw TerrainException("The value is less than the minimum X value");
throw CTBException("The value is less than the minimum X value");

bounds[2] = newValue;
}
Expand All @@ -134,7 +134,7 @@ class terrain::Bounds {
inline void
setMaxY(T newValue) {
if (newValue < getMinY())
throw TerrainException("The value is less than the minimum Y value");
throw CTBException("The value is less than the minimum Y value");

bounds[3] = newValue;
}
Expand Down
16 changes: 8 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# We need GDAL
find_package(GDAL)
if(NOT GDAL_FOUND)
message(FATAL_ERROR "The GDAL library cannot be found on the sytem")
message(FATAL_ERROR "The GDAL library cannot be found on the system")
endif()
include_directories(${GDAL_INCLUDE_DIRS})

Expand All @@ -20,17 +20,17 @@ if(NOT ZLIB_FOUND)
endif()
include_directories(${ZLIB_INCLUDE_DIRS})

add_library(terrain SHARED
add_library(ctb SHARED
GDALTiler.cpp
TerrainTiler.cpp
TerrainTile.cpp
RasterIterator.cpp
TerrainIterator.cpp
GlobalMercator.cpp
GlobalGeodetic.cpp)
target_link_libraries(terrain ${GDAL_LIBRARIES} ${ZLIB_LIBRARIES})
target_link_libraries(ctb ${GDAL_LIBRARIES} ${ZLIB_LIBRARIES})

# Install libterrain
# Install libctb
set(HEADERS
Bounds.hpp
Coordinate.hpp
Expand All @@ -41,15 +41,15 @@ set(HEADERS
Grid.hpp
GridIterator.hpp
RasterIterator.hpp
TerrainException.hpp
CTBException.hpp
TerrainIterator.hpp
TerrainTile.hpp
TerrainTiler.hpp
TileCoordinate.hpp
TileCoordinateIterator.hpp
TilerIterator.hpp
types.hpp)
install(FILES ${HEADERS} DESTINATION include/terrain)
install(FILES terrain.hpp DESTINATION include)
install(FILES ${HEADERS} DESTINATION include/ctb)
install(FILES ctb.hpp DESTINATION include)

install(TARGETS terrain DESTINATION lib)
install(TARGETS ctb DESTINATION lib)
4 changes: 2 additions & 2 deletions src/CRSBoundsIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

#include "GridIterator.hpp"

namespace terrain {
namespace ctb {
class CRSBoundsIterator;
}

/// Forward iterate over tiles in a `Grid` where tiles are `CRSBounds`
class terrain::CRSBoundsIterator :
class ctb::CRSBoundsIterator :
public GridIterator< std::pair<TileCoordinate, CRSBounds> >
{
public:
Expand Down
20 changes: 10 additions & 10 deletions src/TerrainException.hpp → src/CTBException.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TERRAINEXCEPTION_HPP
#define TERRAINEXCEPTION_HPP
#ifndef CTBEXCEPTION_HPP
#define CTBEXCEPTION_HPP

/*******************************************************************************
* Copyright 2014 GeoData <[email protected]>
Expand All @@ -18,24 +18,24 @@
*******************************************************************************/

/**
* @file TerrainException.hpp
* @brief This declares and defines the `TerrainException` class
* @file CTBException.hpp
* @brief This declares and defines the `CTBException` class
*/

#include <stdexcept>

namespace terrain {
class TerrainException;
namespace ctb {
class CTBException;
}

/// This represents a terrain runtime error
class terrain::TerrainException:
/// This represents a CTB runtime error
class ctb::CTBException:
public std::runtime_error
{
public:
TerrainException(const char *message):
CTBException(const char *message):
std::runtime_error(message)
{}
};

#endif /* TERRAINEXCEPTION_HPP */
#endif /* CTBEXCEPTION_HPP */
Loading

0 comments on commit 0016b95

Please sign in to comment.