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_
QMutex m_mutex
Definition: tile.h:105
int64_t m_tileId
Definition: tile.h:102
const int m_column
Definition: tile.h:84
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
int Column() const
Definition: tile.h:69
bool LoadImageToMemory(bool gl=true)
Definition: tile.cpp:80
int Layer() const
Definition: tile.h:66
int MemorySize() const
Definition: tile.h:67
void UnloadImage()
Definition: tile.cpp:129
const std::string m_path
Definition: tile.h:83
tf::Point m_bottom_right
Definition: tile.h:90
tf::Point m_bottom_left
Definition: tile.h:91
tf::Point m_top_right
Definition: tile.h:89
bool Failed() const
Definition: tile.h:62
int Row() const
Definition: tile.h:68
tf::Point m_transformed_top_right
Definition: tile.h:94
int64_t TileID() const
Definition: tile.h:65
bool m_textureLoaded
Definition: tile.h:99
tf::Point m_top_left
Definition: tile.h:88
const int m_level
Definition: tile.h:86
tf::Point m_transformed_bottom_left
Definition: tile.h:96
tf::Point m_transformed_top_left
Definition: tile.h:93
void UnloadTexture()
Definition: tile.cpp:176
QImage m_image
Definition: tile.h:104
bool LoadTexture()
Definition: tile.cpp:139
tf::Point m_transformed_bottom_right
Definition: tile.h:95
void Transform(const swri_transform_util::Transform &transform)
Definition: tile.cpp:211
const int m_row
Definition: tile.h:85
const QImage & Image() const
Definition: tile.h:64
bool TextureLoaded() const
Definition: tile.h:63


multires_image
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 19:25:29