fixed Makefile.am\'s

This commit is contained in:
Artem Pavlenko 2005-03-30 21:45:40 +00:00
parent e124e75441
commit 4806dfdf2f
47 changed files with 1809 additions and 192 deletions

View file

@ -1,5 +1,3 @@
SUBDIRS = m4 libltdl src utils/shapeindex
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = config.rpath mkinstalldirs

293
configure vendored
View file

@ -20702,6 +20702,153 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for png_read_info in -lpng" >&5
echo $ECHO_N "checking for png_read_info in -lpng... $ECHO_C" >&6
if test "${ac_cv_lib_png_png_read_info+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char png_read_info ();
int
main ()
{
png_read_info ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_png_png_read_info=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_png_png_read_info=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_read_info" >&5
echo "${ECHO_T}$ac_cv_lib_png_png_read_info" >&6
if test $ac_cv_lib_png_png_read_info = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPNG 1
_ACEOF
LIBS="-lpng $LIBS"
fi
echo "$as_me:$LINENO: checking for jpeg_read_header in -ljpeg" >&5
echo $ECHO_N "checking for jpeg_read_header in -ljpeg... $ECHO_C" >&6
if test "${ac_cv_lib_jpeg_jpeg_read_header+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ljpeg $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char jpeg_read_header ();
int
main ()
{
jpeg_read_header ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_jpeg_jpeg_read_header=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_jpeg_jpeg_read_header=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_read_header" >&5
echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_read_header" >&6
if test $ac_cv_lib_jpeg_jpeg_read_header = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBJPEG 1
_ACEOF
LIBS="-ljpeg $LIBS"
fi
echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
if test "${ac_cv_c_bigendian+set}" = set; then
@ -21727,6 +21874,152 @@ echo "$as_me: error: install png-devel" >&2;}
fi
if test "${ac_cv_header_jpeglib_h+set}" = set; then
echo "$as_me:$LINENO: checking for jpeglib.h" >&5
echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6
if test "${ac_cv_header_jpeglib_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking jpeglib.h usability" >&5
echo $ECHO_N "checking jpeglib.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <jpeglib.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking jpeglib.h presence" >&5
echo $ECHO_N "checking jpeglib.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <jpeglib.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: jpeglib.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: jpeglib.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: jpeglib.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: jpeglib.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: jpeglib.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## --------------------------------- ##
## Report this to the mapnik lists. ##
## --------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for jpeglib.h" >&5
echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6
if test "${ac_cv_header_jpeglib_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_jpeglib_h=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6
fi
if test $ac_cv_header_jpeglib_h = yes; then
:
else
{ { echo "$as_me:$LINENO: error: install jpeg-devel" >&5
echo "$as_me: error: install jpeg-devel" >&2;}
{ (exit 1); exit 1; }; }
fi
# Checks for typedefs, structures, and compiler characteristics.
echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5

View file

@ -8,6 +8,7 @@ extension mapnik
mapnik_layer.cc
mapnik_envelope.cc
mapnik_map.cc
mapnik_image.cc
mapnik_python.cc
# requirements and dependencies for Boost.Python extensions
<template>@boost/libs/python/build/extension

View file

@ -37,9 +37,9 @@ struct envelope_pickle_suite : boost::python::pickle_suite
void export_envelope()
{
using namespace boost::python;
class_<Envelope<double> >("envelope",init<double,double,double,double>())
class_<Envelope<double> >("envelope",init<double,double,double,double>())
.def(init<>())
.def(init<const coord<double,2>&, const coord<double,2>&>())
.def(init<const coord<double,2>&, const coord<double,2>&>())
.add_property("minx",&Envelope<double>::minx)
.add_property("miny",&Envelope<double>::miny)
.add_property("maxx",&Envelope<double>::maxx)

38
python/mapnik_image.cc Normal file
View file

@ -0,0 +1,38 @@
/* This file is part of python_mapnik (c++/python mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id$
#include <mapnik.hh>
#include <boost/python.hpp>
using mapnik::Image32;
char const* rawdata(const Image32& image)
{
return (char const* )image.raw_data();
}
void export_image()
{
using namespace boost::python;
class_<Image32>("image",init<int,int>())
;
def("rawdata",&rawdata);
}

View file

@ -32,6 +32,7 @@ void export_color();
void export_layer();
void export_parameters();
void export_envelope();
void export_image();
void export_map();
using namespace mapnik;
@ -68,6 +69,11 @@ void render_to_file(const Map& map,const std::string& file,const std::string& fo
image.saveToFile(file,format);
}
void render(const Map& map,Image32& image)
{
Renderer<Image32>::render(map,image);
}
//BEGIN quick hack
ref_ptr<Symbolizer> create_point_symbolizer(const std::string& file,unsigned w,unsigned h)
{
@ -100,6 +106,7 @@ BOOST_PYTHON_MODULE(mapnik)
export_parameters();
export_color();
export_envelope();
export_image();
class_<Style>("style",init<>("Style default constructor"))
.def(init<ref_ptr<Symbolizer> >())
@ -145,7 +152,7 @@ BOOST_PYTHON_MODULE(mapnik)
export_map();
def("render_to_file",&render_to_file);
def("render",&render);
def("create_point_symbolizer",&create_point_symbolizer);
def("create_line_symbolizer",&create_line_symbolizer);
def("create_polygon_symbolizer",&create_polygon_symbolizer);

View file

@ -1,9 +1,9 @@
#Copyright (C) 2005 by Artem Pavlenko
lib_LTLIBRARIES = libmapnik.la
nobase_include_HEADERS = attribute_container.hh attribute.hh color.hh config.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.hh factory.hh feature.hh filter.hh envelope.hh gamma.hh geometry.hh geom_util.hh graphics.hh image_data.hh image_reader.hh image_util.hh layer.hh line_aa.hh map.hh mapnik.hh memory.hh params.hh plugin.hh line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster_feature.hh raster.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.hh vector_feature.hh vertex.hh vertex_transform.hh wkb.hh
nobase_include_HEADERS = attribute_container.hh attribute.hh color.hh config.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.hh factory.hh feature.hh filter.hh filter_visitor.hh envelope.hh gamma.hh geometry.hh geom_util.hh graphics.hh image_data.hh image_reader.hh image_util.hh layer.hh line_aa.hh map.hh mapnik.hh memory.hh params.hh plugin.hh line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster_feature.hh raster.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.hh vector_feature.hh vertex.hh vertex_transform.hh wkb.hh logical.hh rule.hh comparison.hh fill.hh spatial.hh expression.hh stroke.hh attribute_collector.hh
libmapnik_la_SOURCES = attribute_container.cc attribute_container.hh attribute.hh color.cc color.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.cc datasource_cache.hh envelope.cc envelope.hh factory.hh feature.cc feature.hh filter.hh geometry.hh gamma.hh geom_util.hh graphics.cc graphics.hh image_data.hh image_reader.cc image_reader.hh image_util.cc image_util.hh layer.cc layer.hh line_aa.cc line_aa.hh map.cc map.hh mapnik.hh memory.cc memory.hh params.cc params.hh plugin.cc plugin.hh png_reader.cc line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster.cc raster_feature.cc raster_feature.hh raster.hh render.cc render.hh scanline_aa.cc scanline_aa.hh scanline.cc scanline.hh style.cc style.hh style_cache.cc style_cache.hh style_factory.hh symbolizer.hh text.cc text.hh utils.hh vector_feature.cc vector_feature.hh vertex.hh vertex_transform.hh wkb.cc wkb.hh
libmapnik_la_SOURCES = attribute_container.cc attribute_container.hh attribute.hh color.cc color.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.cc datasource_cache.hh envelope.cc envelope.hh factory.hh feature.cc feature.hh filter.hh filter_visitor.hh geometry.hh gamma.hh geom_util.hh graphics.cc graphics.hh image_data.hh image_reader.cc image_reader.hh image_util.cc image_util.hh layer.cc layer.hh line_aa.cc line_aa.hh map.cc map.hh mapnik.hh memory.cc memory.hh params.cc params.hh plugin.cc plugin.hh png_reader.cc line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster.cc raster_feature.cc raster_feature.hh raster.hh render.cc render.hh scanline_aa.cc scanline_aa.hh scanline.cc scanline.hh style.cc style.hh style_cache.cc style_cache.hh style_factory.hh symbolizer.hh text.cc text.hh utils.hh vector_feature.cc vector_feature.hh vertex.hh vertex_transform.hh wkb.cc wkb.hh logical.hh rule.hh comparison.hh fill.hh spatial.hh expression.hh stroke.hh attribute_collector.hh
if BUILD_TIFF_READER
libmapnik_la_SOURCES += tiff_reader.cc
@ -11,7 +11,7 @@ endif
libmapnik_la_CPPFLAGS = $(FREETYPE2_CFLAGS)
libmapnik_la_CPPFLAGS += @INCLTDL@
libmapnik_la_LIBADD = @LIBLTDL@ -lpthread -lpng -ljpeg $(FREETYPE2_LIBS) -lz -lm
libmapnik_la_LIBADD = @LIBLTDL@ -lpthread -lpng -ljpeg $(FREETYPE2_LIBS) -lz -lm
libmapnik_la_LDFLAGS= -version-info 0:0:0 $(TIFF_LDFLAGS)
if SHAPE_DATASOURCE

View file

@ -68,18 +68,20 @@ am__libmapnik_la_SOURCES_DIST = attribute_container.cc \
coord_array.hh vertex_vector.hh ctrans.hh datasource.hh \
datasource_cache.cc datasource_cache.hh envelope.cc \
envelope.hh factory.hh feature.cc feature.hh filter.hh \
geometry.hh gamma.hh geom_util.hh graphics.cc graphics.hh \
image_data.hh image_reader.cc image_reader.hh image_util.cc \
image_util.hh layer.cc layer.hh line_aa.cc line_aa.hh map.cc \
map.hh mapnik.hh memory.cc memory.hh params.cc params.hh \
plugin.cc plugin.hh png_reader.cc line_symbolizer.hh \
polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh \
raster.cc raster_feature.cc raster_feature.hh raster.hh \
render.cc render.hh scanline_aa.cc scanline_aa.hh scanline.cc \
scanline.hh style.cc style.hh style_cache.cc style_cache.hh \
style_factory.hh symbolizer.hh text.cc text.hh utils.hh \
vector_feature.cc vector_feature.hh vertex.hh \
vertex_transform.hh wkb.cc wkb.hh tiff_reader.cc
filter_visitor.hh geometry.hh gamma.hh geom_util.hh \
graphics.cc graphics.hh image_data.hh image_reader.cc \
image_reader.hh image_util.cc image_util.hh layer.cc layer.hh \
line_aa.cc line_aa.hh map.cc map.hh mapnik.hh memory.cc \
memory.hh params.cc params.hh plugin.cc plugin.hh \
png_reader.cc line_symbolizer.hh polygon_symbolizer.hh \
image_symbolizer.hh pool.hh ptr.hh raster.cc raster_feature.cc \
raster_feature.hh raster.hh render.cc render.hh scanline_aa.cc \
scanline_aa.hh scanline.cc scanline.hh style.cc style.hh \
style_cache.cc style_cache.hh style_factory.hh symbolizer.hh \
text.cc text.hh utils.hh vector_feature.cc vector_feature.hh \
vertex.hh vertex_transform.hh wkb.cc wkb.hh logical.hh rule.hh \
comparison.hh fill.hh spatial.hh expression.hh stroke.hh \
attribute_collector.hh tiff_reader.cc
@BUILD_TIFF_READER_TRUE@am__objects_1 = libmapnik_la-tiff_reader.lo
am_libmapnik_la_OBJECTS = libmapnik_la-attribute_container.lo \
libmapnik_la-color.lo libmapnik_la-datasource_cache.lo \
@ -242,13 +244,13 @@ subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
lib_LTLIBRARIES = libmapnik.la
nobase_include_HEADERS = attribute_container.hh attribute.hh color.hh config.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.hh factory.hh feature.hh filter.hh envelope.hh gamma.hh geometry.hh geom_util.hh graphics.hh image_data.hh image_reader.hh image_util.hh layer.hh line_aa.hh map.hh mapnik.hh memory.hh params.hh plugin.hh line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster_feature.hh raster.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.hh vector_feature.hh vertex.hh vertex_transform.hh wkb.hh
nobase_include_HEADERS = attribute_container.hh attribute.hh color.hh config.hh coord.hh coord_array.hh vertex_vector.hh ctrans.hh datasource.hh datasource_cache.hh factory.hh feature.hh filter.hh filter_visitor.hh envelope.hh gamma.hh geometry.hh geom_util.hh graphics.hh image_data.hh image_reader.hh image_util.hh layer.hh line_aa.hh map.hh mapnik.hh memory.hh params.hh plugin.hh line_symbolizer.hh polygon_symbolizer.hh image_symbolizer.hh pool.hh ptr.hh raster_feature.hh raster.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.hh vector_feature.hh vertex.hh vertex_transform.hh wkb.hh logical.hh rule.hh comparison.hh fill.hh spatial.hh expression.hh stroke.hh attribute_collector.hh
libmapnik_la_SOURCES = attribute_container.cc attribute_container.hh \
attribute.hh color.cc color.hh coord.hh coord_array.hh \
vertex_vector.hh ctrans.hh datasource.hh datasource_cache.cc \
datasource_cache.hh envelope.cc envelope.hh factory.hh \
feature.cc feature.hh filter.hh geometry.hh gamma.hh \
geom_util.hh graphics.cc graphics.hh image_data.hh \
feature.cc feature.hh filter.hh filter_visitor.hh geometry.hh \
gamma.hh geom_util.hh graphics.cc graphics.hh image_data.hh \
image_reader.cc image_reader.hh image_util.cc image_util.hh \
layer.cc layer.hh line_aa.cc line_aa.hh map.cc map.hh \
mapnik.hh memory.cc memory.hh params.cc params.hh plugin.cc \
@ -259,9 +261,11 @@ libmapnik_la_SOURCES = attribute_container.cc attribute_container.hh \
scanline.hh style.cc style.hh style_cache.cc style_cache.hh \
style_factory.hh symbolizer.hh text.cc text.hh utils.hh \
vector_feature.cc vector_feature.hh vertex.hh \
vertex_transform.hh wkb.cc wkb.hh $(am__append_1)
vertex_transform.hh wkb.cc wkb.hh logical.hh rule.hh \
comparison.hh fill.hh spatial.hh expression.hh stroke.hh \
attribute_collector.hh $(am__append_1)
libmapnik_la_CPPFLAGS = $(FREETYPE2_CFLAGS) @INCLTDL@
libmapnik_la_LIBADD = @LIBLTDL@ -lpthread -lpng $(FREETYPE2_LIBS) -lz -lm
libmapnik_la_LIBADD = @LIBLTDL@ -lpthread -lpng -ljpeg $(FREETYPE2_LIBS) -lz -lm
libmapnik_la_LDFLAGS = -version-info 0:0:0 $(TIFF_LDFLAGS)
@SHAPE_DATASOURCE_TRUE@SHAPE_DATASOURCE_DIR = shape
@RASTER_DATASOURCE_TRUE@RASTER_DATASOURCE_DIR = raster

View file

@ -25,7 +25,6 @@
namespace mapnik
{
class attribute_base
{
public:
@ -78,7 +77,7 @@ namespace mapnik
attribute& operator=(const attribute& other)
{
attribute<T> temp(other);
Swap(temp);
swap(temp);
return *this;
}
~attribute()
@ -98,7 +97,7 @@ namespace mapnik
return ATraits::to_string(value_);
}
private:
void Swap(attribute<T>& other) throw()
void swap(attribute<T>& other) throw()
{
std::swap(value_,other.value_);
}

View file

@ -0,0 +1,57 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef ATTRIBUTE_COLLECTOR
#define ATTROBUTE_COLLECTOR
#include "filter_visitor.hh"
#include <set>
#include "comparison.hh"
namespace mapnik
{
template <typename Feature>
class attribute_collector : public filter_visitor<Feature>
{
private:
std::set<std::string> names_;
public:
attribute_collector() {}
void visit(filter<Feature>& filter)
{
property_filter<Feature>* pf_;
if((pf_=dynamic_cast<property_filter<Feature>*>(&filter)))
{
names_.insert(pf_->name_);
}
}
const std::set<std::string>& property_names() const
{
return names_;
}
virtual ~attribute_collector() {}
private:
attribute_collector(const attribute_collector&);
attribute_collector& operator=(const attribute_collector&);
};
}
#endif //ATTRIBUTE_COLLECTOR_HH

204
src/comparison.hh Normal file
View file

@ -0,0 +1,204 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef COMPARISON_HH
#define COMPARISON_HH
#include "filter.hh"
#include "expression.hh"
#include "feature.hh"
#include "attribute.hh"
namespace mapnik
{
template<typename Feature>
struct property_filter : public filter<Feature> {
const std::string name_;
explicit property_filter(const std::string& name)
: name_(name) {}
};
template <typename Feature,typename T>
struct property_is_equal_to : public property_filter<Feature>
{
using property_filter<Feature>::name_;
T value_;
property_is_equal_to(const std::string& name,const T& value)
: property_filter<Feature>(name), value_(value) {}
int type() const
{
return filter<Feature>::COMPARISON_OPS;
}
bool pass(const Feature& feature) const
{
//TODO
//attribute attr=feature.attribute_by_name(name_);
//bool result=false;
//try
// {
// result=(value_==boost::any_cast<T>(attr.value_))?true:false;
// }
//catch (boost::bad_any_cast& ex)
// {
// std::cerr<<ex.what()<<std::endl;
//}
//return result;
return false;
}
filter<Feature>* clone() const
{
return new property_is_equal_to(name_,value_);
}
void accept(filter_visitor<Feature>& v)
{
v.visit(*this);
}
virtual ~property_is_equal_to() {}
};
template <typename Feature,typename T>
struct property_is_greater_then : public property_filter<Feature>
{
using property_filter<Feature>::name_;
T value_;
property_is_greater_then(const std::string& name,const T& value)
: property_filter<Feature>(name), value_(value) {}
int type() const
{
return filter<Feature>::COMPARISON_OPS;
}
bool pass(const Feature& feature) const
{
//attribute attr=feature.attribute_by_name(name_);
//bool result=false;
//try
// {
// result=(value_ > boost::any_cast<T>(attr.value_))?true:false;
//}
//catch (boost::bad_any_cast& ex)
// {
// std::cerr<<ex.what()<<std::endl;
// }
//return result;
return false;
}
filter<Feature>* clone() const
{
return new property_is_greater_then(name_,value_);
}
void accept(filter_visitor<Feature>& v)
{
v.visit(*this);
}
virtual ~property_is_greater_then() {}
};
template <typename Feature,typename T>
struct property_is_less_then : public property_filter<Feature>
{
using property_filter<Feature>::name_;
T value_;
property_is_less_then(const std::string& name,const T& value)
: property_filter<Feature>(name), value_(value) {}
int type() const
{
return filter<Feature>::COMPARISON_OPS;
}
bool pass(const Feature& feature) const
{
//attribute attr=feature.attribute_by_name(name_);
//bool result=false;
//try
//{
// result=(value_ > boost::any_cast<T>(attr.value_))?true:false;
// }
//catch (boost::bad_any_cast& ex)
// {
// std::cerr<<ex.what()<<std::endl;
//}
//return result;
return false;
}
void accept(filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature,typename T>
struct property_is_between : public property_filter<Feature>
{
using property_filter<Feature>::name_;
T lo_value_;
T hi_value_;
property_is_between(const std::string& name,const T& lo_value,const T& hi_value)
: property_filter<Feature>(name),
lo_value_(lo_value),
hi_value_(hi_value) {}
int type() const
{
return filter<Feature>::COMPARISON_OPS;
}
bool pass(const Feature& feature) const
{
//attribute attr=feature.attribute_by_name(name_);
//bool result=false;
//try
// {
// T const& a=boost::any_cast<T>(attr.value_);
// result=(lo_value_ < a && a < hi_value_) ? true : false;
// }
//catch (boost::bad_any_cast& ex)
// {
// std::cerr<<ex.what()<<std::endl;
//}
//return result;
return false;
}
filter<Feature>* clone() const
{
return new property_is_between(name_,lo_value_,hi_value_);
}
void accept(filter_visitor<Feature>& v)
{
v.visit(*this);
}
virtual ~property_is_between() {}
};
}
#endif //COMPARISON_HH

View file

@ -19,9 +19,15 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
#undef HAVE_LIBJPEG
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `png' library (-lpng). */
#undef HAVE_LIBPNG
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id: datasource.hh 68 2004-11-23 22:39:58Z artem $
//$Id$
#ifndef DATASOURCE_HH
#define DATASOURCE_HH
@ -56,17 +56,19 @@ namespace mapnik
class datasource
{
public:
enum
{
Point=1,
Line,
Polygon,
Raster
};
enum {
Point=1,
Line,
Polygon,
Raster
};
virtual int type() const=0;
virtual FeaturesetPtr featuresAll(const CoordTransform& t) const=0;
virtual FeaturesetPtr featuresInBox(const CoordTransform& t,const Envelope<double>& box) const=0;
virtual FeaturesetPtr featuresAtPoint(const CoordTransform& t,const coord2d& pt) const=0;
//virtual FeaturesetPtr query(const Envelope<double>& box,);
virtual const Envelope<double>& envelope() const=0;
virtual ~datasource() {};
};

View file

@ -61,7 +61,6 @@ namespace mapnik
EnvelopeType intersect(const EnvelopeType& other) const;
bool operator==(const EnvelopeType &other) const;
void re_center(T cx,T cy);
private:
void init(T x0,T y0,T x1,T y1);
};
@ -78,4 +77,4 @@ namespace mapnik
return out;
}
}
#endif // ENVELOPE_HH
#endif // ENVELOPE_HH

