From 7f62bd7206ae47197242a924ef9bc19641268334 Mon Sep 17 00:00:00 2001 From: kalbl Date: Tue, 18 Oct 2016 15:40:27 +0200 Subject: [PATCH] Create namespace globebrowsing. --- .../openspace/interaction/interactionmode.h | 6 ++- modules/debugging/rendering/debugrenderer.cpp | 21 +++++---- modules/debugging/rendering/debugrenderer.h | 9 +++- modules/globebrowsing/chunk/chunk.cpp | 3 +- modules/globebrowsing/chunk/chunk.h | 5 ++- .../chunk/chunklevelevaluator.cpp | 4 +- .../globebrowsing/chunk/chunklevelevaluator.h | 6 +-- modules/globebrowsing/chunk/chunknode.cpp | 4 +- modules/globebrowsing/chunk/chunknode.h | 11 ++--- modules/globebrowsing/chunk/chunkrenderer.cpp | 4 +- modules/globebrowsing/chunk/chunkrenderer.h | 6 ++- modules/globebrowsing/chunk/culling.cpp | 4 +- modules/globebrowsing/chunk/culling.h | 9 ++-- modules/globebrowsing/geometry/aabb.cpp | 15 ++----- modules/globebrowsing/geometry/aabb.h | 13 ++---- modules/globebrowsing/geometry/angle.h | 30 +------------ modules/globebrowsing/geometry/angle.inl | 28 +----------- modules/globebrowsing/geometry/convexhull.cpp | 11 ++--- modules/globebrowsing/geometry/convexhull.h | 12 ++--- modules/globebrowsing/geometry/ellipsoid.cpp | 5 +-- modules/globebrowsing/geometry/ellipsoid.h | 11 ++--- modules/globebrowsing/geometry/geodetic2.cpp | 36 ++++----------- modules/globebrowsing/geometry/geodetic2.h | 24 +++------- modules/globebrowsing/globebrowsingmodule.cpp | 18 ++++---- .../globebrowsing/globes/chunkedlodglobe.cpp | 5 ++- .../globebrowsing/globes/chunkedlodglobe.h | 14 +++--- modules/globebrowsing/globes/pointglobe.cpp | 8 ++-- modules/globebrowsing/globes/pointglobe.h | 6 ++- .../globebrowsing/globes/renderableglobe.cpp | 5 ++- .../globebrowsing/globes/renderableglobe.h | 4 +- .../layered_rendering/layeredtextures.cpp | 15 ++++--- .../layered_rendering/layeredtextures.h | 3 ++ .../layeredtextureshaderprovider.cpp | 28 +++++------- .../layeredtextureshaderprovider.h | 11 +++-- .../layered_rendering/perlayersetting.cpp | 2 + .../layered_rendering/perlayersetting.h | 3 ++ modules/globebrowsing/meshes/basicgrid.cpp | 8 ++-- modules/globebrowsing/meshes/basicgrid.h | 4 ++ modules/globebrowsing/meshes/clipmapgrid.cpp | 29 ++++++------ modules/globebrowsing/meshes/clipmapgrid.h | 25 ++++++----- modules/globebrowsing/meshes/grid.cpp | 12 +++-- modules/globebrowsing/meshes/grid.h | 18 +++++--- modules/globebrowsing/meshes/skirtedgrid.cpp | 5 ++- modules/globebrowsing/meshes/skirtedgrid.h | 3 ++ modules/globebrowsing/meshes/trianglesoup.cpp | 5 ++- modules/globebrowsing/meshes/trianglesoup.h | 2 + .../other/concurrentjobmanager.h | 15 ++----- .../other/concurrentjobmanager.inl | 5 +-- modules/globebrowsing/other/concurrentqueue.h | 6 +-- .../globebrowsing/other/distanceswitch.cpp | 5 ++- modules/globebrowsing/other/distanceswitch.h | 9 ++-- modules/globebrowsing/other/lrucache.h | 11 +---- modules/globebrowsing/other/lrucache.inl | 11 ++--- .../globebrowsing/other/statscollector.cpp | 5 +-- modules/globebrowsing/other/statscollector.h | 14 +----- modules/globebrowsing/other/threadpool.cpp | 12 +---- modules/globebrowsing/other/threadpool.h | 8 +--- .../globebrowsing/tile/asynctilereader.cpp | 32 ++++--------- modules/globebrowsing/tile/asynctilereader.h | 31 ++----------- modules/globebrowsing/tile/pixelregion.cpp | 45 +++++-------------- modules/globebrowsing/tile/pixelregion.h | 13 +----- modules/globebrowsing/tile/tile.cpp | 8 ++-- modules/globebrowsing/tile/tile.h | 12 ++--- modules/globebrowsing/tile/tiledataset.cpp | 27 ++--------- modules/globebrowsing/tile/tiledataset.h | 12 +---- modules/globebrowsing/tile/tiledatatype.cpp | 26 +++-------- modules/globebrowsing/tile/tiledatatype.h | 9 ++-- .../globebrowsing/tile/tiledepthtransform.h | 6 +++ modules/globebrowsing/tile/tilediskcache.cpp | 8 ++-- modules/globebrowsing/tile/tilediskcache.h | 8 ++-- modules/globebrowsing/tile/tileindex.cpp | 6 +-- modules/globebrowsing/tile/tileindex.h | 18 ++------ modules/globebrowsing/tile/tileioresult.cpp | 21 ++------- modules/globebrowsing/tile/tileioresult.h | 13 +----- .../tile/tileprovider/cachingtileprovider.cpp | 4 +- .../tile/tileprovider/cachingtileprovider.h | 4 +- .../tile/tileprovider/singleimageprovider.cpp | 4 +- .../tile/tileprovider/singleimageprovider.h | 6 ++- .../tileprovider/temporaltileprovider.cpp | 23 ++-------- .../tile/tileprovider/temporaltileprovider.h | 18 ++------ .../tile/tileprovider/texttileprovider.cpp | 12 ++--- .../tile/tileprovider/texttileprovider.h | 10 ++--- .../tile/tileprovider/tileprovider.cpp | 6 +-- .../tile/tileprovider/tileprovider.h | 6 ++- .../tile/tileprovidermanager.cpp | 13 ++---- .../globebrowsing/tile/tileprovidermanager.h | 13 ++---- modules/globebrowsing/tile/tileselector.cpp | 8 ++-- modules/globebrowsing/tile/tileselector.h | 13 ++---- src/interaction/interactionmode.cpp | 2 +- 89 files changed, 374 insertions(+), 674 deletions(-) diff --git a/include/openspace/interaction/interactionmode.h b/include/openspace/interaction/interactionmode.h index b89cd36995..1d169afc61 100644 --- a/include/openspace/interaction/interactionmode.h +++ b/include/openspace/interaction/interactionmode.h @@ -31,6 +31,10 @@ #include #include +#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED +#include +#include +#endif #include @@ -258,7 +262,7 @@ public: private: //void updateCameraStateFromMouseStates(Camera& camera); - RenderableGlobe* _globe; + globebrowsing::RenderableGlobe* _globe; }; } // namespace interaction diff --git a/modules/debugging/rendering/debugrenderer.cpp b/modules/debugging/rendering/debugrenderer.cpp index 26b161daff..6021edb8be 100644 --- a/modules/debugging/rendering/debugrenderer.cpp +++ b/modules/debugging/rendering/debugrenderer.cpp @@ -224,17 +224,20 @@ namespace openspace { glEnable(GL_CULL_FACE); } - void DebugRenderer::renderAABB2(const AABB2& screenSpaceAABB, RGBA rgba) const { +#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED + void DebugRenderer::renderAABB2(const globebrowsing::AABB2& screenSpaceAABB, RGBA rgba) const { Vertices vertices(4); - vertices[0] = vec4(screenSpaceAABB.min.x, screenSpaceAABB.min.y, 1, 1); - vertices[1] = vec4(screenSpaceAABB.min.x, screenSpaceAABB.max.y, 1, 1); - vertices[2] = vec4(screenSpaceAABB.max.x, screenSpaceAABB.min.y, 1, 1); - vertices[3] = vec4(screenSpaceAABB.max.x, screenSpaceAABB.max.y, 1, 1); + vertices[0] = glm::vec4(screenSpaceAABB.min.x, screenSpaceAABB.min.y, 1, 1); + vertices[1] = glm::vec4(screenSpaceAABB.min.x, screenSpaceAABB.max.y, 1, 1); + vertices[2] = glm::vec4(screenSpaceAABB.max.x, screenSpaceAABB.min.y, 1, 1); + vertices[3] = glm::vec4(screenSpaceAABB.max.x, screenSpaceAABB.max.y, 1, 1); renderVertices(vertices, GL_LINES, rgba); } - - const DebugRenderer::Vertices DebugRenderer::verticesFor(const AABB3& screenSpaceAABB) const { +#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED + +#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED + const DebugRenderer::Vertices DebugRenderer::verticesFor(const globebrowsing::AABB3& screenSpaceAABB) const { Vertices vertices(8); for (size_t i = 0; i < 8; i++) { bool cornerIsRight = i % 2 == 0; @@ -245,11 +248,11 @@ namespace openspace { double y = cornerIsUp ? screenSpaceAABB.max.y : screenSpaceAABB.min.y; double z = cornerIsFar ? screenSpaceAABB.max.z : screenSpaceAABB.min.z; - vertices[i] = vec4(x, y, z, 1); + vertices[i] = glm::vec4(x, y, z, 1); } return std::move(vertices); } - +#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED } // namespace openspace diff --git a/modules/debugging/rendering/debugrenderer.h b/modules/debugging/rendering/debugrenderer.h index 52082cfcc7..ba07609d3e 100644 --- a/modules/debugging/rendering/debugrenderer.h +++ b/modules/debugging/rendering/debugrenderer.h @@ -131,17 +131,22 @@ namespace openspace { */ void renderCameraFrustum(const RenderData& data, const Camera& otherCamera, RGBA rgba = { 1, 1, 1, 0.3 }) const; +#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED /** * Renders a screen space AABB2 to the screen with the provided color */ - void renderAABB2(const AABB2& screenSpaceAABB, RGBA rgba = { 1, 1, 1, 0.3 }) const; + void renderAABB2(const globebrowsing::AABB2& screenSpaceAABB, RGBA rgba = { 1, 1, 1, 0.3 }) const; +#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED + +#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED /** * Takes a AABB3 in screen space and returns vertices representing the corner points * of the AABB. The ordering of the corner points is compatible with the box rendering * methods in this class. */ - const Vertices verticesFor(const AABB3& screenSpaceAABB) const; + const Vertices verticesFor(const globebrowsing::AABB3& screenSpaceAABB) const; +#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED protected: std::unique_ptr _programObject; diff --git a/modules/globebrowsing/chunk/chunk.cpp b/modules/globebrowsing/chunk/chunk.cpp index 406fbc446b..8c928b586a 100644 --- a/modules/globebrowsing/chunk/chunk.cpp +++ b/modules/globebrowsing/chunk/chunk.cpp @@ -40,6 +40,7 @@ namespace { } namespace openspace { +namespace globebrowsing { const float Chunk::DEFAULT_HEIGHT = 0.0f; @@ -204,5 +205,5 @@ namespace openspace { return corners; } - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/chunk/chunk.h b/modules/globebrowsing/chunk/chunk.h index 6a1a2044c4..dbdb5b839b 100644 --- a/modules/globebrowsing/chunk/chunk.h +++ b/modules/globebrowsing/chunk/chunk.h @@ -40,6 +40,7 @@ namespace openspace { +namespace globebrowsing { class RenderableGlobe; @@ -83,8 +84,8 @@ namespace openspace { }; - -} +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/chunk/chunklevelevaluator.cpp b/modules/globebrowsing/chunk/chunklevelevaluator.cpp index db8260db36..c325474178 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator.cpp +++ b/modules/globebrowsing/chunk/chunklevelevaluator.cpp @@ -41,7 +41,7 @@ namespace { } namespace openspace { - +namespace globebrowsing { int EvaluateChunkLevelByDistance::getDesiredLevel(const Chunk& chunk, const RenderData& data) const { // Calculations are done in the reference frame of the globe. Hence, the camera @@ -179,5 +179,5 @@ namespace openspace { return currLevel - 1;; } - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/chunk/chunklevelevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator.h index 6d74782127..be38a85319 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator.h @@ -32,8 +32,8 @@ #include - namespace openspace { +namespace globebrowsing { class ChunkLevelEvaluator { public: @@ -57,8 +57,8 @@ namespace openspace { public: virtual int getDesiredLevel(const Chunk& chunk, const RenderData& data) const; }; - -} +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/chunk/chunknode.cpp b/modules/globebrowsing/chunk/chunknode.cpp index 6d33ab76cb..c9e137bfae 100644 --- a/modules/globebrowsing/chunk/chunknode.cpp +++ b/modules/globebrowsing/chunk/chunknode.cpp @@ -39,6 +39,7 @@ namespace { } namespace openspace { +namespace globebrowsing { int ChunkNode::chunkNodeCount = 0; @@ -219,6 +220,5 @@ const Chunk& ChunkNode::getChunk() const { return _chunk; } - - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/chunk/chunknode.h b/modules/globebrowsing/chunk/chunknode.h index 84a72eeb72..842fd57617 100644 --- a/modules/globebrowsing/chunk/chunknode.h +++ b/modules/globebrowsing/chunk/chunknode.h @@ -39,16 +39,10 @@ #include - - -// forward declaration -namespace openspace { - class ChunkedLodGlobe; -} - - namespace openspace { +namespace globebrowsing { +class ChunkedLodGlobe; class ChunkNode { public: @@ -87,6 +81,7 @@ private: Chunk _chunk; }; +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/chunk/chunkrenderer.cpp b/modules/globebrowsing/chunk/chunkrenderer.cpp index fb14c2aa99..1cff4052d9 100644 --- a/modules/globebrowsing/chunk/chunkrenderer.cpp +++ b/modules/globebrowsing/chunk/chunkrenderer.cpp @@ -56,6 +56,7 @@ namespace { } namespace openspace { +namespace globebrowsing { ChunkRenderer::ChunkRenderer( std::shared_ptr grid, @@ -500,4 +501,5 @@ namespace openspace { // disable shader programObject->deactivate(); } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/chunk/chunkrenderer.h b/modules/globebrowsing/chunk/chunkrenderer.h index 4a31e683c0..ab8f6ccac2 100644 --- a/modules/globebrowsing/chunk/chunkrenderer.h +++ b/modules/globebrowsing/chunk/chunkrenderer.h @@ -51,7 +51,8 @@ namespace opengl { } namespace openspace { - +namespace globebrowsing { + class ChunkRenderer { public: ChunkRenderer(std::shared_ptr grid, @@ -127,6 +128,7 @@ namespace openspace { std::shared_ptr _localProgramUniformHandler; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __CHUNK_RENDERER_H__ diff --git a/modules/globebrowsing/chunk/culling.cpp b/modules/globebrowsing/chunk/culling.cpp index 7eaa34e9b6..3beb537175 100644 --- a/modules/globebrowsing/chunk/culling.cpp +++ b/modules/globebrowsing/chunk/culling.cpp @@ -42,6 +42,7 @@ namespace { } namespace openspace { +namespace globebrowsing { ////////////////////////////////////////////////////////////////////////////////////// // FRUSTUM CULLER // @@ -158,4 +159,5 @@ namespace openspace { return distanceToObjectSquared > minimumAllowedDistanceToObjectSquared; } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/chunk/culling.h b/modules/globebrowsing/chunk/culling.h index 3ed58b422d..85063a2e64 100644 --- a/modules/globebrowsing/chunk/culling.h +++ b/modules/globebrowsing/chunk/culling.h @@ -38,20 +38,18 @@ namespace openspace { +namespace globebrowsing { using namespace glm; - class Chunk; - class ChunkCuller { public: virtual void update() { } virtual bool isCullable(const Chunk& chunk, const RenderData& renderData) = 0; }; - class FrustumCuller : public ChunkCuller { public: @@ -65,7 +63,6 @@ namespace openspace { }; - //In the current implementation of the horizon culling and the distance to the //camera, the closer the ellipsoid is to a //sphere, the better this will make the splitting. Using the minimum radius to @@ -85,7 +82,7 @@ namespace openspace { }; - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __CULLING_H__ \ No newline at end of file diff --git a/modules/globebrowsing/geometry/aabb.cpp b/modules/globebrowsing/geometry/aabb.cpp index 43fe4154fd..33d3c08536 100644 --- a/modules/globebrowsing/geometry/aabb.cpp +++ b/modules/globebrowsing/geometry/aabb.cpp @@ -32,6 +32,8 @@ namespace { } namespace openspace { +namespace globebrowsing { + AABB1::AABB1() : min(1e35), max(-1e35) { } AABB1::AABB1(float min, float max) : min(min), max(max) { } @@ -69,11 +71,6 @@ namespace openspace { return AABBSpatialRelation::None; } - - - - - AABB2::AABB2() : min(1e35), max(-1e35) { } AABB2::AABB2(const vec2& min, const vec2& max) : min(min), max(max) { } @@ -116,9 +113,6 @@ namespace openspace { return AABBSpatialRelation::None; } - - - AABB3::AABB3() : min(1e35), max(-1e35) { } AABB3::AABB3(const vec3& min, const vec3& max) : min(min), max(max) { } @@ -166,6 +160,5 @@ namespace openspace { return AABBSpatialRelation::None; } - - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/geometry/aabb.h b/modules/globebrowsing/geometry/aabb.h index d153c5bd7e..47120e10d3 100644 --- a/modules/globebrowsing/geometry/aabb.h +++ b/modules/globebrowsing/geometry/aabb.h @@ -28,11 +28,8 @@ #include #include -// open space includes - - - namespace openspace { +namespace globebrowsing { using namespace glm; @@ -59,7 +56,6 @@ namespace openspace { float max; }; - struct AABB2 { AABB2(); AABB2(const vec2& min, const vec2& max); @@ -76,7 +72,6 @@ namespace openspace { vec2 max; }; - struct AABB3 { AABB3(); AABB3(const vec3& min, const vec3& max); @@ -89,11 +84,11 @@ namespace openspace { bool intersects(const AABB3& o) const; AABBSpatialRelation relationTo(const AABB3& o) const; - vec3 min; vec3 max; }; - -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace #endif // __AABB_H__ diff --git a/modules/globebrowsing/geometry/angle.h b/modules/globebrowsing/geometry/angle.h index 18996b0abf..d80ccfea8b 100644 --- a/modules/globebrowsing/geometry/angle.h +++ b/modules/globebrowsing/geometry/angle.h @@ -30,12 +30,11 @@ #include namespace openspace { - +namespace globebrowsing { template class Angle { public: - ////////////////////////////////////////////////////////////////////////////////////// // STATIC CONSTANTS // ////////////////////////////////////////////////////////////////////////////////////// @@ -43,7 +42,6 @@ public: static const T PI; static const T EPSILON; - /** = 0 radians = 0 degrees = no revolution */ static const Angle ZERO; @@ -56,9 +54,6 @@ public: /** = 2PI radians = 360 degrees = a full revolution */ static const Angle FULL; - - - ////////////////////////////////////////////////////////////////////////////////////// // Factory Methods // ////////////////////////////////////////////////////////////////////////////////////// @@ -67,7 +62,6 @@ public: static Angle fromDegrees(T degrees); static Angle fromRevolutions(T revs); - public: /** Copy constructor */ Angle(const Angle& other); @@ -76,7 +70,6 @@ private: /** Private constructor. Use factory methods to avoid unit confusion */ Angle(T rad); - ////////////////////////////////////////////////////////////////////////////////////// // Conversions // ////////////////////////////////////////////////////////////////////////////////////// @@ -85,7 +78,6 @@ public: inline T asDegrees() const; inline T asRevolutions() const; - ////////////////////////////////////////////////////////////////////////////////////// // Operators (boilerplate, I know.. /eb) // ////////////////////////////////////////////////////////////////////////////////////// @@ -109,10 +101,6 @@ public: bool operator==(const Angle& rhs) const; bool operator!=(const Angle& rhs) const; - - - - ////////////////////////////////////////////////////////////////////////////////////// // Chainable Relative Mutators // ////////////////////////////////////////////////////////////////////////////////////// @@ -133,12 +121,8 @@ public: */ Angle& clamp(const Angle& min = ZERO, const Angle& max = FULL); - Angle& abs(); - - - ////////////////////////////////////////////////////////////////////////////////////// // Chainable Relative Factory Methods // ////////////////////////////////////////////////////////////////////////////////////// @@ -159,28 +143,18 @@ public: */ Angle getClamped(const Angle& min = ZERO, const Angle& max = FULL) const; - Angle getAbs() const; - - private: - T _radians; - }; using dAngle = Angle; using fAngle = Angle; +} // namespace globebrowsing } // namespace openspace - - #include - - - - #endif // __ANGLE_H__ diff --git a/modules/globebrowsing/geometry/angle.inl b/modules/globebrowsing/geometry/angle.inl index 0478f94257..341b35893b 100644 --- a/modules/globebrowsing/geometry/angle.inl +++ b/modules/globebrowsing/geometry/angle.inl @@ -24,11 +24,8 @@ #include - - - namespace openspace { - +namespace globebrowsing { template const T Angle::PI = 3.14159265358979323846264338327950; @@ -36,8 +33,6 @@ const T Angle::PI = 3.14159265358979323846264338327950; template const T Angle::EPSILON = 1e-10; // Should depend on the typedef /eb - - ////////////////////////////////////////////////////////////////////////////////////////// // STATIC CONSTANTS // ////////////////////////////////////////////////////////////////////////////////////////// @@ -54,8 +49,6 @@ const Angle Angle::HALF = Angle::fromRadians(PI); template const Angle Angle::FULL = Angle::fromRadians(2*PI); - - ////////////////////////////////////////////////////////////////////////////////////////// // Constructors // ////////////////////////////////////////////////////////////////////////////////////////// @@ -66,9 +59,6 @@ template Angle::Angle(const Angle& other) template Angle::Angle(T radians) : _radians(radians) { } - - - ////////////////////////////////////////////////////////////////////////////////////////// // Factory Methods // ////////////////////////////////////////////////////////////////////////////////////////// @@ -88,8 +78,6 @@ Angle Angle::fromRevolutions(T revs) { return Angle(revs * 2 * PI); } - - ////////////////////////////////////////////////////////////////////////////////////////// // Conversions // ////////////////////////////////////////////////////////////////////////////////////////// @@ -109,12 +97,10 @@ T Angle::asRevolutions() const { return _radians / (2 * PI); } - ////////////////////////////////////////////////////////////////////////////////////////// // Operators // ////////////////////////////////////////////////////////////////////////////////////////// - template Angle Angle::operator+(const Angle& rhs) const{ return Angle(_radians + rhs._radians); @@ -135,13 +121,11 @@ Angle Angle::operator/(T divisor) const{ return Angle(_radians / divisor); } - template Angle Angle::operator-() const { return Angle(-_radians); } - template void Angle::operator+=(const Angle& rhs){ _radians += rhs._radians; @@ -162,9 +146,6 @@ void Angle::operator/=(T divisor){ _radians /= divisor; } - - - template bool Angle::operator<(const Angle& rhs) const{ return _radians < rhs._radians; @@ -195,8 +176,6 @@ bool Angle::operator!=(const Angle& rhs) const{ return _radians != rhs._radians; } - - ////////////////////////////////////////////////////////////////////////////////////////// // Chainable Relative Mutators // ////////////////////////////////////////////////////////////////////////////////////////// @@ -237,8 +216,6 @@ Angle& Angle::abs(){ return *this; } - - ////////////////////////////////////////////////////////////////////////////////////////// // Chainable Relative Factory Methods // ////////////////////////////////////////////////////////////////////////////////////////// @@ -258,11 +235,10 @@ Angle Angle::getClamped(const Angle& min, const Angle& max) const { return Angle(*this).clamp(min, max); } - - template Angle Angle::getAbs() const { return Angle(*this).abs(); } +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/geometry/convexhull.cpp b/modules/globebrowsing/geometry/convexhull.cpp index c154402e09..9d1f999bcd 100644 --- a/modules/globebrowsing/geometry/convexhull.cpp +++ b/modules/globebrowsing/geometry/convexhull.cpp @@ -22,7 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - #include #include @@ -30,16 +29,15 @@ #include #include - namespace { const std::string _loggerCat = "ConvexHull"; } namespace openspace { +namespace globebrowsing { Point2 ConvexHull2::p0(0,0); - ConvexHull2::ConvexHull2(){ } ConvexHull2 ConvexHull2::grahamScan_NOT_THREAD_SAFE(std::vector& points, int yMinIndex){ @@ -129,7 +127,6 @@ namespace openspace { return true; } - AABB1 ConvexHull2::projectedRegion(glm::vec2 direction) const { AABB1 projectedRegion; for (size_t i = 0; i < _points.size(); i++) { @@ -138,8 +135,6 @@ namespace openspace { return projectedRegion; } - - Point2 ConvexHull2::oneBelowTop(std::stack& S) { Point2 p = S.top(); S.pop(); @@ -179,5 +174,5 @@ namespace openspace { return (o == 2) ? -1 : 1; } - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/geometry/convexhull.h b/modules/globebrowsing/geometry/convexhull.h index 093d3f8403..b7c5dca25a 100644 --- a/modules/globebrowsing/geometry/convexhull.h +++ b/modules/globebrowsing/geometry/convexhull.h @@ -27,18 +27,14 @@ #include - #include #include #include #include -// open space includes - - - namespace openspace { +namespace globebrowsing { using namespace glm; @@ -58,7 +54,6 @@ namespace openspace { bool intersects(const ConvexHull2& o) const; AABB1 projectedRegion(glm::vec2 direction) const; - private: bool hasPerpendicularLineWhereProjectedPointsOverlap(const ConvexHull2& other) const; @@ -72,13 +67,12 @@ namespace openspace { static int orientation(const Point2& p, const Point2& q, const Point2& r); static float dist(const Point2& p1, const Point2& p2); - private: static Point2 p0; std::vector _points; }; - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __CONVEX_HULL_H__ \ No newline at end of file diff --git a/modules/globebrowsing/geometry/ellipsoid.cpp b/modules/globebrowsing/geometry/ellipsoid.cpp index b77bd1c9aa..d3d96a1b8e 100644 --- a/modules/globebrowsing/geometry/ellipsoid.cpp +++ b/modules/globebrowsing/geometry/ellipsoid.cpp @@ -33,6 +33,7 @@ namespace { } namespace openspace { +namespace globebrowsing { Ellipsoid::Ellipsoid() : Ellipsoid(1,1,1) { @@ -66,9 +67,6 @@ namespace openspace { _cached._maximumRadius = radii[2]; } - - - Vec3 Ellipsoid::geocentricSurfaceProjection(const Vec3& p) const { Scalar beta = 1.0 / sqrt(dot(p * p, _cached._oneOverRadiiSquared)); return beta * p; @@ -188,4 +186,5 @@ namespace openspace { return rSurface + geodetic3.height * normal; } +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/geometry/ellipsoid.h b/modules/globebrowsing/geometry/ellipsoid.h index a65c3d00e8..89b409f8b4 100644 --- a/modules/globebrowsing/geometry/ellipsoid.h +++ b/modules/globebrowsing/geometry/ellipsoid.h @@ -28,14 +28,16 @@ #include namespace openspace { +namespace globebrowsing { /** This class is based largely on the Ellipsoid class defined in the book "3D Engine Design for Virtual Globes". Most planets or planetary objects are better described using ellipsoids than spheres. All inputs and outputs to this class is - in the WGS84 standard coordinate system where the x-axis points towards geographic + based on the WGS84 standard coordinate system where the x-axis points towards geographic (lat = 0, lon = 0), the y-axis points towards (lat = 0, lon = 90deg) and the - z-axis points towards the north pole. + z-axis points towards the north pole. For other globes than earth of course the radii + can differ. */ class Ellipsoid { public: @@ -55,7 +57,6 @@ public: Ellipsoid(Scalar x, Scalar y, Scalar z); ~Ellipsoid(); - /** Scales a point along the geocentric normal and places it on the surface of the Ellipsoid. @@ -64,7 +65,6 @@ public: */ Vec3 geocentricSurfaceProjection(const Vec3& p) const; - /** Scales a point along the geodetic normal and places it on the surface of the Ellipsoid. @@ -81,7 +81,6 @@ public: const Vec3& oneOverRadiiSquared() const; const Vec3& radiiToTheFourth() const; - Scalar minimumRadius() const; Scalar maximumRadius() const; Scalar averageRadius() const; @@ -107,6 +106,8 @@ private: Vec3 _radii; }; + +} // namespace globebrowsing } // namespace openspace #endif // __ELLIPSOID_H__ diff --git a/modules/globebrowsing/geometry/geodetic2.cpp b/modules/globebrowsing/geometry/geodetic2.cpp index 6cb4b74bbc..1e22cca34a 100644 --- a/modules/globebrowsing/geometry/geodetic2.cpp +++ b/modules/globebrowsing/geometry/geodetic2.cpp @@ -28,13 +28,13 @@ #include - - namespace { const std::string _loggerCat = "Geodetic2"; } namespace openspace { +namespace globebrowsing { + ////////////////////////////////////////////////////////////////////////////////////// // GEODETIC2 // ////////////////////////////////////////////////////////////////////////////////////// @@ -47,16 +47,11 @@ namespace openspace { Geodetic2::Geodetic2(Scalar latitude, Scalar longitude) : lat(latitude) , lon(longitude) - { - - } + {} Geodetic2::Geodetic2(const Geodetic2& p) : Geodetic2(p.lat, p.lon) - { - - } - + {} Vec2 Geodetic2::toLonLatVec2() const { return Vec2(lon, lat); @@ -82,7 +77,6 @@ namespace openspace { return Geodetic2(lat / scalar, lon / scalar); } - ////////////////////////////////////////////////////////////////////////////////////// // GEODETICPATCH // ////////////////////////////////////////////////////////////////////////////////////// @@ -94,26 +88,19 @@ namespace openspace { Scalar halfSizeLon) : _center(Geodetic2(centerLat, centerLon)) , _halfSize(Geodetic2(halfSizeLat, halfSizeLon)) - { - - } + {} GeodeticPatch::GeodeticPatch( const Geodetic2& center, const Geodetic2& halfSize) : _center(center) , _halfSize(halfSize) - { - - } + {} GeodeticPatch::GeodeticPatch(const GeodeticPatch& patch) : _center(patch._center) , _halfSize(patch._halfSize) - { - - } - + {} GeodeticPatch::GeodeticPatch(const TileIndex& tileIndex) { Scalar deltaLat = (2 * M_PI) / ((double)(1 << tileIndex.level)); @@ -123,9 +110,6 @@ namespace openspace { _center = Geodetic2(nwCorner.lat - _halfSize.lat, nwCorner.lon + _halfSize.lon); } - - - void GeodeticPatch::setCenter(const Geodetic2& center) { _center = center; } @@ -180,14 +164,12 @@ namespace openspace { Scalar GeodeticPatch::maxLon() const { return _center.lon + _halfSize.lon; } - bool GeodeticPatch::contains(const Geodetic2& p) const { Geodetic2 diff = _center - p; return glm::abs(diff.lat) <= _halfSize.lat && glm::abs(diff.lon) <= _halfSize.lon; } - Scalar GeodeticPatch::edgeLatitudeNearestEquator() const { return _center.lat + _halfSize.lat * (isNorthern() ? -1 : 1); } @@ -196,7 +178,6 @@ namespace openspace { return _center.lat > 0.0; } - Geodetic2 GeodeticPatch::clamp(const Geodetic2& p) const { using Ang = Angle; @@ -222,7 +203,6 @@ namespace openspace { ); } - Geodetic2 GeodeticPatch::closestCorner(const Geodetic2& p) const { using Ang = Angle; @@ -247,7 +227,6 @@ namespace openspace { return Geodetic2(cornerLat, cornerLon); } - Geodetic2 GeodeticPatch::closestPoint(const Geodetic2& p) const { // This method finds the closest point on the patch, to the provided // point p. As we are deali ng with latitude-longitude patches, distance in this @@ -311,4 +290,5 @@ namespace openspace { return Geodetic2(clampedLat, clampedLon); } +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/geometry/geodetic2.h b/modules/globebrowsing/geometry/geodetic2.h index 24066f3839..5a344c05a7 100644 --- a/modules/globebrowsing/geometry/geodetic2.h +++ b/modules/globebrowsing/geometry/geodetic2.h @@ -37,31 +37,24 @@ #include - - - // Using double precision typedef double Scalar; typedef glm::dvec2 Vec2; typedef glm::dvec3 Vec3; namespace openspace { +namespace globebrowsing { - // Forward declaration - class Ellipsoid; +// Forward declaration +class Ellipsoid; struct Geodetic2 { Geodetic2(); Geodetic2(Scalar latitude, Scalar longitude); Geodetic2(const Geodetic2& src); - - /* - static Geodetic2 fromCartesian(const Vec3& v); - Vec3 asUnitCartesian() const; - */ - - + //static Geodetic2 fromCartesian(const Vec3& v); + //Vec3 asUnitCartesian() const; Vec2 toLonLatVec2() const; @@ -77,16 +70,11 @@ struct Geodetic2 { Scalar lon; }; - - struct Geodetic3 { Geodetic2 geodetic2; Scalar height; }; - - - ////////////////////////////////////////////////////////////////////////////////////// // GEODETICPATCH // ////////////////////////////////////////////////////////////////////////////////////// @@ -106,7 +94,6 @@ public: GeodeticPatch(const TileIndex& tileIndex); - void setCenter(const Geodetic2&); void setHalfSize(const Geodetic2&); @@ -168,6 +155,7 @@ private: Geodetic2 _halfSize; }; +} // namespace globebrowsing } // namespace openspace #endif // __GEODETIC2_H__ diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 6fc206e54d..e7ba3e3aab 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -50,21 +50,21 @@ void GlobeBrowsingModule::internalInitialize() { auto fRenderable = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "Renderable factory was not created"); - fRenderable->registerClass("RenderableGlobe"); + fRenderable->registerClass("RenderableGlobe"); void addFactory(std::unique_ptr factory); // add Tile Provider factory FactoryManager::ref().addFactory( - std::make_unique>()); + std::make_unique>()); - auto fTileProvider = FactoryManager::ref().factory(); - fTileProvider->registerClass("LRUCaching"); - fTileProvider->registerClass("SingleImage"); - fTileProvider->registerClass("Temporal"); - fTileProvider->registerClass("TileIndex"); - fTileProvider->registerClass("SizeReference"); - + auto fTileProvider = + FactoryManager::ref().factory(); + fTileProvider->registerClass("LRUCaching"); + fTileProvider->registerClass("SingleImage"); + fTileProvider->registerClass("Temporal"); + fTileProvider->registerClass("TileIndex"); + fTileProvider->registerClass("SizeReference"); } } // namespace openspace diff --git a/modules/globebrowsing/globes/chunkedlodglobe.cpp b/modules/globebrowsing/globes/chunkedlodglobe.cpp index f91e43d808..ebb2ded236 100644 --- a/modules/globebrowsing/globes/chunkedlodglobe.cpp +++ b/modules/globebrowsing/globes/chunkedlodglobe.cpp @@ -53,6 +53,7 @@ namespace { } namespace openspace { +namespace globebrowsing { const TileIndex ChunkedLodGlobe::LEFT_HEMISPHERE_INDEX = TileIndex(0, 0, 1); @@ -251,4 +252,6 @@ namespace openspace { void ChunkedLodGlobe::update(const UpdateData& data) { _renderer->update(); } -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/globes/chunkedlodglobe.h b/modules/globebrowsing/globes/chunkedlodglobe.h index 7ca02d5298..7a92cd36cb 100644 --- a/modules/globebrowsing/globes/chunkedlodglobe.h +++ b/modules/globebrowsing/globes/chunkedlodglobe.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __CHUNK_LOD_GLOBE__ -#define __CHUNK_LOD_GLOBE__ +#ifndef __CHUNKED_LOD_GLOBE__ +#define __CHUNKED_LOD_GLOBE__ #include @@ -42,11 +42,11 @@ #include namespace openspace { +namespace globebrowsing { + class ChunkLevelEvaluator; class RenderableGlobe; -} -namespace openspace { class ChunkedLodGlobe : public Renderable { public: ChunkedLodGlobe( @@ -101,6 +101,8 @@ namespace openspace { const RenderableGlobe& _owner; }; -} // namespace openspace -#endif // __CHUNK_LOD_GLOBE__ +} // namespace globebrowsing +} // namespace openspace + +#endif // __CHUNKED_LOD_GLOBE__ diff --git a/modules/globebrowsing/globes/pointglobe.cpp b/modules/globebrowsing/globes/pointglobe.cpp index 79bbb9b9bf..f9a72487b8 100644 --- a/modules/globebrowsing/globes/pointglobe.cpp +++ b/modules/globebrowsing/globes/pointglobe.cpp @@ -33,7 +33,6 @@ #include #include - // ghoul includes #include @@ -45,6 +44,7 @@ namespace { } namespace openspace { +namespace globebrowsing { PointGlobe::PointGlobe(const RenderableGlobe& owner) : _owner(owner) { @@ -107,7 +107,6 @@ namespace openspace { void PointGlobe::render(const RenderData& data) { _programObject->activate(); - // Calculate variables to be used as uniform variables in shader glm::dvec3 bodyPosition = data.modelTransform.translation; @@ -143,5 +142,6 @@ namespace openspace { void PointGlobe::update(const UpdateData& data) { } - -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/globes/pointglobe.h b/modules/globebrowsing/globes/pointglobe.h index 2bdfe21f31..a6d2376c4b 100644 --- a/modules/globebrowsing/globes/pointglobe.h +++ b/modules/globebrowsing/globes/pointglobe.h @@ -37,6 +37,8 @@ #include namespace openspace { +namespace globebrowsing { + using namespace ghoul::opengl; class RenderableGlobe; @@ -59,6 +61,8 @@ namespace openspace { GLuint _vertexBufferID; GLuint _vaoID; }; -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace #endif // __POINT_GLOBE__ diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index ceff1bc77b..bc88e02d8d 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -57,6 +57,8 @@ namespace { } namespace openspace { +namespace globebrowsing { + SingleTexturePropertyOwner::SingleTexturePropertyOwner(std::string name) : isEnabled("isEnabled", "isEnabled", true) { setName(name); @@ -376,5 +378,6 @@ namespace openspace { void RenderableGlobe::setSaveCamera(std::shared_ptr camera) { _savedCamera = camera; } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/globes/renderableglobe.h b/modules/globebrowsing/globes/renderableglobe.h index 273d2f9f21..bd1b673ff0 100644 --- a/modules/globebrowsing/globes/renderableglobe.h +++ b/modules/globebrowsing/globes/renderableglobe.h @@ -45,6 +45,7 @@ #include namespace openspace { +namespace globebrowsing { class ChunkedLodGlobe; class TileProviderManager; @@ -169,6 +170,7 @@ private: std::vector > _textureProperties; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __RENDERABLEGLOBE_H__ diff --git a/modules/globebrowsing/layered_rendering/layeredtextures.cpp b/modules/globebrowsing/layered_rendering/layeredtextures.cpp index 658b34aeea..a0fc531fcb 100644 --- a/modules/globebrowsing/layered_rendering/layeredtextures.cpp +++ b/modules/globebrowsing/layered_rendering/layeredtextures.cpp @@ -29,6 +29,7 @@ namespace { } namespace openspace { +namespace globebrowsing { const size_t LayeredTextures::NUM_TEXTURE_CATEGORIES; const size_t LayeredTextures::MAX_NUM_TEXTURES_PER_CATEGORY; @@ -84,19 +85,22 @@ namespace openspace { PerLayerSettings::PerLayerSettings() { // Here, all the per layer settings are specified and added - _array[LayeredTextures::LayerSettingsIds::opacity] = std::make_shared( + _array[LayeredTextures::LayerSettingsIds::opacity] = + std::make_shared( LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::opacity], LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::opacity], 1, 0, 1); - _array[LayeredTextures::LayerSettingsIds::gamma] = std::make_shared( + _array[LayeredTextures::LayerSettingsIds::gamma] = + std::make_shared( LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::gamma], LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::gamma], 1, 0, 5); - _array[LayeredTextures::LayerSettingsIds::multiplier] = std::make_shared( + _array[LayeredTextures::LayerSettingsIds::multiplier] = + std::make_shared( LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::multiplier], LayeredTextures::layerSettingsIds[LayeredTextures::LayerSettingsIds::multiplier], 1, @@ -115,6 +119,7 @@ namespace openspace { const std::array, LayeredTextures::NUM_LAYER_SETTINGS_VARIABLES>& PerLayerSettings::array() const { return _array; - } + } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/layered_rendering/layeredtextures.h b/modules/globebrowsing/layered_rendering/layeredtextures.h index 3bbd8c59ac..e3cab72977 100644 --- a/modules/globebrowsing/layered_rendering/layeredtextures.h +++ b/modules/globebrowsing/layered_rendering/layeredtextures.h @@ -37,6 +37,7 @@ #include namespace openspace { +namespace globebrowsing { class LayeredTextures { @@ -134,5 +135,7 @@ namespace openspace { LayeredTextures::NUM_LAYER_SETTINGS_VARIABLES> _array; }; +} // namespace globebrowsing } // namespace openspace + #endif // __LAYERED_TEXTURES_H__ diff --git a/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.cpp b/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.cpp index 6935996d83..e657d94994 100644 --- a/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.cpp +++ b/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.cpp @@ -36,6 +36,7 @@ namespace { } namespace openspace { +namespace globebrowsing { bool LayeredTextureInfo::operator==(const LayeredTextureInfo& other) const { @@ -60,11 +61,11 @@ namespace openspace { } // Commented this for-loop. Not necessary since the keyValuePairs // are always supposed to be equal. Comparing strings takes time. - /* - for (size_t i = 0; i < keyValuePairs.size(); i++) { - equal = equal && (keyValuePairs[i] == other.keyValuePairs[i]); - } - */ + + //for (size_t i = 0; i < keyValuePairs.size(); i++) { + // equal = equal && (keyValuePairs[i] == other.keyValuePairs[i]); + //} + return equal; } } @@ -77,9 +78,7 @@ namespace openspace { , _vsPath(vsPath) , _fsPath(fsPath) , _updatedOnLastCall(false) - { - - } + {} LayeredTextureShaderProvider::~LayeredTextureShaderProvider() { @@ -156,14 +155,10 @@ namespace openspace { } LayeredTextureShaderUniformIdHandler::LayeredTextureShaderUniformIdHandler() - { - - } + {} LayeredTextureShaderUniformIdHandler::~LayeredTextureShaderUniformIdHandler() - { - - } + {} void LayeredTextureShaderUniformIdHandler::updateIdsIfNecessary( LayeredTextureShaderProvider* shaderProvider) @@ -236,5 +231,6 @@ namespace openspace { { return *_shaderProvider->_programObject; } - -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.h b/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.h index bdd6a094e3..fd71208d18 100644 --- a/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.h +++ b/modules/globebrowsing/layered_rendering/layeredtextureshaderprovider.h @@ -33,11 +33,9 @@ #include #include -////////////////////////////////////////////////////////////////////////////////////////// -// LAYERED TEXTURE SHADER PROVIDER // -////////////////////////////////////////////////////////////////////////////////////////// - namespace openspace { +namespace globebrowsing { + using namespace ghoul::opengl; class LayeredTextureShaderUniformIdHandler; @@ -158,7 +156,6 @@ namespace openspace { LayeredTextures::NUM_TEXTURE_CATEGORIES> _tileUniformIds; - std::array< std::array< std::array< @@ -170,6 +167,8 @@ namespace openspace { LayeredTextureShaderProvider* _shaderProvider; }; -} // namespace openspace + +} // namespace globebrowsing +} // namespace openspace #endif // __LAYERED_TEXTURE_SHADER_PROVIDER__ diff --git a/modules/globebrowsing/layered_rendering/perlayersetting.cpp b/modules/globebrowsing/layered_rendering/perlayersetting.cpp index a7e48f2d18..b6407a9ac1 100644 --- a/modules/globebrowsing/layered_rendering/perlayersetting.cpp +++ b/modules/globebrowsing/layered_rendering/perlayersetting.cpp @@ -25,6 +25,7 @@ #include namespace openspace { +namespace globebrowsing { PerLayerSetting::PerLayerSetting() {} PerLayerSetting::~PerLayerSetting() {} @@ -48,4 +49,5 @@ namespace openspace { return &_property; } +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/layered_rendering/perlayersetting.h b/modules/globebrowsing/layered_rendering/perlayersetting.h index ce6082cc93..a3c412519a 100644 --- a/modules/globebrowsing/layered_rendering/perlayersetting.h +++ b/modules/globebrowsing/layered_rendering/perlayersetting.h @@ -33,6 +33,7 @@ #include namespace openspace { +namespace globebrowsing { using namespace ghoul::opengl; @@ -63,5 +64,7 @@ namespace openspace { properties::FloatProperty _property; }; +} // namespace globebrowsing } // namespace openspace + #endif // __PER_LAYER_SETTING_H__ diff --git a/modules/globebrowsing/meshes/basicgrid.cpp b/modules/globebrowsing/meshes/basicgrid.cpp index 98061deb00..248f62e708 100644 --- a/modules/globebrowsing/meshes/basicgrid.cpp +++ b/modules/globebrowsing/meshes/basicgrid.cpp @@ -29,6 +29,7 @@ namespace { } namespace openspace { +namespace globebrowsing { BasicGrid::BasicGrid( unsigned int xSegments, @@ -61,9 +62,7 @@ BasicGrid::BasicGrid( } BasicGrid::~BasicGrid() -{ - -} +{} int BasicGrid::xSegments() const { return _xSegments; @@ -172,4 +171,5 @@ std::vector BasicGrid::CreateNormals(int xSegments, int ySegments) { return normals; } -}// namespace openspace \ No newline at end of file +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/meshes/basicgrid.h b/modules/globebrowsing/meshes/basicgrid.h index 05097758da..da4bb7c4ea 100644 --- a/modules/globebrowsing/meshes/basicgrid.h +++ b/modules/globebrowsing/meshes/basicgrid.h @@ -33,6 +33,7 @@ #include namespace openspace { +namespace globebrowsing { class BasicGrid : public Grid { @@ -69,5 +70,8 @@ private: inline size_t numElements(int xSegments, int ySegments); inline size_t numVertices(int xSegments, int ySegments); }; + +} // namespace globebrowsing } // namespace openspace + #endif // __BASICGRIDGEOMETRY_H__ \ No newline at end of file diff --git a/modules/globebrowsing/meshes/clipmapgrid.cpp b/modules/globebrowsing/meshes/clipmapgrid.cpp index 771f6c89d9..4a99bb8c2d 100644 --- a/modules/globebrowsing/meshes/clipmapgrid.cpp +++ b/modules/globebrowsing/meshes/clipmapgrid.cpp @@ -31,21 +31,23 @@ namespace { } namespace openspace { +namespace globebrowsing { ////////////////////////////////////////////////////////////////////////////////////////// -// CLIPMAP GRID (Abstract class) // +// CLIPMAP GRID (Abstract class) // ////////////////////////////////////////////////////////////////////////////////////////// ClipMapGrid::ClipMapGrid(unsigned int segments) - : Grid(segments, segments, TriangleSoup::Positions::No, TriangleSoup::TextureCoordinates::Yes, TriangleSoup::Normals::No) -{ - -} + : Grid( + segments, + segments, + TriangleSoup::Positions::No, + TriangleSoup::TextureCoordinates::Yes, + TriangleSoup::Normals::No) +{} ClipMapGrid::~ClipMapGrid() -{ - -} +{} int ClipMapGrid::xSegments() const { return segments(); @@ -60,7 +62,7 @@ int ClipMapGrid::segments() const { } ////////////////////////////////////////////////////////////////////////////////////////// -// OUTER CLIPMAP GRID // +// OUTER CLIPMAP GRID // ////////////////////////////////////////////////////////////////////////////////////////// OuterClipMapGrid::OuterClipMapGrid(unsigned int segments) @@ -254,7 +256,6 @@ std::vector OuterClipMapGrid::CreatePositions(int xRes, int yRes) return positions; } - std::vector OuterClipMapGrid::CreateTextureCoordinates(int xRes, int yRes){ validate(xRes, yRes); int segments = xRes; @@ -316,10 +317,9 @@ std::vector OuterClipMapGrid::CreateNormals(int xRes, int yRes) { } ////////////////////////////////////////////////////////////////////////////////////////// -// INNER CLIPMAP GRID // +// INNER CLIPMAP GRID // ////////////////////////////////////////////////////////////////////////////////////////// - InnerClipMapGrid::InnerClipMapGrid(unsigned int segments) : ClipMapGrid(segments) { @@ -410,7 +410,6 @@ std::vector InnerClipMapGrid::CreatePositions(int xRes, int yRes) return positions; } - std::vector InnerClipMapGrid::CreateTextureCoordinates(int xRes, int yRes) { validate(xRes, yRes); int segments = xRes; @@ -444,5 +443,5 @@ std::vector InnerClipMapGrid::CreateNormals(int xRes, int yRes) { return normals; } - -}// namespace openspace \ No newline at end of file +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/meshes/clipmapgrid.h b/modules/globebrowsing/meshes/clipmapgrid.h index 80a68030d8..6f15d193f9 100644 --- a/modules/globebrowsing/meshes/clipmapgrid.h +++ b/modules/globebrowsing/meshes/clipmapgrid.h @@ -31,9 +31,10 @@ #include namespace openspace { +namespace globebrowsing { ////////////////////////////////////////////////////////////////////////////////////////// -// CLIPMAP GRID (Abstract class) // +// CLIPMAP GRID (Abstract class) // ////////////////////////////////////////////////////////////////////////////////////////// /** @@ -64,7 +65,7 @@ public: }; ////////////////////////////////////////////////////////////////////////////////////////// -// OUTER CLIPMAP GRID // +// OUTER CLIPMAP GRID // ////////////////////////////////////////////////////////////////////////////////////////// /** @@ -80,10 +81,10 @@ public: ~OuterClipMapGrid(); protected: - virtual std::vector CreateElements(int xSegments, int ySegments); - virtual std::vector CreatePositions(int xSegments, int ySegments); - virtual std::vector CreateTextureCoordinates(int xSegments, int ySegments); - virtual std::vector CreateNormals(int xSegments, int ySegments); + virtual std::vector CreateElements(int xSegments, int ySegments); + virtual std::vector CreatePositions(int xSegments, int ySegments); + virtual std::vector CreateTextureCoordinates(int xSegments, int ySegments); + virtual std::vector CreateNormals(int xSegments, int ySegments); private: void validate(int xSegments, int ySegments); @@ -98,7 +99,7 @@ private: }; ////////////////////////////////////////////////////////////////////////////////////////// -// INNER CLIPMAP GRID // +// INNER CLIPMAP GRID // ////////////////////////////////////////////////////////////////////////////////////////// /** @@ -114,10 +115,10 @@ public: ~InnerClipMapGrid(); private: - virtual std::vector CreateElements( int xSegments, int ySegments); - virtual std::vector CreatePositions(int xSegments, int ySegments); - virtual std::vector CreateTextureCoordinates(int xSegments, int ySegments); - virtual std::vector CreateNormals(int xSegments, int ySegments); + virtual std::vector CreateElements( int xSegments, int ySegments); + virtual std::vector CreatePositions(int xSegments, int ySegments); + virtual std::vector CreateTextureCoordinates(int xSegments, int ySegments); + virtual std::vector CreateNormals(int xSegments, int ySegments); void validate(int xSegments, int ySegments); @@ -125,5 +126,7 @@ private: static size_t numVertices(int segments); }; +} // namespace globebrowsing } // namespace openspace + #endif // __CLIPMAPGEOMETRY_H__ \ No newline at end of file diff --git a/modules/globebrowsing/meshes/grid.cpp b/modules/globebrowsing/meshes/grid.cpp index 414b81eecd..cd3b824b5e 100644 --- a/modules/globebrowsing/meshes/grid.cpp +++ b/modules/globebrowsing/meshes/grid.cpp @@ -29,6 +29,7 @@ namespace { } namespace openspace { +namespace globebrowsing { Grid::Grid( int xSegments, @@ -38,18 +39,15 @@ namespace openspace { TriangleSoup::Normals useNormals) : _xSegments(xSegments) , _ySegments(ySegments) -{ - -} +{} Grid::~Grid() -{ - -} +{} TriangleSoup& Grid::geometry() { return *_geometry; } -}// namespace openspace \ No newline at end of file +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/meshes/grid.h b/modules/globebrowsing/meshes/grid.h index 30986a04c6..d47b314998 100644 --- a/modules/globebrowsing/meshes/grid.h +++ b/modules/globebrowsing/meshes/grid.h @@ -33,6 +33,7 @@ #include namespace openspace { +namespace globebrowsing { /** * Abstract class defining an interface used for geometries with grid structures. @@ -47,7 +48,8 @@ public: int xSegments, int ySegments, TriangleSoup::Positions usePositions = TriangleSoup::Positions::No, - TriangleSoup::TextureCoordinates useTextures = TriangleSoup::TextureCoordinates::No, + TriangleSoup::TextureCoordinates useTextures = + TriangleSoup::TextureCoordinates::No, TriangleSoup::Normals useNormals = TriangleSoup::Normals::No); ~Grid(); @@ -74,9 +76,9 @@ protected: virtual std::vector CreateElements(int xSegments, int ySegments) = 0; /** - * Should return the positions of vertices for a grid with size xSegments * - * ySegments. Where the number of vertices in each direction is the number - * of segments + 1. + * Should return the positions of vertices for a grid with size xSegments + * * ySegments. Where the number of vertices in each direction is the + * number of segments + 1. */ virtual std::vector CreatePositions(int xSegments, int ySegments) = 0; @@ -85,7 +87,8 @@ protected: * xSegments * ySegments. Where the number of vertices in * each direction is the number of segments + 1. */ - virtual std::vector CreateTextureCoordinates(int xSegments, int ySegments) = 0; + virtual std::vector + CreateTextureCoordinates(int xSegments, int ySegments) = 0; /** * Should return the normals of vertices for a grid with size xSegments * @@ -99,5 +102,8 @@ protected: const int _xSegments; const int _ySegments; }; + +} // namespace globebrowsing } // namespace openspace -#endif // __GRIDGEOMETRY_H__ + +#endif // __GRIDGEOMETRY_H__ \ No newline at end of file diff --git a/modules/globebrowsing/meshes/skirtedgrid.cpp b/modules/globebrowsing/meshes/skirtedgrid.cpp index 7a130204e6..e5c42f6564 100644 --- a/modules/globebrowsing/meshes/skirtedgrid.cpp +++ b/modules/globebrowsing/meshes/skirtedgrid.cpp @@ -29,6 +29,7 @@ namespace { } namespace openspace { +namespace globebrowsing { SkirtedGrid::SkirtedGrid( unsigned int xSegments, @@ -171,4 +172,6 @@ namespace openspace { return normals; } -}// namespace openspace \ No newline at end of file + +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/meshes/skirtedgrid.h b/modules/globebrowsing/meshes/skirtedgrid.h index 57669006df..8f22d55b9c 100644 --- a/modules/globebrowsing/meshes/skirtedgrid.h +++ b/modules/globebrowsing/meshes/skirtedgrid.h @@ -33,6 +33,7 @@ #include namespace openspace { +namespace globebrowsing { /** * This grid is the same as BasicGrid except it has skirts around its edges. @@ -75,5 +76,7 @@ private: inline size_t numElements(int xSegments, int ySegments); inline size_t numVertices(int xSegments, int ySegments); }; + +} // namespace globebrowsing } // namespace openspace #endif // __SKIRTEDGRID_H__ \ No newline at end of file diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp index f50e88601b..96f6416cdf 100644 --- a/modules/globebrowsing/meshes/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -28,8 +28,8 @@ namespace { const std::string _loggerCat = "TriangleSoup"; } -namespace openspace -{ +namespace openspace { +namespace globebrowsing { TriangleSoup::TriangleSoup(std::vector elements, Positions usePositions, TextureCoordinates useTextures, Normals useNormals) @@ -170,4 +170,5 @@ void TriangleSoup::drawUsingActiveProgram() { glBindVertexArray(0); } +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/meshes/trianglesoup.h b/modules/globebrowsing/meshes/trianglesoup.h index c80988c29a..1b148f137f 100644 --- a/modules/globebrowsing/meshes/trianglesoup.h +++ b/modules/globebrowsing/meshes/trianglesoup.h @@ -34,6 +34,7 @@ #include namespace openspace { +namespace globebrowsing { /** * Class to hold vertex data and handling OpenGL interfacing and rendering. @@ -104,6 +105,7 @@ private: bool _gpuDataNeedUpdate; }; +} // namespace globebrowsing } // namespace openspace #endif // __TRIANGLESOUP_H__ diff --git a/modules/globebrowsing/other/concurrentjobmanager.h b/modules/globebrowsing/other/concurrentjobmanager.h index e34bbf3c16..be14d45baa 100644 --- a/modules/globebrowsing/other/concurrentjobmanager.h +++ b/modules/globebrowsing/other/concurrentjobmanager.h @@ -37,10 +37,8 @@ #include - - namespace openspace { - +namespace globebrowsing { // Templated abstract base class representing a job to be done. // Client code derive from this class and implement the virtual execute() method @@ -55,9 +53,6 @@ namespace openspace { }; - - - /* * Templated Concurrent Job Manager * This class is used execute specific jobs on one (1) parallell thread @@ -74,7 +69,6 @@ namespace openspace { } - void enqueueJob(std::shared_ptr> job) { //threadPool->queue([this, job]() { // job->execute(); @@ -105,16 +99,13 @@ namespace openspace { threadPool->clearTasks(); } - private: ConcurrentQueue>> _finishedJobs; std::shared_ptr threadPool; }; - +} // namespace globebrowsing } // namespace openspace - - -#endif // __CONCURRENT_JOB_MANAGER_H__ +#endif // __CONCURRENT_JOB_MANAGER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/other/concurrentjobmanager.inl b/modules/globebrowsing/other/concurrentjobmanager.inl index 662fe01799..fdb6301f32 100644 --- a/modules/globebrowsing/other/concurrentjobmanager.inl +++ b/modules/globebrowsing/other/concurrentjobmanager.inl @@ -29,11 +29,10 @@ #include //#include - namespace openspace { +namespace globebrowsing { - - +} // namespace globebrowsing } // namespace openspace #endif // \ No newline at end of file diff --git a/modules/globebrowsing/other/concurrentqueue.h b/modules/globebrowsing/other/concurrentqueue.h index 2694fc2de7..5d51ae294b 100644 --- a/modules/globebrowsing/other/concurrentqueue.h +++ b/modules/globebrowsing/other/concurrentqueue.h @@ -34,8 +34,7 @@ #include namespace openspace { - - +namespace globebrowsing { /** * Templated thread-safe queue based on std::thread and std::queue @@ -91,6 +90,7 @@ private: mutable std::condition_variable _cond; }; -} +} // namespace globebrowsing +} // namespace openspace #endif // __CONCURRENT_QUEUE_H__ diff --git a/modules/globebrowsing/other/distanceswitch.cpp b/modules/globebrowsing/other/distanceswitch.cpp index aa18752e40..7a8358c8d9 100644 --- a/modules/globebrowsing/other/distanceswitch.cpp +++ b/modules/globebrowsing/other/distanceswitch.cpp @@ -30,6 +30,7 @@ namespace { } namespace openspace { +namespace globebrowsing { DistanceSwitch::DistanceSwitch(){ @@ -84,7 +85,6 @@ void DistanceSwitch::update(const UpdateData& data) { } } - void DistanceSwitch::addSwitchValue(std::shared_ptr renderable, double maxDistance) { ghoul_assert(maxDistance > 0, "Renderable must have a positive maxDistance"); if (_maxDistances.size() > 0){ @@ -95,5 +95,6 @@ void DistanceSwitch::addSwitchValue(std::shared_ptr renderable, doub _maxDistances.push_back(maxDistance); } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/other/distanceswitch.h b/modules/globebrowsing/other/distanceswitch.h index 32f3b40377..56117a6558 100644 --- a/modules/globebrowsing/other/distanceswitch.h +++ b/modules/globebrowsing/other/distanceswitch.h @@ -35,7 +35,7 @@ #include namespace openspace { - +namespace globebrowsing { /** Selects a specific Renderable to be used for rendering, based on distance to the @@ -64,11 +64,12 @@ public: void addSwitchValue(std::shared_ptr renderable, double maxDistance); private: - - std::vector> _renderables; std::vector _maxDistances; }; + +} // namespace globebrowsing } // openspace -#endif //__DISTANCESWITCH_H__ + +#endif //__DISTANCESWITCH_H__ \ No newline at end of file diff --git a/modules/globebrowsing/other/lrucache.h b/modules/globebrowsing/other/lrucache.h index 031463373e..f34ac514b3 100644 --- a/modules/globebrowsing/other/lrucache.h +++ b/modules/globebrowsing/other/lrucache.h @@ -31,9 +31,8 @@ #include #include - - namespace openspace { +namespace globebrowsing { // Templated class implementing a Least-Recently-Used Cache template @@ -42,31 +41,25 @@ namespace openspace { LRUCache(size_t size); ~LRUCache(); - void put(const KeyType& key, const ValueType& value); void clear(); bool exist(const KeyType& key) const; ValueType get(const KeyType& key); size_t size() const; - private: void clean(); - // Member varialbes private: - std::list> _itemList; std::unordered_map _itemMap; size_t _cacheSize; - }; - +} // namespace globebrowsing } // namespace openspace - #include #endif // __LRU_CACHE_H__ diff --git a/modules/globebrowsing/other/lrucache.inl b/modules/globebrowsing/other/lrucache.inl index 2ff72383b0..ae00f48964 100644 --- a/modules/globebrowsing/other/lrucache.inl +++ b/modules/globebrowsing/other/lrucache.inl @@ -31,7 +31,7 @@ namespace openspace { - +namespace globebrowsing { template LRUCache::LRUCache(size_t size) @@ -42,7 +42,6 @@ namespace openspace { // Clean up list and map! } - ////////////////////////////// // PUBLIC INTERFACE // ////////////////////////////// @@ -67,14 +66,12 @@ namespace openspace { clean(); } - template bool LRUCache::exist(const KeyType& key) const { return _itemMap.count(key) > 0; } - template ValueType LRUCache::get(const KeyType& key) { @@ -91,8 +88,6 @@ namespace openspace { return _itemMap.size(); } - - ////////////////////////////// // PRIVATE HELPERS // ////////////////////////////// @@ -106,7 +101,7 @@ namespace openspace { } } - +} // namespace globebrowsing } // namespace openspace -#endif // !__LRU_CACHE__ \ No newline at end of file +#endif // __LRU_CACHE__ \ No newline at end of file diff --git a/modules/globebrowsing/other/statscollector.cpp b/modules/globebrowsing/other/statscollector.cpp index 62ee4f6c89..75439eff29 100644 --- a/modules/globebrowsing/other/statscollector.cpp +++ b/modules/globebrowsing/other/statscollector.cpp @@ -26,9 +26,8 @@ #include - - namespace openspace { +namespace globebrowsing { - +} // namespace globebrowsing } // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/other/statscollector.h b/modules/globebrowsing/other/statscollector.h index 3bb73728fa..1e1cd7d647 100644 --- a/modules/globebrowsing/other/statscollector.h +++ b/modules/globebrowsing/other/statscollector.h @@ -28,7 +28,6 @@ #include #include - #include #include #include @@ -36,10 +35,8 @@ #include #include - - namespace openspace { - +namespace globebrowsing { template struct StatsRecord : public std::unordered_map { @@ -51,7 +48,6 @@ namespace openspace { std::set keys; }; - template class TemplatedStatsCollector{ public: @@ -126,7 +122,6 @@ namespace openspace { } } - private: StatsCollection _data; @@ -135,7 +130,6 @@ namespace openspace { size_t _writePos; std::string _delimiter; - }; class StatsCollector { @@ -280,11 +274,7 @@ namespace openspace { }; */ - +} // namespace globebrowsing } // namespace openspace - - - - #endif // __STATS_TRACKER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/other/threadpool.cpp b/modules/globebrowsing/other/threadpool.cpp index 50618c49fb..913d7ca621 100644 --- a/modules/globebrowsing/other/threadpool.cpp +++ b/modules/globebrowsing/other/threadpool.cpp @@ -33,9 +33,8 @@ #include #include - - namespace openspace { +namespace globebrowsing { Worker::Worker(ThreadPool& pool) : pool(pool) @@ -70,14 +69,8 @@ namespace openspace { // execute the task task(); } - - } - - - - ThreadPool::ThreadPool(size_t numThreads) : stop(false) { @@ -97,7 +90,6 @@ namespace openspace { workers[i].join(); } } - // add new work item to the pool void ThreadPool::enqueue(std::function f) { @@ -119,5 +111,5 @@ namespace openspace { } // release lock } - +} // namespace globebrowsing } // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/other/threadpool.h b/modules/globebrowsing/other/threadpool.h index 00f0964705..edff6ff96d 100644 --- a/modules/globebrowsing/other/threadpool.h +++ b/modules/globebrowsing/other/threadpool.h @@ -35,12 +35,10 @@ #include - - // Implementatin based on http://progsch.net/wordpress/?p=81 namespace openspace { - +namespace globebrowsing { class ThreadPool; @@ -73,9 +71,7 @@ namespace openspace { bool stop; }; - +} // namespace globebrowsing } // namespace openspace - - #endif // __THREAD_POOL_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/asynctilereader.cpp b/modules/globebrowsing/tile/asynctilereader.cpp index 67d84a486b..469a3bfc1a 100644 --- a/modules/globebrowsing/tile/asynctilereader.cpp +++ b/modules/globebrowsing/tile/asynctilereader.cpp @@ -22,33 +22,27 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - #include -#include // abspath +#include #include #include #include #include - #include namespace { const std::string _loggerCat = "AsyncTextureDataProvider"; } - - namespace openspace { +namespace globebrowsing { void TileLoadJob::execute() { _tileIOResult = _tileDataset->readTileData(_chunkIndex); } - - - DiskCachedTileLoadJob::DiskCachedTileLoadJob(std::shared_ptr textureDataProvider, const TileIndex& tileIndex, std::shared_ptr tdc, CacheMode m) : TileLoadJob(textureDataProvider, tileIndex) @@ -70,8 +64,6 @@ namespace openspace { else if (cacheMode == "CacheHitsOnly") _mode = CacheMode::CacheHitsOnly; } - - void DiskCachedTileLoadJob::execute() { _tileIOResult = nullptr; @@ -109,25 +101,17 @@ namespace openspace { } break; } - - } - - AsyncTileDataProvider::AsyncTileDataProvider( std::shared_ptr tileDataset, std::shared_ptr pool) : _tileDataset(tileDataset) , _concurrentJobManager(pool) - { - - } - - AsyncTileDataProvider::~AsyncTileDataProvider() { - - } + {} + AsyncTileDataProvider::~AsyncTileDataProvider() + {} std::shared_ptr AsyncTileDataProvider::getTextureDataProvider() const { return _tileDataset; @@ -151,8 +135,7 @@ namespace openspace { readyResults.push_back(_concurrentJobManager.popFinishedJob()->product()); } return readyResults; - } - + } bool AsyncTileDataProvider::satisfiesEnqueueCriteria(const TileIndex& tileIndex) const { // only allow tile to be enqueued if it's not already enqueued @@ -180,4 +163,5 @@ namespace openspace { _enqueuedTileRequests.clear(); } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/asynctilereader.h b/modules/globebrowsing/tile/asynctilereader.h index b3862794de..585bee9db0 100644 --- a/modules/globebrowsing/tile/asynctilereader.h +++ b/modules/globebrowsing/tile/asynctilereader.h @@ -38,32 +38,25 @@ #include - #include #include #include #include - - namespace openspace { +namespace globebrowsing { struct LoadJob : public Job { virtual void execute() = 0; virtual std::shared_ptr product() = 0; }; - struct TileLoadJob : LoadJob { - - TileLoadJob(std::shared_ptr textureDataProvider, const TileIndex& tileIndex) : _tileDataset(textureDataProvider) , _chunkIndex(tileIndex) - { - - } + {} virtual ~TileLoadJob() { } @@ -73,17 +66,12 @@ namespace openspace { return _tileIOResult; } - protected: - TileIndex _chunkIndex; std::shared_ptr _tileDataset; std::shared_ptr _tileIOResult; }; - - - class TileDiskCache; struct DiskCachedTileLoadJob : public TileLoadJob { @@ -106,24 +94,18 @@ namespace openspace { virtual void execute(); protected: - std::shared_ptr _tileDiskCache; CacheMode _mode; }; - - - class AsyncTileDataProvider { public: - AsyncTileDataProvider(std::shared_ptr textureDataProvider, std::shared_ptr pool); ~AsyncTileDataProvider(); - bool enqueueTileIO(const TileIndex& tileIndex); std::vector> getTileIOResults(); @@ -133,22 +115,15 @@ namespace openspace { std::shared_ptr getTextureDataProvider() const; protected: - virtual bool satisfiesEnqueueCriteria(const TileIndex&) const; private: - - - std::shared_ptr _tileDataset; ConcurrentJobManager _concurrentJobManager; std::unordered_map _enqueuedTileRequests; - - }; - - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/tile/pixelregion.cpp b/modules/globebrowsing/tile/pixelregion.cpp index 6e2e3bf942..0952801254 100644 --- a/modules/globebrowsing/tile/pixelregion.cpp +++ b/modules/globebrowsing/tile/pixelregion.cpp @@ -28,44 +28,27 @@ #include #include - - - - namespace { const std::string _loggerCat = "PixelRegion"; } - - - namespace openspace { - +namespace globebrowsing { - PixelRegion::PixelRegion() : start(0) , numPixels(0) - { - - } + {} PixelRegion::PixelRegion(const PixelRegion& o) : start(o.start) , numPixels(o.numPixels) - { - - } + {} PixelRegion::PixelRegion(const PixelCoordinate& pixelStart, const PixelRange& numberOfPixels) : start(pixelStart) , numPixels(numberOfPixels) - { - - } - - - + {} ////////////////////////////////////////////////////////////////////////////////// // Mutators // @@ -98,7 +81,6 @@ namespace openspace { numPixels.y = y - start.y; } - void PixelRegion::align(Side side, int pos) { switch (side) { case LEFT: alignLeft(pos); break; @@ -124,8 +106,6 @@ namespace openspace { start.y = y - numPixels.y; } - - void PixelRegion::scale(const glm::dvec2& s) { start = PixelCoordinate(glm::round(s * glm::dvec2(start))); numPixels = PixelCoordinate(glm::round(s * glm::dvec2(numPixels))); @@ -153,8 +133,6 @@ namespace openspace { start -= wrt; } - - void PixelRegion::move(Side side, int amount) { switch (side) { case LEFT: start.x -= amount; break; @@ -237,7 +215,6 @@ namespace openspace { else return globalCut(side, edge(side) - edgeDirectionSign(side) * p); } - ////////////////////////////////////////////////////////////////////////////////// // Accessors // ////////////////////////////////////////////////////////////////////////////////// @@ -246,7 +223,6 @@ namespace openspace { return numPixels.x * numPixels.y; } - int PixelRegion::edge(Side side) const { switch (side) { case LEFT: return start.x; @@ -268,16 +244,15 @@ namespace openspace { // Comparators // ////////////////////////////////////////////////////////////////////////////////// - bool PixelRegion::lineIntersect(Side side, int p) { switch (side) { - case openspace::PixelRegion::LEFT: - case openspace::PixelRegion::RIGHT: + case PixelRegion::LEFT: + case PixelRegion::RIGHT: return start.x <= p && p <= (start.x + numPixels.x); - case openspace::PixelRegion::TOP: - case openspace::PixelRegion::BOTTOM: + case PixelRegion::TOP: + case PixelRegion::BOTTOM: return start.y <= p && p <= (start.y + numPixels.y); } } @@ -293,5 +268,5 @@ namespace openspace { return start == r.start && numPixels == r.numPixels; } - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/pixelregion.h b/modules/globebrowsing/tile/pixelregion.h index 77ce7cfb35..02f9eb84e3 100644 --- a/modules/globebrowsing/tile/pixelregion.h +++ b/modules/globebrowsing/tile/pixelregion.h @@ -28,6 +28,7 @@ #include namespace openspace { +namespace globebrowsing { typedef glm::ivec2 PixelCoordinate; typedef glm::ivec2 PixelRange; @@ -41,7 +42,6 @@ namespace openspace { PixelRegion(); PixelRegion(const PixelRegion& o); PixelRegion(const PixelCoordinate& pixelStart, const PixelRange& numberOfPixels); - ////////////////////////////////////////////////////////////////////////////////// // Mutators // @@ -72,7 +72,6 @@ namespace openspace { void alignTop(int y); void alignRight(int x); void alignBottom(int y); - void scale(const glm::dvec2& s); void scale(double s); @@ -87,11 +86,9 @@ namespace openspace { void roundUpNumPixelToNearestMultipleOf(unsigned int multiple); void roundDownToQuadratic(); - PixelRegion globalCut(Side side, int globalPos); PixelRegion localCut(Side side, int localPos); - ////////////////////////////////////////////////////////////////////////////////// // Accessors // ////////////////////////////////////////////////////////////////////////////////// @@ -101,7 +98,6 @@ namespace openspace { int edgeDirectionSign(Side side) const; PixelCoordinate end() const; - ////////////////////////////////////////////////////////////////////////////////// // Comparators // ////////////////////////////////////////////////////////////////////////////////// @@ -110,7 +106,6 @@ namespace openspace { bool isInside(const PixelRegion& r) const; bool equals(const PixelRegion& r) const; - ////////////////////////////////////////////////////////////////////////////////// // Members // ////////////////////////////////////////////////////////////////////////////////// @@ -119,11 +114,7 @@ namespace openspace { PixelRange numPixels; }; - - - +} // namespace globebrowsing } // namespace openspace - - #endif // __PIXEL_REGION_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tile.cpp b/modules/globebrowsing/tile/tile.cpp index a7489dfe60..0fcfdc6ec5 100644 --- a/modules/globebrowsing/tile/tile.cpp +++ b/modules/globebrowsing/tile/tile.cpp @@ -30,12 +30,11 @@ namespace { const std::string _loggerCat = "Tile"; } - namespace openspace { +namespace globebrowsing { const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::Status::Unavailable }; - Tile Tile::createPlainTile(const glm::uvec2& size, const glm::uvec4& color) { using namespace ghoul::opengl; @@ -67,6 +66,5 @@ namespace openspace { return tile; } - - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/tile/tile.h b/modules/globebrowsing/tile/tile.h index 5fe0150299..8adbb221fb 100644 --- a/modules/globebrowsing/tile/tile.h +++ b/modules/globebrowsing/tile/tile.h @@ -29,9 +29,9 @@ #include // TilePreprocessData - namespace openspace { - +namespace globebrowsing { + using namespace ghoul::opengl; /** @@ -41,7 +41,6 @@ namespace openspace { std::shared_ptr texture; std::shared_ptr preprocessData; - /** * Describe if this Tile is good for usage (OK) or otherwise * the reason why it is not. @@ -73,7 +72,6 @@ namespace openspace { */ OK } status; - /** * Instantiates a new tile with a single color. @@ -94,9 +92,7 @@ namespace openspace { }; -} // namespace openspace - - - +} // namespace globebrowsing +} // namespace openspace #endif // __TILE_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tiledataset.cpp b/modules/globebrowsing/tile/tiledataset.cpp index 726b54f124..ec1ac4be5f 100644 --- a/modules/globebrowsing/tile/tiledataset.cpp +++ b/modules/globebrowsing/tile/tiledataset.cpp @@ -44,16 +44,14 @@ #include #include - namespace { const std::string _loggerCat = "TileDataset"; } - - namespace openspace { +namespace globebrowsing { - std::ostream& operator<<(std::ostream& os, const openspace::PixelRegion& pr) { + std::ostream& operator<<(std::ostream& os, const PixelRegion& pr) { return os << pr.start.x << ", " << pr.start.y << " with size " << pr.numPixels.x << ", " << pr.numPixels.y; } @@ -75,8 +73,6 @@ namespace openspace { textureFormat = TileDataType::getTextureFormat(numRasters, gdalType); } - - IODescription IODescription::cut(PixelRegion::Side side, int pos) { PixelRegion readPreCut = read.region; PixelRegion writePreCut = write.region; @@ -107,12 +103,6 @@ namespace openspace { return whatCameOff; } - - - - - - ////////////////////////////////////////////////////////////////////////////////// // Tile Dataset // ////////////////////////////////////////////////////////////////////////////////// @@ -124,8 +114,6 @@ namespace openspace { bool TileDataset::GdalHasBeenInitialized = false; - - TileDataset::TileDataset(const std::string& gdalDatasetDesc, const Configuration& config) : _config(config) , hasBeenInitialized(false) @@ -672,8 +660,6 @@ namespace openspace { // The return error from a repeated rasterIO is ONLY based on the main region, // which in the usual case will cover the main area of the patch anyway - - return err; } @@ -701,7 +687,6 @@ namespace openspace { // handle requested write region dataDest -= io.write.region.start.y * io.write.bytesPerLine; // note -= since flipped y axis dataDest += io.write.region.start.x * _dataLayout.bytesPerPixel; - return rasterBand->RasterIO( GF_Read, @@ -717,7 +702,6 @@ namespace openspace { -io.write.bytesPerLine); // Line spacing } - std::shared_ptr TileDataset::preprocess(std::shared_ptr result, const PixelRegion& region) const { size_t bytesPerLine = _dataLayout.bytesPerPixel * region.numPixels.x; size_t totalNumBytes = bytesPerLine * region.numPixels.y; @@ -737,9 +721,6 @@ namespace openspace { noDataValues[c] = _dataset->GetRasterBand(1)->GetNoDataValue(); } - - - for (size_t y = 0; y < region.numPixels.y; y++) { size_t yi = (region.numPixels.y - 1 - y) * bytesPerLine; size_t i = 0; @@ -799,5 +780,5 @@ namespace openspace { return CE_None; } - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tiledataset.h b/modules/globebrowsing/tile/tiledataset.h index 400c9a6ae0..b55c7156b3 100644 --- a/modules/globebrowsing/tile/tiledataset.h +++ b/modules/globebrowsing/tile/tiledataset.h @@ -31,7 +31,6 @@ #include #include - #include #include #include @@ -40,8 +39,8 @@ #include #include - namespace openspace { +namespace globebrowsing { struct TileDataLayout { TileDataLayout(); @@ -70,16 +69,12 @@ namespace openspace { size_t totalNumBytes; } write; - IODescription cut(PixelRegion::Side side, int pos); }; - - using namespace ghoul::opengl; using namespace ghoul::filesystem; - class TileDataset { public: @@ -190,10 +185,7 @@ namespace openspace { bool hasBeenInitialized; }; - - +} // namespace globebrowsing } // namespace openspace - - #endif // __TILE_DATASET_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tiledatatype.cpp b/modules/globebrowsing/tile/tiledatatype.cpp index 726cf2e17e..f332a7803a 100644 --- a/modules/globebrowsing/tile/tiledatatype.cpp +++ b/modules/globebrowsing/tile/tiledatatype.cpp @@ -22,6 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ + +#include + #include #include @@ -29,10 +32,6 @@ #include // abspath #include - -#include - - #include #include @@ -40,17 +39,13 @@ #include #include - - - - namespace { const std::string _loggerCat = "TileIOResult"; } - - namespace openspace { +namespace globebrowsing { + float TileDataType::interpretFloat(GDALDataType gdalType, const char* src) { switch (gdalType) { case GDT_Byte: return static_cast(*reinterpret_cast(src)); @@ -67,8 +62,6 @@ namespace openspace { } } - - size_t TileDataType::numberOfBytes(GDALDataType gdalType) { switch (gdalType) { case GDT_Byte: return sizeof(GLubyte); @@ -98,7 +91,6 @@ namespace openspace { } } - TextureFormat TileDataType::getTextureFormat( int rasterCount, GDALDataType gdalType) { @@ -164,11 +156,6 @@ namespace openspace { return format; } - - - - - GLuint TileDataType::getOpenGLDataType(GDALDataType gdalType) { switch (gdalType) { case GDT_Byte: return GL_UNSIGNED_BYTE; @@ -199,4 +186,5 @@ namespace openspace { } } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tiledatatype.h b/modules/globebrowsing/tile/tiledatatype.h index 1df7a0d5bd..7647fde519 100644 --- a/modules/globebrowsing/tile/tiledatatype.h +++ b/modules/globebrowsing/tile/tiledatatype.h @@ -32,9 +32,9 @@ #include "gdal_priv.h" - namespace openspace { - +namespace globebrowsing { + struct TileDataType { static GLuint getOpenGLDataType(GDALDataType gdalType); @@ -51,10 +51,7 @@ namespace openspace { }; +} // namespace globebrowsing } // namespace openspace - - - - #endif // __TILE_DATA_TYPE_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tiledepthtransform.h b/modules/globebrowsing/tile/tiledepthtransform.h index c283600164..2aac786f09 100644 --- a/modules/globebrowsing/tile/tiledepthtransform.h +++ b/modules/globebrowsing/tile/tiledepthtransform.h @@ -25,9 +25,15 @@ #ifndef __TILEDEPTHTRANSFORM_H__ #define __TILEDEPTHTRANSFORM_H__ +namespace openspace { +namespace globebrowsing { + struct TileDepthTransform { float depthScale; float depthOffset; }; +} // namespace globebrowsing +} // namespace openspace + #endif // __TILEDEPTHTRANSFORM_H__ diff --git a/modules/globebrowsing/tile/tilediskcache.cpp b/modules/globebrowsing/tile/tilediskcache.cpp index d15fc00472..08fceb2241 100644 --- a/modules/globebrowsing/tile/tilediskcache.cpp +++ b/modules/globebrowsing/tile/tilediskcache.cpp @@ -36,10 +36,10 @@ namespace { const std::string _loggerCat = "TileDiskCache"; } - namespace openspace { - const std::string TileDiskCache::CACHE_ROOT = "tilecache"; +namespace globebrowsing { + const std::string TileDiskCache::CACHE_ROOT = "tilecache"; TileDiskCache::TileDiskCache(const std::string& name) : _name(name) @@ -61,7 +61,6 @@ namespace openspace { return FileSys.fileExists(metaFile); } - std::shared_ptr TileDiskCache::get(const TileIndex& tileIndex) { File metaDataFile = getMetaDataFile(tileIndex); File dataFile = getDataFile(tileIndex); @@ -120,6 +119,5 @@ namespace openspace { return File(getFilePath(tileIndex) + ".data"); } - - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/tile/tilediskcache.h b/modules/globebrowsing/tile/tilediskcache.h index 8d0ec4766e..32ecbbaa1c 100644 --- a/modules/globebrowsing/tile/tilediskcache.h +++ b/modules/globebrowsing/tile/tilediskcache.h @@ -25,14 +25,13 @@ #ifndef __TILE_DISK_CACHE_H__ #define __TILE_DISK_CACHE_H__ - #include #include #include - namespace openspace { +namespace globebrowsing { struct TileIOResult; @@ -45,7 +44,6 @@ struct TileIOResult; std::shared_ptr get(const TileIndex& tileIndex); bool has(const TileIndex& tileIndex) const; bool put(const TileIndex& tileIndex, std::shared_ptr tileIOResult); - static const std::string CACHE_ROOT; @@ -60,7 +58,7 @@ struct TileIOResult; }; -} // namespace openspace - +} // namespace globebrowsing +} // namespace openspace #endif // __TILE_DISK_CACHE_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileindex.cpp b/modules/globebrowsing/tile/tileindex.cpp index 8e649f5afc..59e2836b2d 100644 --- a/modules/globebrowsing/tile/tileindex.cpp +++ b/modules/globebrowsing/tile/tileindex.cpp @@ -32,6 +32,7 @@ namespace { } namespace openspace { +namespace globebrowsing { /** Creates the geodetic tile index for the Geodetic patch that covers the @@ -78,7 +79,6 @@ namespace openspace { return *this; } - /** Gets the tile at a specified offset from this tile. Accepts delta indices ranging from [-2^level, Infinity[ @@ -95,7 +95,6 @@ namespace openspace { return std::abs(x - other.x) + std::abs(y - other.y); } - /** Creates a hash which can be used as key in hash maps. @@ -116,7 +115,6 @@ namespace openspace { return key; } - std::string TileIndex::toString() const { std::stringstream ss; for (int i = level; i > 0; i--){ @@ -143,5 +141,5 @@ namespace openspace { return os; } - +} // namespace globebrowsing } // namespace openspace diff --git a/modules/globebrowsing/tile/tileindex.h b/modules/globebrowsing/tile/tileindex.h index 93ca48f70f..61ce061578 100644 --- a/modules/globebrowsing/tile/tileindex.h +++ b/modules/globebrowsing/tile/tileindex.h @@ -31,10 +31,8 @@ #include #include - - namespace openspace { - +namespace globebrowsing { class Geodetic2; @@ -52,17 +50,11 @@ enum CardinalDirection { SOUTH, }; - - using TileHashKey = uint64_t; - struct TileIndex { - - int x, y, level; - TileIndex() : x(0), y(0), level(0) { } TileIndex(int x, int y, int level) : x(x), y(y), level(level) { } TileIndex(const TileIndex& other) : x(other.x), y(other.y), level(other.level) { } @@ -96,7 +88,6 @@ struct TileIndex { return y % 2 == 1; } - TileIndex child(Quad q) const; @@ -115,12 +106,9 @@ struct TileIndex { bool operator==(const TileIndex& other) const; }; - std::ostream& operator<<(std::ostream& os, const TileIndex& ti); - +} // namespace globebrowsing } // namespace openspace - - -#endif // __TILE_INDEX_H__ +#endif // __TILE_INDEX_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileioresult.cpp b/modules/globebrowsing/tile/tileioresult.cpp index 97e42ea932..9279aa7236 100644 --- a/modules/globebrowsing/tile/tileioresult.cpp +++ b/modules/globebrowsing/tile/tileioresult.cpp @@ -38,17 +38,12 @@ #include #include - - - - namespace { const std::string _loggerCat = "TileIOResult"; } - - namespace openspace { +namespace globebrowsing { void TilePreprocessData::serialize(std::ostream& os) { os << maxValues.size() << std::endl; for (float f : maxValues) { @@ -61,7 +56,6 @@ namespace openspace { os << std::endl; } - TilePreprocessData TilePreprocessData::deserialize(std::istream& is) { TilePreprocessData res; int n; is >> n; @@ -84,11 +78,7 @@ namespace openspace { , tileIndex(0, 0, 0) , error(CE_None) , nBytesImageData(0) - { - - } - - + {} TileIOResult TileIOResult::createDefaultRes() { TileIOResult defaultRes; @@ -101,8 +91,6 @@ namespace openspace { return std::move(defaultRes); } - - void TileIOResult::serializeMetaData(std::ostream& os) { os << dimensions.x << " " << dimensions.y << " " << dimensions.z << std::endl; os << tileIndex.x << " " << tileIndex.y << " " << tileIndex.level << std::endl; @@ -117,7 +105,6 @@ namespace openspace { os << nBytesImageData << std::endl; } - TileIOResult TileIOResult::deserializeMetaData(std::istream& is) { TileIOResult res; is >> res.dimensions.x >> res.dimensions.y >> res.dimensions.z; @@ -141,5 +128,5 @@ namespace openspace { return std::move(res); } - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileioresult.h b/modules/globebrowsing/tile/tileioresult.h index 009788f7d2..d45131bd4e 100644 --- a/modules/globebrowsing/tile/tileioresult.h +++ b/modules/globebrowsing/tile/tileioresult.h @@ -30,18 +30,15 @@ #include - #include #include "gdal_priv.h" - #include #include - - namespace openspace { +namespace globebrowsing { using namespace ghoul::opengl; using namespace ghoul::filesystem; @@ -76,13 +73,7 @@ namespace openspace { }; - - - +} // namespace globebrowsing } // namespace openspace - - - - #endif // __TILE_IO_RESULT_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovider/cachingtileprovider.cpp b/modules/globebrowsing/tile/tileprovider/cachingtileprovider.cpp index f0551b5cec..311ea74486 100644 --- a/modules/globebrowsing/tile/tileprovider/cachingtileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/cachingtileprovider.cpp @@ -43,6 +43,7 @@ namespace { } namespace openspace { +namespace globebrowsing { CachingTileProvider::CachingTileProvider(const ghoul::Dictionary& dictionary) : _framesSinceLastRequestFlush(0) @@ -222,4 +223,5 @@ namespace openspace { return tile; } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/cachingtileprovider.h b/modules/globebrowsing/tile/tileprovider/cachingtileprovider.h index 020ffcc4cd..53ce63af8a 100644 --- a/modules/globebrowsing/tile/tileprovider/cachingtileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/cachingtileprovider.h @@ -39,6 +39,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// namespace openspace { +namespace globebrowsing { /** * Provides tiles loaded by AsyncTileDataProvider and @@ -109,6 +110,7 @@ namespace openspace { Tile _defaultTile; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __CACHING_TILE_PROVIDER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp index c3297514fb..a4b8ce165b 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp @@ -39,6 +39,7 @@ namespace { } namespace openspace { +namespace globebrowsing { SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary) { // Required input @@ -92,4 +93,5 @@ namespace openspace { return 1337; // unlimited } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h index 6f6ed6467e..4adf166d7f 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h @@ -42,7 +42,8 @@ #include namespace openspace { - +namespace globebrowsing { + using namespace ghoul::opengl; class SingleImageProvider : public TileProvider { @@ -64,6 +65,7 @@ namespace openspace { std::string _imagePath; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __SINGLE_IMAGE_PROVIDER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp index a7d0f80dfe..80c1668ad9 100644 --- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp @@ -27,7 +27,6 @@ #include #include - #include #include @@ -43,8 +42,6 @@ #include "cpl_minixml.h" - - namespace { const std::string _loggerCat = "TemporalTileProvider"; @@ -55,8 +52,8 @@ namespace { const std::string KeyFlushInterval = "FlushInterval"; } - namespace openspace { +namespace globebrowsing { const std::string TemporalTileProvider::URL_TIME_PLACEHOLDER("${OpenSpaceTimeId}"); @@ -65,7 +62,6 @@ namespace openspace { const std::string TemporalTileProvider::TemporalXMLTags::TIME_RESOLUTION = "OpenSpaceTimeResolution"; const std::string TemporalTileProvider::TemporalXMLTags::TIME_FORMAT = "OpenSpaceTimeIdFormat"; - TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary) : _initDict(dictionary) { @@ -85,9 +81,6 @@ namespace openspace { _defaultTile = getTileProvider()->getDefaultTile(); } - - - std::string TemporalTileProvider::consumeTemporalMetaData(const std::string& xml) { CPLXMLNode* node = CPLParseXMLString(xml.c_str()); @@ -119,7 +112,6 @@ namespace openspace { return CPLSerializeXMLTree(gdalNode); } - std::string TemporalTileProvider::getXMLValue(CPLXMLNode* root, const std::string& key, const std::string& defaultVal) { CPLXMLNode * n = CPLSearchXMLNode(root, key.c_str()); if (!n) { @@ -203,7 +195,6 @@ namespace openspace { } } - std::shared_ptr TemporalTileProvider::initTileProvider(TimeKey timekey) { std::string gdalDatasetXml = getGdalDatasetXML(timekey); _initDict.setValue(KeyFilePath, gdalDatasetXml); @@ -224,10 +215,6 @@ namespace openspace { return timeSpecifiedXml; } - - - - ////////////////////////////////////////////////////////////////////////////////////// // Time Id Providers // ////////////////////////////////////////////////////////////////////////////////////// @@ -239,8 +226,6 @@ namespace openspace { return t.ISO8601().substr(0, 19) + "Z"; } - - ////////////////////////////////////////////////////////////////////////////////////// // Time Id Providers Facotry // ////////////////////////////////////////////////////////////////////////////////////// @@ -265,9 +250,6 @@ namespace openspace { return _timeIdProviderMap[format].get(); } - - - ////////////////////////////////////////////////////////////////////////////////////// // Time Quantizer // ////////////////////////////////////////////////////////////////////////////////////// @@ -330,4 +312,5 @@ namespace openspace { } } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.h b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.h index a15581e231..34e810e728 100644 --- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.h @@ -25,7 +25,6 @@ #ifndef __TEMPORAL_TILE_PROVIDER_H__ #define __TEMPORAL_TILE_PROVIDER_H__ - #include #include @@ -39,14 +38,12 @@ #include - - - ////////////////////////////////////////////////////////////////////////////////////////// // TILE PROVIDER // ////////////////////////////////////////////////////////////////////////////////////////// namespace openspace { +namespace globebrowsing { ////////////////////////////////////////////////////////////////////////////////////// // Time Id Providers // @@ -83,8 +80,6 @@ namespace openspace { virtual std::string stringify(const Time& t) const; }; - - /** * Static factory class for providing different TimeFormats. * A time format stringifier is retrieved by a name of the format. @@ -113,8 +108,6 @@ namespace openspace { static bool initialized; }; - - ////////////////////////////////////////////////////////////////////////////////////// // Time Quantizer // ////////////////////////////////////////////////////////////////////////////////////// @@ -157,7 +150,6 @@ namespace openspace { double _resolution; }; - ////////////////////////////////////////////////////////////////////////////////////// // Temporal tile Provider // ////////////////////////////////////////////////////////////////////////////////////// @@ -317,11 +309,7 @@ namespace openspace { TimeQuantizer _timeQuantizer; }; - - -} // namespace openspace - - - +} // namespace globebrowsing +} // namespace openspace #endif // __TEMPORAL_TILE_PROVIDER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp b/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp index af1f580f22..d554a6f1d3 100644 --- a/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp @@ -36,15 +36,12 @@ #include - - - namespace { const std::string _loggerCat = "TextTileProvider"; } - namespace openspace { +namespace globebrowsing { TextTileProvider::TextTileProvider(const glm::uvec2& textureSize, size_t fontSize) : _tileCache(500) @@ -151,7 +148,6 @@ namespace openspace { return Tile::createPlainTile(_textureSize, color); } - ////////////////////////////////////////////////////////////////////////////////////// // Chunk Index Tile Provider // ////////////////////////////////////////////////////////////////////////////////////// @@ -268,7 +264,5 @@ namespace openspace { } } - - - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/texttileprovider.h b/modules/globebrowsing/tile/tileprovider/texttileprovider.h index 99459ed2c8..e834195947 100644 --- a/modules/globebrowsing/tile/tileprovider/texttileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/texttileprovider.h @@ -41,13 +41,13 @@ #include #include - ////////////////////////////////////////////////////////////////////////////////////////// // TILE PROVIDER // ////////////////////////////////////////////////////////////////////////////////////////// - namespace openspace { +namespace globebrowsing { + using namespace ghoul::fontrendering; /** @@ -66,7 +66,6 @@ namespace openspace { virtual ~TextTileProvider(); // The TileProvider interface below is implemented in this class - virtual Tile getTile(const TileIndex& tileIndex); virtual Tile getDefaultTile(); virtual Tile::Status getTileStatus(const TileIndex& index); @@ -113,7 +112,6 @@ namespace openspace { GLuint _fbo; }; - /** * Provides Tiles with the chunk index rendered as text onto its tiles. */ @@ -135,7 +133,6 @@ namespace openspace { virtual TileHashKey toHash(const TileIndex& tileIndex) const; - private: int roundedLongitudalLength(const TileIndex& tileIndex) const; @@ -144,7 +141,8 @@ namespace openspace { Tile _backgroundTile; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp index f47121ec71..d2d70d451c 100644 --- a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp @@ -28,15 +28,14 @@ #include - namespace { const std::string _loggerCat = "TileProvider"; const std::string KeyType = "Type"; } - namespace openspace { +namespace globebrowsing { TileProvider* TileProvider::createFromDictionary(const ghoul::Dictionary& dictionary) { if (!dictionary.hasValue(KeyType)) { @@ -60,4 +59,5 @@ TileProvider* TileProvider::createFromDictionary(const ghoul::Dictionary& dictio TileProvider::TileProvider(const ghoul::Dictionary& dictionary) { }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileprovider/tileprovider.h b/modules/globebrowsing/tile/tileprovider/tileprovider.h index 2d65e57ea4..b909a29dfa 100644 --- a/modules/globebrowsing/tile/tileprovider/tileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/tileprovider.h @@ -38,7 +38,8 @@ ////////////////////////////////////////////////////////////////////////////////////////// namespace openspace { - +namespace globebrowsing { + using namespace ghoul::opengl; /** @@ -148,6 +149,7 @@ namespace openspace { bool preprocessTiles = false; }; -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace #endif // __TILE_PROVIDER_H__ \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovidermanager.cpp b/modules/globebrowsing/tile/tileprovidermanager.cpp index 4faf0b4302..0f1d79b5ca 100644 --- a/modules/globebrowsing/tile/tileprovidermanager.cpp +++ b/modules/globebrowsing/tile/tileprovidermanager.cpp @@ -30,15 +30,12 @@ #include "cpl_minixml.h" - namespace { const std::string _loggerCat = "TileProviderManager"; } - namespace openspace { - - +namespace globebrowsing { ////////////////////////////////////////////////////////////////////////////////////// // Tile Provider Group // ////////////////////////////////////////////////////////////////////////////////////// @@ -51,7 +48,6 @@ namespace openspace { } } - const std::vector> TileProviderGroup::getActiveTileProviders() const { std::vector> activeTileProviders; for (auto tileProviderWithName : tileProviders) { @@ -75,8 +71,6 @@ namespace openspace { ////////////////////////////////////////////////////////////////////////////////////// // Tile Provider Manager // ////////////////////////////////////////////////////////////////////////////////////// - - TileProviderManager::TileProviderManager( const ghoul::Dictionary& textureCategoriesDictionary, const ghoul::Dictionary& textureInitDictionary){ @@ -194,6 +188,5 @@ namespace openspace { } } - - -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace \ No newline at end of file diff --git a/modules/globebrowsing/tile/tileprovidermanager.h b/modules/globebrowsing/tile/tileprovidermanager.h index 06431c683e..43495e7058 100644 --- a/modules/globebrowsing/tile/tileprovidermanager.h +++ b/modules/globebrowsing/tile/tileprovidermanager.h @@ -36,9 +36,9 @@ #include #include - namespace openspace { - +namespace globebrowsing { + struct NamedTileProvider { std::string name; std::shared_ptr tileProvider; @@ -47,8 +47,6 @@ namespace openspace { PerLayerSettings settings; }; - - struct TileProviderGroup { void update(); @@ -61,8 +59,6 @@ namespace openspace { }; - - class TileProviderManager { public: @@ -71,14 +67,11 @@ namespace openspace { const ghoul::Dictionary& textureInitDictionary); ~TileProviderManager(); - TileProviderGroup& getTileProviderGroup(size_t groupId); TileProviderGroup& getTileProviderGroup(LayeredTextures::TextureCategory); void update(); void reset(bool includingInactive = false); - - private: static void initTexures( std::vector& destination, @@ -88,5 +81,7 @@ namespace openspace { std::array _layerCategories; }; +} // namespace globebrowsing } // namespace openspace + #endif // __TILE_PROVIDER_MANAGER_H__ diff --git a/modules/globebrowsing/tile/tileselector.cpp b/modules/globebrowsing/tile/tileselector.cpp index 57116b7ec9..8dbe493c99 100644 --- a/modules/globebrowsing/tile/tileselector.cpp +++ b/modules/globebrowsing/tile/tileselector.cpp @@ -33,14 +33,12 @@ #include "gdal_priv.h" - - namespace { const std::string _loggerCat = "TileSelector"; } - namespace openspace { +namespace globebrowsing { const TileSelector::CompareResolution TileSelector::HIGHEST_RES = TileSelector::CompareResolution(); @@ -105,7 +103,6 @@ namespace openspace { tiles.push_back(getHighestResolutionTile(provider.get(), tileIndex)); } - std::sort(tiles.begin(), tiles.end(), TileSelector::HIGHEST_RES); return tiles; @@ -127,4 +124,5 @@ namespace openspace { --tileIndex; } -} // namespace openspace +} // namespace globebrowsing +} // namespace openspace diff --git a/modules/globebrowsing/tile/tileselector.h b/modules/globebrowsing/tile/tileselector.h index 4b88c39fea..9a0bde9da7 100644 --- a/modules/globebrowsing/tile/tileselector.h +++ b/modules/globebrowsing/tile/tileselector.h @@ -31,9 +31,8 @@ #include - - namespace openspace { +namespace globebrowsing { struct TileUvTransform { glm::vec2 uvOffset; @@ -45,14 +44,12 @@ namespace openspace { TileUvTransform uvTransform; }; - class TileSelector { public: static TileAndTransform getHighestResolutionTile(TileProvider* tileProvider, TileIndex tileIndex, int parents = 0); static TileAndTransform getHighestResolutionTile(const TileProviderGroup& tileProviderGroup, TileIndex tileIndex); static std::vector getTilesSortedByHighestResolution(const TileProviderGroup&, const TileIndex& tileIndex); - struct CompareResolution { bool operator() (const TileAndTransform& a, const TileAndTransform& b); }; @@ -61,13 +58,9 @@ namespace openspace { private: static void ascendToParent(TileIndex& tileIndex, TileUvTransform& uv); - }; - - - -} // namespace openspace - +} // namespace globebrowsing +} // namespace openspace #endif // __TILE_SELECTOR_H__ \ No newline at end of file diff --git a/src/interaction/interactionmode.cpp b/src/interaction/interactionmode.cpp index bc92a1b78f..36e11ce0c2 100644 --- a/src/interaction/interactionmode.cpp +++ b/src/interaction/interactionmode.cpp @@ -503,7 +503,7 @@ void GlobeBrowsingInteractionMode::setFocusNode(SceneGraphNode* focusNode) { #ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED Renderable* baseRenderable = _focusNode->renderable(); - if (RenderableGlobe* globe = dynamic_cast(baseRenderable)) { + if (globebrowsing::RenderableGlobe* globe = dynamic_cast(baseRenderable)) { _globe = globe; } else {