1. things to keep win32 built happier
2. print color table in gdal.input if present (-DMAPNIK_DEBUG)
This commit is contained in:
parent
c5bca5ab96
commit
17e2b12390
7 changed files with 71 additions and 42 deletions
|
@ -23,6 +23,8 @@
|
|||
#ifndef MAPNIK_ENUMERATION_INCLUDED
|
||||
#define MAPNIK_ENUMERATION_INCLUDED
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
|
@ -130,7 +132,7 @@ class illegal_enum_value : public std::exception
|
|||
*/
|
||||
|
||||
template <class ENUM, int THE_MAX>
|
||||
class enumeration {
|
||||
class MAPNIK_DECL enumeration {
|
||||
public:
|
||||
typedef ENUM native_type;
|
||||
enumeration() {};
|
||||
|
@ -211,7 +213,7 @@ class enumeration {
|
|||
{
|
||||
from_string( word );
|
||||
}
|
||||
catch (const illegal_enum_value & ex)
|
||||
catch (const illegal_enum_value &)
|
||||
{
|
||||
is.setstate(std::ios::failbit);
|
||||
}
|
||||
|
|
|
@ -27,11 +27,15 @@
|
|||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
using boost::int32_t;
|
||||
using boost::uint32_t;
|
||||
using boost::int16_t;
|
||||
using boost::uint16_t;
|
||||
using boost::uint8_t;
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
using boost::int32_t;
|
||||
using boost::uint8_t;
|
||||
|
||||
|
||||
#define int2net(A) (int16_t) (((uint16_t) ((uint8_t) (A)[1])) | \
|
||||
(((uint16_t) ((uint8_t) (A)[0])) << 8))
|
||||
|
||||
|
@ -41,23 +45,23 @@ namespace mapnik
|
|||
(((uint32_t) ((uint8_t) (A)[0])) << 24))
|
||||
|
||||
|
||||
typedef char byte;
|
||||
typedef char byte;
|
||||
#define float8net(V,M) do { double def_temp; \
|
||||
((byte*) &def_temp)[0]=(M)[7]; \
|
||||
((byte*) &def_temp)[1]=(M)[6]; \
|
||||
((byte*) &def_temp)[2]=(M)[5]; \
|
||||
((byte*) &def_temp)[3]=(M)[4]; \
|
||||
((byte*) &def_temp)[4]=(M)[3]; \
|
||||
((byte*) &def_temp)[5]=(M)[2]; \
|
||||
((byte*) &def_temp)[6]=(M)[1]; \
|
||||
((byte*) &def_temp)[7]=(M)[0]; \
|
||||
(V) = def_temp; } while(0)
|
||||
((byte*) &def_temp)[0]=(M)[7]; \
|
||||
((byte*) &def_temp)[1]=(M)[6]; \
|
||||
((byte*) &def_temp)[2]=(M)[5]; \
|
||||
((byte*) &def_temp)[3]=(M)[4]; \
|
||||
((byte*) &def_temp)[4]=(M)[3]; \
|
||||
((byte*) &def_temp)[5]=(M)[2]; \
|
||||
((byte*) &def_temp)[6]=(M)[1]; \
|
||||
((byte*) &def_temp)[7]=(M)[0]; \
|
||||
(V) = def_temp; } while(0)
|
||||
#define float4net(V,M) do { float def_temp; \
|
||||
((byte*) &def_temp)[0]=(M)[3]; \
|
||||
((byte*) &def_temp)[1]=(M)[2]; \
|
||||
((byte*) &def_temp)[2]=(M)[1]; \
|
||||
((byte*) &def_temp)[3]=(M)[0]; \
|
||||
(V)=def_temp; } while(0)
|
||||
((byte*) &def_temp)[0]=(M)[3]; \
|
||||
((byte*) &def_temp)[1]=(M)[2]; \
|
||||
((byte*) &def_temp)[2]=(M)[1]; \
|
||||
((byte*) &def_temp)[3]=(M)[0]; \
|
||||
(V)=def_temp; } while(0)
|
||||
}
|
||||
|
||||
#endif //GLOBAL_HPP
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
namespace mapnik {
|
||||
|
||||
template <typename T>
|
||||
void save_to_file(std::string const& filename,
|
||||
MAPNIK_DECL void save_to_file(std::string const& filename,
|
||||
std::string const& type,
|
||||
T const& image);
|
||||
template <typename T>
|
||||
|
@ -226,13 +226,13 @@ namespace mapnik {
|
|||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template MAPNIK_DECL void save_to_file<ImageData32>(std::string const&,
|
||||
std::string const& ,
|
||||
ImageData32 const&);
|
||||
template MAPNIK_DECL void save_to_file<ImageData32>(std::string const&,
|
||||
std::string const& ,
|
||||
ImageData32 const&);
|
||||
|
||||
template MAPNIK_DECL void save_to_file<image_view<ImageData32> > (std::string const&,
|
||||
std::string const& ,
|
||||
image_view<ImageData32> const&);
|
||||
template MAPNIK_DECL void save_to_file<image_view<ImageData32> > (std::string const&,
|
||||
std::string const& ,
|
||||
image_view<ImageData32> const&);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ namespace mapnik {
|
|||
{
|
||||
return boost::lexical_cast<T>( * str );
|
||||
}
|
||||
catch (const boost::bad_lexical_cast & ex)
|
||||
catch (const boost::bad_lexical_cast & )
|
||||
{
|
||||
throw config_error(string("Failed to parse ") +
|
||||
(is_attribute ? "attribute" : "child node") + " '" +
|
||||
|
@ -300,7 +300,7 @@ namespace mapnik {
|
|||
{
|
||||
return boost::lexical_cast<T>( *str );
|
||||
}
|
||||
catch (const boost::bad_lexical_cast & ex)
|
||||
catch (const boost::bad_lexical_cast & )
|
||||
{
|
||||
throw config_error(string("Failed to parse ") +
|
||||
(is_attribute ? "attribute" : "child node") + " '" +
|
||||
|
@ -344,7 +344,7 @@ namespace mapnik {
|
|||
{
|
||||
result = boost::lexical_cast<T>( *str );
|
||||
}
|
||||
catch (const boost::bad_lexical_cast & ex)
|
||||
catch (const boost::bad_lexical_cast &)
|
||||
{
|
||||
throw config_error(string("Failed to parse ") +
|
||||
(is_attribute ? "attribute" : "child node") + " '" +
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace mapnik
|
|||
|
||||
DEFINE_ENUM( line_join_e, line_join_enum );
|
||||
|
||||
class stroke
|
||||
{
|
||||
class MAPNIK_DECL stroke
|
||||
{
|
||||
Color c_;
|
||||
float width_;
|
||||
float opacity_; // 0.0 - 1.0
|
||||
|
|
|
@ -50,12 +50,14 @@ feature_ptr gdal_featureset::next()
|
|||
GDALRasterBand * grey = 0;
|
||||
for (int i = 0; i < dataset_.GetRasterCount() ;++i)
|
||||
{
|
||||
GDALRasterBand * band = dataset_.GetRasterBand(i+1);
|
||||
//int bsx,bsy;
|
||||
//band->GetBlockSize(&bsx,&bsy);
|
||||
//std::cout << boost::format("Block=%dx%d Type=%s Color=%s \n") % bsx % bsy
|
||||
// % GDALGetDataTypeName(band->GetRasterDataType())
|
||||
// % GDALGetColorInterpretationName(band->GetColorInterpretation());
|
||||
GDALRasterBand * band = dataset_.GetRasterBand(i+1);
|
||||
#ifdef MAPNIK_DEBUG
|
||||
int bsx,bsy;
|
||||
band->GetBlockSize(&bsx,&bsy);
|
||||
std::cout << boost::format("Block=%dx%d Type=%s Color=%s \n") % bsx % bsy
|
||||
% GDALGetDataTypeName(band->GetRasterDataType())
|
||||
% GDALGetColorInterpretationName(band->GetColorInterpretation());
|
||||
#endif
|
||||
GDALColorInterp color_interp = band->GetColorInterpretation();
|
||||
switch (color_interp)
|
||||
{
|
||||
|
@ -74,10 +76,32 @@ feature_ptr gdal_featureset::next()
|
|||
case GCI_GrayIndex:
|
||||
grey = band;
|
||||
break;
|
||||
case GCI_PaletteIndex:
|
||||
{
|
||||
grey = band;
|
||||
GDALColorTable *color_table = band->GetColorTable();
|
||||
|
||||
if ( color_table)
|
||||
{
|
||||
int count = color_table->GetColorEntryCount();
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::cout << "Color Table count = " << count << "\n";´
|
||||
#endif
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
const GDALColorEntry *ce = color_table->GetColorEntry ( i );
|
||||
if (!ce ) continue;
|
||||
#ifdef MAPNIK_DEBUG
|
||||
std::cout << "color entry RGB (" << ce->c1 <<"," <<ce->c2 << "," << ce->c3 << ")\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GCI_Undefined:
|
||||
grey = band;
|
||||
grey = band;
|
||||
break;
|
||||
default:
|
||||
//grey = band;
|
||||
break;
|
||||
;
|
||||
}
|
||||
|
|
|
@ -133,9 +133,8 @@ public:
|
|||
}
|
||||
return HolderType();
|
||||
}
|
||||
|
||||
private:
|
||||
ConnectionManager() {}
|
||||
private:
|
||||
ConnectionManager(const ConnectionManager&);
|
||||
ConnectionManager& operator=(const ConnectionManager);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue