205 lines
7.0 KiB
Diff
205 lines
7.0 KiB
Diff
diff -rupN --no-dereference mapserver-rel-7-4-3/mapscript/csharp/swig_csharp_extensions.i mapserver-rel-7-4-3-new/mapscript/csharp/swig_csharp_extensions.i
|
|
--- mapserver-rel-7-4-3/mapscript/csharp/swig_csharp_extensions.i 2019-12-16 18:59:03.000000000 +0100
|
|
+++ mapserver-rel-7-4-3-new/mapscript/csharp/swig_csharp_extensions.i 2020-03-03 18:55:31.278654827 +0100
|
|
@@ -224,17 +224,20 @@
|
|
}
|
|
%}
|
|
|
|
+#if SWIG_VERSION < 0x040000
|
|
%typemap(csfinalize) SWIGTYPE %{
|
|
/* %typemap(csfinalize) SWIGTYPE */
|
|
~$csclassname() {
|
|
Dispose();
|
|
}
|
|
%}
|
|
+#endif
|
|
|
|
%typemap(csconstruct, excode=SWIGEXCODE) SWIGTYPE %{: this($imcall, true, null) {$excode
|
|
}
|
|
%}
|
|
|
|
+#if SWIG_VERSION < 0x040000
|
|
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
|
|
lock(this) {
|
|
if(swigCPtr.Handle != System.IntPtr.Zero && swigCMemOwn) {
|
|
@@ -246,6 +249,7 @@
|
|
System.GC.SuppressFinalize(this);
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
|
lock(this) {
|
|
diff -rupN --no-dereference mapserver-rel-7-4-3/mapscript/python/pyextend.i mapserver-rel-7-4-3-new/mapscript/python/pyextend.i
|
|
--- mapserver-rel-7-4-3/mapscript/python/pyextend.i 2019-12-16 18:59:03.000000000 +0100
|
|
+++ mapserver-rel-7-4-3-new/mapscript/python/pyextend.i 2020-03-03 18:55:31.277654829 +0100
|
|
@@ -13,6 +13,7 @@
|
|
*
|
|
*****************************************************************************/
|
|
|
|
+
|
|
/* fromstring: Factory for mapfile objects */
|
|
|
|
%pythoncode %{
|
|
@@ -222,15 +223,13 @@ def fromstring(data, mappath=None):
|
|
}
|
|
}
|
|
|
|
- def getItemDefinitions(self):
|
|
- return self._item_definitions
|
|
+ @property
|
|
+ def itemdefinitions(self):
|
|
+ return self._item_definitions
|
|
|
|
- def setItemDefinitions(self, item_definitions):
|
|
+ @itemdefinitions.setter
|
|
+ def itemdefinitions(self, item_definitions):
|
|
self._item_definitions = item_definitions
|
|
-
|
|
- __swig_getmethods__["itemdefinitions"] = getItemDefinitions
|
|
- __swig_setmethods__["itemdefinitions"] = setItemDefinitions
|
|
-
|
|
%}
|
|
}
|
|
|
|
@@ -426,25 +425,14 @@ def fromstring(data, mappath=None):
|
|
memcpy( *argout, self->pattern, sizeof(double) * *pnListSize);
|
|
}
|
|
|
|
- void patternlength_set2(int patternlength)
|
|
- {
|
|
- msSetError(MS_MISCERR, "pattern is read-only", "patternlength_set()");
|
|
- }
|
|
|
|
%pythoncode %{
|
|
|
|
- __swig_setmethods__["patternlength"] = _mapscript.styleObj_patternlength_set2
|
|
- __swig_getmethods__["patternlength"] = _mapscript.styleObj_patternlength_get
|
|
- if _newclass:patternlength = _swig_property(_mapscript.styleObj_patternlength_get, _mapscript.styleObj_patternlength_set2)
|
|
-
|
|
- __swig_setmethods__["pattern"] = _mapscript.styleObj_pattern_set
|
|
- __swig_getmethods__["pattern"] = _mapscript.styleObj_pattern_get
|
|
- if _newclass:pattern = _swig_property(_mapscript.styleObj_pattern_get, _mapscript.styleObj_pattern_set)
|
|
-%}
|
|
+pattern = property(pattern_get, pattern_set)
|
|
|
|
+%}
|
|
}
|
|
|
|
-
|
|
/******************************************************************************
|
|
* Extensions to hashTableObj - add dict methods
|
|
*****************************************************************************/
|
|
diff -rupN --no-dereference mapserver-rel-7-4-3/mapscript/python/pymodule.i mapserver-rel-7-4-3-new/mapscript/python/pymodule.i
|
|
--- mapserver-rel-7-4-3/mapscript/python/pymodule.i 2019-12-16 18:59:03.000000000 +0100
|
|
+++ mapserver-rel-7-4-3-new/mapscript/python/pymodule.i 2020-03-03 18:55:31.277654829 +0100
|
|
@@ -17,7 +17,7 @@
|
|
*****************************************************************************/
|
|
|
|
/* Translates Python None to C NULL for strings */
|
|
-%typemap(in,parse="z") char * "";
|
|
+//%typemap(in,parse="z") char * "";
|
|
|
|
/* To support imageObj::getBytes */
|
|
%typemap(out) gdBuffer {
|
|
@@ -210,33 +210,15 @@ MapServerError = _mapscript.MapServerErr
|
|
MapServerChildError = _mapscript.MapServerChildError
|
|
%}
|
|
|
|
-/* The bogus "if 1:" is to introduce a new scope to work around indentation
|
|
- handling with pythonappend in different versions. (#3180) */
|
|
-%feature("pythonappend") layerObj %{if 1:
|
|
- self.p_map=None
|
|
- try:
|
|
- # python 2.5
|
|
- if args and len(args)!=0:
|
|
- self.p_map=args[0]
|
|
- except NameError:
|
|
- # python 2.6
|
|
- if map:
|
|
- self.p_map=map
|
|
- %}
|
|
-
|
|
-/* The bogus "if 1:" is to introduce a new scope to work around indentation
|
|
- handling with pythonappend in different versions. (#3180) */
|
|
-%feature("pythonappend") classObj %{if 1:
|
|
- self.p_layer =None
|
|
- try:
|
|
- # python 2.5
|
|
- if args and len(args)!=0:
|
|
- self.p_layer=args[0]
|
|
- except NameError:
|
|
- # python 2.6
|
|
- if layer:
|
|
- self.p_layer=layer
|
|
- %}
|
|
+%feature("pythonappend") layerObj %{
|
|
+ self.p_map = None
|
|
+ if map:
|
|
+ self.p_map = map%}
|
|
+
|
|
+%feature("pythonappend") classObj %{
|
|
+ self.p_layer = None
|
|
+ if layer:
|
|
+ self.p_layer = layer%}
|
|
|
|
%feature("shadow") insertClass %{
|
|
def insertClass(*args):
|
|
diff -rupN --no-dereference mapserver-rel-7-4-3/mapscript/python/tests/cases/style_test.py mapserver-rel-7-4-3-new/mapscript/python/tests/cases/style_test.py
|
|
--- mapserver-rel-7-4-3/mapscript/python/tests/cases/style_test.py 2019-12-16 18:59:03.000000000 +0100
|
|
+++ mapserver-rel-7-4-3-new/mapscript/python/tests/cases/style_test.py 2020-03-03 18:55:31.278654827 +0100
|
|
@@ -175,6 +175,53 @@ class NewStylesTestCase(MapTestCase):
|
|
self.assertRaises(mapscript.MapServerChildError,
|
|
class0.insertStyle, None)
|
|
|
|
+ def testPattern(self):
|
|
+ """See https://github.com/mapserver/mapserver/issues/4943"""
|
|
+
|
|
+ si = mapscript.styleObj()
|
|
+ assert si.pattern == ()
|
|
+ assert si.patternlength == 0
|
|
+
|
|
+ def testPattern2(self):
|
|
+
|
|
+ si = mapscript.styleObj()
|
|
+ si.pattern = [2.0, 3, 4]
|
|
+ assert si.pattern == (2.0, 3.0, 4.0)
|
|
+ assert si.patternlength == 3
|
|
+
|
|
+ def testPattern3(self):
|
|
+ """a pattern must have at least 2 elements"""
|
|
+
|
|
+ si = mapscript.styleObj()
|
|
+ exception = None
|
|
+ try:
|
|
+ si.pattern = [1.0]
|
|
+ except Exception:
|
|
+ exception = True
|
|
+ assert exception is True
|
|
+
|
|
+ def testPattern4(self):
|
|
+ """a pattern can have a max of 10 elements
|
|
+ This is set in mapsymbol.h with #define MS_MAXPATTERNLENGTH 10"""
|
|
+
|
|
+ si = mapscript.styleObj()
|
|
+ exception = None
|
|
+ try:
|
|
+ si.pattern = [i for i in range(11)]
|
|
+ except Exception:
|
|
+ exception = True
|
|
+ assert exception is True
|
|
+
|
|
+ def testPattern5(self):
|
|
+ """pattern length is read-only"""
|
|
+ si = mapscript.styleObj()
|
|
+ exception = None
|
|
+ try:
|
|
+ si.patternlength = 0
|
|
+ except Exception:
|
|
+ exception = True
|
|
+ assert exception is True
|
|
+
|
|
|
|
class BrushCachingTestCase(MapTestCase):
|
|
|