Merge branch 'master' into geometry_cleanup

This commit is contained in:
Artem Pavlenko 2011-12-16 09:15:02 +00:00
commit 9fe444ba29
2 changed files with 38 additions and 36 deletions

View file

@ -44,10 +44,6 @@ target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'm
target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2')
libraries = ['mapnik'] libraries = ['mapnik']
libraries.append('png')
if env['JPEG']:
libraries.append('jpeg')
if env['BOOST_PYTHON_LIB']: if env['BOOST_PYTHON_LIB']:
libraries.append(env['BOOST_PYTHON_LIB']) libraries.append(env['BOOST_PYTHON_LIB'])
@ -57,11 +53,16 @@ else:
else: else:
libraries.append('boost_python%s' % env['BOOST_APPEND']) libraries.append('boost_python%s' % env['BOOST_APPEND'])
# TODO - do solaris/fedora need direct linking too?
if env['PLATFORM'] == 'Darwin': if env['PLATFORM'] == 'Darwin':
libraries.append(env['ICU_LIB_NAME']) if not env['PYTHON_DYNAMIC_LOOKUP']:
libraries.append('boost_regex%s' % env['BOOST_APPEND']) libraries.append('png')
if env['THREADING'] == 'multi': if env['JPEG']:
libraries.append('boost_thread%s' % env['BOOST_APPEND']) libraries.append('jpeg')
libraries.append(env['ICU_LIB_NAME'])
libraries.append('boost_regex%s' % env['BOOST_APPEND'])
if env['THREADING'] == 'multi':
libraries.append('boost_thread%s' % env['BOOST_APPEND'])
##### Python linking on OS X is tricky ### ##### Python linking on OS X is tricky ###
# Confounding problems are: # Confounding problems are:
@ -107,6 +108,7 @@ if env['PLATFORM'] == 'Darwin':
else: else:
# TODO - do we need to pass -L/? # TODO - do we need to pass -L/?
python_link_flag = '-lpython%s' % env['PYTHON_VERSION'] python_link_flag = '-lpython%s' % env['PYTHON_VERSION']
elif env['PLATFORM'] == 'SunOS': elif env['PLATFORM'] == 'SunOS':
# make sure to explicitly link mapnik.so against # make sure to explicitly link mapnik.so against
# libmapnik in its installed location # libmapnik in its installed location

View file

@ -293,7 +293,7 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
// wrap text at first wrap_char after (default) the wrap width or immediately before the current word // wrap text at first wrap_char after (default) the wrap width or immediately before the current word
if ((c == '\n') || if ((c == '\n') ||
(line_width > 0 && (((line_width - character_spacing) > wrap_at && !p.wrap_before) || (line_width > 0 && (((line_width - character_spacing) > wrap_at && !p.wrap_before) ||
((line_width + word_width - character_spacing) > wrap_at && p.wrap_before)) )) ((line_width + word_width - character_spacing) > wrap_at && p.wrap_before)) ))
{ {
// Remove width of breaking space character since it is not rendered and the character_spacing for the last character on the line // Remove width of breaking space character since it is not rendered and the character_spacing for the last character on the line
line_width -= (last_wrap_char_width + character_spacing); line_width -= (last_wrap_char_width + character_spacing);
@ -381,12 +381,12 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
x = -(line_width / 2.0); x = -(line_width / 2.0);
if (p.info.get_rtl()==false) if (p.info.get_rtl()==false)
{ {
y = (0.5 * (string_height + (line_spacing * (total_lines-1)))) - max_character_height; y = (0.5 * (string_height + (line_spacing * (total_lines-1)))) - max_character_height;
} }
else else
{ {
y = -(0.5 * (string_height + (line_spacing * (total_lines-1)))) + max_character_height; y = -(0.5 * (string_height + (line_spacing * (total_lines-1)))) + max_character_height;
} }
// if needed, adjust for desired justification (J_MIDDLE is the default) // if needed, adjust for desired justification (J_MIDDLE is the default)
if( po->jalign == J_LEFT ) if( po->jalign == J_LEFT )
@ -411,14 +411,14 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
index_to_wrap_at = line_breaks[++line_number]; index_to_wrap_at = line_breaks[++line_number];
line_width = line_widths[line_number]; line_width = line_widths[line_number];
if (p.info.get_rtl()==false) if (p.info.get_rtl()==false)
{ {
y -= (max_character_height + line_spacing); // move position down to line start y -= (max_character_height + line_spacing); // move position down to line start
} }
else else
{ {
y += (max_character_height + line_spacing); // move position up to line start y += (max_character_height + line_spacing); // move position up to line start
} }
// reset to begining of line position // reset to begining of line position
x = ((po->jalign == J_LEFT)? -(string_width / 2.0): ((po->jalign == J_RIGHT)? ((string_width /2.0) - line_width): -(line_width / 2.0))); x = ((po->jalign == J_LEFT)? -(string_width / 2.0): ((po->jalign == J_RIGHT)? ((string_width /2.0) - line_width): -(line_width / 2.0)));
@ -467,9 +467,9 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
if (p.minimum_padding > 0) if (p.minimum_padding > 0)
{ {
box2d<double> epad(e.minx()-p.minimum_padding, box2d<double> epad(e.minx()-p.minimum_padding,
e.miny()-p.minimum_padding, e.miny()-p.minimum_padding,
e.maxx()+p.minimum_padding, e.maxx()+p.minimum_padding,
e.maxy()+p.minimum_padding); e.maxy()+p.minimum_padding);
if (!dimensions_.contains(epad)) if (!dimensions_.contains(epad))
{ {
return; return;
@ -485,18 +485,18 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
// check the placement of any additional envelopes // check the placement of any additional envelopes
if (!p.allow_overlap && !p.additional_boxes.empty()) if (!p.allow_overlap && !p.additional_boxes.empty())
{ {
BOOST_FOREACH(box2d<double> box, p.additional_boxes) BOOST_FOREACH(box2d<double> box, p.additional_boxes)
{ {
box2d<double> pt(box.minx() + current_placement->starting_x, box2d<double> pt(box.minx() + current_placement->starting_x,
box.miny() + current_placement->starting_y, box.miny() + current_placement->starting_y,
box.maxx() + current_placement->starting_x, box.maxx() + current_placement->starting_x,
box.maxy() + current_placement->starting_y); box.maxy() + current_placement->starting_y);
// abort the whole placement if the additional envelopes can't be placed. // abort the whole placement if the additional envelopes can't be placed.
if (!detector_.has_point_placement(pt, p.minimum_distance)) return; if (!detector_.has_point_placement(pt, p.minimum_distance)) return;
c_envelopes.push(pt); c_envelopes.push(pt);
} }
} }
// since there was no early exit, add the character envelopes to the placements' envelopes // since there was no early exit, add the character envelopes to the placements' envelopes