tile.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 
00030 #ifndef MULTIRES_IMAGE_TILE_H_
00031 #define MULTIRES_IMAGE_TILE_H_
00032 
00033 // C++ standard libraries
00034 #include <string>
00035 
00036 // QT libraries
00037 #include <QImage>
00038 #include <QMutex>
00039 
00040 #include <tf/transform_datatypes.h>
00041 
00042 #include <swri_transform_util/transform.h>
00043 
00044 #ifndef GL_CLAMP_TO_EDGE
00045 #define GL_CLAMP_TO_EDGE 0x812F
00046 #endif
00047 
00048 namespace multires_image
00049 {
00050   class Tile
00051   {
00052   public:
00053     Tile(
00054       const std::string& path, int column, int row, int level,
00055       const tf::Point& topLeft,
00056       const tf::Point& topRight,
00057       const tf::Point& bottomLeft,
00058       const tf::Point& bottomRight);
00059     ~Tile(void);
00060 
00061     bool Exists();
00062     bool Failed() const { return m_failed; }
00063     bool TextureLoaded() const { return m_textureLoaded; }
00064     const QImage& Image() const { return m_image; }
00065     int64_t TileID() const { return m_tileId; }
00066     int Layer() const { return m_level; }
00067     int MemorySize() const { return m_memorySize; }
00068     int Row() const { return m_row; }
00069     int Column() const { return m_column; }
00070 
00071     bool LoadImageToMemory(bool gl = true);
00072     void UnloadImage();
00073 
00074     bool LoadTexture();
00075     void UnloadTexture();
00076 
00077     void Draw();
00078 
00079     void Transform(const swri_transform_util::Transform& transform);
00080 
00081   private:
00082     const std::string   m_path;
00083     const int           m_column;
00084     const int           m_row;
00085     const int           m_level;
00086 
00087     tf::Point           m_top_left;
00088     tf::Point           m_top_right;
00089     tf::Point           m_bottom_right;
00090     tf::Point           m_bottom_left;
00091 
00092     tf::Point           m_transformed_top_left;
00093     tf::Point           m_transformed_top_right;
00094     tf::Point           m_transformed_bottom_right;
00095     tf::Point           m_transformed_bottom_left;
00096 
00097     bool                m_failed;
00098     bool                m_textureLoaded;
00099     int                 m_dimension;
00100     int                 m_textureId;
00101     int64_t             m_tileId;
00102     int                 m_memorySize;
00103     QImage              m_image;
00104     QMutex              m_mutex;
00105   };
00106 }
00107 
00108 #endif  // MULTIRES_IMAGE_TILE_H_


multires_image
Author(s): Marc Alban
autogenerated on Thu Aug 24 2017 02:46:18