tile.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #ifndef MULTIRES_IMAGE_TILE_H_
31 #define MULTIRES_IMAGE_TILE_H_
32 
33 // C++ standard libraries
34 #include <string>
35 
36 // QT libraries
37 #include <QImage>
38 #include <QMutex>
39 
40 #include <tf/transform_datatypes.h>
41 
43 
44 #ifndef GL_CLAMP_TO_EDGE
45 #define GL_CLAMP_TO_EDGE 0x812F
46 #endif
47 
48 namespace multires_image
49 {
50  class Tile
51  {
52  public:
53  Tile(
54  const std::string& path, int column, int row, int level,
55  const tf::Point& topLeft,
56  const tf::Point& topRight,
57  const tf::Point& bottomLeft,
58  const tf::Point& bottomRight);
59  ~Tile(void);
60 
61  bool Exists();
62  bool Failed() const { return m_failed; }
63  bool TextureLoaded() const { return m_textureLoaded; }
64  const QImage& Image() const { return m_image; }
65  int64_t TileID() const { return m_tileId; }
66  int Layer() const { return m_level; }
67  int MemorySize() const { return m_memorySize; }
68  int Row() const { return m_row; }
69  int Column() const { return m_column; }
70 
71  bool LoadImageToMemory(bool gl = true);
72  void UnloadImage();
73 
74  bool LoadTexture();
75  void UnloadTexture();
76 
77  void Draw();
78 
79  void Transform(const swri_transform_util::Transform& transform);
80  void Transform(const swri_transform_util::Transform& transform, const swri_transform_util::Transform& offset_tf);
81 
82  private:
83  const std::string m_path;
84  const int m_column;
85  const int m_row;
86  const int m_level;
87 
92 
97 
98  bool m_failed;
102  int64_t m_tileId;
104  QImage m_image;
105  QMutex m_mutex;
106  };
107 }
108 
109 #endif // MULTIRES_IMAGE_TILE_H_
multires_image::Tile::m_top_left
tf::Point m_top_left
Definition: tile.h:88
multires_image::Tile::Row
int Row() const
Definition: tile.h:68
multires_image::Tile::m_bottom_left
tf::Point m_bottom_left
Definition: tile.h:91
multires_image::Tile::m_textureId
int m_textureId
Definition: tile.h:101
multires_image
Definition: multires_view_node.h:51
multires_image::Tile::Column
int Column() const
Definition: tile.h:69
multires_image::Tile::m_column
const int m_column
Definition: tile.h:84
transform.h
multires_image::Tile
Definition: tile.h:50
multires_image::Tile::m_transformed_top_right
tf::Point m_transformed_top_right
Definition: tile.h:94
multires_image::Tile::m_level
const int m_level
Definition: tile.h:86
multires_image::Tile::m_failed
bool m_failed
Definition: tile.h:98
multires_image::Tile::m_transformed_bottom_right
tf::Point m_transformed_bottom_right
Definition: tile.h:95
multires_image::Tile::m_memorySize
int m_memorySize
Definition: tile.h:103
multires_image::Tile::MemorySize
int MemorySize() const
Definition: tile.h:67
multires_image::Tile::Transform
void Transform(const swri_transform_util::Transform &transform)
Definition: tile.cpp:211
tf::Point
tf::Vector3 Point
multires_image::Tile::m_dimension
int m_dimension
Definition: tile.h:100
multires_image::Tile::UnloadImage
void UnloadImage()
Definition: tile.cpp:129
multires_image::Tile::m_row
const int m_row
Definition: tile.h:85
multires_image::Tile::Failed
bool Failed() const
Definition: tile.h:62
multires_image::Tile::Image
const QImage & Image() const
Definition: tile.h:64
multires_image::Tile::UnloadTexture
void UnloadTexture()
Definition: tile.cpp:176
multires_image::Tile::Exists
bool Exists()
Definition: tile.cpp:75
swri_transform_util::Transform
multires_image::Tile::TileID
int64_t TileID() const
Definition: tile.h:65
multires_image::Tile::m_top_right
tf::Point m_top_right
Definition: tile.h:89
multires_image::Tile::m_transformed_bottom_left
tf::Point m_transformed_bottom_left
Definition: tile.h:96
multires_image::Tile::m_image
QImage m_image
Definition: tile.h:104
transform_datatypes.h
multires_image::Tile::Layer
int Layer() const
Definition: tile.h:66
multires_image::Tile::Tile
Tile(const std::string &path, int column, int row, int level, const tf::Point &topLeft, const tf::Point &topRight, const tf::Point &bottomLeft, const tf::Point &bottomRight)
Definition: tile.cpp:46
multires_image::Tile::m_transformed_top_left
tf::Point m_transformed_top_left
Definition: tile.h:93
multires_image::Tile::m_tileId
int64_t m_tileId
Definition: tile.h:102
multires_image::Tile::m_textureLoaded
bool m_textureLoaded
Definition: tile.h:99
multires_image::Tile::m_mutex
QMutex m_mutex
Definition: tile.h:105
multires_image::Tile::LoadTexture
bool LoadTexture()
Definition: tile.cpp:139
multires_image::Tile::LoadImageToMemory
bool LoadImageToMemory(bool gl=true)
Definition: tile.cpp:80
multires_image::Tile::m_path
const std::string m_path
Definition: tile.h:83
multires_image::Tile::TextureLoaded
bool TextureLoaded() const
Definition: tile.h:63
multires_image::Tile::m_bottom_right
tf::Point m_bottom_right
Definition: tile.h:90
multires_image::Tile::Draw
void Draw()
Definition: tile.cpp:191
multires_image::Tile::~Tile
~Tile(void)
Definition: tile.cpp:71


multires_image
Author(s): Marc Alban
autogenerated on Sun Sep 8 2024 02:27:21