+ take into account <base> when reading
width/height - fixed
This commit is contained in:
parent
4483564b5e
commit
090fdb3974
1 changed files with 1026 additions and 1034 deletions
144
src/load_map.cpp
144
src/load_map.cpp
|
@ -669,25 +669,6 @@ namespace mapnik
|
||||||
{
|
{
|
||||||
type = type_from_filename(*file);
|
type = type_from_filename(*file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!width || !height)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::auto_ptr<ImageReader> reader(get_image_reader(*file));
|
|
||||||
if (reader.get())
|
|
||||||
{
|
|
||||||
if (!width) width = reader->width();
|
|
||||||
if (!height) height = reader->height();
|
|
||||||
BOOST_ASSERT(*width > 0 && *height > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cerr << "Exception caught while loading image:" << *file << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( base )
|
if( base )
|
||||||
|
@ -709,7 +690,23 @@ namespace mapnik
|
||||||
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!width || !height)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::auto_ptr<ImageReader> reader(get_image_reader(*file,*type));
|
||||||
|
if (reader.get())
|
||||||
|
{
|
||||||
|
if (!width) width = reader->width();
|
||||||
|
if (!height) height = reader->height();
|
||||||
|
BOOST_ASSERT(*width > 0 && *height > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception caught while loading image:" << *file << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
point_symbolizer symbol(*file,*type,*width,*height);
|
point_symbolizer symbol(*file,*type,*width,*height);
|
||||||
if (allow_overlap)
|
if (allow_overlap)
|
||||||
{
|
{
|
||||||
|
@ -773,24 +770,6 @@ namespace mapnik
|
||||||
type = type_from_filename(file);
|
type = type_from_filename(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!width || !height)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::auto_ptr<ImageReader> reader(get_image_reader(file));
|
|
||||||
if (reader.get())
|
|
||||||
{
|
|
||||||
if (!width) width = reader->width();
|
|
||||||
if (!height) height = reader->height();
|
|
||||||
BOOST_ASSERT(*width > 0 && *height > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cerr << "Exception caught while loading image:" << file << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( base )
|
if( base )
|
||||||
|
@ -810,7 +789,23 @@ namespace mapnik
|
||||||
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!width || !height)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::auto_ptr<ImageReader> reader(get_image_reader(file,*type));
|
||||||
|
if (reader.get())
|
||||||
|
{
|
||||||
|
if (!width) width = reader->width();
|
||||||
|
if (!height) height = reader->height();
|
||||||
|
BOOST_ASSERT(*width > 0 && *height > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception caught while loading image:" << file << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
line_pattern_symbolizer symbol(file,*type,*width,*height);
|
line_pattern_symbolizer symbol(file,*type,*width,*height);
|
||||||
rule.append(symbol);
|
rule.append(symbol);
|
||||||
|
@ -852,24 +847,6 @@ namespace mapnik
|
||||||
type = type_from_filename(file);
|
type = type_from_filename(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!width || !height)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::auto_ptr<ImageReader> reader(get_image_reader(file));
|
|
||||||
if (reader.get())
|
|
||||||
{
|
|
||||||
if (!width) width = reader->width();
|
|
||||||
if (!height) height = reader->height();
|
|
||||||
BOOST_ASSERT(*width > 0 && *height > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cerr << "Exception caught while loading image:" << file << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( base )
|
if( base )
|
||||||
|
@ -889,7 +866,23 @@ namespace mapnik
|
||||||
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!width || !height)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::auto_ptr<ImageReader> reader(get_image_reader(file,*type));
|
||||||
|
if (reader.get())
|
||||||
|
{
|
||||||
|
if (!width) width = reader->width();
|
||||||
|
if (!height) height = reader->height();
|
||||||
|
BOOST_ASSERT(*width > 0 && *height > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception caught while loading image:" << file << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
polygon_pattern_symbolizer symbol(file,*type,*width,*height);
|
polygon_pattern_symbolizer symbol(file,*type,*width,*height);
|
||||||
rule.append(symbol);
|
rule.append(symbol);
|
||||||
}
|
}
|
||||||
|
@ -1135,24 +1128,6 @@ namespace mapnik
|
||||||
type = type_from_filename(image_file);
|
type = type_from_filename(image_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!width || !height)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::auto_ptr<ImageReader> reader(get_image_reader(image_file));
|
|
||||||
if (reader.get())
|
|
||||||
{
|
|
||||||
if (!width) width = reader->width();
|
|
||||||
if (!height) height = reader->height();
|
|
||||||
BOOST_ASSERT(*width > 0 && *height > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cerr << "Exception caught while loading image:" << image_file << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( base )
|
if( base )
|
||||||
|
@ -1173,6 +1148,23 @@ namespace mapnik
|
||||||
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
std::clog << "\nFound relative paths in xml, leaving unchanged...\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!width || !height)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::auto_ptr<ImageReader> reader(get_image_reader(image_file,*type));
|
||||||
|
if (reader.get())
|
||||||
|
{
|
||||||
|
if (!width) width = reader->width();
|
||||||
|
if (!height) height = reader->height();
|
||||||
|
BOOST_ASSERT(*width > 0 && *height > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception caught while loading image:" << image_file << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shield_symbolizer shield_symbol(name,size,fill,
|
shield_symbolizer shield_symbol(name,size,fill,
|
||||||
image_file,*type,*width,*height);
|
image_file,*type,*width,*height);
|
||||||
|
|
Loading…
Reference in a new issue