Commit e3399435 authored by Bas Couwenberg's avatar Bas Couwenberg

New upstream version 7.4.0~beta2

parent a0fb5c6d
......@@ -18,7 +18,7 @@ include(CheckCSourceCompiles)
set (MapServer_VERSION_MAJOR 7)
set (MapServer_VERSION_MINOR 4)
set (MapServer_VERSION_REVISION 0)
set (MapServer_VERSION_SUFFIX "-beta1")
set (MapServer_VERSION_SUFFIX "-beta2")
set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR})
set(TARGET_VERSION_MINOR ${MapServer_VERSION_MINOR})
......
......@@ -12,6 +12,15 @@ For a complete change history, please see the Git log comments. For more
details about recent point releases, please see the online changelog at:
http://mapserver.org/development/changelog/
7.4.0-beta2 release (2019-4-17)
-------------------------------
- Addresses XSS issue with [layers] template tag (fix available in 6.4, 7.0 and 7.2 branches as well)
- Added Perl/Mapscript to Travis CI
- No other major changes, see detailed changelog for bug fixes
7.4.0-beta1 release (2019-3-29)
-------------------------------
......
......@@ -3,12 +3,13 @@ PHP_MAPSCRIPT=build/mapscript/php/php_mapscript.so
PYTHON_MAPSCRIPT_PATH=build/mapscript/python
JAVA_MAPSCRIPT_PATH=build/mapscript/java
CSHARP_MAPSCRIPT_PATH=build/mapscript/csharp
PERL_MAPSCRIPT_PATH=build/mapscript/perl
BUILDPATH=../../build
FLEX=flex
YACC=yacc
CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 \
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 -DWITH_PERL=1 \
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1 -DWITH_POINT_Z_M=1
all: cmakebuild
......@@ -50,11 +51,23 @@ java-testcase:
csharp-testcase:
test -d "$(CSHARP_MAPSCRIPT_PATH)" && (export CSHARP_MAPSCRIPT_SO="../../$(CSHARP_MAPSCRIPT_PATH)" && cd mapscript/csharp && ./run_test.sh)
perl-testcase:
cd "$(PERL_MAPSCRIPT_PATH)" \
&& PERL5LIB=`pwd` \
&& prove tests \
&& perl examples/RFC24.pl ../../../tests/test.map \
&& perl examples/shp_in_shp.pl --infile1 ../../../tests/line.shp --infile1_shpid 0 --infile2 ../../../tests/polygon.shp --infile2_shpid 0 \
&& perl examples/dump.pl --file ../../../tests/line.shp \
&& perl examples/thin.pl --input ../../../tests/polygon --output examples/junk --tolerance=5
test: cmakebuild
@$(MAKE) $(MFLAGS) wxs-testcase renderers-testcase misc-testcase gdal-testcase query-testcase mspython-testcase
@./print-test-results.sh
@$(MAKE) $(MFLAGS) php-testcase
@$(MAKE) $(MFLAGS) csharp-testcase
@$(MAKE) $(MFLAGS) perl-testcase
lexer: maplexer.c
......
......@@ -355,7 +355,7 @@ int KmlRenderer::startNewLayer(imageObj *img, layerObj *layer)
/*check for image path and image url*/
if (layer->map->debug && (layer->map->web.imageurl == NULL || layer->map->web.imagepath == NULL))
msDebug("KmlRenderer::startNewLayer: imagepath and imageurl sould be set in the web object\n");
msDebug("KmlRenderer::startNewLayer: imagepath and imageurl should be set in the web object\n");
/*map rect for ground overlay*/
......
......@@ -247,6 +247,7 @@ typedef struct ms_MSSQL2008_layer_info_t {
char *user_srid; /* zero length = calculate, non-zero means using this value! */
char *index_name; /* hopefully this isn't necessary - but if the optimizer ain't cuttin' it... */
char *sort_spec; /* the sort by specification which should be applied to the generated select statement */
int mssqlversion_major; /* the sql server major version number */
SQLSMALLINT *itemtypes; /* storing the sql field types for further reference */
msODBCconn * conn; /* Connection to db */
......@@ -973,6 +974,7 @@ int msMSSQL2008LayerOpen(layerObj *layer)
layerinfo->sort_spec = NULL;
layerinfo->conn = NULL;
layerinfo->itemtypes = NULL;
layerinfo->mssqlversion_major = 0;
layerinfo->conn = (msODBCconn *) msConnPoolRequest(layer);
......@@ -1102,26 +1104,162 @@ int msMSSQL2008LayerInitItemInfo(layerObj *layer)
return MS_SUCCESS;
}
static int getMSSQLMajorVersion(layerObj* layer)
{
msMSSQL2008LayerInfo *layerinfo = getMSSQL2008LayerInfo(layer);
if (layerinfo == NULL)
return 0;
if (layerinfo->mssqlversion_major == 0) {
char* mssqlversion_major = msLayerGetProcessingKey(layer, "MSSQL_VERSION_MAJOR");
if (mssqlversion_major != NULL) {
layerinfo->mssqlversion_major = atoi(mssqlversion_major);
}
else {
/* need to query from database */
if (executeSQL(layerinfo->conn, "SELECT SERVERPROPERTY('ProductVersion')")) {
SQLRETURN rc = SQLFetch(layerinfo->conn->hstmt);
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
/* process results */
char result_data[256];
SQLLEN retLen = 0;
rc = SQLGetData(layerinfo->conn->hstmt, 1, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
if (rc != SQL_ERROR) {
result_data[retLen] = 0;
layerinfo->mssqlversion_major = atoi(result_data);
}
}
}
}
}
return layerinfo->mssqlversion_major;
}
/* Get the layer extent as specified in the mapfile or a largest area */
/* covering all features */
int msMSSQL2008LayerGetExtent(layerObj *layer, rectObj *extent)
{
if(layer->debug) {
msDebug("msMSSQL2008LayerGetExtent called\n");
}
msMSSQL2008LayerInfo *layerinfo;
char *query = 0;
char result_data[256];
SQLLEN retLen;
SQLRETURN rc;
if(layer->debug) {
msDebug("msMSSQL2008LayerGetExtent called\n");
}
if (layer->extent.minx == -1.0 && layer->extent.miny == -1.0 &&
layer->extent.maxx == -1.0 && layer->extent.maxy == -1.0) {
extent->minx = extent->miny = -1.0 * FLT_MAX;
extent->maxx = extent->maxy = FLT_MAX;
} else {
extent->minx = layer->extent.minx;
extent->miny = layer->extent.miny;
extent->maxx = layer->extent.maxx;
extent->maxy = layer->extent.maxy;
}
if (!(layer->extent.minx == -1.0 && layer->extent.miny == -1.0 &&
layer->extent.maxx == -1.0 && layer->extent.maxy == -1.0)) {
/* extent was already set */
extent->minx = layer->extent.minx;
extent->miny = layer->extent.miny;
extent->maxx = layer->extent.maxx;
extent->maxy = layer->extent.maxy;
}
return MS_SUCCESS;
layerinfo = getMSSQL2008LayerInfo(layer);
if (!layerinfo) {
msSetError(MS_QUERYERR, "GetExtent called with layerinfo = NULL", "msMSSQL2008LayerGetExtent()");
return MS_FAILURE;
}
/* set up statement */
if (getMSSQLMajorVersion(layer) >= 11) {
if (strcasecmp(layerinfo->geom_column_type, "geography") == 0) {
query = msStringConcatenate(query, "WITH extent(extentcol) AS (SELECT geometry::EnvelopeAggregate(geometry::STGeomFromWKB(");
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".STAsBinary(), ");
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".STSrid)");
}
else {
query = msStringConcatenate(query, "WITH extent(extentcol) AS (SELECT geometry::EnvelopeAggregate(");
query = msStringConcatenate(query, layerinfo->geom_column);
}
query = msStringConcatenate(query, ".MakeValid()) AS extentcol FROM ");
query = msStringConcatenate(query, layerinfo->geom_table);
query = msStringConcatenate(query, ") SELECT extentcol.STPointN(1).STX, extentcol.STPointN(1).STY, extentcol.STPointN(3).STX, extentcol.STPointN(3).STY FROM extent");
}
else {
if (strcasecmp(layerinfo->geom_column_type, "geography") == 0) {
query = msStringConcatenate(query, "WITH ENVELOPE as (SELECT geometry::STGeomFromWKB(");
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".STAsBinary(), ");
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".STSrid)");
}
else {
query = msStringConcatenate(query, "WITH ENVELOPE as (SELECT ");
query = msStringConcatenate(query, layerinfo->geom_column);
}
query = msStringConcatenate(query, ".MakeValid().STEnvelope() as envelope from ");
query = msStringConcatenate(query, layerinfo->geom_table);
query = msStringConcatenate(query, "), CORNERS as (SELECT envelope.STPointN(1) as point from ENVELOPE UNION ALL select envelope.STPointN(3) from ENVELOPE) SELECT MIN(point.STX), MIN(point.STY), MAX(point.STX), MAX(point.STY) FROM CORNERS");
}
if (!executeSQL(layerinfo->conn, query)) {
msFree(query);
return MS_FAILURE;
}
msFree(query);
/* process results */
rc = SQLFetch(layerinfo->conn->hstmt);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
if (layer->debug) {
msDebug("msMSSQL2008LayerGetExtent: No results found.\n");
}
return MS_FAILURE;
}
rc = SQLGetData(layerinfo->conn->hstmt, 1, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
if (rc == SQL_ERROR) {
msSetError(MS_QUERYERR, "Failed to get MinX value", "msMSSQL2008LayerGetExtent()");
return MS_FAILURE;
}
result_data[retLen] = 0;
extent->minx = atof(result_data);
rc = SQLGetData(layerinfo->conn->hstmt, 2, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
if (rc == SQL_ERROR) {
msSetError(MS_QUERYERR, "Failed to get MinY value", "msMSSQL2008LayerGetExtent()");
return MS_FAILURE;
}
result_data[retLen] = 0;
extent->miny = atof(result_data);
rc = SQLGetData(layerinfo->conn->hstmt, 3, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
if (rc == SQL_ERROR) {
msSetError(MS_QUERYERR, "Failed to get MaxX value", "msMSSQL2008LayerGetExtent()");
return MS_FAILURE;
}
result_data[retLen] = 0;
extent->maxx = atof(result_data);
rc = SQLGetData(layerinfo->conn->hstmt, 4, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
if (rc == SQL_ERROR) {
msSetError(MS_QUERYERR, "Failed to get MaxY value", "msMSSQL2008LayerGetExtent()");
return MS_FAILURE;
}
result_data[retLen] = 0;
extent->maxy = atof(result_data);
return MS_SUCCESS;
}
/* Get the layer feature count */
......@@ -1358,19 +1496,15 @@ static int prepare_database(layerObj *layer, rectObj rect, char **query_string)
}
/* adding spatial filter */
msMSSQL2008LayerGetExtent(layer, &extent);
if (rect.minx > extent.minx || rect.miny > extent.miny ||
rect.maxx < extent.maxx || rect.maxy < extent.maxy) {
if (hasFilter == MS_FALSE)
query = msStringConcatenate(query, " WHERE ");
else
query = msStringConcatenate(query, " AND ");
if (hasFilter == MS_FALSE)
query = msStringConcatenate(query, " WHERE ");
else
query = msStringConcatenate(query, " AND ");
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".STIntersects(");
query = msStringConcatenate(query, box3d);
query = msStringConcatenate(query, ") = 1 ");
}
query = msStringConcatenate(query, layerinfo->geom_column);
query = msStringConcatenate(query, ".MakeValid().STIntersects(");
query = msStringConcatenate(query, box3d);
query = msStringConcatenate(query, ") = 1 ");
if (layerinfo->sort_spec)
query = msStringConcatenate(query, layerinfo->sort_spec);
......
......@@ -3171,7 +3171,7 @@ int FLTCheckFeatureIdFilters(FilterEncodingNode *psFilterNode,
tokens = msStringSplit(psFilterNode->pszValue,',', &nTokens);
for (j=0; j<nTokens; j++) {
const char* pszId = tokens[j];
const char* pszDot = strchr(pszId, '.');
const char* pszDot = strrchr(pszId, '.');
if( pszDot )
{
if( pszDot - pszId != strlen(lp->name) ||
......
......@@ -645,7 +645,7 @@ char *FLTGetFeatureIdCommonExpression(FilterEncodingNode *psFilterNode, layerObj
char *pszTmp = NULL;
int bufferSize = 0;
const char* pszId = tokens[i];
const char* pszDot = strchr(pszId, '.');
const char* pszDot = strrchr(pszId, '.');
if( pszDot )
pszId = pszDot + 1;
......
......@@ -806,7 +806,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
lineObj ring;
/* pointObj ringPoints[NUMBER_OF_SAMPLE_POINTS*4+4]; */
pointObj *ringPoints;
int ix, iy;
int ix, iy, ixy;
double dx, dy;
......@@ -841,7 +841,8 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
}
/* -------------------------------------------------------------------- */
/* Build polygon as steps around the source rectangle. */
/* Build polygon as steps around the source rectangle */
/* and possibly its diagonal. */
/* -------------------------------------------------------------------- */
dx = (rect->maxx - rect->minx)/NUMBER_OF_SAMPLE_POINTS;
dy = (rect->maxy - rect->miny)/NUMBER_OF_SAMPLE_POINTS;
......@@ -857,7 +858,8 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
return MS_SUCCESS;
}
ringPoints = (pointObj*) calloc(sizeof(pointObj),NUMBER_OF_SAMPLE_POINTS*4+4);
/* If there is more than two sample points we will also get samples from the diagonal line */
ringPoints = (pointObj*) calloc(sizeof(pointObj),NUMBER_OF_SAMPLE_POINTS*5+3);
ring.point = ringPoints;
ring.numpoints = 0;
......@@ -872,7 +874,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
}
}
/* sample on along right side */
/* sample along right side */
if(dy != 0) {
for(iy = 1; iy <= NUMBER_OF_SAMPLE_POINTS; iy++ ) {
ringPoints[ring.numpoints].x = rect->maxx;
......@@ -888,7 +890,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
}
}
/* sample on along left side */
/* sample along left side */
if(dy != 0) {
for(iy = NUMBER_OF_SAMPLE_POINTS-1; iy >= 0; iy-- ) {
ringPoints[ring.numpoints].x = rect->minx;
......@@ -896,6 +898,17 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
}
}
/* sample along diagonal line */
/* This is done to handle cases where reprojection from world covering projection to one */
/* which isn't could cause min and max values of the projected rectangle to be invalid */
if(dy != 0 && dx != 0) {
/* No need to compute corners as they've already been computed */
for(ixy = NUMBER_OF_SAMPLE_POINTS-2; ixy >= 1; ixy-- ) {
ringPoints[ring.numpoints].x = rect->minx + ixy * dx;
ringPoints[ring.numpoints++].y = rect->miny + ixy * dy;
}
}
msAddLineDirectly( &polygonObj, &ring );
#ifdef notdef
......
......@@ -25,3 +25,6 @@ endif(APPLE)
install(FILES $<TARGET_FILE:${SWIG_MODULE_perlmapscript_REAL_NAME}> DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR}/auto/mapscript)
install(FILES $<TARGET_FILE_DIR:${SWIG_MODULE_perlmapscript_REAL_NAME}>/mapscript.pm DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
#!/usr/bin/perl
use strict;
use warnings;
use mapscript;
$file=$ARGV[0];
use Data::Dumper;
my $file=$ARGV[0];
# utility
sub assertNotNull {
......@@ -12,13 +16,6 @@ sub assertNotNull {
}
}
sub dumpHash {
my ($hashmap) = @_;
print "Dumping hashmap: $hashmap\n";
for my $k ( keys %$hashmap ) {
print "\t".$k.": ".$hashmap{$k}."\n";
}
}
# layerObj
sub testGetLayerObj {
......@@ -49,7 +46,7 @@ sub testInsertLayerObj {
my $position = $map->insertLayer($layer);
$map = undef;
assertNotNull( $position == 7 , "testInsertLayerObj position");
assertNotNull( $layer->{map} , "testInsertLayerObj notnull");
assertNotNull( $layer->{map} , "testInsertLayerObj notnull");
}
# classObj
......@@ -83,7 +80,7 @@ sub testInsertClassObj {
my $position = $layer->insertClass($clazz);
$map = undef; $layer=undef;
assertNotNull( $position == 2 , "testInsertClassObj position");
assertNotNull( $clazz->{layer} , "testInsertClassObj notnull");
assertNotNull( $clazz->{layer} , "testInsertClassObj notnull");
}
if ( ! $file ) {
......@@ -99,8 +96,9 @@ testGetClassObj;
testClassObj;
testInsertClassObj;
$hashmap=mapscript::getPARENT_PTRS();
my $hashmap = mapscript::getPARENT_PTRS();
assertNotNull( keys( %$hashmap )==0 , "checking that hashmap of parent ptrs is empty");
print "No of keys:".keys( %$hashmap )."\n";
dumpHash($hashmap);
#dumpHash($hashmap);
print Dumper( $hashmap );
......@@ -9,8 +9,6 @@
use strict;
use warnings;
use POSIX;
use XBase;
use mapscript;
use Getopt::Long;
use File::Copy;
......@@ -19,7 +17,8 @@ my ($infile1, $infile1_shpid, $infile2, $infile2_shpid, $within);
GetOptions("infile1=s", \$infile1, "infile1_shpid=s", \$infile1_shpid, "infile2=s", \$infile2, "infile2_shpid=s", \$infile2_shpid);
if(!$infile1 or !$infile1_shpid or !$infile2 or !$infile2_shpid) {
# shpid can be zero, which looks false, so use defined()
if(!$infile1 or !defined($infile1_shpid) or !$infile2 or !defined($infile2_shpid)) {
print "Usage: $0 --infile1=[filename] --infile1_shpid=[shpid] --infile2=[filename] --infile2_shpid=[shpid]\n";
exit 0;
}
......
......@@ -10,8 +10,6 @@
use strict;
use warnings;
use POSIX;
use XBase;
use mapscript;
use Getopt::Long;
use File::Copy;
......
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 11;
# check the mapserver version for keywords
sub msHas
{
my ($mod) = @_;
my $ver = mapscript::msGetVersion();
if (index($ver, $mod) > -1) {
return 1;
} else {
return 0;
}
}
require_ok( 'mapscript' );
diag("Testing: " . $INC{'mapscript.pm'});
diag( mapscript::msGetVersion() );
SKIP: {
skip "no geos support", 10 unless msHas('SUPPORTS=GEOS');
my @wkt_list = (
'POINT (5.0000000000000000 7.0000000000000000)',
'LINESTRING (5.0000000000000000 7.0000000000000000, 7.0000000000000000 9.0000000000000000, 9.0000000000000000 -1.0000000000000000)',
'POLYGON ((500.0000000000000000 500.0000000000000000, 3500.0000000000000000 500.0000000000000000, 3500.0000000000000000 2500.0000000000000000, 500.0000000000000000 2500.0000000000000000, 500.0000000000000000 500.0000000000000000), (1000.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1000.0000000000000000))',
'MULTIPOINT (2000.0000000000000000 2000.0000000000000000, 2000.0000000000000000 1900.0000000000000000)',
'MULTILINESTRING ((600.0000000000000000 1500.0000000000000000, 1600.0000000000000000 2500.0000000000000000), (700.0000000000000000 1500.0000000000000000, 1700.0000000000000000 2500.0000000000000000))'
);
for my $orig (@wkt_list)
{
my $shp = mapscript::shapeObj::fromWKT( $orig );
ok( $shp, 'create shapeObj');
my $new_wkt = $shp->toWKT();
ok( $orig eq $new_wkt, 'from WKT <> toWKT' );
}
};
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 10;
use mapscript;
sub msHas
{
my ($mod) = @_;
my $ver = mapscript::msGetVersion();
if (index($ver, $mod) > -1) {
return 1;
} else {
return 0;
}
}
# we need to search up directories for the test folder
my $mapfile = '../../../msautotest/mspython/test_mapio.map';
if (! -e $mapfile)
{
$mapfile = '../../../../msautotest/mspython/test_mapio.map';
}
ok(-e $mapfile, 'mapfile exists');
my $map = new mapscript::mapObj($mapfile);
ok($map, 'create mapObj');
mapscript::msIO_installStdoutToBuffer();
my $owreq = new mapscript::OWSRequest();
ok($owreq, 'create OWSRequest');
$owreq->loadParamsFromURL('service=WMS&version=1.1.1&request=GetMap&layers=grey&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&width=80&height=40');
ok($owreq->getName(0) eq 'service');
ok($owreq->getValue(0) eq 'WMS');
ok($owreq->getValueByName('request') eq 'GetMap');
my $err = $map->OWSDispatch( $owreq );
ok($err == 0, 'OWSDispatch');
# warn(mapscript::msGetErrorString("\n"));
my $h = mapscript::msIO_getAndStripStdoutBufferMimeHeaders();
#my $k = $h->nextKey();
#while ($k)
#{
# diag("$k == " . $h->get($k));
# $k = $h->nextKey($k);
#}
ok($h->get('Cache-Control') eq 'max-age=86400');
ok($h->get('Content-Type') eq 'image/png');
my $x = mapscript::msIO_getStdoutBufferBytes();
#open(F, '>', 'x.png');
#print F $$x;
#close(F);
ok(substr($$x, 1, 3) eq 'PNG');
......@@ -43,4 +43,4 @@ target_link_libraries(php_mapscript ${MAPSERVER_LIBMAPSERVER})
ENDIF(WIN32)
set_target_properties(php_mapscript PROPERTIES PREFIX "")
#install(TARGETS php_mapscript DESTINATION ${PHP_EXTENSION_DIR})
install(TARGETS php_mapscript DESTINATION ${PHP_EXTENSION_DIR})
This diff is collapsed.
......@@ -22,17 +22,17 @@ add_definitions(-DZTS=1)
endif(WITH_THREAD_SAFETY)
endif(WIN32)
include_directories(${PHP_FOUND_INCLUDE_PATH})
include_directories(${PHP_FOUND_INCLUDE_PATH}/main)
include_directories(${PHP_FOUND_INCLUDE_PATH}/Zend)
include_directories(${PHP_FOUND_INCLUDE_PATH}/TSRM)
include_directories(${PHP_INCLUDE_PATH})
include_directories(${PHP_INCLUDE_PATH}/main)
include_directories(${PHP_INCLUDE_PATH}/Zend)
include_directories(${PHP_INCLUDE_PATH}/TSRM)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/phpng)
if(WIN32)
include_directories(${PHP_FOUND_INCLUDE_PATH}/win32)
include_directories(${PHP_INCLUDE_PATH}/win32)
endif(WIN32)
IF(PHP_VERSION LESS 5)
......@@ -56,4 +56,4 @@ target_link_libraries(php_mapscriptng mapserver)
set_target_properties(${SWIG_MODULE_mapscript_REAL_NAME} PROPERTIES PREFIX "")
if(NOT WIN32)
install(TARGETS php_mapscriptng DESTINATION ${PHP_EXTENSION_DIR})
endif()
\ No newline at end of file
endif()
#!/usr/bin/env python
"""
Simple example to read a csv file and reproject point x/y data
......
#!/usr/bin/env python
"""
Dump the contents of the passed in Shapefile
......
#!/usr/bin/env python
"""
Extracts basic descriptive information from a Shapefile
......
#!/usr/bin/env python
"""
Output WMS GetCapabilities response for a Mapfile
......
/* ===========================================================================
$Id$
Project: MapServer
Purpose: SWIG interface file for mapscript imageObj extensions
Author: Steve Lime
Author: Steve Lime
Sean Gillies, sgillies@frii.com
===========================================================================
Copyright (c) 1996-2001 Regents of the University of Minnesota.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
......@@ -29,7 +29,7 @@
=========================================================================*/
%extend imageObj {
/* imageObj constructor now takes filename as an optional argument. */
imageObj(int width, int height, outputFormatObj *input_format=NULL,
const char *file=NULL,
......@@ -55,19 +55,30 @@
}
if (file) {
renderer = format->vtable;
rb = (rasterBufferObj*) malloc(sizeof(rasterBufferObj));
if (!rb) {
msSetError(MS_MEMERR, NULL, "imageObj()");
return NULL;
}
if ( (renderer->loadImageFromFile((char *)file, rb)) == MS_FAILURE)
if ( (renderer->loadImageFromFile((char *)file, rb)) == MS_FAILURE) {
msFreeRasterBuffer(rb);
free(rb);
return NULL;
image = msImageCreate(rb->width, rb->height, format, NULL, NULL,
}
image = msImageCreate(rb->width, rb->height, format, NULL, NULL,
resolution, defresolution, NULL);
renderer->mergeRasterBuffer(image, rb, 1.0, 0, 0, 0, 0, rb->width, rb->height);
if (! image) {
msFreeRasterBuffer(rb);
free(rb);
return NULL;
}
if(renderer->mergeRasterBuffer(image, rb, 1.0, 0, 0, 0, 0, rb->width, rb->height) != MS_SUCCESS) {
msFreeImage(image);
image = NULL;
}
msFreeRasterBuffer(rb);
free(rb);
......@@ -79,13 +90,13 @@
return image;
}
~imageObj()
~imageObj()
{
msFreeImage(self);
msFreeImage(self);
}
/* saveGeo - see Bugzilla issue 549 */
void save(char *filename, mapObj *map=NULL)
/* saveGeo - see Bugzilla issue 549 */
void save(char *filename, mapObj *map=NULL)
{
msSaveImage(map, self, filename );
}
......@@ -119,7 +130,8 @@
else
{
msSetError(MS_IMGERR, "Writing of %s format not implemented",
"imageObj::write");
"imageObj::write",
self->format->name);
}
return retval;
......@@ -136,15 +148,15 @@