merge r1497 through r1498 from trunk into 0.7 branch

This commit is contained in:
Dane Springmeyer 2009-12-31 16:11:52 +00:00
parent f409f91250
commit 77ccb92054
4 changed files with 29 additions and 16 deletions

View file

@ -39,9 +39,10 @@ Several things happen when you do:
""" """
import os import os
from sys import getdlopenflags, setdlopenflags from sys import getdlopenflags, setdlopenflags
try: try:
from dl import RTLD_NOW, RTLD_GLOBAL from ctypes import RTLD_NOW, RTLD_GLOBAL
except ImportError: except ImportError:
RTLD_NOW = 2 RTLD_NOW = 2
RTLD_GLOBAL = 256 RTLD_GLOBAL = 256

View file

@ -41,7 +41,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
{ {
if (!index.isValid() || !map_) if (!index.isValid() || !map_)
return QVariant(); return QVariant();
if (index.row() < 0 || index.row() >= map_->layers().size()) if (index.row() < 0 || index.row() >= int(map_->layers().size()))
return QVariant(); return QVariant();
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
return QString(map_->layers().at(index.row()).name().c_str()); return QString(map_->layers().at(index.row()).name().c_str());
@ -112,8 +112,8 @@ boost::optional<mapnik::Layer&> LayerListModel::map_layer(int i)
if (map_) if (map_)
{ {
std::vector<mapnik::Layer> & layers = const_cast<std::vector<mapnik::Layer>& >(map_->layers()); std::vector<mapnik::Layer> & layers = const_cast<std::vector<mapnik::Layer>& >(map_->layers());
if (i < layers.size()) if (i < int(layers.size()))
return boost::optional<mapnik::Layer&>(layers[i]); return boost::optional<mapnik::layer&>(layers[i]);
} }
return boost::optional<mapnik::Layer&>(); return boost::optional<mapnik::Layer&>();
} }

View file

@ -448,16 +448,28 @@ void MapWidget::updateMap()
unsigned width=map_->getWidth(); unsigned width=map_->getWidth();
unsigned height=map_->getHeight(); unsigned height=map_->getHeight();
Image32 buf(width,height); image_32 buf(width,height);
mapnik::agg_renderer<Image32> ren(*map_,buf);
ren.apply(); try
{
QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32); mapnik::agg_renderer<image_32> ren(*map_,buf);
pix_=QPixmap::fromImage(image.rgbSwapped()); ren.apply();
update();
// emit signal to interested widgets QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32);
emit mapViewChanged(); pix_=QPixmap::fromImage(image.rgbSwapped());
std::cout << map_->getCurrentExtent() << "\n"; update();
// emit signal to interested widgets
emit mapViewChanged();
std::cout << map_->getCurrentExtent() << "\n";
}
catch (mapnik::config_error & ex)
{
std::cerr << ex.what() << std::endl;
}
catch (...)
{
std::cerr << "Unknown exception caught!\n";
}
} }
} }

View file

@ -10,9 +10,9 @@ INCLUDEPATH += /usr/X11/include/
INCLUDEPATH += /usr/X11/include/freetype2 INCLUDEPATH += /usr/X11/include/freetype2
INCLUDEPATH += . INCLUDEPATH += .
#QMAKE_CXXFLAGS +=' -DDARWIN' QMAKE_CXXFLAGS +=' -DDARWIN -Wno-missing-field-initializers'
unix:LIBS = -L/opt/mapnik/lib -L/usr/X11/lib -lmapnik -lfreetype -L/usr/local/lib -licuuc unix:LIBS = -L/opt/mapnik/lib -L/usr/X11/lib -lmapnik -lfreetype -L/usr/local/lib -licuuc
unix:LIBS += -lboost_system-xgcc40-mt -lboost_filesystem-xgcc40-mt -L/opt/boost/lib unix:LIBS += -lboost_system -lboost_filesystem -lboost_regex -L/opt/boost/lib
# Input # Input