Permalink
Browse files

RFC93: UTFGrid Implementation (#4765)

  • Loading branch information...
fdesj authored and tbonfort committed Sep 25, 2013
1 parent a09f2ae commit f0a45dedb38f1f17784a80fe01515130f6dab8dd
Showing with 3,467 additions and 2,204 deletions.
  1. +7 −1 CMakeLists.txt
  2. +12 −127 mapagg.cpp
  3. +184 −0 mapagg.h
  4. +153 −0 mapaggcommon.h
  5. +21 −16 mapdraw.c
  6. +9 −9 mapdummyrenderer.c
  7. +15 −2 mapfile.c
  8. +4 −0 mapfile.h
  9. +1 −0 mapimageio.c
  10. +10 −0 maplayer.c
  11. +2,053 −2,043 maplexer.c
  12. +2 −0 maplexer.l
  13. +13 −0 mapoutput.c
  14. +10 −0 mapserver.h
  15. +6 −1 mapservutil.c
  16. +709 −0 maputfgrid.cpp
  17. +247 −0 maputfgrid.h
  18. +5 −4 maputil.c
  19. +6 −1 mapwms.c
@@ -130,6 +130,7 @@ option(WITH_SDE_PLUGIN "include ArcSDE support as a plugin (must specify SDE_INC
option(WITH_SDE "include ArcSDE support. Add -DSDE_VERSION=91 to use 9.1 arcSDE version" OFF)
option(WITH_EXEMPI "include xmp output metadata support" OFF)
option(WITH_XMLMAPFILE "include native xml mapfile support (requires libxslt/libexslt)" OFF)
option(WITH_AGG_ALIASED "turn off antialising on AGG" OFF)
option(BUILD_STATIC "Also build a static version of mapserver" OFF)
option(LINK_STATIC_LIBMAPSERVER "Link to static version of libmapserver (also for mapscripts)" OFF)
@@ -200,7 +201,7 @@ mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c
mapgeomtransform.c mapogroutput.c mapsde.c mapwfslayer.c mapagg.cpp mapkml.cpp
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c maputfgrid.cpp
mapogr.cpp mapcontour.c mapsmoothing.c mapv8.cpp ${REGEX_SOURCES})
if(BUILD_DYNAMIC)
@@ -341,6 +342,10 @@ if(WITH_ICONV)
endif(ICONV_FOUND)
endif (WITH_ICONV)
if(WITH_AGG_ALIASED)
set (AGG_ALIASED_ENABLED 1)
endif(WITH_AGG_ALIASED)
if(WITH_GENERIC_NINT)
set(USE_GENERIC_MS_NINT 1)
endif(WITH_GENERIC_NINT)
@@ -862,6 +867,7 @@ status_optional_feature("WCS SERVER" "${USE_WCS_SVR}")
status_optional_feature("SOS SERVER" "${USE_SOS_SVR}")
status_optional_feature("WMS CLIENT" "${USE_WMS_LYR}")
status_optional_feature("WFS CLIENT" "${USE_WFS_LYR}")
status_optional_feature("AGG ALISING" "${AGG_ALIASED_ENABLED}")
status_optional_feature("ICONV" "${USE_ICONV}")
status_optional_feature("Thread-safety support" "${USE_THREAD}")
status_optional_feature("KML output" "${USE_KML}")
@@ -29,6 +29,8 @@
#include "mapserver.h"
#include "fontcache.h"
#include "mapagg.h"
#include "mapaggcommon.h"
#include <assert.h>
#include "renderers/agg/include/agg_color_rgba.h"
#include "renderers/agg/include/agg_pixfmt_rgba.h"
@@ -47,7 +49,6 @@
#include "renderers/agg/include/agg_image_accessors.h"
#include "renderers/agg/include/agg_conv_stroke.h"
#include "renderers/agg/include/agg_conv_dash.h"
#include "renderers/agg/include/agg_path_storage.h"
#include "renderers/agg/include/agg_font_freetype.h"
#include "renderers/agg/include/agg_conv_contour.h"
#include "renderers/agg/include/agg_ellipse.h"
@@ -112,123 +113,6 @@ fontMetrics rasterfont_sizes[] = {
{7,mapserver::mcs7x12_mono_high[0]}
};
/*
* interface to a shapeObj representing lines, providing the functions
* needed by the agg rasterizer. treats shapeObjs with multiple linestrings.
*/
class line_adaptor
{
public:
line_adaptor(shapeObj *shape):s(shape) {
m_line=s->line; /*first line*/
m_point=m_line->point; /*current vertex is first vertex of first line*/
m_lend=&(s->line[s->numlines]); /*pointer to after last line*/
m_pend=&(m_line->point[m_line->numpoints]); /*pointer to after last vertex of first line*/
}
/* a class with virtual functions should also provide a virtual destructor */
virtual ~line_adaptor() {}
void rewind(unsigned) {
m_line=s->line; /*first line*/
m_point=m_line->point; /*current vertex is first vertex of first line*/
m_pend=&(m_line->point[m_line->numpoints]); /*pointer to after last vertex of first line*/
}
virtual unsigned vertex(double* x, double* y) {
if(m_point < m_pend) {
/*here we treat the case where a real vertex is returned*/
bool first = m_point == m_line->point; /*is this the first vertex of a line*/
*x = m_point->x;
*y = m_point->y;
m_point++;
return first ? mapserver::path_cmd_move_to : mapserver::path_cmd_line_to;
}
/*if here, we're at the end of a line*/
m_line++;
*x = *y = 0.0;
if(m_line>=m_lend) /*is this the last line of the shapObj. normally,
(m_line==m_lend) should be a sufficient test, as the caller should not call
this function if a previous call returned path_cmd_stop.*/
return mapserver::path_cmd_stop; /*no more points to process*/
/*if here, there are more lines in the shapeObj, continue with next one*/
m_point=m_line->point; /*pointer to first point of next line*/
m_pend=&(m_line->point[m_line->numpoints]); /*pointer to after last point of next line*/
return vertex(x,y); /*this will return the first point of the next line*/
}
private:
shapeObj *s;
lineObj *m_line, /*current line pointer*/
*m_lend; /*points to after the last line*/
pointObj *m_point, /*current point*/
*m_pend; /*points to after last point of current line*/
};
class polygon_adaptor
{
public:
polygon_adaptor(shapeObj *shape):s(shape),m_stop(false) {
m_line=s->line; /*first lines*/
m_point=m_line->point; /*first vertex of first line*/
m_lend=&(s->line[s->numlines]); /*pointer to after last line*/
m_pend=&(m_line->point[m_line->numpoints]); /*pointer to after last vertex of first line*/
}
/* a class with virtual functions should also provide a virtual destructor */
virtual ~polygon_adaptor() {}
void rewind(unsigned) {
/*reset pointers*/
m_stop=false;
m_line=s->line;
m_point=m_line->point;
m_pend=&(m_line->point[m_line->numpoints]);
}
virtual unsigned vertex(double* x, double* y) {
if(m_point < m_pend) {
/*if here, we have a real vertex*/
bool first = m_point == m_line->point;
*x = m_point->x;
*y = m_point->y;
m_point++;
return first ? mapserver::path_cmd_move_to : mapserver::path_cmd_line_to;
}
*x = *y = 0.0;
if(!m_stop) {
/*if here, we're after the last vertex of the current line
* we return the command to close the current polygon*/
m_line++;
if(m_line>=m_lend) {
/*if here, we've finished all the vertexes of the shape.
* we still return the command to close the current polygon,
* but set m_stop so the subsequent call to vertex() will return
* the stop command*/
m_stop=true;
return mapserver::path_cmd_end_poly;
}
/*if here, there's another line in the shape, so we set the pointers accordingly
* and return the command to close the current polygon*/
m_point=m_line->point; /*first vertex of next line*/
m_pend=&(m_line->point[m_line->numpoints]); /*pointer to after last vertex of next line*/
return mapserver::path_cmd_end_poly;
}
/*if here, a previous call to vertex informed us that we'd consumed all the vertexes
* of the shape. return the command to stop processing this shape*/
return mapserver::path_cmd_stop;
}
private:
shapeObj *s;
double ox,oy;
lineObj *m_line, /*pointer to current line*/
*m_lend; /*pointer to after last line of the shape*/
pointObj *m_point, /*pointer to current vertex*/
*m_pend; /*pointer to after last vertex of current line*/
bool m_stop; /*should next call return stop command*/
};
#define aggColor(c) mapserver::rgba8_pre((c)->red, (c)->green, (c)->blue, (c)->alpha)
class aggRendererCache
@@ -796,17 +680,19 @@ int getBitmapGlyphMetrics(int size, unsigned int unicode, glyph_metrics *bounds)
return MS_SUCCESS;
}
static mapserver::path_storage imageVectorSymbolAGG(symbolObj *symbol)
mapserver::path_storage imageVectorSymbol(symbolObj *symbol)
{
mapserver::path_storage path;
bool is_new=true;
int is_new=1;
for(int i=0; i < symbol->numpoints; i++) {
if((symbol->points[i].x == -99) && (symbol->points[i].y == -99)) { // (PENUP)
is_new=true;
} else {
if((symbol->points[i].x == -99) && (symbol->points[i].y == -99))
is_new=1;
else {
if(is_new) {
path.move_to(symbol->points[i].x,symbol->points[i].y);
is_new=false;
is_new=0;
} else {
path.line_to(symbol->points[i].x,symbol->points[i].y);
}
@@ -815,15 +701,14 @@ static mapserver::path_storage imageVectorSymbolAGG(symbolObj *symbol)
return path;
}
int agg2RenderVectorSymbol(imageObj *img, double x, double y,
symbolObj *symbol, symbolStyleObj * style)
{
AGG2Renderer *r = AGG_RENDERER(img);
double ox = symbol->sizex * 0.5;
double oy = symbol->sizey * 0.5;
mapserver::path_storage path = imageVectorSymbolAGG(symbol);
mapserver::path_storage path = imageVectorSymbol(symbol);
mapserver::trans_affine mtx;
mtx *= mapserver::trans_affine_translation(-ox,-oy);
mtx *= mapserver::trans_affine_scaling(style->scale);
@@ -1049,7 +934,7 @@ imageObj *agg2CreateImage(int width, int height, outputFormatObj *format, colorO
int agg2SaveImage(imageObj *img, mapObj* map, FILE *fp, outputFormatObj * format)
{
msSetError(MS_MISCERR, "AGG2 does not support direct image saving", "agg2SaveImage()");
return MS_FAILURE;
}
Oops, something went wrong.

0 comments on commit f0a45de

Please sign in to comment.