[Git][debian-gis-team/mapserver][upstream] New upstream version 7.2.0
Bas Couwenberg
gitlab at salsa.debian.org
Tue Jul 24 08:23:55 BST 2018
Bas Couwenberg pushed to branch upstream at Debian GIS Project / mapserver
Commits:
7ae62cbf by Bas Couwenberg at 2018-07-24T08:07:29+02:00
New upstream version 7.2.0
- - - - -
7 changed files:
- Vagrantfile
- mapmvt.c
- mapstring.c
- mapwfs.c
- scripts/vagrant/mapserver.sh
- scripts/vagrant/packages.sh
- scripts/vagrant/postgis.sh
Changes:
=====================================
Vagrantfile
=====================================
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -7,8 +7,7 @@ require 'socket'
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "precise64"
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "mapserver-vagrant"
@@ -20,6 +19,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
v.name = "mapserver-vagrant"
end
+ # Unless explicitly declined, use the VM host's file system to cache
+ # .deb files to avoid repeated downloads on each vagrant up
+ unless File.exists?("../.no_apt_cache")
+ cache_dir = "../apt-cache/#{config.vm.box}"
+ FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
+ puts "Using local apt cache, #{cache_dir}"
+ config.vm.synced_folder cache_dir, "/var/cache/apt/archives"
+ end
+
config.vm.provision "shell", path: "scripts/vagrant/virtualbox-fix.sh"
config.vm.provision "shell", path: "scripts/vagrant/packages.sh"
config.vm.provision "shell", path: "scripts/vagrant/postgis.sh"
=====================================
mapmvt.c
=====================================
--- a/mapmvt.c
+++ b/mapmvt.c
@@ -64,10 +64,11 @@ static enum MS_RING_DIRECTION mvtGetRingDirection(lineObj *ring) {
/* step throught the edges */
for(i=0; i<ring->numpoints-1; i++) {
- sum += (ring->point[i+1].x - ring->point[i].x)*(ring->point[i+1].y + ring->point[i].y); /* (x2 − x1)*(y2 + y1) */
+ sum += ring->point[i].x * ring->point[i+1].y - ring->point[i+1].x * ring->point[i].y;
}
- return (sum >= 0)?MS_DIRECTION_CLOCKWISE:MS_DIRECTION_COUNTERCLOCKWISE;
+ return sum > 0 ? MS_DIRECTION_CLOCKWISE :
+ sum < 0 ? MS_DIRECTION_COUNTERCLOCKWISE : MS_DIRECTION_INVALID_RING;
}
static void mvtReverseRingDirection(lineObj *ring) {
@@ -83,15 +84,42 @@ static void mvtReverseRingDirection(lineObj *ring) {
}
}
+static void mvtReorderRings(shapeObj *shape, int *outers) {
+ int i, j;
+ int t1;
+ lineObj t2;
+
+ for(i=0; i<(shape->numlines-1); i++) {
+ for(j=0; j<(shape->numlines-i-1); j++) {
+ if(outers[j] < outers[j+1]) {
+ /* swap */
+ t1 = outers[j];
+ outers[j] = outers[j+1];
+ outers[j+1] = t1;
+
+ t2 = shape->line[j];
+ shape->line[j] = shape->line[j+1];
+ shape->line[j+1] = t2;
+ }
+ }
+ }
+}
+
static int mvtTransformShape(shapeObj *shape, rectObj *extent, int layer_type, int mvt_layer_extent) {
double scale_x,scale_y;
int i,j,outj;
- int ring_direction, is_outer_ring;
+ int *outers=NULL, ring_direction;
scale_x = (double)mvt_layer_extent/(extent->maxx - extent->minx);
scale_y = (double)mvt_layer_extent/(extent->maxy - extent->miny);
+ if(layer_type == MS_LAYER_POLYGON) {
+ outers = msGetOuterList(shape); /* compute before we muck with the shape */
+ if(outers[0] == 0) /* first ring must be an outer */
+ mvtReorderRings(shape, outers);
+ }
+
for(i=0;i<shape->numlines;i++) {
for(j=0,outj=0;j<shape->line[i].numpoints;j++) {
@@ -103,14 +131,17 @@ static int mvtTransformShape(shapeObj *shape, rectObj *extent, int layer_type, i
}
shape->line[i].numpoints = outj;
- is_outer_ring = msIsOuterRing(shape, i);
- ring_direction = mvtGetRingDirection(&shape->line[i]);
-
- if( (layer_type==MS_LAYER_POLYGON) && ((ring_direction != MS_DIRECTION_INVALID_RING) && ((is_outer_ring && ring_direction != MS_DIRECTION_CLOCKWISE) || (!is_outer_ring && ring_direction != MS_DIRECTION_COUNTERCLOCKWISE))))
- mvtReverseRingDirection(&shape->line[i]);
+ if(layer_type == MS_LAYER_POLYGON) {
+ ring_direction = mvtGetRingDirection(&shape->line[i]);
+ if(ring_direction == MS_DIRECTION_INVALID_RING)
+ shape->line[i].numpoints = 0; /* so it's not considered anymore */
+ else if((outers[i] && ring_direction != MS_DIRECTION_CLOCKWISE) || (!outers[i] && ring_direction != MS_DIRECTION_COUNTERCLOCKWISE))
+ mvtReverseRingDirection(&shape->line[i]);
+ }
}
msComputeBounds(shape); /* TODO: might need to limit this to just valid parts... */
+ msFree(outers);
return (shape->numlines == 0)?MS_FAILURE:MS_SUCCESS; /* sucess if at least one line */
}
@@ -126,7 +157,8 @@ static int mvtClipShape(shapeObj *shape, int layer_type, int buffer, int mvt_lay
msClipPolylineRect(shape, tile_rect);
}
- if(shape->numlines>0)
+ /* success if at least one line and not a degenerate bounding box */
+ if(shape->numlines > 0 && (shape->bounds.minx != shape->bounds.maxx || shape->bounds.miny != shape->bounds.maxy))
return MS_SUCCESS;
else
return MS_FAILURE;
@@ -194,9 +226,9 @@ int mvtWriteShape( layerObj *layer, shapeObj *shape, VectorTile__Tile__Layer *mv
} else if(layer->type == MS_LAYER_LINE) {
for(i=0;i<shape->numlines;i++)
if(shape->line[i].numpoints >= 2) n_geometry += 2 + shape->line[i].numpoints * 2; /* one MOVETO, one LINETO */
- } else {
+ } else { /* MS_LAYER_POLYGON */
for(i=0;i<shape->numlines;i++)
- if(shape->line[i].numpoints >= 4) n_geometry += 3 + shape->line[i].numpoints * 2; /* one MOVETO, one LINETO, one CLOSEPATH */
+ if(shape->line[i].numpoints >= 4) n_geometry += 3 + (shape->line[i].numpoints-1) * 2; /* one MOVETO, one LINETO, one CLOSEPATH (don't consider last duplicate point) */
}
if(n_geometry == 0) return MS_SUCCESS;
@@ -274,6 +306,7 @@ int mvtWriteShape( layerObj *layer, shapeObj *shape, VectorTile__Tile__Layer *mv
}
}
} else { /* MS_LAYER_LINE or MS_LAYER_POLYGON */
+ int numpoints;
int idx=0, lastx=0, lasty=0;
for(i=0;i<shape->numlines;i++) {
@@ -282,11 +315,12 @@ int mvtWriteShape( layerObj *layer, shapeObj *shape, VectorTile__Tile__Layer *mv
continue; /* skip malformed parts */
}
- for(j=0;j<shape->line[i].numpoints;j++) {
+ numpoints = (layer->type == MS_LAYER_LINE)?shape->line[i].numpoints:(shape->line[i].numpoints-1); /* don't consider last point for polygons */
+ for(j=0;j<numpoints;j++) {
if(j==0) {
mvt_feature->geometry[idx++] = COMMAND(MOVETO, 1);
} else if(j==1) {
- mvt_feature->geometry[idx++] = COMMAND(LINETO, shape->line[i].numpoints-1);
+ mvt_feature->geometry[idx++] = COMMAND(LINETO, numpoints-1);
}
mvt_feature->geometry[idx++] = PARAMETER(MS_NINT(shape->line[i].point[j].x)-lastx);
mvt_feature->geometry[idx++] = PARAMETER(MS_NINT(shape->line[i].point[j].y)-lasty);
=====================================
mapstring.c
=====================================
--- a/mapstring.c
+++ b/mapstring.c
@@ -2103,22 +2103,26 @@ int msStringIsInteger(const char *string)
/* Safe version of msStrdup(). This function is taken from gdal/cpl. */
-char *msStrdup( const char * pszString )
+char *msStrdup(const char * pszString)
{
- char *pszReturn;
+ size_t nStringLength;
+ char *pszReturn;
- if( pszString == NULL )
- pszString = "";
+ if (pszString == NULL)
+ pszString = "";
- pszReturn = strdup( pszString );
+ nStringLength = strlen(pszString) + 1; /* null terminated byte */
+ pszReturn = malloc(nStringLength);
- if( pszReturn == NULL ) {
- fprintf(stderr, "msSmallMsStrdup(): Out of memory allocating %ld bytes.\n",
- (long) strlen(pszString) );
- exit(1);
- }
+ if (pszReturn == NULL) {
+ fprintf(stderr, "msSmallMalloc(): Out of memory allocating %ld bytes.\n",
+ (long)strlen(pszString));
+ exit(1);
+ }
+
+ memcpy(pszReturn, pszString, nStringLength);
- return( pszReturn );
+ return pszReturn;
}
=====================================
mapwfs.c
=====================================
--- a/mapwfs.c
+++ b/mapwfs.c
@@ -1684,6 +1684,7 @@ static void msWFSGetFeature_PrintBasePrevNextURI(cgiRequestObj *req,
}
}
+
static void msWFSGetFeature_GetTimeStamp(char* timestring, size_t timestringlen)
{
struct tm *now;
=====================================
scripts/vagrant/mapserver.sh
=====================================
--- a/scripts/vagrant/mapserver.sh
+++ b/scripts/vagrant/mapserver.sh
@@ -3,14 +3,6 @@
NUMTHREADS=2 # we have 2 cpus configured
export NUMTHREADS
-cd /tmp
-wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.38.tar.bz2
-tar xjf harfbuzz-0.9.38.tar.bz2
-cd harfbuzz-0.9.38
-./configure --without-cairo --without-glib --without-icu
-make -j $NUMTHREADS
-sudo make install && sudo ldconfig
-
cd /vagrant
cd msautotest
=====================================
scripts/vagrant/packages.sh
=====================================
--- a/scripts/vagrant/packages.sh
+++ b/scripts/vagrant/packages.sh
@@ -13,8 +13,8 @@ apt-get -y upgrade
# install packages we need
apt-get install -q -y git build-essential pkg-config cmake libgeos-dev rake \
libpq-dev python-all-dev libproj-dev libxml2-dev postgis php5-dev \
- postgresql-server-dev-9.1 postgresql-9.1-postgis-2.1 vim bison flex swig \
+ postgresql-server-dev-9.3 postgresql-9.3-postgis-2.2 vim bison flex swig \
librsvg2-dev libpng12-dev libjpeg-dev libgif-dev \
libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev \
libgdal1-dev libfribidi-dev libexempi-dev \
- libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler
+ libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler libharfbuzz-dev gdal-bin
=====================================
scripts/vagrant/postgis.sh
=====================================
--- a/scripts/vagrant/postgis.sh
+++ b/scripts/vagrant/postgis.sh
@@ -2,8 +2,8 @@
cd /vagrant/msautotest
-sed -i 's/md5/trust/' /etc/postgresql/9.1/main/pg_hba.conf
-sed -i 's/peer/trust/' /etc/postgresql/9.1/main/pg_hba.conf
+sed -i 's/md5/trust/' /etc/postgresql/9.3/main/pg_hba.conf
+sed -i 's/peer/trust/' /etc/postgresql/9.3/main/pg_hba.conf
service postgresql restart
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/commit/7ae62cbf678aba3106924e40c26b2b6b3be5c335
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/commit/7ae62cbf678aba3106924e40c26b2b6b3be5c335
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180724/569ce52a/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list