<?php include 'lime.php'; // (Fairly) minimal example // Renders just the cities from the rundemo sample. $t = new lime_test(23, new lime_output_color()); // Set up the environment Mapnik\DatasourceCache::registerDatasources("..\\mapnik-0.7.1\\plugins"); $t->is(in_array('shape', Mapnik\DatasourceCache::getPluginNames()), true, 'Shape data source available'); $result = Mapnik\FreetypeEngine::registerFont("..\\mapnik-0.7.1\\fonts\\DejaVuSans.ttf"); $t->is($result, true, 'Registered DejaVuSans.ttf font'); // Set up the map $m = new Mapnik\Map(800, 600); $t->isnt($result, null, 'Created Map of 800x600 pixels'); $m->setBackgroundColor(new Mapnik\Color(255, 255, 255)); $t->is($m->getBackgroundColor()->toHexString(), '#ffffff', 'Set background to 0xffffff (white)'); // Set the map data $popplaces_style = new Mapnik\FeatureStyle(); $t->isnt($popplaces_style, null, 'Created new feature style'); $popplaces_rule = new Mapnik\Rule(); $t->isnt($popplaces_rule, null, 'Created new rule'); $popplaces_text_symbolizer = new Mapnik\TextSymbolizer('GEONAME', 'DejaVu Sans Book', 10, new Mapnik\Color(0, 0, 0)); $t->isnt($popplaces_text_symbolizer, null, 'Created text symbolizer'); // @todo //$t->is($popplaces_text_symbolizer->getName(), 'GEONAME', 'Text symbolizer name is GEONAME'); //$t->is($popplaces_text_symbolizer->getFontFace(), '', 'Text symbolizer font face is DejaVu Sans Book'); //$t->is($popplaces_text_symbolizer->getTextSize(), 10, 'Text symbolizer text size is 10'); //$t->is($popplaces_text_symbolizer->getColor(), '', 'Text symbolizer text color is black'); $popplaces_text_symbolizer->setHaloFill(new Mapnik\Color(255, 255, 200)); $t->isa_ok($popplaces_text_symbolizer->getHaloFill(), 'Mapnik\\Color', 'halo_fill set to a Color'); $t->is($popplaces_text_symbolizer->getHaloFill()->toHexString(), '#ffffc8', 'halo_fill returns the right color');
<?php include 'lime.php'; $t = new lime_test(7, new lime_output_color()); /* Test the various constructors. */ $m = new Mapnik\Map(); $t->is($m->getWidth(), 400, 'Default constructor: width is 400'); $t->is($m->getHeight(), 400, 'Default constructor: height is 400'); $t->is($m->getSrs(), '+proj=latlong +datum=WGS84', 'Default constructor: projection is "+proj=latlong +datum=WGS84"'); $fs = new Mapnik\FeatureStyle(); $t->is($m->addStyle('feature style name', $fs), true, 'Add feature style to map'); $t->is($m->getBackgroundColor(), null, 'No background color set yet, getBackgroundColor returns null'); $bg_color = new Mapnik\Color(255, 255, 255); $m->setBackgroundColor($bg_color); $t->isa_ok($m->getBackgroundColor(), 'Mapnik\\Color', 'getBackgroundColor returns a Color object'); $t->is($m->getBackgroundColor()->toHexString(), $bg_color->toHexString(), 'getBackgroundColor returns the right color'); $l = new Mapnik\Layer('test layer'); $m->addLayer($l); // @todo test getLayer $m->zoomToBox(new Mapnik\Envelope(0.0, 0.0, 1.0, 1.0)); // @todo test zoomToBox /* $t->getStyleNames getStyle removeStyle removeAllStyles */ //$m = new Mapnik\Map(800, 600); //$t->is(); //m->setBackground(Mapnik\ColorFactory::FromString("white")); //m->zoomToBox(new Mapnik\Envelope(1405120.04127408, -247003.813399447, 1706357.31328276, -25098.593149577));