started refactoring and added sld
This commit is contained in:
parent
e9d5d65864
commit
4825baa5b6
32 changed files with 578 additions and 617 deletions
|
@ -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 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
|
||||
nobase_include_HEADERS = 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 query.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.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.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 colorcube.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
|
||||
libmapnik_la_SOURCES = 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 query.hh factory.hh 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.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 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 colorcube.hh
|
||||
|
||||
if BUILD_TIFF_READER
|
||||
libmapnik_la_SOURCES += tiff_reader.cc
|
||||
|
|
103
src/Makefile.in
103
src/Makefile.in
|
@ -63,40 +63,35 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
|
|||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libmapnik_la_DEPENDENCIES =
|
||||
am__libmapnik_la_SOURCES_DIST = 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 \
|
||||
am__libmapnik_la_SOURCES_DIST = 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 query.hh factory.hh 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 \
|
||||
image_symbolizer.hh pool.hh ptr.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 \
|
||||
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
|
||||
attribute_collector.hh colorcube.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 \
|
||||
libmapnik_la-envelope.lo libmapnik_la-feature.lo \
|
||||
am_libmapnik_la_OBJECTS = libmapnik_la-color.lo \
|
||||
libmapnik_la-datasource_cache.lo libmapnik_la-envelope.lo \
|
||||
libmapnik_la-graphics.lo libmapnik_la-image_reader.lo \
|
||||
libmapnik_la-image_util.lo libmapnik_la-layer.lo \
|
||||
libmapnik_la-line_aa.lo libmapnik_la-map.lo \
|
||||
libmapnik_la-memory.lo libmapnik_la-params.lo \
|
||||
libmapnik_la-plugin.lo libmapnik_la-png_reader.lo \
|
||||
libmapnik_la-raster.lo libmapnik_la-raster_feature.lo \
|
||||
libmapnik_la-render.lo libmapnik_la-scanline_aa.lo \
|
||||
libmapnik_la-scanline.lo libmapnik_la-style.lo \
|
||||
libmapnik_la-style_cache.lo libmapnik_la-text.lo \
|
||||
libmapnik_la-vector_feature.lo libmapnik_la-wkb.lo \
|
||||
$(am__objects_1)
|
||||
libmapnik_la-wkb.lo $(am__objects_1)
|
||||
libmapnik_la_OBJECTS = $(am_libmapnik_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
|
@ -244,26 +239,24 @@ 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 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 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 \
|
||||
nobase_include_HEADERS = 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 query.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.hh render.hh scanline_aa.hh scanline.hh style.hh style_cache.hh style_factory.hh symbolizer.hh text.hh utils.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 colorcube.hh
|
||||
libmapnik_la_SOURCES = 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 query.hh factory.hh 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.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 \
|
||||
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 $(am__append_1)
|
||||
attribute_collector.hh colorcube.hh $(am__append_1)
|
||||
libmapnik_la_CPPFLAGS = $(FREETYPE2_CFLAGS) @INCLTDL@
|
||||
libmapnik_la_LIBADD = @LIBLTDL@ -lpthread -lpng -ljpeg $(FREETYPE2_LIBS) -lz -lm
|
||||
libmapnik_la_LDFLAGS = -version-info 0:0:0 $(TIFF_LDFLAGS)
|
||||
|
@ -358,11 +351,9 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-attribute_container.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-color.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-datasource_cache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-envelope.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-feature.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-graphics.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-image_reader.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-image_util.Plo@am__quote@
|
||||
|
@ -373,8 +364,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-params.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-plugin.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-png_reader.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-raster.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-raster_feature.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-render.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-scanline.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-scanline_aa.Plo@am__quote@
|
||||
|
@ -382,7 +371,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-style_cache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-text.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-tiff_reader.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-vector_feature.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmapnik_la-wkb.Plo@am__quote@
|
||||
|
||||
.cc.o:
|
||||
|
@ -406,13 +394,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
libmapnik_la-attribute_container.lo: attribute_container.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-attribute_container.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-attribute_container.Tpo" -c -o libmapnik_la-attribute_container.lo `test -f 'attribute_container.cc' || echo '$(srcdir)/'`attribute_container.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-attribute_container.Tpo" "$(DEPDIR)/libmapnik_la-attribute_container.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-attribute_container.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='attribute_container.cc' object='libmapnik_la-attribute_container.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) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-attribute_container.lo `test -f 'attribute_container.cc' || echo '$(srcdir)/'`attribute_container.cc
|
||||
|
||||
libmapnik_la-color.lo: color.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-color.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-color.Tpo" -c -o libmapnik_la-color.lo `test -f 'color.cc' || echo '$(srcdir)/'`color.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-color.Tpo" "$(DEPDIR)/libmapnik_la-color.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-color.Tpo"; exit 1; fi
|
||||
|
@ -434,13 +415,6 @@ libmapnik_la-envelope.lo: envelope.cc
|
|||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-envelope.lo `test -f 'envelope.cc' || echo '$(srcdir)/'`envelope.cc
|
||||
|
||||
libmapnik_la-feature.lo: feature.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-feature.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-feature.Tpo" -c -o libmapnik_la-feature.lo `test -f 'feature.cc' || echo '$(srcdir)/'`feature.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-feature.Tpo" "$(DEPDIR)/libmapnik_la-feature.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-feature.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='feature.cc' object='libmapnik_la-feature.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) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-feature.lo `test -f 'feature.cc' || echo '$(srcdir)/'`feature.cc
|
||||
|
||||
libmapnik_la-graphics.lo: graphics.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-graphics.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-graphics.Tpo" -c -o libmapnik_la-graphics.lo `test -f 'graphics.cc' || echo '$(srcdir)/'`graphics.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-graphics.Tpo" "$(DEPDIR)/libmapnik_la-graphics.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-graphics.Tpo"; exit 1; fi
|
||||
|
@ -511,20 +485,6 @@ libmapnik_la-png_reader.lo: png_reader.cc
|
|||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-png_reader.lo `test -f 'png_reader.cc' || echo '$(srcdir)/'`png_reader.cc
|
||||
|
||||
libmapnik_la-raster.lo: raster.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-raster.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-raster.Tpo" -c -o libmapnik_la-raster.lo `test -f 'raster.cc' || echo '$(srcdir)/'`raster.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-raster.Tpo" "$(DEPDIR)/libmapnik_la-raster.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-raster.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='raster.cc' object='libmapnik_la-raster.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) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-raster.lo `test -f 'raster.cc' || echo '$(srcdir)/'`raster.cc
|
||||
|
||||
libmapnik_la-raster_feature.lo: raster_feature.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-raster_feature.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-raster_feature.Tpo" -c -o libmapnik_la-raster_feature.lo `test -f 'raster_feature.cc' || echo '$(srcdir)/'`raster_feature.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-raster_feature.Tpo" "$(DEPDIR)/libmapnik_la-raster_feature.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-raster_feature.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='raster_feature.cc' object='libmapnik_la-raster_feature.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) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-raster_feature.lo `test -f 'raster_feature.cc' || echo '$(srcdir)/'`raster_feature.cc
|
||||
|
||||
libmapnik_la-render.lo: render.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-render.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-render.Tpo" -c -o libmapnik_la-render.lo `test -f 'render.cc' || echo '$(srcdir)/'`render.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-render.Tpo" "$(DEPDIR)/libmapnik_la-render.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-render.Tpo"; exit 1; fi
|
||||
|
@ -567,13 +527,6 @@ libmapnik_la-text.lo: text.cc
|
|||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-text.lo `test -f 'text.cc' || echo '$(srcdir)/'`text.cc
|
||||
|
||||
libmapnik_la-vector_feature.lo: vector_feature.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-vector_feature.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-vector_feature.Tpo" -c -o libmapnik_la-vector_feature.lo `test -f 'vector_feature.cc' || echo '$(srcdir)/'`vector_feature.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-vector_feature.Tpo" "$(DEPDIR)/libmapnik_la-vector_feature.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-vector_feature.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vector_feature.cc' object='libmapnik_la-vector_feature.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) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmapnik_la-vector_feature.lo `test -f 'vector_feature.cc' || echo '$(srcdir)/'`vector_feature.cc
|
||||
|
||||
libmapnik_la-wkb.lo: wkb.cc
|
||||
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmapnik_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmapnik_la-wkb.lo -MD -MP -MF "$(DEPDIR)/libmapnik_la-wkb.Tpo" -c -o libmapnik_la-wkb.lo `test -f 'wkb.cc' || echo '$(srcdir)/'`wkb.cc; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmapnik_la-wkb.Tpo" "$(DEPDIR)/libmapnik_la-wkb.Plo"; else rm -f "$(DEPDIR)/libmapnik_la-wkb.Tpo"; exit 1; fi
|
||||
|
|
218
src/attribute.hh
218
src/attribute.hh
|
@ -22,116 +22,178 @@
|
|||
#define ATTRIBUTE_HH
|
||||
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
#include <map>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
class attribute_base
|
||||
{
|
||||
public:
|
||||
virtual std::string to_string() const=0;
|
||||
virtual attribute_base* clone() const=0;
|
||||
virtual ~attribute_base() {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct attribute_traits
|
||||
{
|
||||
static std::string to_string(const T& val)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
return ss.str();
|
||||
}
|
||||
static T default_value()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static std::string to_string(const T& value)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << value;
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct attribute_traits<std::string>
|
||||
{
|
||||
static std::string to_string(const std::string& s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
static std::string default_value()
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T,typename ATraits=attribute_traits<T> >
|
||||
class attribute : public attribute_base
|
||||
{
|
||||
typedef T value_type;
|
||||
private:
|
||||
value_type value_;
|
||||
public:
|
||||
attribute(const T& value)
|
||||
: attribute_base(),
|
||||
value_(value) {}
|
||||
attribute(const attribute& other)
|
||||
: attribute_base(),
|
||||
value_(other.value_) {}
|
||||
attribute& operator=(const attribute& other)
|
||||
static std::string to_string(const std::string& value)
|
||||
{
|
||||
attribute<T> temp(other);
|
||||
swap(temp);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
class attribute
|
||||
{
|
||||
public:
|
||||
attribute()
|
||||
: base_(0) {}
|
||||
|
||||
template <typename T>
|
||||
attribute(const T& value)
|
||||
: base_(new attribute_impl<T>(value))
|
||||
{}
|
||||
|
||||
attribute(const attribute& rhs)
|
||||
: base_(rhs.base_ ? rhs.base_->clone() : 0)
|
||||
{}
|
||||
|
||||
~attribute()
|
||||
{
|
||||
delete base_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
attribute& operator=(const T& rhs)
|
||||
{
|
||||
attribute(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
~attribute()
|
||||
|
||||
attribute& operator=(const attribute& rhs)
|
||||
{
|
||||
attribute(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
attribute<T>* clone() const
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return new attribute<T>(*this);
|
||||
return !base_;
|
||||
}
|
||||
value_type value() const
|
||||
|
||||
const std::type_info & type() const
|
||||
{
|
||||
return base_ ? base_->type() : typeid(void);
|
||||
}
|
||||
|
||||
const std::string to_string() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
std::string to_string() const
|
||||
{
|
||||
return ATraits::to_string(value_);
|
||||
return base_ ? base_->to_string() : "";
|
||||
}
|
||||
private:
|
||||
void swap(attribute<T>& other) throw()
|
||||
attribute& swap(attribute& rhs)
|
||||
{
|
||||
std::swap(value_,other.value_);
|
||||
std::swap(base_,rhs.base_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
struct attribute_base
|
||||
{
|
||||
virtual ~attribute_base() {}
|
||||
virtual attribute_base* clone() const=0;
|
||||
virtual std::string to_string() const=0;
|
||||
virtual const std::type_info& type() const=0;
|
||||
};
|
||||
|
||||
template <typename T,typename ATraits=attribute_traits<T> >
|
||||
class attribute_impl : public attribute_base
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
attribute_impl(const value_type& value)
|
||||
: value_(value) {}
|
||||
|
||||
std::string to_string() const
|
||||
{
|
||||
return ATraits::to_string(value_);
|
||||
}
|
||||
attribute_base* clone() const
|
||||
{
|
||||
return new attribute_impl(value_);
|
||||
}
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(value_);
|
||||
}
|
||||
value_type value_;
|
||||
};
|
||||
template<typename value_type>
|
||||
friend value_type* attribute_cast(attribute*);
|
||||
public:
|
||||
attribute_base* base_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct bad_attribute_cast : public std::bad_cast
|
||||
{
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "attribute::failed conversion";
|
||||
}
|
||||
};
|
||||
|
||||
template <class charT,class traits>
|
||||
inline std::basic_ostream<charT,traits>&
|
||||
operator << (std::basic_ostream<charT,traits>& out,
|
||||
const attribute_base& base)
|
||||
|
||||
template <typename T>
|
||||
bool is_type(const attribute& attr)
|
||||
{
|
||||
std::basic_ostringstream<charT,traits> s;
|
||||
s.copyfmt(out);
|
||||
s.width(0);
|
||||
s<<base.to_string();
|
||||
out << s.str();
|
||||
return out;
|
||||
return attr.type()==typeid(T);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* attribute_cast(attribute* attr)
|
||||
{
|
||||
return attr && attr->type() == typeid(T)
|
||||
? &static_cast<attribute::attribute_impl<T>*>(attr->base_)->value_
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
||||
class invalid_attribute : public attribute<std::string>
|
||||
{
|
||||
public:
|
||||
invalid_attribute()
|
||||
:attribute<std::string>("#INVALID_ATTRIBUTE#") {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
attribute<T> attribute_from_string(const std::string& val)
|
||||
T* attribute_cast(const attribute* attr)
|
||||
{
|
||||
return attribute_cast<T>(const_cast<attribute*>(attr));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T attribute_cast(const attribute& attr)
|
||||
{
|
||||
const T* result=attribute_cast<T>(&attr);
|
||||
if (!result)
|
||||
throw bad_attribute_cast<T>();
|
||||
return *result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T attribute_cast(attribute& attr)
|
||||
{
|
||||
T* result=attribute_cast<T>(&attr);
|
||||
if (!result)
|
||||
throw bad_attribute_cast<T>();
|
||||
return *result;
|
||||
}
|
||||
|
||||
typedef std::map<std::string,attribute> attributes;
|
||||
|
||||
template <typename T>
|
||||
attribute attribute_from_string(const std::string& val)
|
||||
{
|
||||
std::istringstream is(val);
|
||||
T t;
|
||||
is >> t;
|
||||
return attribute<T>(t);
|
||||
}
|
||||
return attribute(t);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //ATTRIBUTE_HH
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/* 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: attribute_container.cc 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#include "attribute_container.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
attribute_container::attribute_container() {}
|
||||
|
||||
attribute_container::~attribute_container()
|
||||
{
|
||||
std::map<std::string,attribute_base*>::iterator itr=attr_.begin();
|
||||
for (;itr!=attr_.end();++itr)
|
||||
{
|
||||
delete itr->second;
|
||||
}
|
||||
}
|
||||
|
||||
void attribute_container::add(const std::string& name,const attribute_base& attr)
|
||||
{
|
||||
attr_.insert(make_pair(name,attr.clone()));
|
||||
}
|
||||
|
||||
const attribute_base& attribute_container::get(const std::string& name) const
|
||||
{
|
||||
std::map<std::string,attribute_base*>::const_iterator itr=attr_.find(name);
|
||||
if (itr!=attr_.end())
|
||||
return *(itr->second);
|
||||
return invalid_;
|
||||
}
|
||||
const invalid_attribute attribute_container::invalid_;
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/* 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: attribute_container.hh 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#ifndef ATTRIBUTE_CONTAINER_HH
|
||||
#define ATTRIBUTE_CONTAINER_HH
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "attribute.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
class attribute_container
|
||||
{
|
||||
private:
|
||||
static const invalid_attribute invalid_;
|
||||
std::map<std::string,attribute_base*> attr_;
|
||||
public:
|
||||
attribute_container();
|
||||
virtual ~attribute_container();
|
||||
void add(const std::string& name,const attribute_base& a);
|
||||
const attribute_base& get(const std::string& name) const;
|
||||
private:
|
||||
attribute_container(const attribute_container&);
|
||||
attribute_container& operator=(const attribute_container&);
|
||||
};
|
||||
}
|
||||
#endif //ATTRIBUTE_CONTAINER
|
91
src/colorcube.hh
Normal file
91
src/colorcube.hh
Normal file
|
@ -0,0 +1,91 @@
|
|||
/* 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$
|
||||
|
||||
#include "mapnik.hh"
|
||||
#include <iostream>
|
||||
|
||||
#ifndef COLORCUBE_HH
|
||||
#define COLORCUBE_HH
|
||||
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
template <int rLevel,int gLevel,int bLevel>
|
||||
struct color_cube
|
||||
{
|
||||
const static unsigned maxcolors=rLevel * gLevel * bLevel + 32;
|
||||
static unsigned cube[maxcolors];
|
||||
static bool initialized;
|
||||
static unsigned rDiv;
|
||||
static unsigned gDiv;
|
||||
static unsigned bDiv;
|
||||
|
||||
static unsigned color(unsigned red,unsigned green,unsigned blue)
|
||||
{
|
||||
if (!initialized)
|
||||
init();
|
||||
unsigned index=rgb_level_index(red/rDiv,green/gDiv,blue/bDiv);
|
||||
return cube[index];
|
||||
}
|
||||
|
||||
private:
|
||||
static unsigned rgb_level_index(unsigned red,unsigned green,unsigned blue)
|
||||
{
|
||||
return (red * gLevel * bLevel + green * bLevel + blue);
|
||||
}
|
||||
|
||||
static void init()
|
||||
{
|
||||
unsigned red,green,blue;
|
||||
unsigned count=0;
|
||||
for (int r=0;r<rLevel;++r)
|
||||
{
|
||||
for (int g=0;g<gLevel;++g)
|
||||
{
|
||||
for (int b=0;b<bLevel;++b)
|
||||
{
|
||||
red = std::min(255,r * (255 /(rLevel - 1)));
|
||||
green = std::min(255,g * (255 /(gLevel - 1)));
|
||||
blue = std::min(255,b * (255 /(bLevel - 1)));
|
||||
|
||||
cube[rgb_level_index(r,g,b)]= (red) | (green<<8) | (blue<<16);
|
||||
//std::cout<<std::hex<<cube[rgb_level_index(r,g,b)]<<std::dec<<"\n";
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<<"number of colours="<<count<<"\n";
|
||||
}
|
||||
};
|
||||
|
||||
//template<int rLevel,int gLevel,int bLevel>
|
||||
//unsigned color_cube<rLevel,gLevel,bLevel>::cube[color_cube<rLevel,gLevel, bLevel>::maxcolors];
|
||||
template<int rLevel,int gLevel,int bLevel>
|
||||
unsigned color_cube<rLevel,gLevel,bLevel>::rDiv=52;
|
||||
template<int rLevel,int gLevel,int bLevel>
|
||||
unsigned color_cube<rLevel,gLevel,bLevel>::gDiv=52;
|
||||
template<int rLevel,int gLevel,int bLevel>
|
||||
unsigned color_cube<rLevel,gLevel,bLevel>::bDiv=52;
|
||||
template<int rLevel,int gLevel,int bLevel>
|
||||
bool color_cube<rLevel,gLevel,bLevel>::initialized=false;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -16,6 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id$
|
||||
|
||||
#ifndef COMPARISON_HH
|
||||
#define COMPARISON_HH
|
||||
|
@ -52,21 +53,19 @@ namespace mapnik
|
|||
|
||||
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;
|
||||
attribute attr=feature.attribute_by_name(name_);
|
||||
bool result=false;
|
||||
try
|
||||
{
|
||||
result=(value_==attribute_cast<T>(attr))?true:false;
|
||||
}
|
||||
catch (bad_attribute_cast<T>& ex)
|
||||
{
|
||||
std::cerr<<ex.what()<<std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
filter<Feature>* clone() const
|
||||
{
|
||||
return new property_is_equal_to(name_,value_);
|
||||
|
@ -76,7 +75,7 @@ namespace mapnik
|
|||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
|
||||
virtual ~property_is_equal_to() {}
|
||||
};
|
||||
|
||||
|
@ -95,18 +94,17 @@ namespace mapnik
|
|||
|
||||
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;
|
||||
attribute attr=feature.attribute_by_name(name_);
|
||||
bool result=false;
|
||||
try
|
||||
{
|
||||
result = (value_ > attribute_cast<T>(attr))?true:false;
|
||||
}
|
||||
catch (bad_attribute_cast<T>& ex)
|
||||
{
|
||||
std::cerr<<ex.what()<<std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
filter<Feature>* clone() const
|
||||
{
|
||||
|
@ -134,26 +132,24 @@ namespace mapnik
|
|||
|
||||
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;
|
||||
}
|
||||
attribute attr=feature.attribute_by_name(name_);
|
||||
bool result=false;
|
||||
try
|
||||
{
|
||||
result=(value_ > attribute_cast<T>(attr))?true:false;
|
||||
}
|
||||
catch (bad_attribute_cast<T>& ex)
|
||||
{
|
||||
std::cerr<<ex.what()<<std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void accept(filter_visitor<Feature>& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename Feature,typename T>
|
||||
struct property_is_between : public property_filter<Feature>
|
||||
{
|
||||
|
@ -173,20 +169,20 @@ namespace mapnik
|
|||
|
||||
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;
|
||||
attribute attr=feature.attribute_by_name(name_);
|
||||
bool result=false;
|
||||
try
|
||||
{
|
||||
T const& a=attribute_cast<T>(attr);
|
||||
result=(lo_value_ < a && a < hi_value_) ? true : false;
|
||||
}
|
||||
catch (bad_attribute_cast<T>& ex)
|
||||
{
|
||||
std::cerr<<ex.what()<<std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
filter<Feature>* clone() const
|
||||
{
|
||||
return new property_is_between(name_,lo_value_,hi_value_);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "ctrans.hh"
|
||||
#include "params.hh"
|
||||
#include "feature.hh"
|
||||
#include "query.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -66,8 +67,7 @@ namespace mapnik
|
|||
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 FeaturesetPtr features(const query& q) const=0;
|
||||
|
||||
virtual const Envelope<double>& envelope() const=0;
|
||||
virtual ~datasource() {};
|
||||
|
@ -75,7 +75,7 @@ namespace mapnik
|
|||
|
||||
typedef std::string datasource_name();
|
||||
typedef datasource* create_ds(const Parameters& params);
|
||||
typedef void destroy_ds(datasource *);
|
||||
typedef void destroy_ds(datasource *ds);
|
||||
|
||||
template <typename DATASOURCE>
|
||||
struct datasource_delete
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* 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: feature.cc 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#include "feature.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
FeatureImpl::FeatureImpl(int id)
|
||||
: id_(id) {}
|
||||
|
||||
FeatureImpl::~FeatureImpl() {}
|
||||
|
||||
int FeatureImpl::id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
void FeatureImpl::add(const std::string& name,const attribute_base& a)
|
||||
{
|
||||
attributes_.add(name,a);
|
||||
}
|
||||
|
||||
const attribute_base& FeatureImpl::get(const std::string& name) const
|
||||
{
|
||||
return attributes_.get(name);
|
||||
}
|
||||
|
||||
const attribute_container& FeatureImpl::attributes() const
|
||||
{
|
||||
return attributes_;
|
||||
}
|
||||
}
|
111
src/feature.hh
111
src/feature.hh
|
@ -16,43 +16,106 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id: feature.hh 58 2004-10-31 16:21:26Z artem $
|
||||
//$Id$
|
||||
|
||||
#ifndef FEATURE_HH
|
||||
#define FEATURE_HH
|
||||
|
||||
#include "geometry.hh"
|
||||
#include "raster.hh"
|
||||
#include "attribute_container.hh"
|
||||
#include "attribute.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
typedef ref_ptr<raster> RasterPtr;
|
||||
|
||||
struct Feature
|
||||
{
|
||||
virtual int id() const=0;
|
||||
virtual bool isRaster() const=0;
|
||||
virtual geometry_ptr& getGeometry()=0;
|
||||
virtual const RasterPtr& getRaster() const=0;
|
||||
virtual void add(const std::string& name,const attribute_base& a)=0;
|
||||
virtual const attribute_base& get(const std::string& name) const=0;
|
||||
virtual const attribute_container& attributes() const=0;
|
||||
virtual ~Feature() {};
|
||||
};
|
||||
|
||||
class FeatureImpl : public Feature
|
||||
typedef ref_ptr<raster> raster_ptr;
|
||||
|
||||
template <typename T1,typename T2>
|
||||
struct feature
|
||||
{
|
||||
public:
|
||||
typedef T1 geometry_type;
|
||||
typedef T2 raster_type;
|
||||
private:
|
||||
int id_;
|
||||
attribute_container attributes_;
|
||||
geometry_type geom_;
|
||||
raster_type raster_;
|
||||
attributes attr_;
|
||||
public:
|
||||
FeatureImpl(int id);
|
||||
virtual ~FeatureImpl();
|
||||
int id () const;
|
||||
void add(const std::string& name,const attribute_base& a);
|
||||
const attribute_base& get(const std::string& name) const;
|
||||
const attribute_container& attributes() const;
|
||||
|
||||
explicit feature(int id)
|
||||
: id_(id),
|
||||
geom_(),
|
||||
raster_() {}
|
||||
|
||||
feature(int id,const geometry_type& geom)
|
||||
: id_(id),
|
||||
geom_(geom),
|
||||
raster_() {}
|
||||
|
||||
feature(const feature<T1,T2>& rhs)
|
||||
: id_(rhs.id_),
|
||||
geom_(rhs.geom_),
|
||||
raster_(rhs.raster_) {}
|
||||
|
||||
feature<T1,T2>& operator=(const feature<T1,T2>& rhs)
|
||||
{
|
||||
feature<T1,T2> tmp;
|
||||
swap(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~feature() {}
|
||||
|
||||
int id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
void set_geometry(geometry_type& geom)
|
||||
{
|
||||
geom_=geom;
|
||||
}
|
||||
|
||||
geometry_type& get_geometry()
|
||||
{
|
||||
return geom_;
|
||||
}
|
||||
|
||||
const raster_type& get_raster() const
|
||||
{
|
||||
return raster_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void add_attribute(const std::string& name,const T& value)
|
||||
{
|
||||
attr_.insert(std::make_pair(name,attribute(value)));
|
||||
}
|
||||
|
||||
attribute attribute_by_name(const std::string& name) const
|
||||
{
|
||||
typename attributes::const_iterator pos=attr_.find(name);
|
||||
if (pos!=attr_.end())
|
||||
return pos->second;
|
||||
return attribute();
|
||||
}
|
||||
|
||||
const attributes& get_attributes() const
|
||||
{
|
||||
return attr_;
|
||||
}
|
||||
|
||||
private:
|
||||
void swap(const feature<T1,T2>& rhs) throw()
|
||||
{
|
||||
std::swap(id_,rhs.id_);
|
||||
std::swap(geom_,rhs.geom_);
|
||||
std::swap(raster_,rhs.raster_);
|
||||
std::swap(attr_,rhs.attr_);
|
||||
}
|
||||
};
|
||||
|
||||
typedef feature<geometry_ptr,raster_ptr> Feature;
|
||||
|
||||
}
|
||||
#endif //FEATURE_HH
|
||||
|
|
|
@ -39,9 +39,9 @@ namespace mapnik
|
|||
};
|
||||
|
||||
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 bool pass (const Feature& feature) const = 0;
|
||||
virtual filter<Feature>* clone() const = 0;
|
||||
virtual void accept(filter_visitor<Feature>& v) = 0;
|
||||
virtual ~filter() {}
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace mapnik
|
|||
}
|
||||
|
||||
template <typename T,typename Image>
|
||||
bool clip_line(T& x0,T& y0,T& x1,T& y1,const Image* image)
|
||||
bool clip_line(T& x0,T& y0,T& x1,T& y1,const Image* image)
|
||||
{
|
||||
double tmin=0.0;
|
||||
double tmax=1.0;
|
||||
|
@ -79,37 +79,32 @@ namespace mapnik
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool point_inside_path(double x,double y,const geometry<vertex2d>& geom)
|
||||
|
||||
template <typename Iter>
|
||||
inline bool point_inside_path(Iter start,Iter end,double x,double y)
|
||||
{
|
||||
bool inside=false;
|
||||
if (geom.num_points()>2)
|
||||
double x0=start->x;
|
||||
double y0=start->y;
|
||||
double x1,y1;
|
||||
while (++start!=end)
|
||||
{
|
||||
geometry<vertex2d>::path_iterator<NO_SHIFT> itr=geom.begin<NO_SHIFT>();
|
||||
geometry<vertex2d>::path_iterator<NO_SHIFT> end=geom.end<NO_SHIFT>();
|
||||
|
||||
double x0=itr->x;
|
||||
double y0=itr->y;
|
||||
double x1,y1;
|
||||
while (++itr!=end)
|
||||
if (start->cmd == SEG_MOVETO)
|
||||
{
|
||||
if (itr->cmd == SEG_MOVETO)
|
||||
{
|
||||
x0=itr->x;
|
||||
y0=itr->y;
|
||||
continue;
|
||||
}
|
||||
x1=itr->x;
|
||||
y1=itr->y;
|
||||
if ((((y1 <= y) && (y < y0)) ||
|
||||
((y0 <= y) && (y < y1))) &&
|
||||
( x < (x0 - x1) * (y - y1)/ (y0 - y1) + x1))
|
||||
inside=!inside;
|
||||
x0=itr->x;
|
||||
y0=itr->y;
|
||||
}
|
||||
x0=start->x;
|
||||
y0=start->y;
|
||||
continue;
|
||||
}
|
||||
x1=start->x;
|
||||
y1=start->y;
|
||||
if ((((y1 <= y) && (y < y0)) ||
|
||||
((y0 <= y) && (y < y1))) &&
|
||||
( x < (x0 - x1) * (y - y1)/ (y0 - y1) + x1))
|
||||
inside=!inside;
|
||||
x0=x1;
|
||||
y0=y1;
|
||||
}
|
||||
return inside;
|
||||
return inside;
|
||||
}
|
||||
|
||||
#define TOL 0.00001
|
||||
|
@ -161,6 +156,7 @@ namespace mapnik
|
|||
|
||||
double x0=itr->x;
|
||||
double y0=itr->y;
|
||||
|
||||
while (++itr!=end)
|
||||
{
|
||||
if (itr->cmd == SEG_MOVETO)
|
||||
|
|
|
@ -53,7 +53,9 @@ namespace mapnik
|
|||
cont_() {}
|
||||
|
||||
virtual int type() const=0;
|
||||
|
||||
virtual bool hit_test(value_type x,value_type y) const=0;
|
||||
|
||||
int srid() const
|
||||
{
|
||||
return srid_;
|
||||
|
@ -200,10 +202,12 @@ namespace mapnik
|
|||
template <typename T, template <typename> class Container=vertex_vector>
|
||||
class polygon : public geometry<T,Container>
|
||||
{
|
||||
typedef typename geometry<T,Container>::value_type value_type;
|
||||
typedef geometry<T,Container> geometry_base;
|
||||
typedef typename geometry_base::value_type value_type;
|
||||
typedef typename geometry_base::template path_iterator<NO_SHIFT> path_iterator;
|
||||
public:
|
||||
polygon(int srid)
|
||||
: geometry<T,Container>(srid)
|
||||
: geometry_base(srid)
|
||||
{}
|
||||
|
||||
int type() const
|
||||
|
@ -212,8 +216,10 @@ namespace mapnik
|
|||
}
|
||||
|
||||
bool hit_test(value_type x,value_type y) const
|
||||
{
|
||||
return point_inside_path(x,y,*this);
|
||||
{
|
||||
path_iterator start = geometry_base::template begin<NO_SHIFT>();
|
||||
path_iterator end = geometry_base::template end<NO_SHIFT>();
|
||||
return point_inside_path(start,end,x,y);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ namespace mapnik
|
|||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
|
||||
png_set_compression_strategy(png_ptr, Z_FILTERED);
|
||||
png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8,
|
||||
PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define LOGICAL_HH
|
||||
|
||||
#include "filter.hh"
|
||||
#include "feature.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "ptr.hh"
|
||||
#include "factory.hh"
|
||||
#include "filter.hh"
|
||||
#include "query.hh"
|
||||
#include "rule.hh"
|
||||
#include "spatial.hh"
|
||||
#include "logical.hh"
|
||||
|
@ -41,10 +42,8 @@
|
|||
#include "geom_util.hh"
|
||||
#include "raster.hh"
|
||||
#include "feature.hh"
|
||||
#include "vector_feature.hh"
|
||||
#include "raster_feature.hh"
|
||||
#include "attribute.hh"
|
||||
#include "attribute_container.hh"
|
||||
#include "attribute_collector.hh"
|
||||
#include "render.hh"
|
||||
#include "graphics.hh"
|
||||
#include "image_reader.hh"
|
||||
|
@ -54,6 +53,7 @@
|
|||
#include "datasource_cache.hh"
|
||||
#include "wkb.hh"
|
||||
#include "map.hh"
|
||||
#include "colorcube.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
class PngReader : public ImageReader
|
||||
class PngReader : public ImageReader
|
||||
{
|
||||
private:
|
||||
std::string fileName_;
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/* 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: raster.cc 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#include "raster.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
raster::raster(int x,int y,ImageData32& data)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
data_(data) {}
|
||||
|
||||
raster::~raster() {}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id: raster.hh 58 2004-10-31 16:21:26Z artem $
|
||||
//$Id$
|
||||
|
||||
#ifndef RASTER_HH
|
||||
#define RASTER_HH
|
||||
|
@ -30,8 +30,11 @@ namespace mapnik
|
|||
int x_;
|
||||
int y_;
|
||||
ImageData32 data_;
|
||||
raster(int x,int y,ImageData32& data);
|
||||
~raster();
|
||||
raster(int x,int y,ImageData32& data)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
data_(data) {}
|
||||
};
|
||||
}
|
||||
#endif //RASTER_HH
|
||||
|
||||
#endif //RASTER_HH
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/* 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: raster_feature.cc 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#include "raster_feature.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
RasterFeature::RasterFeature(int id,const RasterPtr& ras)
|
||||
: FeatureImpl(id),
|
||||
ras_(ras) {}
|
||||
|
||||
RasterFeature::~RasterFeature()
|
||||
{
|
||||
}
|
||||
|
||||
bool RasterFeature::isRaster() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const RasterPtr& RasterFeature::getRaster() const
|
||||
{
|
||||
return ras_;
|
||||
}
|
||||
|
||||
geometry_ptr& RasterFeature::getGeometry()
|
||||
{
|
||||
static geometry_ptr geom(0);
|
||||
return geom;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/* 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: raster_feature.hh 58 2004-10-31 16:21:26Z artem $
|
||||
|
||||
#ifndef RASTER_FEATURE_HH
|
||||
#define RASTER_FEATURE_HH
|
||||
|
||||
#include "feature.hh"
|
||||
#include "raster.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
class RasterFeature : public FeatureImpl
|
||||
{
|
||||
private:
|
||||
RasterPtr ras_;
|
||||
public:
|
||||
RasterFeature(int id,const RasterPtr& ras);
|
||||
virtual ~RasterFeature();
|
||||
bool isRaster() const;
|
||||
geometry_ptr& getGeometry();
|
||||
const RasterPtr& getRaster() const;
|
||||
private:
|
||||
RasterFeature(const RasterFeature&);
|
||||
RasterFeature& operator=(const RasterFeature&);
|
||||
};
|
||||
}
|
||||
#endif //RASTER_FEATURE_HH
|
|
@ -32,16 +32,17 @@
|
|||
#include "image_reader.hh"
|
||||
#include "polygon_symbolizer.hh"
|
||||
#include "line_symbolizer.hh"
|
||||
#include "query.hh"
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
template <typename Image>
|
||||
void Renderer<Image>::renderLayer(const Layer& l,const CoordTransform& t,
|
||||
const Envelope<double>& extent,Image& image)
|
||||
const query& q,Image& image)
|
||||
{
|
||||
const datasource_p& ds=l.datasource();
|
||||
if (!ds) return;
|
||||
FeaturesetPtr fs=ds->featuresInBox(t,extent);
|
||||
FeaturesetPtr fs=ds->features(q);
|
||||
if (fs)
|
||||
{
|
||||
volatile style_cache* styles=style_cache::instance();
|
||||
|
@ -54,6 +55,14 @@ namespace mapnik
|
|||
Feature* feature=0;
|
||||
while (feature=fs->next())
|
||||
{
|
||||
geometry_ptr& geom=feature->get_geometry();
|
||||
if (geom)
|
||||
{
|
||||
geom->transform(t);
|
||||
(*itr)->render(*geom,image);
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO
|
||||
if (feature->isRaster())
|
||||
{
|
||||
|
@ -63,9 +72,10 @@ namespace mapnik
|
|||
else
|
||||
{
|
||||
geometry_ptr& geom=feature->getGeometry();
|
||||
geom->transform(t);
|
||||
|
||||
(*itr)->render(*geom,image);
|
||||
}
|
||||
*/
|
||||
delete feature,feature=0;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +94,7 @@ namespace mapnik
|
|||
|
||||
while (itr!=selection.end())
|
||||
{
|
||||
geometry_ptr& geom=(*itr)->getGeometry();
|
||||
geometry_ptr& geom=(*itr)->get_geometry();
|
||||
geom->transform(t);
|
||||
(*pos)->render(*geom,image);
|
||||
++itr;
|
||||
|
@ -103,21 +113,19 @@ namespace mapnik
|
|||
double scale=map.scale();
|
||||
std::cout<<" scale="<<scale<<"\n";
|
||||
|
||||
int width=map.getWidth();
|
||||
int height=map.getHeight();
|
||||
|
||||
unsigned width=map.getWidth();
|
||||
unsigned height=map.getHeight();
|
||||
CoordTransform t(width,height,extent);
|
||||
const Color& background=map.getBackground();
|
||||
|
||||
image.setBackground(background);
|
||||
|
||||
query q(extent);
|
||||
for (size_t n=0;n<map.layerCount();++n)
|
||||
{
|
||||
const Layer& l=map.getLayer(n);
|
||||
if (l.isVisible(scale))
|
||||
{
|
||||
//TODO make datasource to return its extent!!!
|
||||
renderLayer(l,t,extent,image);
|
||||
renderLayer(l,t,q,image);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id: render.hh 64 2004-11-12 10:29:32Z artem $
|
||||
//$Id$
|
||||
|
||||
#ifndef RENDER_HH
|
||||
#define RENDER_HH
|
||||
|
||||
|
@ -38,7 +39,7 @@ namespace mapnik
|
|||
static void render(const Map& map,Image& image);
|
||||
private:
|
||||
Renderer();
|
||||
static void renderLayer(const Layer& l,const CoordTransform& t,const Envelope<double>& extent,Image& image);
|
||||
static void renderLayer(const Layer& l,const CoordTransform& t,const query& q,Image& image);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ int main(int argc,char** argv)
|
|||
{
|
||||
int width=dbf.descriptor(j).length_;
|
||||
string name=dbf.descriptor(j).name_;
|
||||
cout<<setw(width)<<name<<"|";
|
||||
char type=dbf.descriptor(j).type_;
|
||||
cout<<setw(width)<<name<<"("<<type<<")""|";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
|
|
|
@ -109,26 +109,45 @@ const field_descriptor& dbf_file::descriptor(int col) const
|
|||
}
|
||||
|
||||
|
||||
void dbf_file::add_attribute(int col,Feature* f) const
|
||||
void dbf_file::add_attribute(int col,Feature* f) const throw()
|
||||
{
|
||||
if (col>=0 && col<num_fields_)
|
||||
{
|
||||
std::string name=fields_[col].name_;
|
||||
std::string str(record_+fields_[col].offset_,fields_[col].length_);
|
||||
std::string str=trim_left(std::string(record_+fields_[col].offset_,fields_[col].length_));
|
||||
|
||||
switch (fields_[col].type_)
|
||||
{
|
||||
case 'C':
|
||||
case 'D'://todo handle date?
|
||||
case 'M':
|
||||
f->add(name,attribute<std::string>(str));
|
||||
break;
|
||||
case 'L':
|
||||
{
|
||||
f->add_attribute<std::string>(name,str);
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
f->add(name,attribute_from_string<int>(str));
|
||||
break;
|
||||
case 'F':
|
||||
f->add(name,attribute_from_string<double>(str));
|
||||
break;
|
||||
}
|
||||
case 'F':
|
||||
{
|
||||
if (str[0]=='*')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (fields_[col].dec_>0)
|
||||
{
|
||||
double val;
|
||||
fromString(str,val);
|
||||
f->add_attribute<double>(name,val);
|
||||
}
|
||||
else
|
||||
{
|
||||
int val;
|
||||
fromString(str,val);
|
||||
f->add_attribute<int>(name,val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +172,7 @@ void dbf_file::read_header()
|
|||
field_descriptor desc;
|
||||
desc.index_=i;
|
||||
file_.read(name,10);
|
||||
desc.name_=name; //TODO trim ws
|
||||
desc.name_=trim_left(name);
|
||||
skip(1);
|
||||
desc.type_=file_.get();
|
||||
skip(4);
|
||||
|
|
|
@ -41,14 +41,7 @@ struct field_descriptor
|
|||
class dbf_file
|
||||
{
|
||||
private:
|
||||
enum
|
||||
{
|
||||
String=1,
|
||||
Numeric,
|
||||
Date,
|
||||
Float,
|
||||
Other
|
||||
};
|
||||
|
||||
int num_records_;
|
||||
int num_fields_;
|
||||
int record_length_;
|
||||
|
@ -68,7 +61,7 @@ class dbf_file
|
|||
const field_descriptor& descriptor(int col) const;
|
||||
void move_to(int index);
|
||||
std::string string_value(int col) const;
|
||||
void add_attribute(int col,Feature* f) const;
|
||||
void add_attribute(int col,Feature* f) const throw();
|
||||
private:
|
||||
dbf_file(const dbf_file&);
|
||||
dbf_file& operator=(const dbf_file&);
|
||||
|
|
|
@ -132,6 +132,15 @@ FeaturesetPtr shape_datasource::featuresAtPoint(const CoordTransform& t,const ma
|
|||
return FeaturesetPtr(new ShapeFeatureset<filter_at_point>(filter,shape_name_,file_length_,-1));
|
||||
}
|
||||
|
||||
FeaturesetPtr shape_datasource::features(const query& q) const
|
||||
{
|
||||
filter_in_box filter(q.get_bbox());
|
||||
if (indexed_)
|
||||
{
|
||||
return FeaturesetPtr(new ShapeIndexFeatureset<filter_in_box>(filter,shape_name_,-1));
|
||||
}
|
||||
return FeaturesetPtr(new ShapeFeatureset<filter_in_box>(filter,shape_name_,file_length_,-1));
|
||||
}
|
||||
|
||||
const Envelope<double>& shape_datasource::envelope() const
|
||||
{
|
||||
|
|
|
@ -37,7 +37,10 @@ public:
|
|||
FeaturesetPtr featuresAll(const CoordTransform& t) const;
|
||||
FeaturesetPtr featuresInBox(const CoordTransform& t,const mapnik::Envelope<double>& box) const;
|
||||
FeaturesetPtr featuresAtPoint(const CoordTransform& t,const mapnik::coord2d& pt) const;
|
||||
const mapnik::Envelope<double>& envelope() const;
|
||||
|
||||
FeaturesetPtr features(const query& q) const;
|
||||
|
||||
const Envelope<double>& envelope() const;
|
||||
shape_datasource(const Parameters ¶ms);
|
||||
virtual ~shape_datasource();
|
||||
private:
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#include <iostream>
|
||||
|
||||
template <typename filterT>
|
||||
ShapeFeatureset<filterT>::ShapeFeatureset(const filterT& filter, const std::string& shape_file, long file_length, int srid)
|
||||
ShapeFeatureset<filterT>::ShapeFeatureset(const filterT& filter,
|
||||
const std::string& shape_file,
|
||||
long file_length, int srid)
|
||||
: srid_(srid),
|
||||
filter_(filter),
|
||||
shape_type_(shape_io::shape_null),
|
||||
|
@ -36,22 +38,21 @@ ShapeFeatureset<filterT>::ShapeFeatureset(const filterT& filter, const std::stri
|
|||
template <typename filterT>
|
||||
Feature* ShapeFeatureset<filterT>::next()
|
||||
{
|
||||
VectorFeature* feature=0;
|
||||
unsigned long pos=shape_.shp().pos(); // should be pos_type (or streampos)!!!
|
||||
Feature* feature=0;
|
||||
std::streampos pos=shape_.shp().pos();
|
||||
|
||||
if (pos < file_length_ * 2)
|
||||
if (pos < std::streampos(file_length_ * 2))
|
||||
{
|
||||
int id = shape_.shp().read_xdr_integer();
|
||||
int record_len = shape_.shp().read_xdr_integer();
|
||||
int type = shape_.shp().read_ndr_integer();
|
||||
|
||||
shape_.move_to(pos);
|
||||
int type=shape_.type();
|
||||
int id=shape_.id_;
|
||||
if (type == shape_io::shape_point)
|
||||
{
|
||||
double x=shape_.shp().read_double();
|
||||
double y=shape_.shp().read_double();
|
||||
geometry_ptr point(new point_impl(-1));
|
||||
point->move_to(x,y);
|
||||
feature=new VectorFeature(pos,point);
|
||||
feature=new Feature(id,point);
|
||||
++count_;
|
||||
}
|
||||
else if (type == shape_io::shape_pointz)
|
||||
|
@ -61,22 +62,17 @@ Feature* ShapeFeatureset<filterT>::next()
|
|||
double z=shape_.shp().read_double();
|
||||
geometry_ptr point(new point_impl(-1));
|
||||
point->move_to(x,y);
|
||||
feature=new VectorFeature(pos,point);
|
||||
feature=new Feature(id,point);
|
||||
++count_;
|
||||
}
|
||||
else
|
||||
{
|
||||
Envelope<double> extent;
|
||||
shape_.shp().read_envelope(extent);
|
||||
while (!filter_.pass(extent))
|
||||
while (!filter_.pass(shape_.current_extent()))
|
||||
{
|
||||
shape_.shp().skip(2 * record_len + 8 - (4 * 3 + 8 * 4));
|
||||
if (shape_.shp().pos() >= file_length_ * 2)
|
||||
unsigned reclen=shape_.reclength_;
|
||||
shape_.move_to(long(shape_.shp().pos()) + 2 * reclen - 36);
|
||||
if ((unsigned long)shape_.shp().pos() >= file_length_ * 2)
|
||||
return 0;
|
||||
id = shape_.shp().read_xdr_integer();
|
||||
record_len = shape_.shp().read_xdr_integer();
|
||||
type = shape_.shp().read_ndr_integer();
|
||||
shape_.shp().read_envelope(extent);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
|
@ -84,19 +80,19 @@ Feature* ShapeFeatureset<filterT>::next()
|
|||
case shape_io::shape_polyline:
|
||||
{
|
||||
geometry_ptr line = shape_.read_polyline();
|
||||
feature=new VectorFeature(pos,line);
|
||||
feature=new Feature(id,line);
|
||||
++count_;
|
||||
break;
|
||||
}
|
||||
case shape_io::shape_polygon:
|
||||
{
|
||||
geometry_ptr poly = shape_.read_polygon();
|
||||
feature=new VectorFeature(pos,poly);
|
||||
feature=new Feature(id,poly);
|
||||
++count_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (0)
|
||||
|
|
|
@ -46,8 +46,7 @@ ShapeIndexFeatureset<filterT>::ShapeIndexFeatureset(const filterT& filter,
|
|||
template <typename filterT>
|
||||
Feature* ShapeIndexFeatureset<filterT>::next()
|
||||
{
|
||||
VectorFeature *f=0;
|
||||
|
||||
Feature *f=0;
|
||||
if (itr_!=ids_.end())
|
||||
{
|
||||
int pos=*itr_++;
|
||||
|
@ -59,7 +58,7 @@ Feature* ShapeIndexFeatureset<filterT>::next()
|
|||
double y=shape_.shp().read_double();
|
||||
geometry_ptr point(new point_impl(-1));
|
||||
point->move_to(x,y);
|
||||
f=new VectorFeature(shape_.id_,point);
|
||||
f=new Feature(shape_.id_,point);
|
||||
++count_;
|
||||
}
|
||||
else if (type == shape_io::shape_pointz)
|
||||
|
@ -69,7 +68,7 @@ Feature* ShapeIndexFeatureset<filterT>::next()
|
|||
double z=shape_.shp().read_double();
|
||||
geometry_ptr point(new point_impl(-1));
|
||||
point->move_to(x,y);
|
||||
f=new VectorFeature(shape_.id_,point);
|
||||
f=new Feature(shape_.id_,point);
|
||||
++count_;
|
||||
}
|
||||
else
|
||||
|
@ -86,7 +85,7 @@ Feature* ShapeIndexFeatureset<filterT>::next()
|
|||
case shape_io::shape_polyline:
|
||||
{
|
||||
geometry_ptr line = shape_.read_polyline();
|
||||
f=new VectorFeature(shape_.id_,line);
|
||||
f=new Feature(shape_.id_,line);
|
||||
++count_;
|
||||
break;
|
||||
}
|
||||
|
@ -94,17 +93,25 @@ Feature* ShapeIndexFeatureset<filterT>::next()
|
|||
{
|
||||
|
||||
geometry_ptr poly = shape_.read_polygon();
|
||||
f=new VectorFeature(shape_.id_,poly);
|
||||
f=new Feature(shape_.id_,poly);
|
||||
++count_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (0)
|
||||
{
|
||||
//shape_.dbf().move_to(id);
|
||||
//for (int j=0;j<shape_.dbf().num_fields();++j) {
|
||||
// shape_.dbf().add_attribute(j,f);//TODO optimize!!!
|
||||
//}
|
||||
shape_.dbf().move_to(shape_.id_);
|
||||
for (int j=0;j<shape_.dbf().num_fields();++j)
|
||||
{
|
||||
try
|
||||
{
|
||||
shape_.dbf().add_attribute(j,f);//TODO optimize!!!
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
inline void skip(int bytes)
|
||||
inline void skip(std::streampos bytes)
|
||||
{
|
||||
file_.seekg(bytes,std::ios::cur);
|
||||
}
|
||||
|
@ -171,13 +171,13 @@ public:
|
|||
seek(100);
|
||||
}
|
||||
|
||||
inline void seek(long pos)
|
||||
inline void seek(std::streampos pos)
|
||||
{
|
||||
file_.seekg(pos,std::ios::beg);
|
||||
}
|
||||
|
||||
|
||||
inline long pos()
|
||||
inline std::streampos pos()
|
||||
{
|
||||
return file_.tellg();
|
||||
}
|
||||
|
|
21
src/utils.hh
21
src/utils.hh
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id: utils.hh 70 2004-11-25 22:09:48Z artem $
|
||||
//$Id$
|
||||
|
||||
#ifndef UTILS_HH
|
||||
#define UTILS_HH
|
||||
|
@ -275,6 +275,25 @@ namespace mapnik
|
|||
throw BadConversion("fromString("+s+")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline bool space (char c)
|
||||
{
|
||||
return isspace(c);
|
||||
}
|
||||
|
||||
inline bool not_space (char c)
|
||||
{
|
||||
return !isspace(c);
|
||||
}
|
||||
|
||||
inline std::string trim_left(const std::string& str)
|
||||
{
|
||||
typedef std::string::const_iterator iter;
|
||||
iter i = find_if(str.begin(),str.end(),not_space);
|
||||
return std::string(i,str.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //UTILS_HH
|
||||
|
|
Loading…
Add table
Reference in a new issue