63
src/expression.hh Normal file
View file

@ -0,0 +1,63 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef EXPRESSION_HH
#define EXPRESSION_HH
namespace mapnik
{
//arithmetic expressions
template <typename T>
struct add
{
T operator()(T operand1,T operand2) const
{
return operand1 + operand2;
}
};
template <typename T>
struct divide
{
T operator()(T operand1,T operand2) const
{
assert(operand2);
return operand1 / operand2;
}
};
template <typename T>
struct mult
{
T operator() (T operand1,T operand2) const
{
return operand1 * operand2;
}
};
template <typename T>
struct sub
{
T operator() (T operand1,T operand2) const
{
return operand1 - operand2;
}
};
}
#endif //EXPRESSION_HH

32
src/fill.hh Normal file
View file

@ -0,0 +1,32 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef FILL_HH
#define FILL_HH
namespace mapnik
{
class fill
{
};
}
#endif //FILL_HH

View file

@ -22,30 +22,55 @@
#define FILTER_HH
#include "envelope.hh"
#include "feature.hh"
#include "filter_visitor.hh"
namespace mapnik
{
struct filter_in_box
template <typename Feature>
struct filter
{
Envelope<double> box_;
explicit filter_in_box(const Envelope<double>& box)
: box_(box) {}
bool pass(const Envelope<double>& extent) const
{
return extent.intersects(box_);
}
enum {
NULL_OPS,
SPATIAL_OPS,
COMPARISON_OPS,
LOGICAL_OPS,
FEATUREID_OPS
};
virtual int type() const=0;
virtual bool pass (const Feature& feature) const=0;
virtual filter<Feature>* clone() const=0;
virtual void accept(filter_visitor<Feature>& v)=0;
virtual ~filter() {}
};
struct filter_at_point
template <typename Feature>
struct null_filter : public filter<Feature>
{
coord2d pt_;
explicit filter_at_point(const coord2d& pt)
: pt_(pt) {}
bool pass(const Envelope<double>& extent) const
{
return extent.contains(pt_);
}
typedef filter<Feature> _Base_;
int type() const
{
return _Base_::NULL_OPS;
}
bool pass (const Feature&) const
{
return true;
}
_Base_* clone() const
{
return new null_filter<Feature>;
}
void accept(filter_visitor<Feature>& v)
{
v.visit(*this);
}
~null_filter() {}
};
}
#endif //FILTER_HH
#endif //FILTER_HH

36
src/filter_visitor.hh Normal file
View file

@ -0,0 +1,36 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef FILTER_VISITOR_HH
#define FILTER_VISITOR_HH
#include "filter.hh"
#include "feature.hh"
namespace mapnik
{
template <typename Feature> class filter;
template <typename Feature>
struct filter_visitor
{
virtual void visit(filter<Feature>& filter)=0;
virtual ~filter_visitor() {}
};
}
#endif //FILTER_VISITOR_HH

View file

@ -202,6 +202,30 @@ namespace mapnik
}
return false;
}
struct filter_in_box
{
Envelope<double> box_;
explicit filter_in_box(const Envelope<double>& box)
: box_(box) {}
bool pass(const Envelope<double>& extent) const
{
return extent.intersects(box_);
}
};
struct filter_at_point
{
coord2d pt_;
explicit filter_at_point(const coord2d& pt)
: pt_(pt) {}
bool pass(const Envelope<double>& extent) const
{
return extent.contains(pt_);
}
};
}
#endif //GEOM_UTIL_HH

View file

@ -43,11 +43,13 @@ namespace mapnik
typedef Container<vertex_type> container_type;
private:
int srid_;
mutable unsigned itr_;
protected:
container_type cont_;
public:
geometry (int srid=-1)
: srid_(srid),
itr_(0),
cont_() {}
virtual int type() const=0;
@ -56,7 +58,7 @@ namespace mapnik
{
return srid_;
}
void move_to(value_type x,value_type y)
{
cont_.push_back(x,y,SEG_MOVETO);
@ -66,7 +68,16 @@ namespace mapnik
{
cont_.push_back(x,y,SEG_LINETO);
}
//unsigned vertex(double* x, double* y)
// {
// return cont_.get_vertex(itr_++,x,y);
// }
//void rewind(unsigned )
// {
// itr_=0;
// }
template <typename Transform>
class path_iterator
{

View file

@ -56,7 +56,12 @@ namespace mapnik
{
return data_.getBytes();
}
inline unsigned char* raw_data()
{
return data_.getBytes();
}
void saveToFile(const std::string& file,const std::string& format="auto");
private:
@ -88,6 +93,7 @@ namespace mapnik
int r=gammaTable_.l2g[(gammaTable_.g2l[red]*alpha+gammaTable_.g2l[bgRed]*(255-alpha))>>8];
int g=gammaTable_.l2g[(gammaTable_.g2l[green]*alpha+gammaTable_.g2l[bgGreen]*(255-alpha))>>8];
int b=gammaTable_.l2g[(gammaTable_.g2l[blue]*alpha+gammaTable_.g2l[bgBlue]*(255-alpha))>>8];
return 0xff<<24 | r<<16 | g<<8 | b;
}

View file

@ -78,10 +78,22 @@ namespace mapnik
{
return pData_;
}
inline T* getData()
{
return pData_;
}
inline const unsigned char* getBytes() const
{
return (unsigned char*)pData_;
}
inline unsigned char* getBytes()
{
return (unsigned char*)pData_;
}
inline const T* getRow(unsigned row) const
{
return pData_+row*width_;
@ -96,14 +108,15 @@ namespace mapnik
{
memcpy(pData_+row*width_+x0,buf,(x1-x0)*sizeof(T));
}
inline ~ImageData()
{
::operator delete(pData_),pData_=0;
}
};
typedef ImageData<unsigned> ImageData32;
typedef ImageData<unsigned char> ImageData8;
}
#endif //IMAGE_DATA_HH

