Commit dd32a812 authored by Alexander Bock's avatar Alexander Bock
Browse files

Change tabs to spaces

parent 87aa34f8
Showing with 115 additions and 128 deletions
+115 -128
......@@ -28,10 +28,10 @@
namespace openspace {
namespace distanceconstants {
const float EarthRadius = 6371;
const float LightYear = 9.4607304725808E15;
const float AstronomicalUnit = 1.495978707E11;
const float Parsec = 3.0856776E16;
const float EarthRadius = 6371;
const float LightYear = 9.4607304725808E15;
const float AstronomicalUnit = 1.495978707E11;
const float Parsec = 3.0856776E16;
}
}
......
......@@ -38,17 +38,17 @@ namespace cache {
*/
class MemoryAwareCacheable {
public:
/**
* \param memoryImpact is the memory impact of the object. Can for example be given
* in kilobytes.
*/
MemoryAwareCacheable(size_t memoryImpact) : _memoryImpact(memoryImpact) {};
~MemoryAwareCacheable() {};
/**
* \param memoryImpact is the memory impact of the object. Can for example be given
* in kilobytes.
*/
MemoryAwareCacheable(size_t memoryImpact) : _memoryImpact(memoryImpact) {};
~MemoryAwareCacheable() {};
size_t memoryImpact() { return _memoryImpact; };
size_t memoryImpact() { return _memoryImpact; };
protected:
size_t _memoryImpact;
size_t _memoryImpact;
};
} // namespace cache
......
......@@ -103,7 +103,7 @@ private:
static MemoryAwareTileCache* _singleton;
MemoryAwareLRUCache<ProviderTileKey, Tile, ProviderTileHasher> _tileCache;
static std::mutex _mutexLock;
static std::mutex _mutexLock;
};
} // namespace cache
......
......@@ -107,18 +107,18 @@ ghoul::opengl::ProgramObject* ChunkRenderer::getActivatedProgramWithTileData(
std::to_string(debugProps.showHeightResolution));
pairs.emplace_back("showHeightIntensities",
std::to_string(debugProps.showHeightIntensities));
pairs.emplace_back("defaultHeight", std::to_string(Chunk::DEFAULT_HEIGHT));
pairs.emplace_back("tilePaddingStart",
"ivec2(" +
std::to_string(RawTileDataReader::padding.start.x) + "," +
std::to_string(RawTileDataReader::padding.start.y) + ")"
);
pairs.emplace_back("tilePaddingSizeDiff",
"ivec2(" +
std::to_string(RawTileDataReader::padding.numPixels.x) + "," +
std::to_string(RawTileDataReader::padding.numPixels.y) + ")"
);
pairs.emplace_back("defaultHeight", std::to_string(Chunk::DEFAULT_HEIGHT));
pairs.emplace_back("tilePaddingStart",
"ivec2(" +
std::to_string(RawTileDataReader::padding.start.x) + "," +
std::to_string(RawTileDataReader::padding.start.y) + ")"
);
pairs.emplace_back("tilePaddingSizeDiff",
"ivec2(" +
std::to_string(RawTileDataReader::padding.numPixels.x) + "," +
std::to_string(RawTileDataReader::padding.numPixels.y) + ")"
);
// Now the shader program can be accessed
ghoul::opengl::ProgramObject* programObject =
......
......@@ -39,23 +39,23 @@ LayerRenderSettings::LayerRenderSettings()
}
float LayerRenderSettings::performLayerSettings(float currentValue) const {
float newValue = currentValue;
float newValue = currentValue;
newValue = glm::sign(newValue) * glm::pow(glm::abs(newValue), gamma);
newValue = newValue * multiplier;
newValue = newValue * opacity;
newValue = glm::sign(newValue) * glm::pow(glm::abs(newValue), gamma);
newValue = newValue * multiplier;
newValue = newValue * opacity;
return newValue;
return newValue;
}
glm::vec4 LayerRenderSettings::performLayerSettings(glm::vec4 currentValue) const {
glm::vec4 newValue = glm::vec4(
performLayerSettings(currentValue.r),
performLayerSettings(currentValue.g),
performLayerSettings(currentValue.b),
performLayerSettings(currentValue.a));
glm::vec4 newValue = glm::vec4(
performLayerSettings(currentValue.r),
performLayerSettings(currentValue.g),
performLayerSettings(currentValue.b),
performLayerSettings(currentValue.a));
return newValue;
return newValue;
}
} // namespace globebrowsing
......
......@@ -41,7 +41,7 @@ struct LayerRenderSettings : public properties::PropertyOwner {
/// This function matches the function with the same name in the
/// shader code
float performLayerSettings(float currentValue) const;
/// This function matches the function with the same name in the
/// This function matches the function with the same name in the
/// shader code
glm::vec4 performLayerSettings(glm::vec4 currentValue) const;
};
......
......@@ -34,11 +34,11 @@ namespace openspace {
namespace globebrowsing {
struct ChunkTile {
ChunkTile() : tile(Tile::TileUnavailable) {};
ChunkTile(Tile tile, TileUvTransform uvTransform, TileDepthTransform depthTransform) :
tile(tile),
uvTransform(uvTransform),
depthTransform(depthTransform) {};
ChunkTile() : tile(Tile::TileUnavailable) {};
ChunkTile(Tile tile, TileUvTransform uvTransform, TileDepthTransform depthTransform) :
tile(tile),
uvTransform(uvTransform),
depthTransform(depthTransform) {};
Tile tile;
TileUvTransform uvTransform;
......
......@@ -31,8 +31,8 @@ namespace globebrowsing {
TileLoadJob::TileLoadJob(std::shared_ptr<RawTileDataReader> rawTileDataReader,
const TileIndex& tileIndex)
: _rawTileDataReader(rawTileDataReader)
, _chunkIndex(tileIndex) {}
: _rawTileDataReader(rawTileDataReader)
, _chunkIndex(tileIndex) {}
void TileLoadJob::execute() {
_rawTile = _rawTileDataReader->readTileData(_chunkIndex);
......
......@@ -132,9 +132,9 @@ TileDepthTransform RawTileDataReader::getDepthTransform() const {
std::array<double, 6> RawTileDataReader::getGeoTransform() const {
std::array<double, 6> padfTransform;
GeodeticPatch globalCoverage(Geodetic2(0,0), Geodetic2(M_PI / 2.0, M_PI));
padfTransform[1] = Angle<double>::fromRadians(
padfTransform[1] = Angle<double>::fromRadians(
globalCoverage.size().lon).asDegrees() / rasterXSize();
padfTransform[5] = -Angle<double>::fromRadians(
globalCoverage.size().lat).asDegrees() / rasterYSize();
......
......@@ -51,42 +51,42 @@ public:
* Describe if this Tile is good for usage (OK) or otherwise
* the reason why it is not.
*/
enum class Status {
/**
* E.g when texture data is not currently in memory.
* texture and tileMetaData are both null
*/
Unavailable,
/**
* Can be set by <code>TileProvider</code>s if the requested
* <code>TileIndex</code> is undefined for that particular
* provider.
* texture and metaData are both null
*/
OutOfRange,
/**
* An IO Error happend
* texture and metaData are both null
*/
IOError,
/**
* The Texture is uploaded to the GPU and good for usage.
* texture is defined. metaData may be defined.
*/
OK
};
enum class Status {
/**
* E.g when texture data is not currently in memory.
* texture and tileMetaData are both null
*/
Unavailable,
/**
* Can be set by <code>TileProvider</code>s if the requested
* <code>TileIndex</code> is undefined for that particular
* provider.
* texture and metaData are both null
*/
OutOfRange,
/**
* An IO Error happend
* texture and metaData are both null
*/
IOError,
/**
* The Texture is uploaded to the GPU and good for usage.
* texture is defined. metaData may be defined.
*/
OK
};
Tile(std::shared_ptr<ghoul::opengl::Texture> texture,
std::shared_ptr<TileMetaData> metaData,
Status status);
~Tile() = default;
std::shared_ptr<TileMetaData> metaData() const { return _metaData; };
Status status() const { return _status; };
std::shared_ptr<ghoul::opengl::Texture> texture() const { return _texture; };
std::shared_ptr<TileMetaData> metaData() const { return _metaData; };
Status status() const { return _status; };
std::shared_ptr<ghoul::opengl::Texture> texture() const { return _texture; };
/**
* Instantiates a new tile with a single color.
......@@ -102,16 +102,16 @@ public:
glm::vec2 sizeDiff, glm::uvec2 resolution, glm::vec2 tileUV);
static glm::vec2 TileUvToTextureSamplePosition(const TileUvTransform& uvTransform,
glm::vec2 tileUV, glm::uvec2 resolution);
/**
* A tile with status unavailable that any user can return to
* indicate that a tile was unavailable.
*/
static const Tile TileUnavailable;
/**
* A tile with status unavailable that any user can return to
* indicate that a tile was unavailable.
*/
static const Tile TileUnavailable;
private:
std::shared_ptr<ghoul::opengl::Texture> _texture;
std::shared_ptr<TileMetaData> _metaData;
Status _status;
std::shared_ptr<ghoul::opengl::Texture> _texture;
std::shared_ptr<TileMetaData> _metaData;
Status _status;
};
} // namespace globebrowsing
......
......@@ -50,7 +50,7 @@ namespace tileprovider {
CachingTileProvider::CachingTileProvider(const ghoul::Dictionary& dictionary)
: TileProvider(dictionary)
, _framesSinceLastRequestFlush(0)
, _defaultTile(Tile::TileUnavailable)
, _defaultTile(Tile::TileUnavailable)
{
std::string name = "Name unspecified";
dictionary.getValue("Name", name);
......
......@@ -112,7 +112,7 @@ documentation::Documentation ProjectionTileProvider::Documentation() {
ProjectionTileProvider::ProjectionTileProvider(const ghoul::Dictionary& dictionary)
: _fboProgramObject(nullptr)
, _capture(false)
, _defaultTile(Tile::TileUnavailable)
, _defaultTile(Tile::TileUnavailable)
{
ghoul::Dictionary geometryDictionary;
......
......@@ -49,7 +49,7 @@ SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary)
SingleImageProvider::SingleImageProvider(const std::string& imagePath)
: _imagePath(imagePath)
, _tile(nullptr, nullptr, Tile::Status::Unavailable)
, _tile(nullptr, nullptr, Tile::Status::Unavailable)
{
reset();
}
......@@ -87,7 +87,7 @@ void SingleImageProvider::reset() {
tileTexture->uploadTexture();
tileTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
_tile = Tile(tileTexture, tileMetaData, tileStatus);
_tile = Tile(tileTexture, tileMetaData, tileStatus);
}
int SingleImageProvider::maxLevel() {
......
......@@ -46,7 +46,7 @@ namespace {
}
SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& dictionary)
: _backgroundTile(Tile::TileUnavailable)
: _backgroundTile(Tile::TileUnavailable)
{
_fontSize = 50;
_font = OsEng.fontManager().font("Mono", _fontSize);
......@@ -58,9 +58,9 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di
_ellipsoid = Ellipsoid(radii);
auto backgroundTileStatus = Tile::Status::Unavailable;
std::shared_ptr<ghoul::opengl::Texture> backgroundTileTexture;
std::shared_ptr<ghoul::opengl::Texture> backgroundTileTexture;
std::string backgroundImagePath;
std::string backgroundImagePath;
if (dictionary.getValue(KeyBackgroundImagePath, backgroundImagePath)) {
using namespace ghoul::io;
std::string imgAbsPath = absPath(backgroundImagePath);
......@@ -69,7 +69,7 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di
backgroundTileTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
backgroundTileStatus = Tile::Status::OK;
}
_backgroundTile = Tile(backgroundTileTexture, nullptr, backgroundTileStatus);
_backgroundTile = Tile(backgroundTileTexture, nullptr, backgroundTileStatus);
}
void SizeReferenceTileProvider::renderText(const ghoul::fontrendering::FontRenderer&
......
......@@ -166,7 +166,7 @@ Tile TemporalTileProvider::getTile(const TileIndex& tileIndex) {
}
Tile TemporalTileProvider::getDefaultTile() {
return getTileProvider()->getDefaultTile();
return getTileProvider()->getDefaultTile();
}
int TemporalTileProvider::maxLevel() {
......@@ -228,33 +228,20 @@ std::shared_ptr<TileProvider> TemporalTileProvider::getTileProvider(TimeKey time
}
std::shared_ptr<TileProvider> TemporalTileProvider::initTileProvider(TimeKey timekey) {
std::string gdalDatasetXml = getGdalDatasetXML(timekey);
try {
gdalDatasetXml = absPath(gdalDatasetXml);
}
catch (ghoul::filesystem::FileSystem::ResolveTokenException& e) {
const std::vector<std::string> AllowedToken = {
// From: http://www.gdal.org/frmt_wms.html
// @FRAGILE: What happens if a user specifies one of these as path tokens?
// ---abock
"${x}",
"${y}",
"${z}",
"${version}",
"${format}",
"${layer}"
};
auto it = std::find(AllowedToken.begin(), AllowedToken.end(), e.token);
if (it == AllowedToken.end()) {
throw;
}
LINFOC(
"TemporalTileProvider",
fmt::format("Ignoring '{}' in absolute path resolve", e.token)
);
}
static const std::vector<std::string> AllowedToken = {
// From: http://www.gdal.org/frmt_wms.html
// @FRAGILE: What happens if a user specifies one of these as path tokens?
// ---abock
"${x}",
"${y}",
"${z}",
"${version}",
"${format}",
"${layer}"
};
std::string gdalDatasetXml = getGdalDatasetXML(timekey);
FileSys.expandPathTokens(gdalDatasetXml, AllowedToken);
_initDict.setValue<std::string>(KeyFilePath, gdalDatasetXml);
auto tileProvider = std::make_shared<CachingTileProvider>(_initDict);
......
......@@ -41,10 +41,10 @@ namespace tileselector {
ChunkTile getHighestResolutionTile(const LayerGroup& layerGroup, const TileIndex& tileIndex);
std::vector<ChunkTile> getTilesSortedByHighestResolution(const LayerGroup& layerGroup,
const TileIndex& tileIndex);
const TileIndex& tileIndex);
std::vector<std::pair<ChunkTile, const LayerRenderSettings*> >
getTilesAndSettingsSortedByHighestResolution(const LayerGroup& layerGroup,
const TileIndex& tileIndex);
getTilesAndSettingsSortedByHighestResolution(const LayerGroup& layerGroup,
const TileIndex& tileIndex);
void ascendToParent(TileIndex& tileIndex, TileUvTransform& uv);
......
......@@ -109,7 +109,7 @@ void KameleonDocumentationTask::perform(const Task::ProgressCallback & progressC
file.exceptions(~std::ofstream::goodbit);
file.open(_outputPath);
std::stringstream html;
std::stringstream html;
html << "<!DOCTYPE html>\n"
<< "<html>\n"
<< "\t<head>\n"
......
......@@ -119,13 +119,13 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
addTag(std::move(tagName));
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
ghoul::Dictionary tagNames = dictionary.value<ghoul::Dictionary>(KeyTag);
std::vector<std::string> keys = tagNames.keys();
std::vector<std::string> keys = tagNames.keys();
std::string tagName;
for (const std::string& key : keys) {
tagName = tagNames.value<std::string>(key);
if (!tagName.empty())
addTag(std::move(tagName));
}
}
}
if (_startTime != "" && _endTime != "") {
......
......@@ -152,13 +152,13 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
addTag(std::move(tagName));
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
ghoul::Dictionary tagNames = dictionary.value<ghoul::Dictionary>(KeyTag);
std::vector<std::string> keys = tagNames.keys();
std::vector<std::string> keys = tagNames.keys();
std::string tagName;
for (const std::string& key : keys) {
tagName = tagNames.value<std::string>(key);
if (!tagName.empty())
addTag(std::move(tagName));
}
}
}
// Setting spherical/euclidean onchange handler
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment