Skip to content

Commit 12a279e

Browse files
committed
Merge branch 'branch-1-2'
Conflicts: CMakeLists.txt
2 parents 31ea220 + fe8de8b commit 12a279e

File tree

6 files changed

+20
-216
lines changed

6 files changed

+20
-216
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ set(CMAKE_LINK_INTERFACE_LIBRARY "")
6666
file(GLOB mapcache_SOURCES lib/*.c )
6767

6868
add_library(mapcache SHARED ${mapcache_SOURCES})
69+
set_target_properties(mapcache PROPERTIES
70+
VERSION ${MAPCACHE_VERSION_STRING}
71+
SOVERSION 1
72+
)
6973

7074
#options suported by the cmake builder
7175
option(WITH_PIXMAN "Use pixman for SSE optimized image manipulations" ON)
7276
option(WITH_SQLITE "Use sqlite as a cache backend" ON)
73-
option(WITH_BERKELEY_DB "Use sqlite as a cache backend" OFF)
77+
option(WITH_BERKELEY_DB "Use Berkeley DB as a cache backend" OFF)
7478
option(WITH_MEMCACHE "Use memcache as a cache backend (requires recent apr-util)" OFF)
7579
option(WITH_TIFF "Use TIFFs as a cache backend" OFF)
7680
option(WITH_TIFF_WRITE_SUPPORT "Enable (experimental) support for writable TIFF cache backends" OFF)

INSTALL

Lines changed: 2 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -8,212 +8,8 @@ cd mapcache
88
mkdir build
99
cd build
1010
cmake ..
11-
# follow instructions below if missing a dependency
1211
make
1312
sudo make install
1413

15-
The installation script takes care of putting the built module in the apache module directory.
16-
The process for activating a module is usually distro specific, but can be resumed by the
17-
following snippet that should be present in the apache configuration file(s):
18-
19-
LoadModule mapcache_module modules/mod_mapcache.so
20-
21-
Next, a mapcache configuration is mapped to the server url with the following snippet
22-
23-
<IfModule mapcache_module>
24-
<Directory /path/to/directory>
25-
Order Allow,Deny
26-
Allow from all
27-
</Directory>
28-
MapCacheAlias /mapcache "/path/to/directory/mapcache.xml"
29-
</IfModule>
30-
31-
Before you restart, copy the example mapcache.xml file to where you want it:
32-
33-
cp mapcache.xml /path/to/directory/mapcache.xml
34-
35-
(as root)
36-
# apachectl restart
37-
38-
If you have not disabled the demo service, you should now have access to it on
39-
http://myserver/mapcache/demo
40-
41-
42-
Customizing the build, or if something went wrong
43-
-------------------------------------------------
44-
45-
mod_mapcache requires apache, libcurl, libjpeg and libpng development headers.
46-
The cmake script will try to locate them in default system locations, that can be
47-
overriden or specified with -D switches. For example, if you don't want fcgi and
48-
you get a message such as 'Could NOT find APR ', you can use a command such as:
49-
(assuming that apr is at /usr/local/apr)
50-
51-
cmake -DWITH_FCGI=0 -DCMAKE_PREFIX_PATH="/usr/local/apr;" ..
52-
53-
54-
55-
apache apxs
56-
===========
57-
58-
--with-apxs=/path/to/apxs
59-
60-
apxs is the apache extension tool that is used for building and installing the module to a local
61-
apache instance. it should be installed along with a standard apache build, or supplied by
62-
distros when installing the apache development packages.
63-
apxs is sometimes called apxs2 (notably on debian).
64-
On Ubuntu, apt-get install apache2-prefork-dev might help
65-
66-
apr
67-
===
68-
69-
--with-apr-config=/path/to/apr-config
70-
71-
apr-config is sometimes called apr-1-config on some systems. The path to the apr libraries is susually determined
72-
from the previous apxs utility. you can use this switch to override which apr will be used. beware that using a different
73-
version of apr than the one that is linked to by apache will likely cause bugs.
74-
75-
apr-util
76-
========
77-
78-
--with-apu-config=/path/to/apu-config
79-
80-
apu-config is sometimes called apu-1-config. the apr-util library is used to enable the memcached cache backend for
81-
stroing tiles. If you don't plan on using it you can safely ignore or disable it.
82-
83-
libcurl
84-
=======
85-
86-
--with-curl-config=/path/to/curl-config
87-
88-
libpng
89-
======
90-
91-
--with-png=/path/to/png/prefix
92-
93-
this is the path where the libpng headers and libs can be located.
94-
the configure script will be looking for [path]/include/png.h and [path]/lib/libpng.so
95-
96-
libjpeg
97-
======
98-
99-
--with-jpeg=/path/to/jpeg/prefix
100-
101-
this is the path where the libjpeg headers and libs can be located.
102-
the configure script will be looking for [path]/include/jpeg.h and [path]/lib/libjpeg.so
103-
104-
pixman (from 0.5 onwards) (recommended)
105-
=======================================
106-
107-
--with-pixman=[yes|no|/path/to/pkgconfig/pixman.pc]
108-
109-
pixman is a pixel manipulation library used to assemble image tiles when responding
110-
to non-tiled wms requests. Pixman support is recommended as it is highly optimized
111-
and will take advantage of recent processor extensions (mms, sse, ...) to speed up
112-
blending and resampling operations. In case the pixman library is not found, mod-mapcache
113-
will fall back to internal pixel operations that are slower.
114-
115-
sqlite (from 0.5 onwards) (optional)
116-
====================================
117-
118-
--with-sqlite[=/path/to/sqlite/prefix]
119-
120-
sqlite is used to enable the sqlite and mbtiles cache backend. version 3.5.0 or newer is
121-
required.
122-
123-
124-
gdal (from 0.4 onwards) (optional)
125-
===================================
126-
127-
--with-gdal=/path/to/gdal-config
128-
129-
gdal (actually ogr) is used by the seeding utility to allow the seeding of tiles only intersecting a given polygon, e.g.
130-
to preseed all the tiles of a given country.
131-
132-
geos (from 0.5 onwards) (optional)
133-
===================================
134-
135-
--with-geos=/path/to/geos-config
136-
137-
along with gdal/ogr, geos is needed by the seeder to test for the intersection of tiles with geographical features.
138-
139-
pcre (optional)
140-
===============
141-
142-
--with-pcre=/path/to/pcre/prefix
143-
144-
pcre (perl compatible regular expressions) can be used instead of posix regular expressions for validating WMS dimensions.
145-
they are more powerfull than posix REs (and might be slower). you don't need this if you aren't planning on using WMS
146-
dimension support with regex validation, or if your validation needs are covered by posix REs.
147-
148-
fastcgi support (optional)
149-
==========================
150-
151-
mod-mapcache can run as a fastcgi executable. Note that the overhead of fastcgi is non-negligeable with respect to
152-
the throughput you may obtain with a native apache module. Note that the fastcgi build is less tested, and may lag behind
153-
compared to the apache module version on some minor details (most notably on error reporting, and cache-control header
154-
generation).
155-
156-
--with-fastcgi=/path/to/fastcgi/prefix
157-
158-
give the location of the fastcgi libraries and headers.
159-
160-
Experimental options, use at your own risk
161-
------------------------------------------
162-
163-
debug
164-
=====
165-
166-
--enable-debug
167-
168-
enables some extra tests inside the code, and prints out many more debugging messages to the server logs. you should
169-
probably not enable this unless you want to track down a problem happening inside mod-mapcache.
170-
171-
file locking
172-
============
173-
174-
--with-lock-mechanism=file|semaphore
175-
176-
mod-mapcache needs to keep a cross-process and cross-thread lock on tiles so that requests for tiles of a same metatile
177-
don't end up becoming multiple requests for the same metatile on the wms server. The default mechanism "file" is highly
178-
recommended unless you know what you are doing.
179-
180-
This can be configured in two different ways in mod-mapcache, each with their advantage and inconvenience:
181-
182-
* file : mod-mapcache will use a file to signal other rendering threads that the given metatile is being rendered by the
183-
wms source. (the location of these files is configurable with the <lock_dir> configuration directive). In the case of
184-
threaded mpm, this has the inconvenience that we cannot be signaled by the operating system that this file has been
185-
deleted, and thus must resort to sleeping every .5 sec and checking if the file still exists until the file is deleted.
186-
This isn't very efficient, but should not be problematic in practice as this loop only happens if the tile wasn't
187-
already in the cache, i.e. at most once per tile for the whole lifetime of the cache.
188-
189-
* semaphore : mod-mapcache can use posix semaphores for waiting on tile rendering. This method has the inconvenience
190-
that if a rendering thread crashes (or more likely is killed by the system administrator while waiting for the wms
191-
source to finish rendering), the semaphore lives on in the operating system and will prevent all accesses to the
192-
tile until the sempahore is manually deleted. As apache threads are locked while waiting for this semaphore that
193-
will never be released, you might end up with loads of idle processes stacking up. (stuck semaphores on linux can
194-
be discarded by deleteing the files of the form sem.x-x-x-gridname-tilesetname(...) that are located in /dev/shm/.
195-
The "file" maechanism does not have this limitation, as stale lockfiles can be deleted upon server restart.
196-
197-
198-
enabling mod_mapcache on Ubuntu
199-
===============================
200-
201-
Ubuntu has it's own method of invoking modules, using a 'load' file.
202-
The conf files should be created in /etc/apache2/mods-available/, ie
203-
204-
echo 'LoadModule mapcache_module /usr/lib/apache2/modules/mod_mapcache.so' > /etc/apache2/mods-available/mapcache.load
205-
206-
and then enable it: a2enmod mapcache
207-
208-
However, before you restart apache, you will need to make the lib (which is in
209-
/usr/local/lib) available, maybe by:
210-
211-
ln -s /usr/local/lib/libmapcache.so /usr/lib/libmapcache.so
212-
213-
214-
215-
216-
217-
Win32 compilation instructions
218-
------------------------------
219-
TODO
14+
Detailed instructions and configuration options are maintained in the mapcache documentation :
15+
http://mapserver.org/mapcache/install.html

include/mapcache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ mapcache_image* mapcache_image_create_with_data(mapcache_context *ctx, int width
889889
void mapcache_image_copy_resampled_nearest(mapcache_context *ctx, mapcache_image *src, mapcache_image *dst,
890890
double off_x, double off_y, double scale_x, double scale_y);
891891
void mapcache_image_copy_resampled_bilinear(mapcache_context *ctx, mapcache_image *src, mapcache_image *dst,
892-
double off_x, double off_y, double scale_x, double scale_y);
892+
double off_x, double off_y, double scale_x, double scale_y, int reflect_edges);
893893

894894

895895
/**

lib/cache_sqlite.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ static void _mapcache_cache_mbtiles_multi_set(mapcache_context *ctx, mapcache_ti
749749
}
750750
}
751751
conn = _sqlite_get_conn(ctx, &tiles[0], 0);
752+
GC_CHECK_ERROR(ctx);
752753

753754
sqlite3_exec(conn->handle, "BEGIN TRANSACTION", 0, 0, 0);
754755
for (i = 0; i < ntiles; i++) {

lib/image.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void mapcache_image_copy_resampled_nearest(mapcache_context *ctx, mapcache_image
233233
}
234234

235235
void mapcache_image_copy_resampled_bilinear(mapcache_context *ctx, mapcache_image *src, mapcache_image *dst,
236-
double off_x, double off_y, double scale_x, double scale_y)
236+
double off_x, double off_y, double scale_x, double scale_y, int reflect_edges)
237237
{
238238
#ifdef USE_PIXMAN
239239
pixman_image_t *si = pixman_image_create_bits(PIXMAN_a8r8g8b8,src->w,src->h,
@@ -244,7 +244,9 @@ void mapcache_image_copy_resampled_bilinear(mapcache_context *ctx, mapcache_imag
244244
pixman_transform_init_translate(&transform,pixman_double_to_fixed(-off_x),pixman_double_to_fixed(-off_y));
245245
pixman_transform_scale(&transform,NULL,pixman_double_to_fixed(1.0/scale_x),pixman_double_to_fixed(1.0/scale_y));
246246
pixman_image_set_transform (si, &transform);
247-
pixman_image_set_repeat (si, PIXMAN_REPEAT_REFLECT);
247+
if(reflect_edges) {
248+
pixman_image_set_repeat (si, PIXMAN_REPEAT_REFLECT);
249+
}
248250
pixman_image_set_filter(si,PIXMAN_FILTER_BILINEAR, NULL, 0);
249251
pixman_image_composite (PIXMAN_OP_OVER, si, NULL, bi,
250252
0, 0, 0, 0, 0, 0, dst->w,dst->h);

lib/tileset.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ void mapcache_tileset_get_map_tiles(mapcache_context *ctx, mapcache_tileset *til
194194

195195
mapcache_grid_get_xy(ctx,grid_link->grid,bbox->minx,bbox->miny,level,&bl_x,&bl_y);
196196
mapcache_grid_get_xy(ctx,grid_link->grid,bbox->maxx,bbox->maxy,level,&tr_x,&tr_y);
197-
Mx = MAPCACHE_MAX(tr_x,bl_x);
198-
My = MAPCACHE_MAX(tr_y,bl_y);
199-
mx = MAPCACHE_MIN(tr_x,bl_x);
200-
my = MAPCACHE_MIN(tr_y,bl_y);
197+
Mx = MAPCACHE_MAX(MAPCACHE_MIN(MAPCACHE_MAX(tr_x,bl_x),grid_link->grid_limits[level].maxx),grid_link->grid_limits[level].minx);
198+
My = MAPCACHE_MAX(MAPCACHE_MIN(MAPCACHE_MAX(tr_y,bl_y),grid_link->grid_limits[level].maxy),grid_link->grid_limits[level].miny);
199+
mx = MAPCACHE_MIN(MAPCACHE_MAX(MAPCACHE_MIN(tr_x,bl_x),grid_link->grid_limits[level].minx),grid_link->grid_limits[level].maxx);
200+
my = MAPCACHE_MIN(MAPCACHE_MAX(MAPCACHE_MIN(tr_y,bl_y),grid_link->grid_limits[level].miny),grid_link->grid_limits[level].maxy);
201201
*ntiles = (Mx-mx+1)*(My-my+1);
202202
i=0;
203203
*tiles = (mapcache_tile**)apr_pcalloc(ctx->pool, *ntiles*sizeof(mapcache_tile*));
@@ -340,7 +340,7 @@ mapcache_image* mapcache_tileset_assemble_map_tiles(mapcache_context *ctx, mapca
340340
} else {
341341
switch(mode) {
342342
case MAPCACHE_RESAMPLE_BILINEAR:
343-
mapcache_image_copy_resampled_bilinear(ctx,srcimage,image,dstminx,dstminy,hf,vf);
343+
mapcache_image_copy_resampled_bilinear(ctx,srcimage,image,dstminx,dstminy,hf,vf,0);
344344
break;
345345
default:
346346
mapcache_image_copy_resampled_nearest(ctx,srcimage,image,dstminx,dstminy,hf,vf);
@@ -691,7 +691,7 @@ void mapcache_tileset_assemble_out_of_zoom_tile(mapcache_context *ctx, mapcache_
691691
* ctx->log(ctx, MAPCACHE_DEBUG, "factor: %g. start: %g,%g (im size: %g)",scalefactor,dstminx,dstminy,scalefactor*256);
692692
*/
693693
if(scalefactor <= tile->grid_link->grid->tile_sx/2) /*FIXME: might fail for non-square tiles, also check tile_sy */
694-
mapcache_image_copy_resampled_bilinear(ctx,childtile->raw_image,tile->raw_image,dstminx,dstminy,scalefactor,scalefactor);
694+
mapcache_image_copy_resampled_bilinear(ctx,childtile->raw_image,tile->raw_image,dstminx,dstminy,scalefactor,scalefactor,1);
695695
else {
696696
/* no use going through bilinear resampling if the requested scalefactor maps less than 4 pixels onto the
697697
* resulting tile, plus pixman has some rounding bugs in this case, see
@@ -828,6 +828,7 @@ void mapcache_tileset_tile_get(mapcache_context *ctx, mapcache_tile *tile)
828828

829829
mapcache_unlock_resource(ctx, mapcache_tileset_metatile_resource_key(ctx,mt));
830830
}
831+
GC_CHECK_ERROR(ctx);
831832

832833
/* the previous step has successfully finished, we can now query the cache to return the tile content */
833834
ret = tile->tileset->cache->tile_get(ctx, tile);

0 commit comments

Comments
 (0)