View file

@ -54,7 +54,7 @@ namespace mapnik
virtual ~ImageSymbolizer() {}
void render(const geometry_type& geom,Image32& image) const
void render(geometry_type& geom,Image32& image) const
{
int w=symbol_.width();
int h=symbol_.height();

View file

@ -24,6 +24,7 @@
#include "graphics.hh"
#include "image_util.hh"
#include "memory.hh"
namespace mapnik
{

View file

@ -21,8 +21,32 @@
#ifndef LINE_SYMBOLIZER_HH
#define LINE_SYMBOLIZER_HH
//#include "agg_basics.h"
//#include "agg_rendering_buffer.h"
//#include "agg_rasterizer_scanline_aa.h"
//#include "agg_conv_stroke.h"
//#include "agg_conv_dash.h"
//#include "agg_conv_curve.h"
//#include "agg_conv_contour.h"
//#include "agg_conv_stroke.h"
//#include "agg_vcgen_stroke.h"
//#include "agg_conv_adaptor_vcgen.h"
//#include "agg_conv_smooth_poly1.h"
//#include "agg_conv_marker.h"
//#include "agg_arrowhead.h"
//#include "agg_vcgen_markers_term.h"
//#include "agg_scanline_p.h"
//#include "agg_renderer_scanline.h"
//#include "agg_pixfmt_rgba32.h"
//#include "agg_path_storage.h"
//#include "agg_renderer_outline_aa.h"
//#include "agg_rasterizer_outline_aa.h"
//#include "agg_rasterizer_outline.h"
//#include "agg_renderer_outline_image.h"
#include "symbolizer.hh"
#include "line_aa.hh"
#include "scanline_aa.hh"
namespace mapnik
{
@ -30,19 +54,66 @@ namespace mapnik
{
private:
Color pen_;
double width_;
public:
LineSymbolizer(const Color& pen)
LineSymbolizer(const Color& pen,double width=1.0)
: SymbolizerImpl(),
pen_(pen) {}
pen_(pen),
width_(width) {}
LineSymbolizer(const Color& pen,double minScale,double maxScale)
LineSymbolizer(const Color& pen,double minScale,double maxScale,double width=1.0)
: SymbolizerImpl(minScale,maxScale),
pen_(pen) {}
pen_(pen),
width_(width) {}
void render(const geometry_type& geom, Image32& image) const
void render(geometry_type& geom, Image32& image) const
{
LineRasterizerAA<Image32> rasterizer(image);
rasterizer.render<SHIFT0>(geom,pen_);
if (1) //width_ == 1.0)
{
//typedef agg::renderer_outline_aa<ren_base> renderer_oaa;
//typedef agg::rasterizer_outline_aa<renderer_oaa> rasterizer_outline_aa;
//agg::line_profile_aa prof;
//prof.width(1.0);
//renderer_oaa ren_oaa(renb, prof);
//rasterizer_outline_aa ras_oaa(ren_oaa);
//ren_oaa.color(agg::rgba(r, g, b));
//ras_oaa.add_path(geom);
LineRasterizerAA<Image32> rasterizer(image);
rasterizer.render<SHIFT0>(geom,pen_);
}
else
{
//typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base;
//agg::row_ptr_cache<agg::int8u> buf(image.raw_data(),image.width(),image.height(),image.width()*4);
//agg::pixfmt_rgba32 pixf(buf);
//ren_base renb(pixf);
//double r=pen_.red()/255.0;
//double g=pen_.green()/255.0;
//double b=pen_.blue()/255.0;
//typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
//renderer ren(renb);
//ren.color(agg::rgba(r, g, b));
//agg::rasterizer_scanline_aa<> ras;
//agg::scanline_p8 sl;
//agg::conv_adaptor_vcgen<geometry<vertex2d,vertex_vector>,
// agg::vcgen_stroke,agg::null_markers> stroke(geom);
//stroke.generator().line_join(agg::round_join);
//stroke.generator().line_cap(agg::round_cap);
//stroke.generator().miter_limit(2.0);
//stroke.generator().width(width_);
//ScanlineRasterizerAA<Image32> rasterizer(image);
//rasterizer.render<agg::conv_adaptor_vcgen<geometry<vertex2d,vertex_vector>,
// agg::vcgen_stroke,agg::null_markers> >(stroke,pen_);
//ras.add_path(stroke);
//agg::render_scanlines(ras, sl, ren);
}
}
private:
LineSymbolizer(const LineSymbolizer&);

144
src/logical.hh Normal file
View file

@ -0,0 +1,144 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id: logical.hh 11 2005-03-16 19:46:18Z artem $
#ifndef LOGICAL_HH
#define LOGICAL_HH
#include "filter.hh"
namespace mapnik
{
template <typename Feature>
struct logical_and : public filter<Feature>
{
logical_and(const filter<Feature>& filter1,filter<Feature>& filter2)
: filter1_(filter1.clone()),
filter2_(filter2.clone()) {}
int type() const
{
return filter<Feature>::LOGICAL_OPS;
}
bool pass(const Feature& feature) const
{
return (filter1_->pass(feature) &&
filter2_->pass(feature));
}
filter<Feature>* clone() const
{
return new logical_and(*filter1_,*filter2_);
}
void accept(filter_visitor<Feature>& v)
{
filter1_->accept(v);
filter2_->accept(v);
v.visit(*this);
}
virtual ~logical_and()
{
delete filter1_;
delete filter2_;
}
private:
filter<Feature>* filter1_;
filter<Feature>* filter2_;
};
template <typename Feature>
struct logical_or : public filter<Feature>
{
logical_or(const filter<Feature>& filter1,filter<Feature>& filter2)
: filter1_(filter1.clone()),
filter2_(filter2.clone()) {}
int type() const
{
return filter<Feature>::LOGICAL_OPS;
}
bool pass(const Feature& feature) const
{
return (filter1_->pass(feature) ||
filter2_->pass(feature));
}
filter<Feature>* clone() const
{
return new logical_or(*filter1_,*filter2_);
}
void accept(filter_visitor<Feature>& v)
{
filter1_->accept(v);
filter2_->accept(v);
v.visit(*this);
}
virtual ~logical_or()
{
delete filter1_;
delete filter2_;
}
private:
filter<Feature>* filter1_;
filter<Feature>* filter2_;
};
template <typename Feature>
struct logical_not : public filter<Feature>
{
logical_not(const filter<Feature>& filter)
: filter_(filter.clone()) {}
int type() const
{
return filter<Feature>::LOGICAL_OPS;
}
bool pass(const Feature& feature) const
{
return !(filter_->pass(feature));
}
filter<Feature>* clone() const
{
return new logical_not(*filter_);
}
void accept(filter_visitor<Feature>& v)
{
filter_->accept(v);
v.visit(*this);
}
~logical_not()
{
delete filter_;
}
private:
filter<Feature>* filter_;
};
}
#endif //LOGICAL_HH

View file

@ -29,6 +29,10 @@
#include "ptr.hh"
#include "factory.hh"
#include "filter.hh"
#include "rule.hh"
#include "spatial.hh"
#include "logical.hh"
#include "comparison.hh"
#include "utils.hh"
#include "style.hh"
#include "symbolizer.hh"

View file

@ -21,7 +21,6 @@
#ifndef POLYGON_SYMBOLIZER_HH
#define POLYGON_SYMBOLIZER_HH
#include "symbolizer.hh"
#include "scanline_aa.hh"
#include "line_aa.hh"
@ -44,7 +43,7 @@ namespace mapnik
virtual ~PolygonSymbolizer() {}
void render(const geometry_type& geom,Image32& image) const
void render(geometry_type& geom,Image32& image) const
{
ScanlineRasterizerAA<Image32> rasterizer(image);
rasterizer.render<SHIFT8>(geom,fill_);
@ -72,7 +71,7 @@ namespace mapnik
fill_(fill),
stroke_(stroke) {}
void render(const geometry_type& geom,Image32& image) const
void render(geometry_type& geom,Image32& image) const
{
ScanlineRasterizerAA<Image32> rasterizer1(image);
rasterizer1.render<SHIFT8>(geom,fill_);

View file

@ -3,5 +3,5 @@ postgis_la_SOURCES = resultset.hh connection.hh connection_manager.hh postgis.cc
postgis_la_LIBDADD =
postgis_la_LDFLAGS = -module -version-info 0:0:0 $(POSTGRESQL_LIBS) -lpthread
INCLUDES = -I ../ $(POSTGRESQL_CFLAGS)
postgis_la_CXXFLAGS = -I$(top_srcdir)/src
postgis_la_CXXFLAGS += $(POSTGRESQL_CFLAGS)

View file

@ -58,7 +58,7 @@ am__installdirs = "$(DESTDIR)$(pluginsdir)"
pluginsLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(plugins_LTLIBRARIES)
postgis_la_LIBADD =
am_postgis_la_OBJECTS = postgis.lo postgisfs.lo
am_postgis_la_OBJECTS = postgis_la-postgis.lo postgis_la-postgisfs.lo
postgis_la_OBJECTS = $(am_postgis_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -200,7 +200,7 @@ plugins_LTLIBRARIES = postgis.la
postgis_la_SOURCES = resultset.hh connection.hh connection_manager.hh postgis.cc postgisfs.cc postgis.hh
postgis_la_LIBDADD =
postgis_la_LDFLAGS = -module -version-info 0:0:0 $(POSTGRESQL_LIBS) -lpthread
INCLUDES = -I ../ $(POSTGRESQL_CFLAGS)
postgis_la_CXXFLAGS = -I$(top_srcdir)/src $(POSTGRESQL_CFLAGS)
all: all-am
.SUFFIXES:
@ -270,8 +270,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postgis.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postgisfs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postgis_la-postgis.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postgis_la-postgisfs.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@ -294,6 +294,20 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
postgis_la-postgis.lo: postgis.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(postgis_la_CXXFLAGS) $(CXXFLAGS) -MT postgis_la-postgis.lo -MD -MP -MF "$(DEPDIR)/postgis_la-postgis.Tpo" -c -o postgis_la-postgis.lo `test -f 'postgis.cc' || echo '$(srcdir)/'`postgis.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/postgis_la-postgis.Tpo" "$(DEPDIR)/postgis_la-postgis.Plo"; else rm -f "$(DEPDIR)/postgis_la-postgis.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='postgis.cc' object='postgis_la-postgis.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(postgis_la_CXXFLAGS) $(CXXFLAGS) -c -o postgis_la-postgis.lo `test -f 'postgis.cc' || echo '$(srcdir)/'`postgis.cc
postgis_la-postgisfs.lo: postgisfs.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(postgis_la_CXXFLAGS) $(CXXFLAGS) -MT postgis_la-postgisfs.lo -MD -MP -MF "$(DEPDIR)/postgis_la-postgisfs.Tpo" -c -o postgis_la-postgisfs.lo `test -f 'postgisfs.cc' || echo '$(srcdir)/'`postgisfs.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/postgis_la-postgisfs.Tpo" "$(DEPDIR)/postgis_la-postgisfs.Plo"; else rm -f "$(DEPDIR)/postgis_la-postgisfs.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='postgisfs.cc' object='postgis_la-postgisfs.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(postgis_la_CXXFLAGS) $(CXXFLAGS) -c -o postgis_la-postgisfs.lo `test -f 'postgisfs.cc' || echo '$(srcdir)/'`postgisfs.cc
mostlyclean-libtool:
-rm -f *.lo

View file

@ -36,7 +36,8 @@ PostgisDatasource::PostgisDatasource(const Parameters& params)
creator_(params.get("host"),
params.get("dbname"),
params.get("user"),
params.get("pass"))
params.get("pass")),
type_(0)
{
@ -73,10 +74,25 @@ PostgisDatasource::PostgisDatasource(const Parameters& params)
type_=datasource::Line;
else if (postgisType=="POLYGON" || postgisType=="MULTIPOLYGON")
type_=datasource::Polygon;
else
type_=0;
rs->close();
}
rs->close();
s.str("");
s << "select xmin(ext),ymin(ext),xmax(ext),ymax(ext)";
s << " from (select estimated_extent('"<<table_name<<"','"<<geometryColumn_<<"') as ext) as tmp";
std::cout<<s.str()<<"\n";
rs=conn->executeQuery(s.str());
if (rs->next())
{
double lox,loy,hix,hiy;
fromString(rs->getValue(0),lox);
fromString(rs->getValue(1),loy);
fromString(rs->getValue(2),hix);
fromString(rs->getValue(3),hiy);
extent_.init(lox,loy,hix,hiy);
std::cout<<extent_<<"\n";
}
rs->close();
}
}
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id: ptr.hh 58 2004-10-31 16:21:26Z artem $
//$Id$
#ifndef PTR_HH
#define PTR_HH
@ -31,76 +31,77 @@ namespace mapnik
delete p;
}
};
template <typename T,
template <typename T> class DeallocPolicy=DefaultDeletePolicy>
class ref_ptr
template <typename T> class DeallocPolicy=DefaultDeletePolicy>
class ref_ptr
{
private:
T* ptr_;
int* pCount_;
public:
T* operator->() {return ptr_;}
const T* operator->() const {return ptr_;}
T* get() {return ptr_;}
const T* get() const {return ptr_;}
const T& operator *() const {return *ptr_;}
explicit ref_ptr(T* ptr=0)
:ptr_(ptr),pCount_(new int(1)) {}
ref_ptr(const ref_ptr& rhs)
:ptr_(rhs.ptr_),pCount_(rhs.pCount_)
{
(*pCount_)++;
}
ref_ptr& operator=(const ref_ptr& rhs)
{
if (ptr_==rhs.ptr_) return *this;
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
ptr_=rhs.ptr_;
pCount_=rhs.pCount_;
(*pCount_)++;
return *this;
}
bool operator !() const
{
return ptr_==0;
}
operator bool () const
{
return ptr_!=0;
}
inline friend bool operator==(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_==rhs;
}
inline friend bool operator==(const T* lhs,
const ref_ptr& rhs)
{
return lhs==rhs.ptr_;
}
inline friend bool operator!=(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_!=rhs;
}
inline friend bool operator!=(const T* lhs,
const ref_ptr& rhs)
{
return lhs!=rhs.ptr_;
}
~ref_ptr()
{
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
}
private:
T* ptr_;
int* pCount_;
public:
T* operator->() {return ptr_;}
const T* operator->() const {return ptr_;}
T* get() {return ptr_;}
const T* get() const {return ptr_;}
const T& operator *() const {return *ptr_;}
T& operator *() {return *ptr_;}
explicit ref_ptr(T* ptr=0)
:ptr_(ptr),pCount_(new int(1)) {}
ref_ptr(const ref_ptr& rhs)
:ptr_(rhs.ptr_),pCount_(rhs.pCount_)
{
(*pCount_)++;
}
ref_ptr& operator=(const ref_ptr& rhs)
{
if (ptr_==rhs.ptr_) return *this;
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
ptr_=rhs.ptr_;
pCount_=rhs.pCount_;
(*pCount_)++;
return *this;
}
bool operator !() const
{
return ptr_==0;
}
operator bool () const
{
return ptr_!=0;
}
inline friend bool operator==(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_==rhs;
}
inline friend bool operator==(const T* lhs,
const ref_ptr& rhs)
{
return lhs==rhs.ptr_;
}
inline friend bool operator!=(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_!=rhs;
}
inline friend bool operator!=(const T* lhs,
const ref_ptr& rhs)
{
return lhs!=rhs.ptr_;
}
~ref_ptr()
{
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
}
};
}
#endif //PTR_HH

View file

@ -4,5 +4,5 @@ raster_la_SOURCES = raster_datasource.hh raster_featureset.hh raster_info.hh ras
raster_la_LIBDADD =
raster_la_LDFLAGS = -module -version-info 0:0:0 -lpthread
INCLUDES = -I ../
raster_la_CXXFLAGS = -I$(top_srcdir)/src

View file

@ -58,8 +58,8 @@ am__installdirs = "$(DESTDIR)$(pluginsdir)"
pluginsLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(plugins_LTLIBRARIES)
raster_la_LIBADD =
am_raster_la_OBJECTS = raster_datasource.lo raster_featureset.lo \
raster_info.lo
am_raster_la_OBJECTS = raster_la-raster_datasource.lo \
raster_la-raster_featureset.lo raster_la-raster_info.lo
raster_la_OBJECTS = $(am_raster_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -201,7 +201,7 @@ plugins_LTLIBRARIES = raster.la
raster_la_SOURCES = raster_datasource.hh raster_featureset.hh raster_info.hh raster_datasource.cc raster_featureset.cc raster_info.cc
raster_la_LIBDADD =
raster_la_LDFLAGS = -module -version-info 0:0:0 -lpthread
INCLUDES = -I ../
raster_la_CXXFLAGS = -I$(top_srcdir)/src
all: all-am
.SUFFIXES:
@ -271,9 +271,9 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_datasource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_info.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_la-raster_datasource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_la-raster_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raster_la-raster_info.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@ -296,6 +296,27 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
raster_la-raster_datasource.lo: raster_datasource.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -MT raster_la-raster_datasource.lo -MD -MP -MF "$(DEPDIR)/raster_la-raster_datasource.Tpo" -c -o raster_la-raster_datasource.lo `test -f 'raster_datasource.cc' || echo '$(srcdir)/'`raster_datasource.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/raster_la-raster_datasource.Tpo" "$(DEPDIR)/raster_la-raster_datasource.Plo"; else rm -f "$(DEPDIR)/raster_la-raster_datasource.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='raster_datasource.cc' object='raster_la-raster_datasource.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -c -o raster_la-raster_datasource.lo `test -f 'raster_datasource.cc' || echo '$(srcdir)/'`raster_datasource.cc
raster_la-raster_featureset.lo: raster_featureset.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -MT raster_la-raster_featureset.lo -MD -MP -MF "$(DEPDIR)/raster_la-raster_featureset.Tpo" -c -o raster_la-raster_featureset.lo `test -f 'raster_featureset.cc' || echo '$(srcdir)/'`raster_featureset.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/raster_la-raster_featureset.Tpo" "$(DEPDIR)/raster_la-raster_featureset.Plo"; else rm -f "$(DEPDIR)/raster_la-raster_featureset.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='raster_featureset.cc' object='raster_la-raster_featureset.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -c -o raster_la-raster_featureset.lo `test -f 'raster_featureset.cc' || echo '$(srcdir)/'`raster_featureset.cc
raster_la-raster_info.lo: raster_info.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -MT raster_la-raster_info.lo -MD -MP -MF "$(DEPDIR)/raster_la-raster_info.Tpo" -c -o raster_la-raster_info.lo `test -f 'raster_info.cc' || echo '$(srcdir)/'`raster_info.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/raster_la-raster_info.Tpo" "$(DEPDIR)/raster_la-raster_info.Plo"; else rm -f "$(DEPDIR)/raster_la-raster_info.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='raster_info.cc' object='raster_la-raster_info.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(raster_la_CXXFLAGS) $(CXXFLAGS) -c -o raster_la-raster_info.lo `test -f 'raster_info.cc' || echo '$(srcdir)/'`raster_info.cc
mostlyclean-libtool:
-rm -f *.lo

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id: render.cc 67 2004-11-23 10:04:32Z artem $
//$Id$
#include <algorithm>
#include <cmath>
@ -71,7 +71,6 @@ namespace mapnik
}
}
if (l.isSelectable())
{
volatile style_cache* styles=style_cache::instance();

150
src/rule.hh Normal file
View file

@ -0,0 +1,150 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef RULE_HH
#define RULE_HH
#include "symbolizer.hh"
#include "filter.hh"
#include <ptr.hh>
#include <string>
#include <vector>
namespace mapnik
{
typedef ref_ptr<Symbolizer> symbolizer_ptr;
typedef std::vector<symbolizer_ptr> symbolizers;
template <typename Feature,template <typename> class Filter>
class rule
{
typedef Filter<Feature> filter_type;
typedef ref_ptr<filter_type> filter_ptr;
private:
std::string name_;
std::string title_;
std::string abstract_;
double min_scale_;
double max_scale_;
symbolizers syms_;
filter_ptr filter_;
bool else_filter_;
public:
rule()
: name_(),
title_(),
abstract_(),
min_scale_(0),
max_scale_(std::numeric_limits<double>::infinity()),
syms_(),
filter_(new null_filter<Feature>),
else_filter_(false) {}
rule(const std::string& name,const std::string& title)
: name_(name),
title_(title),
abstract_(),
min_scale_(0),
max_scale_(std::numeric_limits<double>::infinity()),
syms_(),
filter_(new null_filter<Feature>),
else_filter_(false) {}
rule(const std::string& name,const std::string& title,
double min_scale_denominator,double max_scale_denominator)
: name_(name),
title_(title),
min_scale_(min_scale_denominator),
max_scale_(max_scale_denominator),
syms_(),
filter_(new null_filter<Feature>),
else_filter_(false) {}
rule(const rule& rhs)
: name_(rhs.name_),
title_(rhs.title_),
abstract_(rhs.abstract_),
min_scale_(rhs.min_scale_),
max_scale_(rhs.max_scale_),
syms_(rhs.syms_),
filter_(rhs.filter_),
else_filter_(rhs.else_filter_) {}
rule& operator=(rule const& rhs)
{
rule tmp(rhs);
swap(tmp);
return *this;
}
void abstract(const std::string& abstract)
{
abstract_=abstract;
}
const std::string& abstract() const
{
return abstract_;
}
void add(const symbolizer_ptr& symbol)
{
syms_.push_back(symbol);
}
const symbolizers& get_symbolizers() const
{
return syms_;
}
void set_filter(const filter_ptr& filter)
{
filter_=filter;
}
const filter_ptr& get_filter() const
{
return filter_;
}
void set_else(bool else_filter)
{
else_filter_=else_filter;
}
bool has_else_filter() const
{
return else_filter_;
}
private:
void swap(rule& rhs) throw()
{
title_=rhs.title_;
abstract_=rhs.abstract_;
min_scale_=rhs.min_scale_;
max_scale_=rhs.max_scale_;
syms_=rhs.syms_;
filter_=rhs.filter_;
else_filter_=rhs.else_filter_;
}
};
}
#endif //RULE_HH

View file

@ -23,7 +23,7 @@
// rasterizing algorithm to work with my library, but render_line and
// render_hline remain intact.
//$Id: scanline_aa.cc 60 2004-11-04 09:40:49Z artem $
//$Id$
#include "scanline_aa.hh"
@ -578,14 +578,13 @@ namespace mapnik
}
}
}
template <typename PixBuffer>
inline void ScanlineRasterizerAA<PixBuffer>::blend_hline(int x0,int len,int y,const unsigned char* covers,
unsigned rgba)
{
if (y<0) return;
if (y>pixbuf_->height()-1) return;
if(x0<0)
{
len -= 0 - x0;
@ -605,6 +604,8 @@ namespace mapnik
}
}
template <typename PixBuffer>
inline void ScanlineRasterizerAA<PixBuffer>::render_hline(int x0,int x1,int y,unsigned rgba)
{

View file

@ -24,7 +24,7 @@
// render_hline remain intact.
//$Id: scanline_aa.hh 60 2004-11-04 09:40:49Z artem $
//$Id$
#ifndef SCANLINE_AA_HH
#define SCANLINE_AA_HH

View file

@ -4,5 +4,5 @@ shape_la_SOURCES = dbffile.cc shape.cc shape_io.cc shape_featureset.cc shape_ind
shape_la_LIBDADD =
shape_la_LDFLAGS = -module -version-info 0:0:0 -lpthread
INCLUDES = -I ../
shape_la_CXXFLAGS = -I$(top_srcdir)/src

View file

@ -58,9 +58,10 @@ am__installdirs = "$(DESTDIR)$(pluginsdir)"
pluginsLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(plugins_LTLIBRARIES)
shape_la_LIBADD =
am_shape_la_OBJECTS = dbffile.lo shape.lo shape_io.lo \
shape_featureset.lo shapefile.lo shp_index.lo dbf_test.lo \
shape_index_featureset.lo
am_shape_la_OBJECTS = shape_la-dbffile.lo shape_la-shape.lo \
shape_la-shape_io.lo shape_la-shape_featureset.lo \
shape_la-shapefile.lo shape_la-shp_index.lo \
shape_la-dbf_test.lo shape_la-shape_index_featureset.lo
shape_la_OBJECTS = $(am_shape_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -202,7 +203,7 @@ plugins_LTLIBRARIES = shape.la
shape_la_SOURCES = dbffile.cc shape.cc shape_io.cc shape_featureset.cc shape_index_featureset.hh dbffile.hh shapefile.cc shape_featureset.hh shape_io.hh shp_index.cc dbf_test.cc shapefile.hh shape.hh shape_index_featureset.cc shp_index.hh
shape_la_LIBDADD =
shape_la_LDFLAGS = -module -version-info 0:0:0 -lpthread
INCLUDES = -I ../
shape_la_CXXFLAGS = -I$(top_srcdir)/src
all: all-am
.SUFFIXES:
@ -272,14 +273,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbf_test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbffile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_index_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapefile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shp_index.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-dbf_test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-dbffile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shape.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shape_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shape_index_featureset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shape_io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shapefile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_la-shp_index.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@ -302,6 +303,62 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
shape_la-dbffile.lo: dbffile.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-dbffile.lo -MD -MP -MF "$(DEPDIR)/shape_la-dbffile.Tpo" -c -o shape_la-dbffile.lo `test -f 'dbffile.cc' || echo '$(srcdir)/'`dbffile.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-dbffile.Tpo" "$(DEPDIR)/shape_la-dbffile.Plo"; else rm -f "$(DEPDIR)/shape_la-dbffile.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dbffile.cc' object='shape_la-dbffile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-dbffile.lo `test -f 'dbffile.cc' || echo '$(srcdir)/'`dbffile.cc
shape_la-shape.lo: shape.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shape.lo -MD -MP -MF "$(DEPDIR)/shape_la-shape.Tpo" -c -o shape_la-shape.lo `test -f 'shape.cc' || echo '$(srcdir)/'`shape.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shape.Tpo" "$(DEPDIR)/shape_la-shape.Plo"; else rm -f "$(DEPDIR)/shape_la-shape.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shape.cc' object='shape_la-shape.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shape.lo `test -f 'shape.cc' || echo '$(srcdir)/'`shape.cc
shape_la-shape_io.lo: shape_io.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shape_io.lo -MD -MP -MF "$(DEPDIR)/shape_la-shape_io.Tpo" -c -o shape_la-shape_io.lo `test -f 'shape_io.cc' || echo '$(srcdir)/'`shape_io.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shape_io.Tpo" "$(DEPDIR)/shape_la-shape_io.Plo"; else rm -f "$(DEPDIR)/shape_la-shape_io.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shape_io.cc' object='shape_la-shape_io.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shape_io.lo `test -f 'shape_io.cc' || echo '$(srcdir)/'`shape_io.cc
shape_la-shape_featureset.lo: shape_featureset.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shape_featureset.lo -MD -MP -MF "$(DEPDIR)/shape_la-shape_featureset.Tpo" -c -o shape_la-shape_featureset.lo `test -f 'shape_featureset.cc' || echo '$(srcdir)/'`shape_featureset.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shape_featureset.Tpo" "$(DEPDIR)/shape_la-shape_featureset.Plo"; else rm -f "$(DEPDIR)/shape_la-shape_featureset.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shape_featureset.cc' object='shape_la-shape_featureset.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shape_featureset.lo `test -f 'shape_featureset.cc' || echo '$(srcdir)/'`shape_featureset.cc
shape_la-shapefile.lo: shapefile.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shapefile.lo -MD -MP -MF "$(DEPDIR)/shape_la-shapefile.Tpo" -c -o shape_la-shapefile.lo `test -f 'shapefile.cc' || echo '$(srcdir)/'`shapefile.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shapefile.Tpo" "$(DEPDIR)/shape_la-shapefile.Plo"; else rm -f "$(DEPDIR)/shape_la-shapefile.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shapefile.cc' object='shape_la-shapefile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shapefile.lo `test -f 'shapefile.cc' || echo '$(srcdir)/'`shapefile.cc
shape_la-shp_index.lo: shp_index.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shp_index.lo -MD -MP -MF "$(DEPDIR)/shape_la-shp_index.Tpo" -c -o shape_la-shp_index.lo `test -f 'shp_index.cc' || echo '$(srcdir)/'`shp_index.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shp_index.Tpo" "$(DEPDIR)/shape_la-shp_index.Plo"; else rm -f "$(DEPDIR)/shape_la-shp_index.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shp_index.cc' object='shape_la-shp_index.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shp_index.lo `test -f 'shp_index.cc' || echo '$(srcdir)/'`shp_index.cc
shape_la-dbf_test.lo: dbf_test.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-dbf_test.lo -MD -MP -MF "$(DEPDIR)/shape_la-dbf_test.Tpo" -c -o shape_la-dbf_test.lo `test -f 'dbf_test.cc' || echo '$(srcdir)/'`dbf_test.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-dbf_test.Tpo" "$(DEPDIR)/shape_la-dbf_test.Plo"; else rm -f "$(DEPDIR)/shape_la-dbf_test.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dbf_test.cc' object='shape_la-dbf_test.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-dbf_test.lo `test -f 'dbf_test.cc' || echo '$(srcdir)/'`dbf_test.cc
shape_la-shape_index_featureset.lo: shape_index_featureset.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -MT shape_la-shape_index_featureset.lo -MD -MP -MF "$(DEPDIR)/shape_la-shape_index_featureset.Tpo" -c -o shape_la-shape_index_featureset.lo `test -f 'shape_index_featureset.cc' || echo '$(srcdir)/'`shape_index_featureset.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/shape_la-shape_index_featureset.Tpo" "$(DEPDIR)/shape_la-shape_index_featureset.Plo"; else rm -f "$(DEPDIR)/shape_la-shape_index_featureset.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shape_index_featureset.cc' object='shape_la-shape_index_featureset.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shape_la_CXXFLAGS) $(CXXFLAGS) -c -o shape_la-shape_index_featureset.lo `test -f 'shape_index_featureset.cc' || echo '$(srcdir)/'`shape_index_featureset.cc
mostlyclean-libtool:
-rm -f *.lo

176
src/spatial.hh Normal file
View file

@ -0,0 +1,176 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef SPATIAL_HH
#define SPATIAL_HH
#include "filter.hh"
namespace mapnik
{
template <typename Feature>
struct equals : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct disjoint : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct touches : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct within : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct overlaps : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct crosses : public filter<Feature>
{
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return false;
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
};
template <typename Feature>
struct bbox : public filter<Feature>
{
private:
Envelope<double> box_;
public:
bbox(const Envelope<double>& box)
: box_(box) {}
int type() const
{
return filter<Feature>::SPATIAL_OPS;
}
bool pass(const Feature& feature) const
{
return box_.contains(feature.get_geometry()->bbox());
}
std::string to_string()
{
return "BBOX filter";
}
filter<Feature>* clone() const
{
return new bbox<Feature>(box_);
}
void accept(const filter_visitor<Feature>& v)
{
v.visit(*this);
}
virtual ~bbox() {}
};
}
#endif //SPATIAL_HH

126
src/stroke.hh Normal file
View file

@ -0,0 +1,126 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef STROKE_HH
#define STROKE_HH
#include "color.hh"
namespace mapnik
{
enum line_cap_e
{
BUTT_CAP,
SQUARE_CAP,
ROUND_CAP
};
enum line_join_e
{
MITER_JOIN,
MITER_REVERT_JOIN,
ROUND_JOIN,
BEVEL_JOIN
};
class stroke
{
color c_;
int width_;
float opacity_; // 0.0 - 1.0
line_cap_e line_cap_;
line_join_e line_join_;
public:
stroke()
: c_(),
width_(1),
opacity_(1.0),
line_cap_(BUTT_CAP),
line_join_(MITER_JOIN) {}
stroke(const color& c, int width=1)
: c_(c),
width_(width),
opacity_(1.0),
line_cap_(BUTT_CAP),
line_join_(MITER_JOIN) {}
stroke& operator=(const stroke& rhs)
{
stroke tmp(rhs);
swap(tmp);
return *this;
}
void set_color(const color& c)
{
c_=c;
}
const color& get_color()
{
return c_;
}
void set_opacity(float opacity)
{
if (opacity > 1.0) opacity_=1.0;
else if (opacity < 0.0) opacity_=0.0;
else opacity_=opacity;
}
float get_opacity() const
{
return opacity_;
}
void set_line_cap(line_cap_e line_cap)
{
line_cap_=line_cap;
}
line_cap_e get_line_cap() const
{
return line_cap_;
}
void set_line_join(line_join_e line_join)
{
line_join_=line_join;
}
line_join_e get_line_join() const
{
return line_join_;
}
private:
void swap(const stroke& other) throw()
{
c_=other.c_;
width_=other.width_;
opacity_=other.opacity_;
line_cap_=other.line_cap_;
line_join_=other.line_join_;
}
};
}
#endif //STROKE_HH

View file

@ -30,9 +30,9 @@ namespace mapnik
class Image32;
struct Symbolizer
{
virtual bool active(double scale) const=0;
virtual void render(const geometry_type& geom, Image32& image) const=0;
virtual ~Symbolizer() {}
virtual bool active(double scale) const=0;
virtual void render(geometry_type& geom, Image32& image) const=0;
virtual ~Symbolizer() {}
};
struct SymbolizerImpl : public Symbolizer

View file

@ -92,7 +92,15 @@ namespace mapnik
*vertex = y;
++pos_;
}
unsigned get_vertex(unsigned pos,value_type* x,value_type* y) const
{
if (pos >= pos_) return SEG_END;
unsigned block = pos >> block_shift;
const value_type* vertex = vertexs_[block] + (( pos & block_mask) << 1);
*x = (*vertex++);
*y = (*vertex);
return commands_[block] [pos & block_mask];
}
unsigned get_at(unsigned pos,value_type& x,value_type& y) const
{
if (pos >= pos_) return SEG_END;

View file

@ -1,7 +1,7 @@
bin_PROGRAMS = shapeindex
shapeindex_SOURCES = quadtree.cc quadtree.hh shapeindex.cc
shapeindex_CXXFLAGS = -I../../src -I../../src/shape
SHAPELIB = ../../src/shape/.libs/shape.a
MAPNIKLIB = ../../src/.libs/libmapnik.a
shapeindex_CXXFLAGS = -I$(srcdir)/../../src -I$(srcdir)/../../src/shape
SHAPELIB = ../../src/shape/.libs/shape.a
MAPNIKLIB = ../../src/.libs/libmapnik.a
shapeindex_LDADD = $(SHAPELIB) $(MAPNIKLIB)
shapeindex_LDFLAGS =

View file

@ -158,9 +158,9 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
shapeindex_SOURCES = quadtree.cc quadtree.hh shapeindex.cc
shapeindex_CXXFLAGS = -I../../src -I../../src/shape
shapeindex_CXXFLAGS = -I$(srcdir)/../../src -I$(srcdir)/../../src/shape
SHAPELIB = ../../src/shape/.libs/shape.a
MAPNIKLIB = ../../src/.libs/libmapnik.a
MAPNIKLIB = ../../src/.libs/libmapnik.a
shapeindex_LDADD = $(SHAPELIB) $(MAPNIKLIB)
shapeindex_LDFLAGS =
all: config.hh

View file

@ -150,14 +150,25 @@ int main (int argc,char** argv) {
shp.skip(4);
Envelope<double> item_ext;
if (shape_type==shape_io::shape_point) {
coord2d c(0,0);
shp.read_coord(c);
if (shape_type==shape_io::shape_point)
{
double x=shp.read_double();
double y=shp.read_double();
shp.skip(2*content_length-2*8-4);
item_ext=Envelope<double>(c.x,c.y,c.x,c.y);
item_ext=Envelope<double>(x,y,x,y);
} else {
}
else if (shape_type==shape_io::shape_pointz)
{
double x=shp.read_double();
double y=shp.read_double();
double z=shp.read_double();
shp.skip(2*content_length-2*8-4);
item_ext=Envelope<double>(x,y,x,y);
}
else
{
shp.read_envelope(item_ext);
shp.skip(2*content_length-4*8-4);