added a bit of colour to SCons
This commit is contained in:
parent
0390f129a1
commit
747ef8cccf
6 changed files with 50 additions and 33 deletions
25
SConstruct
25
SConstruct
|
@ -59,9 +59,16 @@ opts.Add(EnumOption('XMLPARSER','Set xml parser ','tinyxml', ['tinyxml','spirit'
|
|||
|
||||
env = Environment(ENV=os.environ, options=opts)
|
||||
|
||||
def color_print(color,text):
|
||||
# 1 - red
|
||||
# 2 - green
|
||||
# 3 - yellow
|
||||
# 4 - blue
|
||||
print "\033[9%sm%s\033[0m" % (color,text)
|
||||
|
||||
env['LIBDIR_SCHEMA'] = LIBDIR_SCHEMA
|
||||
env['PLATFORM'] = platform.uname()[0]
|
||||
print "Building on %s ..." % env['PLATFORM']
|
||||
color_print (4,"Building on %s ..." % env['PLATFORM'])
|
||||
Help(opts.GenerateHelpText(env))
|
||||
|
||||
conf = Configure(env)
|
||||
|
@ -133,12 +140,12 @@ BOOST_LIBSHEADERS = [
|
|||
|
||||
for libinfo in C_LIBSHEADERS:
|
||||
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], 'C') and libinfo[2]:
|
||||
print 'Could not find header or shared library for %s, exiting!' % libinfo[0]
|
||||
color_print (1,'Could not find header or shared library for %s, exiting!' % libinfo[0])
|
||||
Exit(1)
|
||||
|
||||
for libinfo in CXX_LIBSHEADERS:
|
||||
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], 'C++') and libinfo[2]:
|
||||
print 'Could not find header or shared library for %s, exiting!' % libinfo[0]
|
||||
color_print(1,'Could not find header or shared library for %s, exiting!' % libinfo[0])
|
||||
Exit(1)
|
||||
|
||||
if len(env['BOOST_TOOLKIT']):
|
||||
|
@ -149,10 +156,10 @@ else:
|
|||
for count, libinfo in enumerate(BOOST_LIBSHEADERS):
|
||||
if env['THREADING'] == 'multi' :
|
||||
if not conf.CheckLibWithHeader('boost_%s%s-mt' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++') and libinfo[2] :
|
||||
print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
|
||||
color_print(1,'Could not find header or shared library for boost %s, exiting!' % libinfo[0])
|
||||
Exit(1)
|
||||
elif not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++') :
|
||||
print 'Could not find header or shared library for boost %s, exiting!' % libinfo[0]
|
||||
color_print(1,'Could not find header or shared library for boost %s, exiting!' % libinfo[0])
|
||||
Exit(1)
|
||||
|
||||
Export('env')
|
||||
|
@ -198,21 +205,21 @@ if 'gigabase' in inputplugins and 'gigabase_r' in env['LIBS']:
|
|||
|
||||
if 'python' in env['BINDINGS']:
|
||||
if not os.access(env['PYTHON'], os.X_OK):
|
||||
print "Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON']
|
||||
color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON'])
|
||||
Exit(1)
|
||||
|
||||
env['PYTHON_PREFIX'] = os.popen("%s -c 'import sys; print sys.prefix'" % env['PYTHON']).read().strip()
|
||||
env['PYTHON_VERSION'] = os.popen("%s -c 'import sys; print sys.version'" % env['PYTHON']).read()[0:3]
|
||||
|
||||
print 'Bindings Python version... %s' % env['PYTHON_VERSION']
|
||||
color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION'])
|
||||
|
||||
majver, minver = env['PYTHON_VERSION'].split('.')
|
||||
|
||||
if (int(majver), int(minver)) < (2, 2):
|
||||
print "Python version 2.2 or greater required"
|
||||
color_print(1,"Python version 2.2 or greater required")
|
||||
Exit(1)
|
||||
|
||||
print 'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_PREFIX'])
|
||||
color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_PREFIX']))
|
||||
|
||||
SConscript('bindings/python/SConscript')
|
||||
|
||||
|
|
|
@ -42,7 +42,11 @@ int main ( int argc , char** argv)
|
|||
std::cout << " running demo ... \n";
|
||||
using namespace mapnik;
|
||||
datasource_cache::instance()->register_datasources(argv[1]);
|
||||
<<<<<<< .mine
|
||||
freetype_engine::instance()->register_font("../lib/mapnik/fonts/DejaVuSans.ttf");
|
||||
=======
|
||||
freetype_engine::instance()->register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
|
||||
>>>>>>> .r549
|
||||
|
||||
Map m(800,600);
|
||||
m.set_background(color_factory::from_string("white"));
|
||||
|
|
|
@ -30,16 +30,17 @@ int main( int argc, char **argv )
|
|||
using mapnik::datasource_cache;
|
||||
using mapnik::freetype_engine;
|
||||
|
||||
datasource_cache::instance()->register_datasources("/usr/local/lib/mapnik/input");
|
||||
datasource_cache::instance()->register_datasources("/opt/mapnik/lib/mapnik/input");
|
||||
|
||||
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf");
|
||||
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans-Bold.ttf");
|
||||
freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSansMono.ttf");
|
||||
freetype_engine::register_font("/opt/mapnik/lib/mapnik/fonts/DejaVuSans.ttf");
|
||||
freetype_engine::register_font("/opt/mapnik/lib/mapnik/fonts/DejaVuSans-Bold.ttf");
|
||||
freetype_engine::register_font("/opt/mapnik/lib/mapnik/fonts/DejaVuSansMono.ttf");
|
||||
|
||||
|
||||
QApplication app( argc, argv );
|
||||
MainWindow window;
|
||||
window.show();
|
||||
if (argc > 1) window.open(argv[1]);
|
||||
if (argc == 3)
|
||||
{
|
||||
QStringList list = QString(argv[2]).split(",");
|
||||
|
@ -50,20 +51,9 @@ int main( int argc, char **argv )
|
|||
double y0 = list[1].toDouble(&ok);
|
||||
double x1 = list[2].toDouble(&ok);
|
||||
double y1 = list[3].toDouble(&ok);
|
||||
if (ok)
|
||||
{
|
||||
try
|
||||
{
|
||||
mapnik::projection prj("+proj=merc +datum=WGS84");
|
||||
prj.forward(x0,y0);
|
||||
prj.forward(x1,y1);
|
||||
window.set_default_extent(x0,y0,x1,y1);
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
if (ok) window.set_default_extent(x0,y0,x1,y1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 1) window.open(argv[1]);
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -371,3 +371,23 @@ void MainWindow::createToolBars()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::set_default_extent(double x0,double y0, double x1, double y1)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::shared_ptr<mapnik::Map> map_ptr = mapWidget_->getMap();
|
||||
if (map_ptr)
|
||||
{
|
||||
mapnik::projection prj(map_ptr->srs());
|
||||
prj.forward(x0,y0);
|
||||
prj.forward(x1,y1);
|
||||
default_extent_=mapnik::Envelope<double>(x0,y0,x1,y1);
|
||||
mapWidget_->zoomToBox(default_extent_);
|
||||
std::cout << "SET DEFAULT EXT\n";
|
||||
}
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,11 +42,7 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
MainWindow();
|
||||
virtual ~MainWindow();
|
||||
inline void set_default_extent(double x0,double y0,double x1, double y1)
|
||||
{
|
||||
default_extent_=mapnik::Envelope<double>(x0,y0,x1,y1);
|
||||
}
|
||||
|
||||
void set_default_extent(double x0,double y0,double x1, double y1);
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
public slots:
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
CC = g++
|
||||
TEMPLATE = app
|
||||
|
||||
INCLUDEPATH += /usr/local/include
|
||||
INCLUDEPATH += /opt/boost_1_35/include/boost-1_35
|
||||
INCLUDEPATH += /opt/mapnik/include
|
||||
INCLUDEPATH += /opt/boost/include/boost-1_34_1
|
||||
INCLUDEPATH += /usr/local/include/freetype2
|
||||
INCLUDEPATH += /Users/artem/projects/mapnik/agg/include
|
||||
INCLUDEPATH += .
|
||||
|
||||
QMAKE_CXXFLAGS +=' -DDARWIN'
|
||||
unix:LIBS = -L/usr/local/lib -lmapnik -lfreetype
|
||||
unix:LIBS = -L/opt/mapnik/lib -lmapnik -lfreetype
|
||||
|
||||
# Input
|
||||
|
||||
|
|
Loading…
Reference in a new issue