File indexing completed on 2024-04-14 03:48:50

0001 #ifndef READONLYMAPDEFINITION_H
0002 #define READONLYMAPDEFINITION_H
0003 
0004 #include "mapreproject.h"
0005 
0006 #include <QDebug>
0007 #include <QString>
0008 
0009 class InterpolationMethod;
0010 class ReadOnlyMapImage;
0011 
0012 class ReadOnlyMapDefinition
0013 {
0014     friend QDebug operator<<( QDebug dbg, ReadOnlyMapDefinition const & r);
0015 
0016 public:
0017     ReadOnlyMapDefinition();
0018 
0019     ReadOnlyMapImage * createReadOnlyMap() const;
0020 
0021     void setBaseDirectory( QString const & baseDirectory );
0022     void setCacheSizeBytes( int const cacheSizeBytes );
0023     void setInterpolationMethod( EInterpolationMethod const interpolationMethod );
0024     void setFileName( QString const & fileName );
0025     void setMapType( MapSourceType const mapType );
0026     void setTileLevel( int const tileLevel );
0027 
0028 private:
0029     InterpolationMethod * createInterpolationMethod() const;
0030 
0031     MapSourceType m_mapType;
0032     EInterpolationMethod m_interpolationMethod;
0033 
0034     // relevant for tiled maps
0035     QString m_baseDirectory;
0036     int m_tileLevel;
0037     int m_cacheSizeBytes;
0038 
0039     // relevant for non-tiled maps (only one image)
0040     QString m_filename;
0041 };
0042 
0043 QDebug operator<<( QDebug dbg, ReadOnlyMapDefinition const & r);
0044 
0045 
0046 // inline definitions
0047 
0048 inline void ReadOnlyMapDefinition::setBaseDirectory( QString const & baseDirectory )
0049 {
0050     m_baseDirectory = baseDirectory;
0051 }
0052 
0053 inline void ReadOnlyMapDefinition::setCacheSizeBytes( int const cacheSizeBytes )
0054 {
0055     m_cacheSizeBytes = cacheSizeBytes;
0056 }
0057 
0058 inline void ReadOnlyMapDefinition::setInterpolationMethod( EInterpolationMethod const interpolationMethod )
0059 {
0060     m_interpolationMethod = interpolationMethod;
0061 }
0062 
0063 inline void ReadOnlyMapDefinition::setFileName( QString const & fileName )
0064 {
0065     m_filename = fileName;
0066 }
0067 
0068 inline void ReadOnlyMapDefinition::setMapType( MapSourceType const mapType )
0069 {
0070     m_mapType = mapType;
0071 }
0072 
0073 inline void ReadOnlyMapDefinition::setTileLevel( int const tileLevel )
0074 {
0075     m_tileLevel = tileLevel;
0076 }
0077 
0078 
0079 inline QDebug operator<<( QDebug dbg, ReadOnlyMapDefinition const & r)
0080 {
0081     dbg.nospace() << "("
0082                   << r.m_mapType << ", "
0083                   << r.m_interpolationMethod << ", "
0084                   << r.m_baseDirectory << ", "
0085                   << r.m_tileLevel << ", "
0086                   << r.m_cacheSizeBytes << ", "
0087                   << r.m_filename << ")";
0088     return dbg.space();
0089 }
0090 
0091 #endif