You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jd...@us...> - 2007-11-16 15:58:28
|
Revision: 4336 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4336&view=rev Author: jdh2358 Date: 2007-11-16 07:58:05 -0800 (Fri, 16 Nov 2007) Log Message: ----------- fixed bug in polyfit, polyval deprecation Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-16 15:56:34 UTC (rev 4335) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-16 15:58:05 UTC (rev 4336) @@ -442,6 +442,7 @@ kw = dict(rowvar=False) return npy.corrcoef(*args, **kw) + def polyfit(*args, **kwargs): """ def polyfit(x,y,N) @@ -482,7 +483,7 @@ """ warnings.warn("use numpy.poyfit", DeprecationWarning) - return npy.polyfit(*args, **kw) + return npy.polyfit(*args, **kwargs) @@ -504,9 +505,8 @@ """ warnings.warn("use numpy.polyval", DeprecationWarning) - return npy.polyval(*args, **kw) + return npy.polyval(*args, **kwargs) - def vander(*args, **kwargs): """ X = vander(x,N=None) @@ -2262,7 +2262,8 @@ return x class FormatInt(FormatObj): - pass + def toval(self, x): + return x class FormatPercent(FormatFloat): def __init__(self, precision=4): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-16 15:56:42
|
Revision: 4335 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4335&view=rev Author: jswhit Date: 2007-11-16 07:56:34 -0800 (Fri, 16 Nov 2007) Log Message: ----------- remove reference to pupynere Modified Paths: -------------- trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py Modified: trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py =================================================================== --- trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py 2007-11-16 15:54:31 UTC (rev 4334) +++ trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py 2007-11-16 15:56:34 UTC (rev 4335) @@ -19,10 +19,6 @@ locally orthogonal to each other. POP grids are used extensively locally in oceanographic and ice models. - -This example uses the pupynere pure-python netCDF 3 reader -from Roberto De Almeida for reading netCDF files (included). - """ import pylab as pl from matplotlib import rcParams This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-16 15:54:42
|
Revision: 4334 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4334&view=rev Author: jswhit Date: 2007-11-16 07:54:31 -0800 (Fri, 16 Nov 2007) Log Message: ----------- move pupynere.py Added Paths: ----------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/pupynere.py Removed Paths: ------------- trunk/toolkits/basemap-testing/examples/pupynere.py Deleted: trunk/toolkits/basemap-testing/examples/pupynere.py =================================================================== --- trunk/toolkits/basemap-testing/examples/pupynere.py 2007-11-16 15:53:57 UTC (rev 4333) +++ trunk/toolkits/basemap-testing/examples/pupynere.py 2007-11-16 15:54:31 UTC (rev 4334) @@ -1,251 +0,0 @@ -"""NetCDF reader. - -Pupynere implements a PUre PYthon NEtcdf REader. -""" - -__author__ = "Roberto De Almeida <ro...@py...>" - - -import struct -import itertools -import mmap - -from numpy import ndarray, zeros, array - - -ABSENT = '\x00' * 8 -ZERO = '\x00' * 4 -NC_BYTE = '\x00\x00\x00\x01' -NC_CHAR = '\x00\x00\x00\x02' -NC_SHORT = '\x00\x00\x00\x03' -NC_INT = '\x00\x00\x00\x04' -NC_FLOAT = '\x00\x00\x00\x05' -NC_DOUBLE = '\x00\x00\x00\x06' -NC_DIMENSION = '\x00\x00\x00\n' -NC_VARIABLE = '\x00\x00\x00\x0b' -NC_ATTRIBUTE = '\x00\x00\x00\x0c' - - -class NetCDFFile(object): - """A NetCDF file parser.""" - - def __init__(self, file): - self._buffer = open(file, 'rb') - self._parse() - - def read(self, size=-1): - """Alias for reading the file buffer.""" - return self._buffer.read(size) - - def _parse(self): - """Initial parsing of the header.""" - # Check magic bytes. - assert self.read(3) == 'CDF' - - # Read version byte. - byte = self.read(1) - self.version_byte = struct.unpack('>b', byte)[0] - - # Read header info. - self._numrecs() - self._dim_array() - self._gatt_array() - self._var_array() - - def _numrecs(self): - """Read number of records.""" - self._nrecs = self._unpack_int() - - def _dim_array(self): - """Read a dict with dimensions names and sizes.""" - assert self.read(4) in [ZERO, NC_DIMENSION] - count = self._unpack_int() - - self.dimensions = {} - self._dims = [] - for dim in range(count): - name = self._read_string() - length = self._unpack_int() - if length == 0: length = None # record dimension - self.dimensions[name] = length - self._dims.append(name) # preserve dim order - - def _gatt_array(self): - """Read global attributes.""" - self.attributes = self._att_array() - - # Update __dict__ for compatibility with S.IO.N - self.__dict__.update(self.attributes) - - def _att_array(self): - """Read a dict with attributes.""" - assert self.read(4) in [ZERO, NC_ATTRIBUTE] - count = self._unpack_int() - - # Read attributes. - attributes = {} - for attribute in range(count): - name = self._read_string() - nc_type = self._unpack_int() - n = self._unpack_int() - - # Read value for attributes. - attributes[name] = self._read_values(n, nc_type) - - return attributes - - def _var_array(self): - """Read all variables.""" - assert self.read(4) in [ZERO, NC_VARIABLE] - - # Read size of each record, in bytes. - self._read_recsize() - - # Read variables. - self.variables = {} - count = self._unpack_int() - for variable in range(count): - name = self._read_string() - self.variables[name] = self._read_var() - - def _read_recsize(self): - """Read all variables and compute record bytes.""" - pos = self._buffer.tell() - - recsize = 0 - count = self._unpack_int() - for variable in range(count): - name = self._read_string() - n = self._unpack_int() - isrec = False - for i in range(n): - dimid = self._unpack_int() - name = self._dims[dimid] - dim = self.dimensions[name] - if dim is None and i == 0: - isrec = True - attributes = self._att_array() - nc_type = self._unpack_int() - vsize = self._unpack_int() - begin = [self._unpack_int, self._unpack_int64][self.version_byte-1]() - - if isrec: recsize += vsize - - self._recsize = recsize - self._buffer.seek(pos) - - def _read_var(self): - dimensions = [] - shape = [] - n = self._unpack_int() - isrec = False - for i in range(n): - dimid = self._unpack_int() - name = self._dims[dimid] - dimensions.append(name) - dim = self.dimensions[name] - if dim is None and i == 0: - dim = self._nrecs - isrec = True - shape.append(dim) - dimensions = tuple(dimensions) - shape = tuple(shape) - - attributes = self._att_array() - nc_type = self._unpack_int() - vsize = self._unpack_int() - - # Read offset. - begin = [self._unpack_int, self._unpack_int64][self.version_byte-1]() - - return NetCDFVariable(self._buffer.fileno(), nc_type, vsize, begin, shape, dimensions, attributes, isrec, self._recsize) - - def _read_values(self, n, nc_type): - bytes = [1, 1, 2, 4, 4, 8] - typecodes = ['b', 'c', 'h', 'i', 'f', 'd'] - - count = n * bytes[nc_type-1] - values = self.read(count) - padding = self.read((4 - (count % 4)) % 4) - - typecode = typecodes[nc_type-1] - if nc_type != 2: # not char - values = struct.unpack('>%s' % (typecode * n), values) - values = array(values, dtype=typecode) - else: - # Remove EOL terminator. - if values.endswith('\x00'): values = values[:-1] - - return values - - def _unpack_int(self): - return struct.unpack('>i', self.read(4))[0] - _unpack_int32 = _unpack_int - - def _unpack_int64(self): - return struct.unpack('>q', self.read(8))[0] - - def _read_string(self): - count = struct.unpack('>i', self.read(4))[0] - s = self.read(count) - # Remove EOL terminator. - if s.endswith('\x00'): s = s[:-1] - padding = self.read((4 - (count % 4)) % 4) - return s - - def close(self): - self._buffer.close() - - -class NetCDFVariable(object): - def __init__(self, fileno, nc_type, vsize, begin, shape, dimensions, attributes, isrec=False, recsize=0): - self._nc_type = nc_type - self._vsize = vsize - self._begin = begin - self.shape = shape - self.dimensions = dimensions - self.attributes = attributes # for ``dap.plugins.netcdf`` - self.__dict__.update(attributes) - self._is_record = isrec - - # Number of bytes and type. - self._bytes = [1, 1, 2, 4, 4, 8][self._nc_type-1] - type_ = ['i', 'S', 'i', 'i', 'f', 'f'][self._nc_type-1] - dtype = '>%s%d' % (type_, self._bytes) - bytes = self._begin + self._vsize - - if isrec: - # Record variables are not stored contiguosly on disk, so we - # need to create a separate array for each record. - self.__array_data__ = zeros(shape, dtype) - bytes += (shape[0] - 1) * recsize - for n in range(shape[0]): - offset = self._begin + (n * recsize) - mm = mmap.mmap(fileno, bytes, access=mmap.ACCESS_READ) - self.__array_data__[n] = ndarray.__new__(ndarray, shape[1:], dtype=dtype, buffer=mm, offset=offset, order=0) - else: - # Create buffer and data. - mm = mmap.mmap(fileno, bytes, access=mmap.ACCESS_READ) - self.__array_data__ = ndarray.__new__(ndarray, shape, dtype=dtype, buffer=mm, offset=self._begin, order=0) - - # N-D array interface - self.__array_interface__ = {'shape' : shape, - 'typestr': dtype, - 'data' : self.__array_data__, - 'version': 3, - } - - def __getitem__(self, index): - return self.__array_data__.__getitem__(index) - - def getValue(self): - """For scalars.""" - return self.__array_data__.item() - - def typecode(self): - return ['b', 'c', 'h', 'i', 'f', 'd'][self._nc_type-1] - - -def _test(): - import doctest - doctest.testmod() Added: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/pupynere.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/pupynere.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/pupynere.py 2007-11-16 15:54:31 UTC (rev 4334) @@ -0,0 +1,272 @@ +"""NetCDF reader. + +Pupynere implements a PUre PYthon NEtcdf REader. + +Copyright (c) 2003-2006 Roberto De Almeida <ro...@py...> + +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 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +__author__ = "Roberto De Almeida <ro...@py...>" + + +import struct +import itertools +import mmap + +from numpy import ndarray, zeros, array + + +ABSENT = '\x00' * 8 +ZERO = '\x00' * 4 +NC_BYTE = '\x00\x00\x00\x01' +NC_CHAR = '\x00\x00\x00\x02' +NC_SHORT = '\x00\x00\x00\x03' +NC_INT = '\x00\x00\x00\x04' +NC_FLOAT = '\x00\x00\x00\x05' +NC_DOUBLE = '\x00\x00\x00\x06' +NC_DIMENSION = '\x00\x00\x00\n' +NC_VARIABLE = '\x00\x00\x00\x0b' +NC_ATTRIBUTE = '\x00\x00\x00\x0c' + + +class NetCDFFile(object): + """A NetCDF file parser.""" + + def __init__(self, file): + self._buffer = open(file, 'rb') + self._parse() + + def read(self, size=-1): + """Alias for reading the file buffer.""" + return self._buffer.read(size) + + def _parse(self): + """Initial parsing of the header.""" + # Check magic bytes. + assert self.read(3) == 'CDF' + + # Read version byte. + byte = self.read(1) + self.version_byte = struct.unpack('>b', byte)[0] + + # Read header info. + self._numrecs() + self._dim_array() + self._gatt_array() + self._var_array() + + def _numrecs(self): + """Read number of records.""" + self._nrecs = self._unpack_int() + + def _dim_array(self): + """Read a dict with dimensions names and sizes.""" + assert self.read(4) in [ZERO, NC_DIMENSION] + count = self._unpack_int() + + self.dimensions = {} + self._dims = [] + for dim in range(count): + name = self._read_string() + length = self._unpack_int() + if length == 0: length = None # record dimension + self.dimensions[name] = length + self._dims.append(name) # preserve dim order + + def _gatt_array(self): + """Read global attributes.""" + self.attributes = self._att_array() + + # Update __dict__ for compatibility with S.IO.N + self.__dict__.update(self.attributes) + + def _att_array(self): + """Read a dict with attributes.""" + assert self.read(4) in [ZERO, NC_ATTRIBUTE] + count = self._unpack_int() + + # Read attributes. + attributes = {} + for attribute in range(count): + name = self._read_string() + nc_type = self._unpack_int() + n = self._unpack_int() + + # Read value for attributes. + attributes[name] = self._read_values(n, nc_type) + + return attributes + + def _var_array(self): + """Read all variables.""" + assert self.read(4) in [ZERO, NC_VARIABLE] + + # Read size of each record, in bytes. + self._read_recsize() + + # Read variables. + self.variables = {} + count = self._unpack_int() + for variable in range(count): + name = self._read_string() + self.variables[name] = self._read_var() + + def _read_recsize(self): + """Read all variables and compute record bytes.""" + pos = self._buffer.tell() + + recsize = 0 + count = self._unpack_int() + for variable in range(count): + name = self._read_string() + n = self._unpack_int() + isrec = False + for i in range(n): + dimid = self._unpack_int() + name = self._dims[dimid] + dim = self.dimensions[name] + if dim is None and i == 0: + isrec = True + attributes = self._att_array() + nc_type = self._unpack_int() + vsize = self._unpack_int() + begin = [self._unpack_int, self._unpack_int64][self.version_byte-1]() + + if isrec: recsize += vsize + + self._recsize = recsize + self._buffer.seek(pos) + + def _read_var(self): + dimensions = [] + shape = [] + n = self._unpack_int() + isrec = False + for i in range(n): + dimid = self._unpack_int() + name = self._dims[dimid] + dimensions.append(name) + dim = self.dimensions[name] + if dim is None and i == 0: + dim = self._nrecs + isrec = True + shape.append(dim) + dimensions = tuple(dimensions) + shape = tuple(shape) + + attributes = self._att_array() + nc_type = self._unpack_int() + vsize = self._unpack_int() + + # Read offset. + begin = [self._unpack_int, self._unpack_int64][self.version_byte-1]() + + return NetCDFVariable(self._buffer.fileno(), nc_type, vsize, begin, shape, dimensions, attributes, isrec, self._recsize) + + def _read_values(self, n, nc_type): + bytes = [1, 1, 2, 4, 4, 8] + typecodes = ['b', 'c', 'h', 'i', 'f', 'd'] + + count = n * bytes[nc_type-1] + values = self.read(count) + padding = self.read((4 - (count % 4)) % 4) + + typecode = typecodes[nc_type-1] + if nc_type != 2: # not char + values = struct.unpack('>%s' % (typecode * n), values) + values = array(values, dtype=typecode) + else: + # Remove EOL terminator. + if values.endswith('\x00'): values = values[:-1] + + return values + + def _unpack_int(self): + return struct.unpack('>i', self.read(4))[0] + _unpack_int32 = _unpack_int + + def _unpack_int64(self): + return struct.unpack('>q', self.read(8))[0] + + def _read_string(self): + count = struct.unpack('>i', self.read(4))[0] + s = self.read(count) + # Remove EOL terminator. + if s.endswith('\x00'): s = s[:-1] + padding = self.read((4 - (count % 4)) % 4) + return s + + def close(self): + self._buffer.close() + + +class NetCDFVariable(object): + def __init__(self, fileno, nc_type, vsize, begin, shape, dimensions, attributes, isrec=False, recsize=0): + self._nc_type = nc_type + self._vsize = vsize + self._begin = begin + self.shape = shape + self.dimensions = dimensions + self.attributes = attributes # for ``dap.plugins.netcdf`` + self.__dict__.update(attributes) + self._is_record = isrec + + # Number of bytes and type. + self._bytes = [1, 1, 2, 4, 4, 8][self._nc_type-1] + type_ = ['i', 'S', 'i', 'i', 'f', 'f'][self._nc_type-1] + dtype = '>%s%d' % (type_, self._bytes) + bytes = self._begin + self._vsize + + if isrec: + # Record variables are not stored contiguosly on disk, so we + # need to create a separate array for each record. + self.__array_data__ = zeros(shape, dtype) + bytes += (shape[0] - 1) * recsize + for n in range(shape[0]): + offset = self._begin + (n * recsize) + mm = mmap.mmap(fileno, bytes, access=mmap.ACCESS_READ) + self.__array_data__[n] = ndarray.__new__(ndarray, shape[1:], dtype=dtype, buffer=mm, offset=offset, order=0) + else: + # Create buffer and data. + mm = mmap.mmap(fileno, bytes, access=mmap.ACCESS_READ) + self.__array_data__ = ndarray.__new__(ndarray, shape, dtype=dtype, buffer=mm, offset=self._begin, order=0) + + # N-D array interface + self.__array_interface__ = {'shape' : shape, + 'typestr': dtype, + 'data' : self.__array_data__, + 'version': 3, + } + + def __getitem__(self, index): + return self.__array_data__.__getitem__(index) + + def getValue(self): + """For scalars.""" + return self.__array_data__.item() + + def typecode(self): + return ['b', 'c', 'h', 'i', 'f', 'd'][self._nc_type-1] + + +def _test(): + import doctest + doctest.testmod() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-16 15:54:04
|
Revision: 4333 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4333&view=rev Author: mdboom Date: 2007-11-16 07:53:57 -0800 (Fri, 16 Nov 2007) Log Message: ----------- Upgrade to Agg 2.4; Stop building Agg SWIG wrappers and remove small dependency on them. Modified Paths: -------------- branches/transforms/lib/matplotlib/mpl.py branches/transforms/setup.py branches/transforms/setupext.py branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h branches/transforms/src/_image.cpp Added Paths: ----------- branches/transforms/agg24/ branches/transforms/agg24/include/ branches/transforms/agg24/include/agg_alpha_mask_u8.h branches/transforms/agg24/include/agg_arc.h branches/transforms/agg24/include/agg_array.h branches/transforms/agg24/include/agg_arrowhead.h branches/transforms/agg24/include/agg_basics.h branches/transforms/agg24/include/agg_bezier_arc.h branches/transforms/agg24/include/agg_bitset_iterator.h branches/transforms/agg24/include/agg_blur.h branches/transforms/agg24/include/agg_bounding_rect.h branches/transforms/agg24/include/agg_bspline.h branches/transforms/agg24/include/agg_clip_liang_barsky.h branches/transforms/agg24/include/agg_color_gray.h branches/transforms/agg24/include/agg_color_rgba.h branches/transforms/agg24/include/agg_config.h branches/transforms/agg24/include/agg_conv_adaptor_vcgen.h branches/transforms/agg24/include/agg_conv_adaptor_vpgen.h branches/transforms/agg24/include/agg_conv_bspline.h branches/transforms/agg24/include/agg_conv_clip_polygon.h branches/transforms/agg24/include/agg_conv_clip_polyline.h branches/transforms/agg24/include/agg_conv_close_polygon.h branches/transforms/agg24/include/agg_conv_concat.h branches/transforms/agg24/include/agg_conv_contour.h branches/transforms/agg24/include/agg_conv_curve.h branches/transforms/agg24/include/agg_conv_dash.h branches/transforms/agg24/include/agg_conv_gpc.h branches/transforms/agg24/include/agg_conv_marker.h branches/transforms/agg24/include/agg_conv_marker_adaptor.h branches/transforms/agg24/include/agg_conv_segmentator.h branches/transforms/agg24/include/agg_conv_shorten_path.h branches/transforms/agg24/include/agg_conv_smooth_poly1.h branches/transforms/agg24/include/agg_conv_stroke.h branches/transforms/agg24/include/agg_conv_transform.h branches/transforms/agg24/include/agg_conv_unclose_polygon.h branches/transforms/agg24/include/agg_curves.h branches/transforms/agg24/include/agg_dda_line.h branches/transforms/agg24/include/agg_ellipse.h branches/transforms/agg24/include/agg_ellipse_bresenham.h branches/transforms/agg24/include/agg_embedded_raster_fonts.h branches/transforms/agg24/include/agg_font_cache_manager.h branches/transforms/agg24/include/agg_gamma_functions.h branches/transforms/agg24/include/agg_gamma_lut.h branches/transforms/agg24/include/agg_glyph_raster_bin.h branches/transforms/agg24/include/agg_gradient_lut.h branches/transforms/agg24/include/agg_gsv_text.h branches/transforms/agg24/include/agg_image_accessors.h branches/transforms/agg24/include/agg_image_filters.h branches/transforms/agg24/include/agg_line_aa_basics.h branches/transforms/agg24/include/agg_math.h branches/transforms/agg24/include/agg_math_stroke.h branches/transforms/agg24/include/agg_path_length.h branches/transforms/agg24/include/agg_path_storage.h branches/transforms/agg24/include/agg_path_storage_integer.h branches/transforms/agg24/include/agg_pattern_filters_rgba.h branches/transforms/agg24/include/agg_pixfmt_amask_adaptor.h branches/transforms/agg24/include/agg_pixfmt_gray.h branches/transforms/agg24/include/agg_pixfmt_rgb.h branches/transforms/agg24/include/agg_pixfmt_rgb_packed.h branches/transforms/agg24/include/agg_pixfmt_rgba.h branches/transforms/agg24/include/agg_pixfmt_transposer.h branches/transforms/agg24/include/agg_rasterizer_cells_aa.h branches/transforms/agg24/include/agg_rasterizer_compound_aa.h branches/transforms/agg24/include/agg_rasterizer_outline.h branches/transforms/agg24/include/agg_rasterizer_outline_aa.h branches/transforms/agg24/include/agg_rasterizer_scanline_aa.h branches/transforms/agg24/include/agg_rasterizer_sl_clip.h branches/transforms/agg24/include/agg_renderer_base.h branches/transforms/agg24/include/agg_renderer_markers.h branches/transforms/agg24/include/agg_renderer_mclip.h branches/transforms/agg24/include/agg_renderer_outline_aa.h branches/transforms/agg24/include/agg_renderer_outline_image.h branches/transforms/agg24/include/agg_renderer_primitives.h branches/transforms/agg24/include/agg_renderer_raster_text.h branches/transforms/agg24/include/agg_renderer_scanline.h branches/transforms/agg24/include/agg_rendering_buffer.h branches/transforms/agg24/include/agg_rendering_buffer_dynarow.h branches/transforms/agg24/include/agg_rounded_rect.h branches/transforms/agg24/include/agg_scanline_bin.h branches/transforms/agg24/include/agg_scanline_boolean_algebra.h branches/transforms/agg24/include/agg_scanline_p.h branches/transforms/agg24/include/agg_scanline_storage_aa.h branches/transforms/agg24/include/agg_scanline_storage_bin.h branches/transforms/agg24/include/agg_scanline_u.h branches/transforms/agg24/include/agg_shorten_path.h branches/transforms/agg24/include/agg_simul_eq.h branches/transforms/agg24/include/agg_span_allocator.h branches/transforms/agg24/include/agg_span_converter.h branches/transforms/agg24/include/agg_span_gouraud.h branches/transforms/agg24/include/agg_span_gouraud_gray.h branches/transforms/agg24/include/agg_span_gouraud_rgba.h branches/transforms/agg24/include/agg_span_gradient.h branches/transforms/agg24/include/agg_span_gradient_alpha.h branches/transforms/agg24/include/agg_span_image_filter.h branches/transforms/agg24/include/agg_span_image_filter_gray.h branches/transforms/agg24/include/agg_span_image_filter_rgb.h branches/transforms/agg24/include/agg_span_image_filter_rgba.h branches/transforms/agg24/include/agg_span_interpolator_adaptor.h branches/transforms/agg24/include/agg_span_interpolator_linear.h branches/transforms/agg24/include/agg_span_interpolator_persp.h branches/transforms/agg24/include/agg_span_interpolator_trans.h branches/transforms/agg24/include/agg_span_pattern_gray.h branches/transforms/agg24/include/agg_span_pattern_rgb.h branches/transforms/agg24/include/agg_span_pattern_rgba.h branches/transforms/agg24/include/agg_span_solid.h branches/transforms/agg24/include/agg_span_subdiv_adaptor.h branches/transforms/agg24/include/agg_trans_affine.h branches/transforms/agg24/include/agg_trans_bilinear.h branches/transforms/agg24/include/agg_trans_double_path.h branches/transforms/agg24/include/agg_trans_perspective.h branches/transforms/agg24/include/agg_trans_single_path.h branches/transforms/agg24/include/agg_trans_viewport.h branches/transforms/agg24/include/agg_trans_warp_magnifier.h branches/transforms/agg24/include/agg_vcgen_bspline.h branches/transforms/agg24/include/agg_vcgen_contour.h branches/transforms/agg24/include/agg_vcgen_dash.h branches/transforms/agg24/include/agg_vcgen_markers_term.h branches/transforms/agg24/include/agg_vcgen_smooth_poly1.h branches/transforms/agg24/include/agg_vcgen_stroke.h branches/transforms/agg24/include/agg_vcgen_vertex_sequence.h branches/transforms/agg24/include/agg_vertex_sequence.h branches/transforms/agg24/include/agg_vpgen_clip_polygon.h branches/transforms/agg24/include/agg_vpgen_clip_polyline.h branches/transforms/agg24/include/agg_vpgen_segmentator.h branches/transforms/agg24/include/ctrl/ branches/transforms/agg24/include/ctrl/agg_bezier_ctrl.h branches/transforms/agg24/include/ctrl/agg_cbox_ctrl.h branches/transforms/agg24/include/ctrl/agg_ctrl.h branches/transforms/agg24/include/ctrl/agg_gamma_ctrl.h branches/transforms/agg24/include/ctrl/agg_gamma_spline.h branches/transforms/agg24/include/ctrl/agg_polygon_ctrl.h branches/transforms/agg24/include/ctrl/agg_rbox_ctrl.h branches/transforms/agg24/include/ctrl/agg_scale_ctrl.h branches/transforms/agg24/include/ctrl/agg_slider_ctrl.h branches/transforms/agg24/include/ctrl/agg_spline_ctrl.h branches/transforms/agg24/include/platform/ branches/transforms/agg24/include/platform/agg_platform_support.h branches/transforms/agg24/include/platform/mac/ branches/transforms/agg24/include/platform/mac/agg_mac_pmap.h branches/transforms/agg24/include/platform/win32/ branches/transforms/agg24/include/platform/win32/agg_win32_bmp.h branches/transforms/agg24/include/util/ branches/transforms/agg24/include/util/agg_color_conv.h branches/transforms/agg24/include/util/agg_color_conv_rgb16.h branches/transforms/agg24/include/util/agg_color_conv_rgb8.h branches/transforms/agg24/src/ branches/transforms/agg24/src/ChangeLog branches/transforms/agg24/src/agg_arc.cpp branches/transforms/agg24/src/agg_arrowhead.cpp branches/transforms/agg24/src/agg_bezier_arc.cpp branches/transforms/agg24/src/agg_bspline.cpp branches/transforms/agg24/src/agg_curves.cpp branches/transforms/agg24/src/agg_embedded_raster_fonts.cpp branches/transforms/agg24/src/agg_gsv_text.cpp branches/transforms/agg24/src/agg_image_filters.cpp branches/transforms/agg24/src/agg_line_aa_basics.cpp branches/transforms/agg24/src/agg_line_profile_aa.cpp branches/transforms/agg24/src/agg_rounded_rect.cpp branches/transforms/agg24/src/agg_sqrt_tables.cpp branches/transforms/agg24/src/agg_trans_affine.cpp branches/transforms/agg24/src/agg_trans_double_path.cpp branches/transforms/agg24/src/agg_trans_single_path.cpp branches/transforms/agg24/src/agg_trans_warp_magnifier.cpp branches/transforms/agg24/src/agg_vcgen_bspline.cpp branches/transforms/agg24/src/agg_vcgen_contour.cpp branches/transforms/agg24/src/agg_vcgen_dash.cpp branches/transforms/agg24/src/agg_vcgen_markers_term.cpp branches/transforms/agg24/src/agg_vcgen_smooth_poly1.cpp branches/transforms/agg24/src/agg_vcgen_stroke.cpp branches/transforms/agg24/src/agg_vpgen_clip_polygon.cpp branches/transforms/agg24/src/agg_vpgen_clip_polyline.cpp branches/transforms/agg24/src/agg_vpgen_segmentator.cpp branches/transforms/agg24/src/authors branches/transforms/agg24/src/copying branches/transforms/agg24/src/ctrl/ branches/transforms/agg24/src/ctrl/agg_bezier_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_cbox_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_gamma_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_gamma_spline.cpp branches/transforms/agg24/src/ctrl/agg_polygon_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_rbox_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_scale_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_slider_ctrl.cpp branches/transforms/agg24/src/ctrl/agg_spline_ctrl.cpp branches/transforms/agg24/src/platform/ branches/transforms/agg24/src/platform/AmigaOS/ branches/transforms/agg24/src/platform/AmigaOS/agg_platform_support.cpp branches/transforms/agg24/src/platform/BeOS/ branches/transforms/agg24/src/platform/BeOS/agg_platform_support.cpp branches/transforms/agg24/src/platform/X11/ branches/transforms/agg24/src/platform/X11/agg_platform_support.cpp branches/transforms/agg24/src/platform/mac/ branches/transforms/agg24/src/platform/mac/agg_mac_pmap.cpp branches/transforms/agg24/src/platform/mac/agg_platform_support.cpp branches/transforms/agg24/src/platform/sdl/ branches/transforms/agg24/src/platform/sdl/agg_platform_support.cpp branches/transforms/agg24/src/platform/win32/ branches/transforms/agg24/src/platform/win32/agg_platform_support.cpp branches/transforms/agg24/src/platform/win32/agg_win32_bmp.cpp Removed Paths: ------------- branches/transforms/agg23/ Added: branches/transforms/agg24/include/agg_alpha_mask_u8.h =================================================================== --- branches/transforms/agg24/include/agg_alpha_mask_u8.h (rev 0) +++ branches/transforms/agg24/include/agg_alpha_mask_u8.h 2007-11-16 15:53:57 UTC (rev 4333) @@ -0,0 +1,499 @@ +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mc...@an... +// mcs...@ya... +// http://www.antigrain.com +//---------------------------------------------------------------------------- +// +// scanline_u8 class +// +//---------------------------------------------------------------------------- +#ifndef AGG_ALPHA_MASK_U8_INCLUDED +#define AGG_ALPHA_MASK_U8_INCLUDED + +#include <string.h> +#include "agg_basics.h" +#include "agg_rendering_buffer.h" + +namespace agg +{ + //===================================================one_component_mask_u8 + struct one_component_mask_u8 + { + static unsigned calculate(const int8u* p) { return *p; } + }; + + + //=====================================================rgb_to_gray_mask_u8 + template<unsigned R, unsigned G, unsigned B> + struct rgb_to_gray_mask_u8 + { + static unsigned calculate(const int8u* p) + { + return (p[R]*77 + p[G]*150 + p[B]*29) >> 8; + } + }; + + //==========================================================alpha_mask_u8 + template<unsigned Step=1, unsigned Offset=0, class MaskF=one_component_mask_u8> + class alpha_mask_u8 + { + public: + typedef int8u cover_type; + typedef alpha_mask_u8<Step, Offset, MaskF> self_type; + enum cover_scale_e + { + cover_shift = 8, + cover_none = 0, + cover_full = 255 + }; + + alpha_mask_u8() : m_rbuf(0) {} + explicit alpha_mask_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} + + void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } + + MaskF& mask_function() { return m_mask_function; } + const MaskF& mask_function() const { return m_mask_function; } + + + //-------------------------------------------------------------------- + cover_type pixel(int x, int y) const + { + if(x >= 0 && y >= 0 && + x < (int)m_rbuf->width() && + y < (int)m_rbuf->height()) + { + return (cover_type)m_mask_function.calculate( + m_rbuf->row_ptr(y) + x * Step + Offset); + } + return 0; + } + + //-------------------------------------------------------------------- + cover_type combine_pixel(int x, int y, cover_type val) const + { + if(x >= 0 && y >= 0 && + x < (int)m_rbuf->width() && + y < (int)m_rbuf->height()) + { + return (cover_type)((cover_full + val * + m_mask_function.calculate( + m_rbuf->row_ptr(y) + x * Step + Offset)) >> + cover_shift); + } + return 0; + } + + + //-------------------------------------------------------------------- + void fill_hspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; + + int count = num_pix; + cover_type* covers = dst; + + if(y < 0 || y > ymax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + + if(x < 0) + { + count += x; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -x * sizeof(cover_type)); + covers -= x; + x = 0; + } + + if(x + count > xmax) + { + int rest = x + count - xmax - 1; + count -= rest; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } + + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers++ = (cover_type)m_mask_function.calculate(mask); + mask += Step; + } + while(--count); + } + + + //-------------------------------------------------------------------- + void combine_hspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; + + int count = num_pix; + cover_type* covers = dst; + + if(y < 0 || y > ymax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + + if(x < 0) + { + count += x; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -x * sizeof(cover_type)); + covers -= x; + x = 0; + } + + if(x + count > xmax) + { + int rest = x + count - xmax - 1; + count -= rest; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } + + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers = (cover_type)((cover_full + (*covers) * + m_mask_function.calculate(mask)) >> + cover_shift); + ++covers; + mask += Step; + } + while(--count); + } + + //-------------------------------------------------------------------- + void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; + + int count = num_pix; + cover_type* covers = dst; + + if(x < 0 || x > xmax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + + if(y < 0) + { + count += y; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -y * sizeof(cover_type)); + covers -= y; + y = 0; + } + + if(y + count > ymax) + { + int rest = y + count - ymax - 1; + count -= rest; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } + + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers++ = (cover_type)m_mask_function.calculate(mask); + mask += m_rbuf->stride(); + } + while(--count); + } + + //-------------------------------------------------------------------- + void combine_vspan(int x, int y, cover_type* dst, int num_pix) const + { + int xmax = m_rbuf->width() - 1; + int ymax = m_rbuf->height() - 1; + + int count = num_pix; + cover_type* covers = dst; + + if(x < 0 || x > xmax) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + + if(y < 0) + { + count += y; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers, 0, -y * sizeof(cover_type)); + covers -= y; + y = 0; + } + + if(y + count > ymax) + { + int rest = y + count - ymax - 1; + count -= rest; + if(count <= 0) + { + memset(dst, 0, num_pix * sizeof(cover_type)); + return; + } + memset(covers + count, 0, rest * sizeof(cover_type)); + } + + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *covers = (cover_type)((cover_full + (*covers) * + m_mask_function.calculate(mask)) >> + cover_shift); + ++covers; + mask += m_rbuf->stride(); + } + while(--count); + } + + + private: + alpha_mask_u8(const self_type&); + const self_type& operator = (const self_type&); + + rendering_buffer* m_rbuf; + MaskF m_mask_function; + }; + + + typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8 + + typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r + typedef alpha_mask_u8<3, 1> alpha_mask_rgb24g; //----alpha_mask_rgb24g + typedef alpha_mask_u8<3, 2> alpha_mask_rgb24b; //----alpha_mask_rgb24b + + typedef alpha_mask_u8<3, 2> alpha_mask_bgr24r; //----alpha_mask_bgr24r + typedef alpha_mask_u8<3, 1> alpha_mask_bgr24g; //----alpha_mask_bgr24g + typedef alpha_mask_u8<3, 0> alpha_mask_bgr24b; //----alpha_mask_bgr24b + + typedef alpha_mask_u8<4, 0> alpha_mask_rgba32r; //----alpha_mask_rgba32r + typedef alpha_mask_u8<4, 1> alpha_mask_rgba32g; //----alpha_mask_rgba32g + typedef alpha_mask_u8<4, 2> alpha_mask_rgba32b; //----alpha_mask_rgba32b + typedef alpha_mask_u8<4, 3> alpha_mask_rgba32a; //----alpha_mask_rgba32a + + typedef alpha_mask_u8<4, 1> alpha_mask_argb32r; //----alpha_mask_argb32r + typedef alpha_mask_u8<4, 2> alpha_mask_argb32g; //----alpha_mask_argb32g + typedef alpha_mask_u8<4, 3> alpha_mask_argb32b; //----alpha_mask_argb32b + typedef alpha_mask_u8<4, 0> alpha_mask_argb32a; //----alpha_mask_argb32a + + typedef alpha_mask_u8<4, 2> alpha_mask_bgra32r; //----alpha_mask_bgra32r + typedef alpha_mask_u8<4, 1> alpha_mask_bgra32g; //----alpha_mask_bgra32g + typedef alpha_mask_u8<4, 0> alpha_mask_bgra32b; //----alpha_mask_bgra32b + typedef alpha_mask_u8<4, 3> alpha_mask_bgra32a; //----alpha_mask_bgra32a + + typedef alpha_mask_u8<4, 3> alpha_mask_abgr32r; //----alpha_mask_abgr32r + typedef alpha_mask_u8<4, 2> alpha_mask_abgr32g; //----alpha_mask_abgr32g + typedef alpha_mask_u8<4, 1> alpha_mask_abgr32b; //----alpha_mask_abgr32b + typedef alpha_mask_u8<4, 0> alpha_mask_abgr32a; //----alpha_mask_abgr32a + + typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgb24gray; //----alpha_mask_rgb24gray + typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgr24gray; //----alpha_mask_bgr24gray + typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgba32gray; //----alpha_mask_rgba32gray + typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_argb32gray; //----alpha_mask_argb32gray + typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgra32gray; //----alpha_mask_bgra32gray + typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_abgr32gray; //----alpha_mask_abgr32gray + + + + //==========================================================amask_no_clip_u8 + template<unsigned Step=1, unsigned Offset=0, class MaskF=one_component_mask_u8> + class amask_no_clip_u8 + { + public: + typedef int8u cover_type; + typedef amask_no_clip_u8<Step, Offset, MaskF> self_type; + enum cover_scale_e + { + cover_shift = 8, + cover_none = 0, + cover_full = 255 + }; + + amask_no_clip_u8() : m_rbuf(0) {} + explicit amask_no_clip_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} + + void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } + + MaskF& mask_function() { return m_mask_function; } + const MaskF& mask_function() const { return m_mask_function; } + + + //-------------------------------------------------------------------- + cover_type pixel(int x, int y) const + { + return (cover_type)m_mask_function.calculate( + m_rbuf->row_ptr(y) + x * Step + Offset); + } + + + //-------------------------------------------------------------------- + cover_type combine_pixel(int x, int y, cover_type val) const + { + return (cover_type)((cover_full + val * + m_mask_function.calculate( + m_rbuf->row_ptr(y) + x * Step + Offset)) >> + cover_shift); + } + + + //-------------------------------------------------------------------- + void fill_hspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst++ = (cover_type)m_mask_function.calculate(mask); + mask += Step; + } + while(--num_pix); + } + + + + //-------------------------------------------------------------------- + void combine_hspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst = (cover_type)((cover_full + (*dst) * + m_mask_function.calculate(mask)) >> + cover_shift); + ++dst; + mask += Step; + } + while(--num_pix); + } + + + //-------------------------------------------------------------------- + void fill_vspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst++ = (cover_type)m_mask_function.calculate(mask); + mask += m_rbuf->stride(); + } + while(--num_pix); + } + + + //-------------------------------------------------------------------- + void combine_vspan(int x, int y, cover_type* dst, int num_pix) const + { + const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; + do + { + *dst = (cover_type)((cover_full + (*dst) * + m_mask_function.calculate(mask)) >> + cover_shift); + ++dst; + mask += m_rbuf->stride(); + } + while(--num_pix); + } + + private: + amask_no_clip_u8(const self_type&); + const self_type& operator = (const self_type&); + + rendering_buffer* m_rbuf; + MaskF m_mask_function; + }; + + + typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8 + + typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r + typedef amask_no_clip_u8<3, 1> amask_no_clip_rgb24g; //----amask_no_clip_rgb24g + typedef amask_no_clip_u8<3, 2> amask_no_clip_rgb24b; //----amask_no_clip_rgb24b + + typedef amask_no_clip_u8<3, 2> amask_no_clip_bgr24r; //----amask_no_clip_bgr24r + typedef amask_no_clip_u8<3, 1> amask_no_clip_bgr24g; //----amask_no_clip_bgr24g + typedef amask_no_clip_u8<3, 0> amask_no_clip_bgr24b; //----amask_no_clip_bgr24b + + typedef amask_no_clip_u8<4, 0> amask_no_clip_rgba32r; //----amask_no_clip_rgba32r + typedef amask_no_clip_u8<4, 1> amask_no_clip_rgba32g; //----amask_no_clip_rgba32g + typedef amask_no_clip_u8<4, 2> amask_no_clip_rgba32b; //----amask_no_clip_rgba32b + typedef amask_no_clip_u8<4, 3> amask_no_clip_rgba32a; //----amask_no_clip_rgba32a + + typedef amask_no_clip_u8<4, 1> amask_no_clip_argb32r; //----amask_no_clip_argb32r + typedef amask_no_clip_u8<4, 2> amask_no_clip_argb32g; //----amask_no_clip_argb32g + typedef amask_no_clip_u8<4, 3> amask_no_clip_argb32b; //----amask_no_clip_argb32b + typedef amask_no_clip_u8<4, 0> amask_no_clip_argb32a; //----amask_no_clip_argb32a + + typedef amask_no_clip_u8<4, 2> amask_no_clip_bgra32r; //----amask_no_clip_bgra32r + typedef amask_no_clip_u8<4, 1> amask_no_clip_bgra32g; //----amask_no_clip_bgra32g + typedef amask_no_clip_u8<4, 0> amask_no_clip_bgra32b; //----amask_no_clip_bgra32b + typedef amask_no_clip_u8<4, 3> amask_no_clip_bgra32a; //----amask_no_clip_bgra32a + + typedef amask_no_clip_u8<4, 3> amask_no_clip_abgr32r; //----amask_no_clip_abgr32r + typedef amask_no_clip_u8<4, 2> amask_no_clip_abgr32g; //----amask_no_clip_abgr32g + typedef amask_no_clip_u8<4, 1> amask_no_clip_abgr32b; //----amask_no_clip_abgr32b + typedef amask_no_clip_u8<4, 0> amask_no_clip_abgr32a; //----amask_no_clip_abgr32a + + typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgb24gray; //----amask_no_clip_rgb24gray + typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgr24gray; //----amask_no_clip_bgr24gray + typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgba32gray; //----amask_no_clip_rgba32gray + typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_argb32gray; //----amask_no_clip_argb32gray + typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgra32gray; //----amask_no_clip_bgra32gray + typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_abgr32gray; //----amask_no_clip_abgr32gray + + +} + + + +#endif Added: branches/transforms/agg24/include/agg_arc.h =================================================================== --- branches/transforms/agg24/include/agg_arc.h (rev 0) +++ branches/transforms/agg24/include/agg_arc.h 2007-11-16 15:53:57 UTC (rev 4333) @@ -0,0 +1,74 @@ +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mc...@an... +// mcs...@ya... +// http://www.antigrain.com +//---------------------------------------------------------------------------- +// +// Arc vertex generator +// +//---------------------------------------------------------------------------- + +#ifndef AGG_ARC_INCLUDED +#define AGG_ARC_INCLUDED + +#include <math.h> +#include "agg_basics.h" + +namespace agg +{ + + //=====================================================================arc + // + // See Implementation agg_arc.cpp + // + class arc + { + public: + arc() : m_scale(1.0), m_initialized(false) {} + arc(double x, double y, + double rx, double ry, + double a1, double a2, + bool ccw=true); + + void init(double x, double y, + double rx, double ry, + double a1, double a2, + bool ccw=true); + + void approximation_scale(double s); + double approximation_scale() const { return m_scale; } + + void rewind(unsigned); + unsigned vertex(double* x, double* y); + + private: + void normalize(double a1, double a2, bool ccw); + + double m_x; + double m_y; + double m_rx; + double m_ry; + double m_angle; + double m_start; + double m_end; + double m_scale; + double m_da; + bool m_ccw; + bool m_initialized; + unsigned m_path_cmd; + }; + + +} + + +#endif Added: branches/transforms/agg24/include/agg_array.h =================================================================== --- branches/transforms/agg24/include/agg_array.h (rev 0) +++ branches/transforms/agg24/include/agg_array.h 2007-11-16 15:53:57 UTC (rev 4333) @@ -0,0 +1,1119 @@ +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mc...@an... +// mcs...@ya... +// http://www.antigrain.com +//---------------------------------------------------------------------------- +#ifndef AGG_ARRAY_INCLUDED +#define AGG_ARRAY_INCLUDED + +#include <stddef.h> +#include <string.h> +#include "agg_basics.h" + +namespace agg +{ + + //-------------------------------------------------------pod_array_adaptor + template<class T> class pod_array_adaptor + { + public: + typedef T value_type; + pod_array_adaptor(T* array, unsigned size) : + m_array(array), m_size(size) {} + + unsigned size() const { return m_size; } + const T& operator [] (unsigned i) const { return m_array[i]; } + T& operator [] (unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T* m_array; + unsigned m_size; + }; + + + //---------------------------------------------------------pod_auto_array + template<class T, unsigned Size> class pod_auto_array + { + public: + typedef T value_type; + typedef pod_auto_array<T, Size> self_type; + + pod_auto_array() {} + explicit pod_auto_array(const T* c) + { + memcpy(m_array, c, sizeof(T) * Size); + } + + const self_type& operator = (const T* c) + { + memcpy(m_array, c, sizeof(T) * Size); + return *this; + } + + static unsigned size() { return Size; } + const T& operator [] (unsigned i) const { return m_array[i]; } + T& operator [] (unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T m_array[Size]; + }; + + + //--------------------------------------------------------pod_auto_vector + template<class T, unsigned Size> class pod_auto_vector + { + public: + typedef T value_type; + typedef pod_auto_vector<T, Size> self_type; + + pod_auto_vector() : m_size(0) {} + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void add(const T& v) { m_array[m_size++] = v; } + void push_back(const T& v) { m_array[m_size++] = v; } + void inc_size(unsigned size) { m_size += size; } + + unsigned size() const { return m_size; } + const T& operator [] (unsigned i) const { return m_array[i]; } + T& operator [] (unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + private: + T m_array[Size]; + unsigned m_size; + }; + + + //---------------------------------------------------------------pod_array + template<class T> class pod_array + { + public: + typedef T value_type; + typedef pod_array<T> self_type; + + ~pod_array() { pod_allocator<T>::deallocate(m_array, m_size); } + pod_array() : m_array(0), m_size(0) {} + + pod_array(unsigned size) : + m_array(pod_allocator<T>::allocate(size)), + m_size(size) + {} + + pod_array(const self_type& v) : + m_array(pod_allocator<T>::allocate(v.m_size)), + m_size(v.m_size) + { + memcpy(m_array, v.m_array, sizeof(T) * m_size); + } + + void resize(unsigned size) + { + if(size != m_size) + { + pod_allocator<T>::deallocate(m_array, m_size); + m_array = pod_allocator<T>::allocate(m_size = size); + } + } + const self_type& operator = (const self_type& v) + { + resize(v.size()); + memcpy(m_array, v.m_array, sizeof(T) * m_size); + return *this; + } + + unsigned size() const { return m_size; } + const T& operator [] (unsigned i) const { return m_array[i]; } + T& operator [] (unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + const T* data() const { return m_array; } + T* data() { return m_array; } + private: + T* m_array; + unsigned m_size; + }; + + + + //--------------------------------------------------------------pod_vector + // A simple class template to store Plain Old Data, a vector + // of a fixed size. The data is continous in memory + //------------------------------------------------------------------------ + template<class T> class pod_vector + { + public: + typedef T value_type; + + ~pod_vector() { pod_allocator<T>::deallocate(m_array, m_capacity); } + pod_vector() : m_size(0), m_capacity(0), m_array(0) {} + pod_vector(unsigned cap, unsigned extra_tail=0); + + // Copying + pod_vector(const pod_vector<T>&); + const pod_vector<T>& operator = (const pod_vector<T>&); + + // Set new capacity. All data is lost, size is set to zero. + void capacity(unsigned cap, unsigned extra_tail=0); + unsigned capacity() const { return m_capacity; } + + // Allocate n elements. All data is lost, + // but elements can be accessed in range 0...size-1. + void allocate(unsigned size, unsigned extra_tail=0); + + // Resize keeping the content. + void resize(unsigned new_size); + + void zero() + { + memset(m_array, 0, sizeof(T) * m_size); + } + + void add(const T& v) { m_array[m_size++] = v; } + void push_back(const T& v) { m_array[m_size++] = v; } + void insert_at(unsigned pos, const T& val); + void inc_size(unsigned size) { m_size += size; } + unsigned size() const { return m_size; } + unsigned byte_size() const { return m_size * sizeof(T); } + void serialize(int8u* ptr) const; + void deserialize(const int8u* data, unsigned byte_size); + const T& operator [] (unsigned i) const { return m_array[i]; } + T& operator [] (unsigned i) { return m_array[i]; } + const T& at(unsigned i) const { return m_array[i]; } + T& at(unsigned i) { return m_array[i]; } + T value_at(unsigned i) const { return m_array[i]; } + + const T* data() const { return m_array; } + T* data() { return m_array; } + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void cut_at(unsigned num) { if(num < m_size) m_size = num; } + + private: + unsigned m_size; + unsigned m_capacity; + T* m_array; + }; + + //------------------------------------------------------------------------ + template<class T> + void pod_vector<T>::capacity(unsigned cap, unsigned extra_tail) + { + m_size = 0; + if(cap > m_capacity) + { + pod_allocator<T>::deallocate(m_array, m_capacity); + m_capacity = cap + extra_tail; + m_array = m_capacity ? pod_allocator<T>::allocate(m_capacity) : 0; + } + } + + //------------------------------------------------------------------------ + template<class T> + void pod_vector<T>::allocate(unsigned size, unsigned extra_tail) + { + capacity(size, extra_tail); + m_size = size; + } + + + //------------------------------------------------------------------------ + template<class T> + void pod_vector<T>::resize(unsigned new_size) + { + if(new_size > m_size) + { + if(new_size > m_capacity) + { + T* data = pod_allocator<T>::allocate(new_size); + memcpy(data, m_array, m_size * sizeof(T)); + pod_allocator<T>::deallocate(m_array, m_capacity); + m_array = data; + } + } + else + { + m_size = new_size; + } + } + + //------------------------------------------------------------------------ + template<class T> pod_vector<T>::pod_vector(unsigned cap, unsigned extra_tail) : + m_size(0), + m_capacity(cap + extra_tail), + m_array(pod_allocator<T>::allocate(m_capacity)) {} + + //------------------------------------------------------------------------ + template<class T> pod_vector<T>::pod_vector(const pod_vector<T>& v) : + m_size(v.m_size), + m_capacity(v.m_capacity), + m_array(v.m_capacity ? pod_allocator<T>::allocate(v.m_capacity) : 0) + { + memcpy(m_array, v.m_array, sizeof(T) * v.m_size); + } + + //------------------------------------------------------------------------ + template<class T> const pod_vector<T>& + pod_vector<T>::operator = (const pod_vector<T>&v) + { + allocate(v.m_size); + if(v.m_size) memcpy(m_array, v.m_array, sizeof(T) * v.m_size); + return *this; + } + + //------------------------------------------------------------------------ + template<class T> void pod_vector<T>::serialize(int8u* ptr) const + { + if(m_size) memcpy(ptr, m_array, m_size * sizeof(T)); + } + + //------------------------------------------------------------------------ + template<class T> + void pod_vector<T>::deserialize(const int8u* data, unsigned byte_size) + { + byte_size /= sizeof(T); + allocate(byte_size); + if(byte_size) memcpy(m_array, data, byte_size * sizeof(T)); + } + + //------------------------------------------------------------------------ + template<class T> + void pod_vector<T>::insert_at(unsigned pos, const T& val) + { + if(pos >= m_size) + { + m_array[m_size] = val; + } + else + { + memmove(m_array + pos + 1, m_array + pos, (m_size - pos) * sizeof(T)); + m_array[pos] = val; + } + ++m_size; + } + + //---------------------------------------------------------------pod_bvector + // A simple class template to store Plain Old Data, similar to std::deque + // It doesn't reallocate memory but instead, uses blocks of data of size + // of (1 << S), that is, power of two. The data is NOT contiguous in memory, + // so the only valid access method is operator [] or curr(), prev(), next() + // + // There reallocs occure only when the pool of pointers to blocks needs + // to be extended (it happens very rarely). You can control the value + // of increment to reallocate the pointer buffer. See the second constructor. + // By default, the incremeent value equals (1 << S), i.e., the block size. + //------------------------------------------------------------------------ + template<class T, unsigned S=6> class pod_bvector + { + public: + enum block_scale_e + { + block_shift = S, + block_size = 1 << block_shift, + block_mask = block_size - 1 + }; + + typedef T value_type; + + ~pod_bvector(); + pod_bvector(); + pod_bvector(unsigned block_ptr_inc); + + // Copying + pod_bvector(const pod_bvector<T, S>& v); + const pod_bvector<T, S>& operator = (const pod_bvector<T, S>& v); + + void remove_all() { m_size = 0; } + void clear() { m_size = 0; } + void free_all() { free_tail(0); } + void free_tail(unsigned size); + void add(const T& val); + void push_back(const T& val) { add(val); } + void modify_last(const T& val); + void remove_last(); + + int allocate_continuous_block(unsigned num_elements); + + void add_array(const T* ptr, unsigned num_elem) + { + while(num_elem--) + { + add(*ptr++); + } + } + + template<class DataAccessor> void add_data(DataAccessor& data) + { + while(data.size()) + { + add(*data); + ++data; + } + } + + void cut_at(unsigned size) + { + if(size < m_size) m_size = size; + } + + unsigned size() const { return m_size; } + + const T& operator [] (unsigned i) const + { + return m_blocks[i >> block_shift][i & block_mask]; + } + + T& operator [] (unsigned i) + { + return m_blocks[i >> block_shift][i & block_mask]; + } + + const T& at(unsigned i) const + { + return m_blocks[i >> block_shift][i & block_mask]; + } + + T& at(unsigned i) + { + return m_blocks[i >> block_shift][i & block_mask]; + } + + T value_at(unsigned i) const + { + return m_blocks[i >> block_shift][i & block_mask]; + } + + const T& curr(unsigned idx) const + { + return (*this)[idx]; + } + + T& curr(unsigned idx) + { + return (*this)[idx]; + } + + const T& prev(unsigned idx) const + { + return (*this)[(idx + m_size - 1) % m_size]; + } + + T& prev(unsigned idx) + { + return (*this)[(idx + m_size - 1) % m_size]; + } + + const T& next(unsigned idx) const + { + return (*this)[(idx + 1) % m_size]; + } + + T& next(unsigned idx) + { + return (*this)[(idx + 1) % m_size]; + } + + const T& last() const + { + return (*this)[m_size - 1]; + } + + T& last() + { + return (*this)[m_size - 1]; + } + + unsigned byte_size() const; + void serialize(int8u* ptr) const; + void deserialize(const int8u* data, unsigned byte_size); + void deserialize(unsigned start, const T& empty_val, + const int8u* data, unsigned byte_size); + + template<class ByteAccessor> + void deserialize(ByteAccessor data) + { + remove_all(); + unsigned elem_size = data.size() / sizeof(T); + + for(unsigned i = 0; i < elem_size; ++i) + { + int8u* ptr = (int8u*)data_ptr(); + for(unsigned j = 0; j < sizeof(T); ++j) + { + *ptr++ = *data; + ++data; + } + ++m_size; + } + } + + template<class ByteAccessor> + void deserialize(unsigned start, const T& empty_val, ByteAccessor data) + { + while(m_size < start) + { + add(empty_val); + } + + unsigned elem_size = data.size() / sizeof(T); + for(unsigned i = 0; i < elem_size; ++i) + { + int8u* ptr; + if(start + i < m_size) + { + ptr = (int8u*)(&((*this)[start + i])); + } + else + { + ptr = (int8u*)data_ptr(); + ++m_size; + } + for(unsigned j = 0; j < sizeof(T); ++j) + { + *ptr++ = *data; + ++data; + } + } + } + + const T* block(unsigned nb) const { return m_blocks[nb]; } + + private: + void allocate_block(unsigned nb); + T* data_ptr(); + + unsigned m_size; + unsigned m_num_blocks; + unsigned m_max_blocks; + T** m_blocks; + unsigned m_block_ptr_inc; + }; + + + //------------------------------------------------------------------------ + template<class T, unsigned S> pod_bvector<T, S>::~pod_bvector() + { + if(m_num_blocks) + { + T** blk = m_blocks + m_num_blocks - 1; + while(m_num_blocks--) + { + pod_allocator<T>::deallocate(*blk, block_size); + --blk; + } + } + pod_allocator<T*>::deallocate(m_blocks, m_max_blocks); + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::free_tail(unsigned size) + { + if(size < m_size) + { + unsigned nb = (size + block_mask) >> block_shift; + while(m_num_blocks > nb) + { + pod_allocator<T>::deallocate(m_blocks[--m_num_blocks], block_size); + } + if(m_num_blocks == 0) + { + pod_allocator<T*>::deallocate(m_blocks, m_max_blocks); + m_blocks = 0; + m_max_blocks = 0; + } + m_size = size; + } + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> pod_bvector<T, S>::pod_bvector() : + m_size(0), + m_num_blocks(0), + m_max_blocks(0), + m_blocks(0), + m_block_ptr_inc(block_size) + { + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + pod_bvector<T, S>::pod_bvector(unsigned block_ptr_inc) : + m_size(0), + m_num_blocks(0), + m_max_blocks(0), + m_blocks(0), + m_block_ptr_inc(block_ptr_inc) + { + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + pod_bvector<T, S>::pod_bvector(const pod_bvector<T, S>& v) : + m_size(v.m_size), + m_num_blocks(v.m_num_blocks), + m_max_blocks(v.m_max_blocks), + m_blocks(v.m_max_blocks ? + pod_allocator<T*>::allocate(v.m_max_blocks) : + 0), + m_block_ptr_inc(v.m_block_ptr_inc) + { + unsigned i; + for(i = 0; i < v.m_num_blocks; ++i) + { + m_blocks[i] = pod_allocator<T>::allocate(block_size); + memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); + } + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + const pod_bvector<T, S>& + pod_bvector<T, S>::operator = (const pod_bvector<T, S>& v) + { + unsigned i; + for(i = m_num_blocks; i < v.m_num_blocks; ++i) + { + allocate_block(i); + } + for(i = 0; i < v.m_num_blocks; ++i) + { + memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); + } + m_size = v.m_size; + return *this; + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::allocate_block(unsigned nb) + { + if(nb >= m_max_blocks) + { + T** new_blocks = pod_allocator<T*>::allocate(m_max_blocks + m_block_ptr_inc); + + if(m_blocks) + { + memcpy(new_blocks, + m_blocks, + m_num_blocks * sizeof(T*)); + + pod_allocator<T*>::deallocate(m_blocks, m_max_blocks); + } + m_blocks = new_blocks; + m_max_blocks += m_block_ptr_inc; + } + m_blocks[nb] = pod_allocator<T>::allocate(block_size); + m_num_blocks++; + } + + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + inline T* pod_bvector<T, S>::data_ptr() + { + unsigned nb = m_size >> block_shift; + if(nb >= m_num_blocks) + { + allocate_block(nb); + } + return m_blocks[nb] + (m_size & block_mask); + } + + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + inline void pod_bvector<T, S>::add(const T& val) + { + *data_ptr() = val; + ++m_size; + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + inline void pod_bvector<T, S>::remove_last() + { + if(m_size) --m_size; + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::modify_last(const T& val) + { + remove_last(); + add(val); + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + int pod_bvector<T, S>::allocate_continuous_block(unsigned num_elements) + { + if(num_elements < block_size) + { + data_ptr(); // Allocate initial block if necessary + unsigned rest = block_size - (m_size & block_mask); + unsigned index; + if(num_elements <= rest) + { + // The rest of the block is good, we can use it + //----------------- + index = m_size; + m_size += num_elements; + return index; + } + + // New block + //--------------- + m_size += rest; + data_ptr(); + index = m_size; + m_size += num_elements; + return index; + } + return -1; // Impossible to allocate + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + unsigned pod_bvector<T, S>::byte_size() const + { + return m_size * sizeof(T); + } + + + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::serialize(int8u* ptr) const + { + unsigned i; + for(i = 0; i < m_size; i++) + { + memcpy(ptr, &(*this)[i], sizeof(T)); + ptr += sizeof(T); + } + } + + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::deserialize(const int8u* data, unsigned byte_size) + { + remove_all(); + byte_size /= sizeof(T); + for(unsigned i = 0; i < byte_size; ++i) + { + T* ptr = data_ptr(); + memcpy(ptr, data, sizeof(T)); + ++m_size; + data += sizeof(T); + } + } + + + // Replace or add a number of elements starting from "start" position + //------------------------------------------------------------------------ + template<class T, unsigned S> + void pod_bvector<T, S>::deserialize(unsigned start, const T& empty_val, + const int8u* data, unsigned byte_size) + { + while(m_size < start) + { + add(empty_val); + } + + byte_size /= sizeof(T); + for(unsigned i = 0; i < byte_size; ++i) + { + if(start + i < m_size) + { + memcpy(&((*this)[start + i]), data, sizeof(T)); + } + else + { + T* ptr = data_ptr(); + memcpy(ptr, data, sizeof(T)); + ++m_size; + } + data += sizeof(T); + } + } + + + //---------------------------------------------------------block_allocator + // Allocator for arbitrary POD data. Most usable in different cache + // systems for efficient memory allocations. + // Memory is allocated with blocks of fixed size ("block_size" in + // the constructor). If required size exceeds the block size the allocator + // creates a new block of the required size. However, the most efficient + // use is when the average reqired size is much less than the block size. + //------------------------------------------------------------------------ + class block_allocator + { + struct block_type + { + int8u* data; + unsigned size; + }; + + public: + void remove_all() + { + if(m_num_blocks) + { + block_type* blk = m_blocks + m_num_blocks - 1; + while(m_num_blocks--) + { + pod_allocator<int8u>::deallocate(blk->data, blk->size); + --blk; + } + pod_allocator<block_type>::deallocate(m_blocks, m_max_blocks); + } + m_num_blocks = 0; + m_max_blocks = 0; + m_blocks = 0; + m_buf_ptr = 0; + m_rest = 0; + } + + ~block_allocator() + { + remove_all(); + } + + block_allocator(unsigned block_size, unsigned block_ptr_inc=256-8) : + m_block_size(block_size), + m_block_ptr_inc(block_ptr_inc), + m_num_blocks(0), + m_max_blocks(0), + m_blocks... [truncated message content] |
From: <js...@us...> - 2007-11-16 15:54:01
|
Revision: 4332 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4332&view=rev Author: jswhit Date: 2007-11-16 07:53:50 -0800 (Fri, 16 Nov 2007) Log Message: ----------- added NetCDF reader to basemap namespace (from matplotlib.toolkits.basemap import NetCDFFile) Modified Paths: -------------- trunk/toolkits/basemap-testing/MANIFEST.in trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py trunk/toolkits/basemap-testing/examples/plotprecip.py trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap-testing/MANIFEST.in =================================================================== --- trunk/toolkits/basemap-testing/MANIFEST.in 2007-11-16 13:46:59 UTC (rev 4331) +++ trunk/toolkits/basemap-testing/MANIFEST.in 2007-11-16 15:53:50 UTC (rev 4332) @@ -54,7 +54,6 @@ include examples/setwh.py include examples/ccsm_popgrid.py include examples/ccsm_popgrid.nc -include examples/pupynere.py include examples/plot_tissot.py include examples/tissot.dbf include examples/tissot.shp @@ -69,6 +68,7 @@ include lib/matplotlib/toolkits/basemap/proj.py include lib/matplotlib/toolkits/basemap/pyproj.py include lib/matplotlib/toolkits/basemap/cm.py +include lib/matplotlib/toolkits/basemap/pupynere.py include pyshapelib/README pyshapelib/COPYING pyshapelib/ChangeLog pyshapelib/NEWS include pyshapelib/*.i pyshapelib/*.c pyshapelib/*.py pyshapelib/*.h include pyshapelib/*.shp pyshapelib/*.shx pyshapelib/*.dbf Modified: trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py =================================================================== --- trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py 2007-11-16 13:46:59 UTC (rev 4331) +++ trunk/toolkits/basemap-testing/examples/ccsm_popgrid.py 2007-11-16 15:53:50 UTC (rev 4332) @@ -24,7 +24,6 @@ from Roberto De Almeida for reading netCDF files (included). """ -from pupynere import NetCDFFile import pylab as pl from matplotlib import rcParams try: @@ -34,7 +33,7 @@ raise ImportError('this example requires numpy') import matplotlib.numerix.ma as MA import matplotlib.numerix as N -from matplotlib.toolkits.basemap import Basemap +from matplotlib.toolkits.basemap import Basemap, NetCDFFile # read in data from netCDF file. infile = 'ccsm_popgrid.nc' Modified: trunk/toolkits/basemap-testing/examples/plotprecip.py =================================================================== --- trunk/toolkits/basemap-testing/examples/plotprecip.py 2007-11-16 13:46:59 UTC (rev 4331) +++ trunk/toolkits/basemap-testing/examples/plotprecip.py 2007-11-16 15:53:50 UTC (rev 4332) @@ -1,5 +1,4 @@ -from pupynere import NetCDFFile -from matplotlib.toolkits.basemap import Basemap, cm +from matplotlib.toolkits.basemap import Basemap, cm, NetCDFFile import pylab, copy from matplotlib import rcParams Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/__init__.py 2007-11-16 13:46:59 UTC (rev 4331) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/__init__.py 2007-11-16 15:53:50 UTC (rev 4332) @@ -1,2 +1,3 @@ from basemap import __doc__, __version__ from basemap import * +from pupynere import NetCDFFile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-16 13:47:01
|
Revision: 4331 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4331&view=rev Author: mdboom Date: 2007-11-16 05:46:59 -0800 (Fri, 16 Nov 2007) Log Message: ----------- Fix numerals in stixsans mode. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/_mathtext_data.py Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py =================================================================== --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-16 13:28:44 UTC (rev 4330) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-16 13:46:59 UTC (rev 4331) @@ -2434,7 +2434,9 @@ ], 'it': [ - (0x0030, 0x0039, 'it', 0xe1b4), # 0-9 + # These numerals are actually upright. We don't actually + # want italic numerals ever. + (0x0030, 0x0039, 'rm', 0x1d7e2), # 0-9 (0x0041, 0x005a, 'it', 0x1d608), # A-Z (0x0061, 0x007a, 'it', 0x1d622), # a-z (0x0391, 0x03a9, 'it', 0xe1bf), # \Alpha-\Omega This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-16 13:28:47
|
Revision: 4330 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4330&view=rev Author: mdboom Date: 2007-11-16 05:28:44 -0800 (Fri, 16 Nov 2007) Log Message: ----------- Merged revisions 4318-4329 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4325 | dsdale | 2007-11-15 16:23:27 -0500 (Thu, 15 Nov 2007) | 4 lines added npy.seterr(invalid='ignore') to beginning of axes.py, to silence repeated warnings created by finding extrema of arrays containing nans (discovered during calls to errorbar) ........ r4328 | efiring | 2007-11-16 02:47:51 -0500 (Fri, 16 Nov 2007) | 2 lines ScalarMappable.to_rgba can return uint8 instead of float64 ........ r4329 | dsdale | 2007-11-16 08:16:12 -0500 (Fri, 16 Nov 2007) | 2 lines removed numpy.seterr(invalid='ignore') from axes.py ........ Modified Paths: -------------- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/cm.py branches/transforms/lib/matplotlib/colors.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4317 + /trunk/matplotlib:1-4329 Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-11-16 13:16:12 UTC (rev 4329) +++ branches/transforms/lib/matplotlib/axes.py 2007-11-16 13:28:44 UTC (rev 4330) @@ -2597,7 +2597,6 @@ self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs) - if not iterable(x): x = [x] if not iterable(ymin): ymin = [ymin] if not iterable(ymax): ymax = [ymax] Modified: branches/transforms/lib/matplotlib/cm.py =================================================================== --- branches/transforms/lib/matplotlib/cm.py 2007-11-16 13:16:12 UTC (rev 4329) +++ branches/transforms/lib/matplotlib/cm.py 2007-11-16 13:28:44 UTC (rev 4330) @@ -45,14 +45,18 @@ 'set the colorbar image and axes associated with mappable' self.colorbar = im, ax - def to_rgba(self, x, alpha=1.0): + def to_rgba(self, x, alpha=1.0, bytes=False): '''Return a normalized rgba array corresponding to x. If x is already an rgb or rgba array, return it unchanged. ''' - if hasattr(x, 'shape') and len(x.shape)>2: return x + try: + if x.ndim == 3 and (x.shape[2] == 3 or x.shape[2] == 4): + return x + except AttributeError: + pass x = ma.asarray(x) x = self.norm(x) - x = self.cmap(x, alpha) + x = self.cmap(x, alpha=alpha, bytes=bytes) return x def set_array(self, A): Modified: branches/transforms/lib/matplotlib/colors.py =================================================================== --- branches/transforms/lib/matplotlib/colors.py 2007-11-16 13:16:12 UTC (rev 4329) +++ branches/transforms/lib/matplotlib/colors.py 2007-11-16 13:28:44 UTC (rev 4330) @@ -407,7 +407,7 @@ self._isinit = False - def __call__(self, X, alpha=1.0): + def __call__(self, X, alpha=1.0, bytes=False): """ X is either a scalar or an array (of any dimension). If scalar, a tuple of rgba values is returned, otherwise @@ -416,6 +416,8 @@ If they are floating point, then they must be in the interval (0.0, 1.0). Alpha must be a scalar. + If bytes is False, the rgba values will be floats on a + 0-1 scale; if True, they will be uint8, 0-255. """ if not self._isinit: self._init() @@ -440,7 +442,11 @@ npy.putmask(xa, xa<0, self._i_under) if mask_bad is not None and mask_bad.shape == xa.shape: npy.putmask(xa, mask_bad, self._i_bad) - rgba = self._lut[xa] + if bytes: + lut = (self._lut * 255).astype(npy.uint8) + else: + lut = self._lut + rgba = lut[xa] if vtype == 'scalar': rgba = tuple(rgba[0,:]) return rgba This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-16 13:16:31
|
Revision: 4329 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4329&view=rev Author: dsdale Date: 2007-11-16 05:16:12 -0800 (Fri, 16 Nov 2007) Log Message: ----------- removed numpy.seterr(invalid='ignore') from axes.py Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-16 07:47:51 UTC (rev 4328) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-16 13:16:12 UTC (rev 4329) @@ -2,7 +2,6 @@ import math, sys, warnings import numpy as npy -npy.seterr(invalid='ignore') import matplotlib.numerix.npyma as ma This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2007-11-16 07:47:53
|
Revision: 4328 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4328&view=rev Author: efiring Date: 2007-11-15 23:47:51 -0800 (Thu, 15 Nov 2007) Log Message: ----------- ScalarMappable.to_rgba can return uint8 instead of float64 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/cm.py trunk/matplotlib/lib/matplotlib/colors.py Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2007-11-16 00:11:50 UTC (rev 4327) +++ trunk/matplotlib/lib/matplotlib/cm.py 2007-11-16 07:47:51 UTC (rev 4328) @@ -45,14 +45,18 @@ 'set the colorbar image and axes associated with mappable' self.colorbar = im, ax - def to_rgba(self, x, alpha=1.0): + def to_rgba(self, x, alpha=1.0, bytes=False): '''Return a normalized rgba array corresponding to x. If x is already an rgb or rgba array, return it unchanged. ''' - if hasattr(x, 'shape') and len(x.shape)>2: return x + try: + if x.ndim == 3 and (x.shape[2] == 3 or x.shape[2] == 4): + return x + except AttributeError: + pass x = ma.asarray(x) x = self.norm(x) - x = self.cmap(x, alpha) + x = self.cmap(x, alpha=alpha, bytes=bytes) return x def set_array(self, A): Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2007-11-16 00:11:50 UTC (rev 4327) +++ trunk/matplotlib/lib/matplotlib/colors.py 2007-11-16 07:47:51 UTC (rev 4328) @@ -406,7 +406,7 @@ self._isinit = False - def __call__(self, X, alpha=1.0): + def __call__(self, X, alpha=1.0, bytes=False): """ X is either a scalar or an array (of any dimension). If scalar, a tuple of rgba values is returned, otherwise @@ -415,6 +415,8 @@ If they are floating point, then they must be in the interval (0.0, 1.0). Alpha must be a scalar. + If bytes is False, the rgba values will be floats on a + 0-1 scale; if True, they will be uint8, 0-255. """ if not self._isinit: self._init() @@ -439,7 +441,11 @@ npy.putmask(xa, xa<0, self._i_under) if mask_bad is not None and mask_bad.shape == xa.shape: npy.putmask(xa, mask_bad, self._i_bad) - rgba = self._lut[xa] + if bytes: + lut = (self._lut * 255).astype(npy.uint8) + else: + lut = self._lut + rgba = lut[xa] if vtype == 'scalar': rgba = tuple(rgba[0,:]) return rgba This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-16 00:12:03
|
Revision: 4327 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4327&view=rev Author: jswhit Date: 2007-11-15 16:11:50 -0800 (Thu, 15 Nov 2007) Log Message: ----------- refine definition of Antarctica Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-15 21:33:13 UTC (rev 4326) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-16 00:11:50 UTC (rev 4327) @@ -805,7 +805,7 @@ # regions and high-resolution boundary geometries). if not containsPole: # close Antarctica. - if name == 'gshhs' and south < -68: + if name == 'gshhs' and south < -68 and area > 10000: lons = b[:,0] lats = b[:,1] lons2 = lons[:-2][::-1] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-15 21:33:14
|
Revision: 4326 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4326&view=rev Author: jswhit Date: 2007-11-15 13:33:13 -0800 (Thu, 15 Nov 2007) Log Message: ----------- add full-res data files. Modified Paths: -------------- trunk/toolkits/basemap-testing/Changelog Modified: trunk/toolkits/basemap-testing/Changelog =================================================================== --- trunk/toolkits/basemap-testing/Changelog 2007-11-15 21:23:27 UTC (rev 4325) +++ trunk/toolkits/basemap-testing/Changelog 2007-11-15 21:33:13 UTC (rev 4326) @@ -1,7 +1,11 @@ version 0.9.7 (not yet released) * added support for full-resolution boundaries (will be - a separate download). + a separate download). Full-res files (totaling around + 100 mb) available in SVN. * high-resolution boundaries now included. + * postpone processing of countries, states and river + boundaries until a draw is requested. Only the + coastlines are processed in __init__. * use a Pyrex/Cython interface to the GEOS library (http://geos.refractions.net - LGPL license) to find geometries that are within map projection region. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-15 21:23:34
|
Revision: 4325 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4325&view=rev Author: dsdale Date: 2007-11-15 13:23:27 -0800 (Thu, 15 Nov 2007) Log Message: ----------- added npy.seterr(invalid='ignore') to beginning of axes.py, to silence repeated warnings created by finding extrema of arrays containing nans (discovered during calls to errorbar) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-15 21:13:52 UTC (rev 4324) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-15 21:23:27 UTC (rev 4325) @@ -2,6 +2,7 @@ import math, sys, warnings import numpy as npy +npy.seterr(invalid='ignore') import matplotlib.numerix.npyma as ma @@ -2503,7 +2504,6 @@ self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs) - if not iterable(x): x = [x] if not iterable(ymin): ymin = [ymin] if not iterable(ymax): ymax = [ymax] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 21:14:03
|
Revision: 4324 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4324&view=rev Author: mdboom Date: 2007-11-15 13:13:52 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Speed up auto-legend. Modified Paths: -------------- branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_path.cpp Modified: branches/transforms/lib/matplotlib/legend.py =================================================================== --- branches/transforms/lib/matplotlib/legend.py 2007-11-15 21:12:54 UTC (rev 4323) +++ branches/transforms/lib/matplotlib/legend.py 2007-11-15 21:13:52 UTC (rev 4324) @@ -340,29 +340,26 @@ bboxes = [] lines = [] - inv = ax.transAxes.inverted().transform + inverse_transform = ax.transAxes.inverted() for handle in ax.lines: assert isinstance(handle, Line2D) data = handle.get_xydata() trans = handle.get_transform() tdata = trans.transform(data) - averts = inv(tdata) + averts = inverse_transform.transform(tdata) lines.append(averts) for handle in ax.patches: assert isinstance(handle, Patch) - path = handle.get_path() - trans = handle.get_transform() - tpath = trans.transform_path(path) - tverts = tpath.vertices - averts = inv(tverts) + if isinstance(handle, Rectangle): + transform = handle.get_data_transform() + inverse_transform + bboxes.append(handle._bbox.transformed(transform)) + else: + transform = handle.get_transform() + inverse_transform + bboxes.append(handle.get_path().get_extents(transform)) - bbox = Bbox.unit() - bbox.update_from_data_xy(averts, True) - bboxes.append(bbox) - return [vertices, bboxes, lines] def draw_frame(self, b): Modified: branches/transforms/lib/matplotlib/patches.py =================================================================== --- branches/transforms/lib/matplotlib/patches.py 2007-11-15 21:12:54 UTC (rev 4323) +++ branches/transforms/lib/matplotlib/patches.py 2007-11-15 21:13:52 UTC (rev 4324) @@ -103,6 +103,9 @@ self.set_figure(other.get_figure()) self.set_alpha(other.get_alpha()) + def get_extents(self): + return self.get_path().get_extents(self.get_transform()) + def get_transform(self): return self._combined_transform Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-11-15 21:12:54 UTC (rev 4323) +++ branches/transforms/lib/matplotlib/transforms.py 2007-11-15 21:13:52 UTC (rev 4324) @@ -32,6 +32,7 @@ import cbook from path import Path +from _path import count_bboxes_overlapping_bbox DEBUG = False if DEBUG: @@ -93,16 +94,16 @@ Invalidate this transform node and all of its parents. Should be called anytime the transform changes. """ - # Shortcut: If self is already invalid, that means its parents - # are as well, so we don't need to do anything. - if self._invalid or not len(self._parents): - return - # If we are an affine transform being changed, we can set the # flag to INVALID_AFFINE_ONLY value = ((self.is_affine or self.is_bbox) and self.INVALID_AFFINE or self.INVALID) + + # Shortcut: If self is already invalid, that means its parents + # are as well, so we don't need to do anything. + if self._invalid == value or not len(self._parents): + return # Invalidate all ancestors of self using pseudo-recursion. parent = None @@ -194,10 +195,12 @@ read-only access to its data. """ is_bbox = True - - def __init__(self): - TransformNode.__init__(self) + #* Redundant: Removed for performance + # + # def __init__(self): + # TransformNode.__init__(self) + if DEBUG: def _check(points): if ma.isMaskedArray(points): @@ -896,10 +899,12 @@ # True if this transform is separable in the x- and y- dimensions. is_separable = False - - def __init__(self): - TransformNode.__init__(self) + #* Redundant: Removed for performance + # + # def __init__(self): + # TransformNode.__init__(self) + def __add__(self, other): """ Composes two transforms together such that self is followed by other. @@ -1171,8 +1176,10 @@ input_dims = 2 output_dims = 2 - def __init__(self): - AffineBase.__init__(self) + #* Redundant: Removed for performance + # + # def __init__(self): + # Affine2DBase.__init__(self) def frozen(self): return Affine2D(self.get_matrix().copy()) Modified: branches/transforms/src/_path.cpp =================================================================== --- branches/transforms/src/_path.cpp 2007-11-15 21:12:54 UTC (rev 4323) +++ branches/transforms/src/_path.cpp 2007-11-15 21:13:52 UTC (rev 4324) @@ -41,6 +41,8 @@ "clip_path_to_rect(path, bbox, inside)"); add_varargs_method("affine_transform", &_path_module::affine_transform, "affine_transform(vertices, transform)"); + add_varargs_method("count_bboxes_overlapping_bbox", &_path_module::count_bboxes_overlapping_bbox, + "count_bboxes_overlapping_bbox(bbox, bboxes)"); initialize("Helper functions for paths"); } @@ -57,6 +59,7 @@ Py::Object path_in_path(const Py::Tuple& args); Py::Object clip_path_to_rect(const Py::Tuple& args); Py::Object affine_transform(const Py::Tuple& args); + Py::Object count_bboxes_overlapping_bbox(const Py::Tuple& args); }; // @@ -736,6 +739,46 @@ return Py::Object((PyObject*)result, true); } +Py::Object _path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args) { + args.verify_length(2); + + Py::Object bbox = args[0]; + Py::SeqBase<Py::Object> bboxes = args[1]; + + double ax0, ay0, ax1, ay1; + double bx0, by0, bx1, by1; + long count = 0; + + if (py_convert_bbox(bbox.ptr(), ax0, ay0, ax1, ay1)) { + if (ax1 < ax0) + std::swap(ax0, ax1); + if (ay1 < ay0) + std::swap(ay0, ay1); + + size_t num_bboxes = bboxes.size(); + for (size_t i = 0; i < num_bboxes; ++i) { + Py::Object bbox_b = bboxes[i]; + if (py_convert_bbox(bbox_b.ptr(), bx0, by0, bx1, by1)) { + if (bx1 < bx0) + std::swap(bx0, bx1); + if (by1 < by0) + std::swap(by0, by1); + if (not ((bx1 <= ax0) or + (by1 <= ay0) or + (bx0 >= ax1) or + (by0 >= ay1))) + ++count; + } else { + throw Py::ValueError("Non-bbox object in bboxes list"); + } + } + } else { + throw Py::ValueError("First argument to count_bboxes_overlapping_bbox must be a Bbox object."); + } + + return Py::Int(count); +} + extern "C" DL_EXPORT(void) init_path(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 21:13:03
|
Revision: 4323 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4323&view=rev Author: mdboom Date: 2007-11-15 13:12:54 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Don't create masked arrays unless we absolutely have to. Modified Paths: -------------- branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/scale.py =================================================================== --- branches/transforms/lib/matplotlib/scale.py 2007-11-15 21:06:14 UTC (rev 4322) +++ branches/transforms/lib/matplotlib/scale.py 2007-11-15 21:12:54 UTC (rev 4323) @@ -1,5 +1,6 @@ import numpy as npy from matplotlib.numerix import npyma as ma +MaskedArray = ma.MaskedArray from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext from ticker import NullLocator, LogLocator, AutoLocator @@ -26,17 +27,26 @@ def get_transform(self): return IdentityTransform() - + +def _mask_non_positives(a): + mask = a <= 0.0 + if mask.any(): + return ma.MaskedArray(a, mask=mask) + return a + class LogScale(ScaleBase): name = 'log' - + class Log10Transform(Transform): input_dims = 1 output_dims = 1 is_separable = True def transform(self, a): - return ma.log10(ma.masked_where(a <= 0.0, a * 10.0)) + a = _mask_non_positives(a * 10.0) + if isinstance(a, MaskedArray): + return ma.log10(a) + return npy.log10(a) def inverted(self): return LogScale.InvertedLog10Transform() @@ -58,7 +68,10 @@ is_separable = True def transform(self, a): - return ma.log2(ma.masked_where(a <= 0.0, a * 2.0)) + a = _mask_non_positives(a * 2.0) + if isinstance(a, MaskedArray): + return ma.log2(a) + return npy.log2(a) def inverted(self): return LogScale.InvertedLog2Transform() @@ -80,7 +93,10 @@ is_separable = True def transform(self, a): - return ma.log(ma.masked_where(a <= 0.0, a * npy.e)) + a = _mask_non_positives(a * npy.e) + if isinstance(a, MaskedArray): + return ma.log(a) + return npy.log(a) def inverted(self): return LogScale.InvertedNaturalLogTransform() @@ -106,7 +122,10 @@ self._base = base def transform(self, a): - return ma.log(ma.masked_where(a <= 0.0, a * self._base)) / npy.log(self._base) + a = _mask_non_positives(a * self._base) + if isinstance(a, MaskedArray): + return ma.log10(a) / npy.log(self._base) + return npy.log(a) / npy.log(self._base) def inverted(self): return LogScale.InvertedLogTransform(self._base) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-15 21:06:16
|
Revision: 4322 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4322&view=rev Author: jswhit Date: 2007-11-15 13:06:14 -0800 (Thu, 15 Nov 2007) Log Message: ----------- add GEOS License (LGPL). Modified Paths: -------------- trunk/toolkits/basemap-testing/README Added Paths: ----------- trunk/toolkits/basemap-testing/LICENSE_geos Added: trunk/toolkits/basemap-testing/LICENSE_geos =================================================================== --- trunk/toolkits/basemap-testing/LICENSE_geos (rev 0) +++ trunk/toolkits/basemap-testing/LICENSE_geos 2007-11-15 21:06:14 UTC (rev 4322) @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + Modified: trunk/toolkits/basemap-testing/README =================================================================== --- trunk/toolkits/basemap-testing/README 2007-11-15 21:00:07 UTC (rev 4321) +++ trunk/toolkits/basemap-testing/README 2007-11-15 21:06:14 UTC (rev 4322) @@ -19,7 +19,7 @@ source code for the GEOS library is included in the 'geos-2.2.3' directory under the terms given in -geos-2.2.3/COPYING. +LICENSE_geos. pyshapelib by Bernhard Herzog is included in the 'pyshapelib' directory under the terms given in LICENSE_pyshapelib. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-15 21:00:12
|
Revision: 4321 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4321&view=rev Author: jswhit Date: 2007-11-15 13:00:07 -0800 (Thu, 15 Nov 2007) Log Message: ----------- library version now a module variable (__geos_version__) Modified Paths: -------------- trunk/toolkits/basemap-testing/src/_geos.c trunk/toolkits/basemap-testing/src/_geos.pyx Modified: trunk/toolkits/basemap-testing/src/_geos.c =================================================================== --- trunk/toolkits/basemap-testing/src/_geos.c 2007-11-15 20:26:03 UTC (rev 4320) +++ trunk/toolkits/basemap-testing/src/_geos.c 2007-11-15 21:00:07 UTC (rev 4321) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.8 on Wed Nov 14 11:06:42 2007 */ +/* Generated by Cython 0.9.6.8 on Thu Nov 15 13:56:55 2007 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -146,17 +146,16 @@ static PyTypeObject *__pyx_ptype_5_geos_Point = 0; static void __pyx_f_5_geos_notice_h(char *,char *); /*proto*/ static void __pyx_f_5_geos_error_h(char *,char *); /*proto*/ +static PyObject *__pyx_f_5_geos_geos_version(void); /*proto*/ static PyObject *__pyx_f_5_geos__get_coords(GEOSGeom *); /*proto*/ /* Implementation of _geos */ static char __pyx_k3[] = "0.1"; -static char __pyx_k4[] = "version 2.2.3 of the geos library is required"; +static char __pyx_k4[] = "2.2.3-CAPI-1.1.1"; +static char __pyx_k5[] = "version 2.2.3 of the geos library is required"; -static PyObject *__pyx_num_2; -static PyObject *__pyx_num_3; - static PyObject *__pyx_n_is_valid; static PyObject *__pyx_n_geom_type; static PyObject *__pyx_n_within; @@ -170,20 +169,21 @@ static PyObject *__pyx_n_sys; static PyObject *__pyx_n_numpy; static PyObject *__pyx_n___version__; -static PyObject *__pyx_n_geos_version; +static PyObject *__pyx_n___geos_version__; static PyObject *__pyx_n_ValueError; static PyObject *__pyx_k3p; static PyObject *__pyx_k4p; +static PyObject *__pyx_k5p; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_n_stdout; static PyObject *__pyx_n_write; -static PyObject *__pyx_k5p; +static PyObject *__pyx_k6p; -static char __pyx_k5[] = "GEOS_NOTICE: %s\n"; +static char __pyx_k6[] = "GEOS_NOTICE: %s\n"; static void __pyx_f_5_geos_notice_h(char *__pyx_v_fmt,char *__pyx_v_msg) { PyObject *__pyx_v_format; @@ -196,31 +196,31 @@ __pyx_v_message = Py_None; Py_INCREF(Py_None); __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":103 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":101 * * cdef void notice_h(char *fmt, char*msg): * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< * message = PyString_FromString(msg) * try: */ - __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;} + __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;} Py_DECREF(__pyx_v_format); __pyx_v_format = __pyx_1; __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":104 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":102 * cdef void notice_h(char *fmt, char*msg): * format = PyString_FromString(fmt) * message = PyString_FromString(msg) # <<<<<<<<<<<<<< * try: * warn_msg = format % message */ - __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;} + __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;} Py_DECREF(__pyx_v_message); __pyx_v_message = __pyx_1; __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":105 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":103 * format = PyString_FromString(fmt) * message = PyString_FromString(msg) * try: # <<<<<<<<<<<<<< @@ -228,7 +228,7 @@ * except: */ /*try:*/ { - __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L2;} + __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L2;} Py_DECREF(__pyx_v_warn_msg); __pyx_v_warn_msg = __pyx_1; __pyx_1 = 0; @@ -237,7 +237,7 @@ __pyx_L2:; Py_XDECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":107 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":105 * try: * warn_msg = format % message * except: # <<<<<<<<<<<<<< @@ -246,7 +246,7 @@ */ /*except:*/ { __Pyx_AddTraceback("_geos.notice_h"); - if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} + if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} Py_INCREF(__pyx_v_format); Py_DECREF(__pyx_v_warn_msg); __pyx_v_warn_msg = __pyx_v_format; @@ -257,23 +257,23 @@ } __pyx_L3:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":109 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":107 * except: * warn_msg = format * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) # <<<<<<<<<<<<<< * * cdef void error_h(char *fmt, char*msg): */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyNumber_Remainder(__pyx_k5p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} + __pyx_1 = PyNumber_Remainder(__pyx_k6p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); __pyx_1 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} + __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; @@ -292,9 +292,9 @@ static PyObject *__pyx_n_stderr; -static PyObject *__pyx_k6p; +static PyObject *__pyx_k7p; -static char __pyx_k6[] = "GEOS_ERROR: %s\n"; +static char __pyx_k7[] = "GEOS_ERROR: %s\n"; static void __pyx_f_5_geos_error_h(char *__pyx_v_fmt,char *__pyx_v_msg) { PyObject *__pyx_v_format; @@ -307,31 +307,31 @@ __pyx_v_message = Py_None; Py_INCREF(Py_None); __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":112 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":110 * * cdef void error_h(char *fmt, char*msg): * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< * message = PyString_FromString(msg) * try: */ - __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;} + __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;} Py_DECREF(__pyx_v_format); __pyx_v_format = __pyx_1; __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":113 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":111 * cdef void error_h(char *fmt, char*msg): * format = PyString_FromString(fmt) * message = PyString_FromString(msg) # <<<<<<<<<<<<<< * try: * warn_msg = format % message */ - __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;} + __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;} Py_DECREF(__pyx_v_message); __pyx_v_message = __pyx_1; __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":114 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":112 * format = PyString_FromString(fmt) * message = PyString_FromString(msg) * try: # <<<<<<<<<<<<<< @@ -339,7 +339,7 @@ * except: */ /*try:*/ { - __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L2;} + __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L2;} Py_DECREF(__pyx_v_warn_msg); __pyx_v_warn_msg = __pyx_1; __pyx_1 = 0; @@ -348,7 +348,7 @@ __pyx_L2:; Py_XDECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":116 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":114 * try: * warn_msg = format % message * except: # <<<<<<<<<<<<<< @@ -357,7 +357,7 @@ */ /*except:*/ { __Pyx_AddTraceback("_geos.error_h"); - if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} + if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} Py_INCREF(__pyx_v_format); Py_DECREF(__pyx_v_warn_msg); __pyx_v_warn_msg = __pyx_v_format; @@ -368,23 +368,23 @@ } __pyx_L3:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":118 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":116 * except: * warn_msg = format * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<< * * # check library version */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} + __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyNumber_Remainder(__pyx_k6p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} + __pyx_1 = PyNumber_Remainder(__pyx_k7p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); __pyx_1 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;} + __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; @@ -401,6 +401,24 @@ Py_DECREF(__pyx_v_warn_msg); } +static PyObject *__pyx_f_5_geos_geos_version(void) { + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + __pyx_1 = PyString_FromString(GEOSversion()); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("_geos.geos_version"); + __pyx_r = 0; + __pyx_L0:; + return __pyx_r; +} + static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused) { char __pyx_v_valid; @@ -408,7 +426,7 @@ char __pyx_1; Py_INCREF(__pyx_v_self); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":134 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":134 * def is_valid(self): * cdef char valid * valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<< @@ -417,7 +435,7 @@ */ __pyx_v_valid = GEOSisValid(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":135 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":135 * cdef char valid * valid = GEOSisValid(self._geom) * if valid: # <<<<<<<<<<<<<< @@ -476,7 +494,7 @@ Py_INCREF(__pyx_v_geom); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":146 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":146 * cdef GEOSGeom *g1, *g2 * cdef char answer * g1 = self._geom # <<<<<<<<<<<<<< @@ -485,7 +503,7 @@ */ __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":147 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":147 * cdef char answer * g1 = self._geom * g2 = geom._geom # <<<<<<<<<<<<<< @@ -494,7 +512,7 @@ */ __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":148 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":148 * g1 = self._geom * g2 = geom._geom * answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<< @@ -503,7 +521,7 @@ */ __pyx_v_answer = GEOSWithin(__pyx_v_g1,__pyx_v_g2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":149 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":149 * g2 = geom._geom * answer = GEOSWithin(g1, g2) * if answer: # <<<<<<<<<<<<<< @@ -546,7 +564,7 @@ Py_INCREF(__pyx_v_geom); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":157 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":157 * cdef GEOSGeom *g1, *g2 * cdef char answer * g1 = self._geom # <<<<<<<<<<<<<< @@ -555,7 +573,7 @@ */ __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":158 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":158 * cdef char answer * g1 = self._geom * g2 = geom._geom # <<<<<<<<<<<<<< @@ -564,7 +582,7 @@ */ __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":159 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":159 * g1 = self._geom * g2 = geom._geom * answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<< @@ -573,7 +591,7 @@ */ __pyx_v_answer = GEOSIntersects(__pyx_v_g1,__pyx_v_g2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":160 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":160 * g2 = geom._geom * answer = GEOSIntersects(g1, g2) * if answer: # <<<<<<<<<<<<<< @@ -608,11 +626,11 @@ static PyObject *__pyx_n_append; static PyObject *__pyx_n_NotImplementedError; -static PyObject *__pyx_k7p; +static PyObject *__pyx_k8p; static PyObject *__pyx_builtin_NotImplementedError; -static char __pyx_k7[] = "intersections of type '%s' not yet implemented"; +static char __pyx_k8[] = "intersections of type '%s' not yet implemented"; static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { @@ -640,7 +658,7 @@ __pyx_v_type = Py_None; Py_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":169 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":169 * cdef char answer * cdef int numgeoms, i, typeid * g1 = self._geom # <<<<<<<<<<<<<< @@ -649,7 +667,7 @@ */ __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":170 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":170 * cdef int numgeoms, i, typeid * g1 = self._geom * g2 = geom._geom # <<<<<<<<<<<<<< @@ -658,7 +676,7 @@ */ __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":171 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":171 * g1 = self._geom * g2 = geom._geom * g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<< @@ -667,7 +685,7 @@ */ __pyx_v_g3 = GEOSIntersection(__pyx_v_g1,__pyx_v_g2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":172 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":172 * g2 = geom._geom * g3 = GEOSIntersection(g1, g2) * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<< @@ -676,7 +694,7 @@ */ __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":173 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":173 * g3 = GEOSIntersection(g1, g2) * typeid = GEOSGeomTypeId(g3) * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<< @@ -686,7 +704,7 @@ __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":174 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":174 * typeid = GEOSGeomTypeId(g3) * if typeid == GEOS_POLYGON: * b = _get_coords(g3) # <<<<<<<<<<<<<< @@ -698,7 +716,7 @@ __pyx_v_b = __pyx_2; __pyx_2 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":175 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":175 * if typeid == GEOS_POLYGON: * b = _get_coords(g3) * p = Polygon(b) # <<<<<<<<<<<<<< @@ -714,7 +732,7 @@ __pyx_v_p = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":176 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":176 * b = _get_coords(g3) * p = Polygon(b) * pout = [p] # <<<<<<<<<<<<<< @@ -732,7 +750,7 @@ __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":178 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":178 * pout = [p] * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) # <<<<<<<<<<<<<< @@ -744,7 +762,7 @@ __pyx_v_b = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":179 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":179 * elif typeid == GEOS_LINESTRING: * b = _get_coords(g3) * p = LineString(b) # <<<<<<<<<<<<<< @@ -760,7 +778,7 @@ __pyx_v_p = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":180 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":180 * b = _get_coords(g3) * p = LineString(b) * pout = [p] # <<<<<<<<<<<<<< @@ -778,7 +796,7 @@ __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":182 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":182 * pout = [p] * elif typeid == GEOS_MULTIPOLYGON: * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< @@ -787,7 +805,7 @@ */ __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":183 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":183 * elif typeid == GEOS_MULTIPOLYGON: * numgeoms = GEOSGetNumGeometries(g3) * pout = [] # <<<<<<<<<<<<<< @@ -799,7 +817,7 @@ __pyx_v_pout = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":184 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":184 * numgeoms = GEOSGetNumGeometries(g3) * pout = [] * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< @@ -808,7 +826,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":185 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":185 * pout = [] * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< @@ -817,7 +835,7 @@ */ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":186 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":186 * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) # <<<<<<<<<<<<<< @@ -829,7 +847,7 @@ __pyx_v_b = __pyx_2; __pyx_2 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":187 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":187 * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) * p = Polygon(b) # <<<<<<<<<<<<<< @@ -845,7 +863,7 @@ __pyx_v_p = __pyx_2; __pyx_2 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":188 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":188 * b = _get_coords(gout) * p = Polygon(b) * pout.append(p) # <<<<<<<<<<<<<< @@ -866,7 +884,7 @@ __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":190 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":190 * pout.append(p) * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< @@ -875,7 +893,7 @@ */ __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":191 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":191 * elif typeid == GEOS_MULTILINESTRING: * numgeoms = GEOSGetNumGeometries(g3) * pout = [] # <<<<<<<<<<<<<< @@ -887,7 +905,7 @@ __pyx_v_pout = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":192 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":192 * numgeoms = GEOSGetNumGeometries(g3) * pout = [] * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< @@ -896,7 +914,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":193 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":193 * pout = [] * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< @@ -905,7 +923,7 @@ */ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":194 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":194 * for i from 0 <= i < numgeoms: * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) # <<<<<<<<<<<<<< @@ -917,7 +935,7 @@ __pyx_v_b = __pyx_2; __pyx_2 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":195 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":195 * gout = GEOSGetGeometryN(g3, i) * b = _get_coords(gout) * p = LineString(b) # <<<<<<<<<<<<<< @@ -933,7 +951,7 @@ __pyx_v_p = __pyx_3; __pyx_3 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":196 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":196 * b = _get_coords(gout) * p = LineString(b) * pout.append(p) # <<<<<<<<<<<<<< @@ -953,7 +971,7 @@ } /*else*/ { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":198 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":198 * pout.append(p) * else: * type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<< @@ -965,14 +983,14 @@ __pyx_v_type = __pyx_2; __pyx_2 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":199 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":199 * else: * type = PyString_FromString(GEOSGeomType(g3)) * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<< * GEOSGeom_destroy(g3) * return pout */ - __pyx_4 = PyNumber_Remainder(__pyx_k7p, __pyx_v_type); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} + __pyx_4 = PyNumber_Remainder(__pyx_k8p, __pyx_v_type); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4); __pyx_4 = 0; @@ -984,7 +1002,7 @@ } __pyx_L2:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":200 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":200 * type = PyString_FromString(GEOSGeomType(g3)) * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) * GEOSGeom_destroy(g3) # <<<<<<<<<<<<<< @@ -993,7 +1011,7 @@ */ GEOSGeom_destroy(__pyx_v_g3); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":201 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":201 * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) * GEOSGeom_destroy(g3) * return pout # <<<<<<<<<<<<<< @@ -1118,7 +1136,7 @@ Py_INCREF(__pyx_v_b); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":225 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":225 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -1138,7 +1156,7 @@ } __pyx_L2:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":228 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":228 * b = b.copy() * * m = b.shape[0] # <<<<<<<<<<<<<< @@ -1160,7 +1178,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_v_m = __pyx_5; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":231 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":231 * * # Add closing coordinates to sequence? * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< @@ -1216,7 +1234,7 @@ } __pyx_L3:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":235 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":235 * else: * M = m * self._npts = M # <<<<<<<<<<<<<< @@ -1225,7 +1243,7 @@ */ ((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":238 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":238 * * # Create a coordinate sequence * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< @@ -1234,7 +1252,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":241 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":241 * * # add to coordinate sequence * bbuffer = <double *>b.data # <<<<<<<<<<<<<< @@ -1243,7 +1261,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":242 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":242 * # add to coordinate sequence * bbuffer = <double *>b.data * for i from 0 <= i < m: # <<<<<<<<<<<<<< @@ -1252,7 +1270,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_m; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":243 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":243 * bbuffer = <double *>b.data * for i from 0 <= i < m: * dx = bbuffer[2*i] # <<<<<<<<<<<<<< @@ -1261,7 +1279,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":244 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":244 * for i from 0 <= i < m: * dx = bbuffer[2*i] * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< @@ -1270,7 +1288,7 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":247 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":247 * # Because of a bug in the GEOS C API, * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< @@ -1279,7 +1297,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,__pyx_v_i,__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":248 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":248 * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< @@ -1289,7 +1307,7 @@ GEOSCoordSeq_setY(__pyx_v_cs,__pyx_v_i,__pyx_v_dy); } - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":251 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":251 * * # Add closing coordinates to sequence? * if M > m: # <<<<<<<<<<<<<< @@ -1299,7 +1317,7 @@ __pyx_1 = (__pyx_v_M > __pyx_v_m); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":252 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":252 * # Add closing coordinates to sequence? * if M > m: * dx = bbuffer[0] # <<<<<<<<<<<<<< @@ -1308,7 +1326,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[0]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":253 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":253 * if M > m: * dx = bbuffer[0] * dy = bbuffer[1] # <<<<<<<<<<<<<< @@ -1317,7 +1335,7 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[1]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":254 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":254 * dx = bbuffer[0] * dy = bbuffer[1] * GEOSCoordSeq_setX(cs, M-1, dx) # <<<<<<<<<<<<<< @@ -1326,7 +1344,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,(__pyx_v_M - 1),__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":255 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":255 * dy = bbuffer[1] * GEOSCoordSeq_setX(cs, M-1, dx) * GEOSCoordSeq_setY(cs, M-1, dy) # <<<<<<<<<<<<<< @@ -1338,7 +1356,7 @@ } __pyx_L6:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":258 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":258 * * # create LinearRing * lr = GEOSGeom_createLinearRing(cs) # <<<<<<<<<<<<<< @@ -1347,7 +1365,7 @@ */ __pyx_v_lr = GEOSGeom_createLinearRing(__pyx_v_cs); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":261 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":261 * * # create Polygon from LinearRing (assuming no holes) * self._geom = GEOSGeom_createPolygon(lr,NULL,0) # <<<<<<<<<<<<<< @@ -1356,7 +1374,7 @@ */ ((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPolygon(__pyx_v_lr,NULL,0); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":262 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":262 * # create Polygon from LinearRing (assuming no holes) * self._geom = GEOSGeom_createPolygon(lr,NULL,0) * self.boundary = b # <<<<<<<<<<<<<< @@ -1389,7 +1407,7 @@ PyObject *__pyx_1 = 0; Py_INCREF((PyObject *)__pyx_v_self); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":267 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":267 * def area(self): * cdef double area * GEOSArea(self._geom, &area) # <<<<<<<<<<<<<< @@ -1398,7 +1416,7 @@ */ GEOSArea(((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._geom,(&__pyx_v_area)); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":268 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":268 * cdef double area * GEOSArea(self._geom, &area) * return area # <<<<<<<<<<<<<< @@ -1442,7 +1460,7 @@ Py_INCREF(__pyx_v_b); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":279 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":279 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -1462,7 +1480,7 @@ } __pyx_L2:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":282 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":282 * b = b.copy() * * M = b.shape[0] # <<<<<<<<<<<<<< @@ -1484,7 +1502,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_v_M = __pyx_5; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":283 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":283 * * M = b.shape[0] * self._npts = M # <<<<<<<<<<<<<< @@ -1493,7 +1511,7 @@ */ ((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":286 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":286 * * # Create a coordinate sequence * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< @@ -1502,7 +1520,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":289 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":289 * * # add to coordinate sequence * bbuffer = <double *>b.data # <<<<<<<<<<<<<< @@ -1511,7 +1529,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":290 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":290 * # add to coordinate sequence * bbuffer = <double *>b.data * for i from 0 <= i < M: # <<<<<<<<<<<<<< @@ -1520,7 +1538,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":291 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":291 * bbuffer = <double *>b.data * for i from 0 <= i < M: * dx = bbuffer[2*i] # <<<<<<<<<<<<<< @@ -1529,7 +1547,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":292 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":292 * for i from 0 <= i < M: * dx = bbuffer[2*i] * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< @@ -1538,7 +1556,7 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":295 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":295 * # Because of a bug in the GEOS C API, * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< @@ -1547,7 +1565,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,__pyx_v_i,__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":296 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":296 * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< @@ -1557,7 +1575,7 @@ GEOSCoordSeq_setY(__pyx_v_cs,__pyx_v_i,__pyx_v_dy); } - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":299 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":299 * * # create LineString * self._geom = GEOSGeom_createLineString(cs) # <<<<<<<<<<<<<< @@ -1566,7 +1584,7 @@ */ ((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createLineString(__pyx_v_cs); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":300 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":300 * # create LineString * self._geom = GEOSGeom_createLineString(cs) * self.boundary = b # <<<<<<<<<<<<<< @@ -1606,7 +1624,7 @@ Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_b); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":308 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":308 * cdef GEOSCoordSeq *cs * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) # <<<<<<<<<<<<<< @@ -1615,7 +1633,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(1,2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":309 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":309 * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] # <<<<<<<<<<<<<< @@ -1635,7 +1653,7 @@ Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_dx = __pyx_3; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":309 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":309 * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] # <<<<<<<<<<<<<< @@ -1655,7 +1673,7 @@ Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_dy = __pyx_3; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":310 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":310 * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) # <<<<<<<<<<<<<< @@ -1664,7 +1682,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,0,__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":311 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":311 * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) # <<<<<<<<<<<<<< @@ -1673,7 +1691,7 @@ */ GEOSCoordSeq_setY(__pyx_v_cs,0,__pyx_v_dy); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":312 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":312 * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<< @@ -1682,7 +1700,7 @@ */ ((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":313 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":313 * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 # <<<<<<<<<<<<<< @@ -1691,7 +1709,7 @@ */ ((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._npts = 1; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":314 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":314 * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 * self.boundary = b # <<<<<<<<<<<<<< @@ -1715,6 +1733,8 @@ return __pyx_r; } +static PyObject *__pyx_num_2; + static PyObject *__pyx_n_empty; static PyObject *__pyx_n_float64; @@ -1735,7 +1755,7 @@ PyObject *__pyx_5 = 0; __pyx_v_b = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":323 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":323 * cdef ndarray b * cdef double *bbuffer * if GEOSGeomTypeId(geom) == GEOS_POLYGON: # <<<<<<<<<<<<<< @@ -1745,7 +1765,7 @@ __pyx_1 = (GEOSGeomTypeId(__pyx_v_geom) == GEOS_POLYGON); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":324 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":324 * cdef double *bbuffer * if GEOSGeomTypeId(geom) == GEOS_POLYGON: * lr = GEOSGetExteriorRing(geom) # <<<<<<<<<<<<<< @@ -1754,7 +1774,7 @@ */ __pyx_v_lr = GEOSGetExteriorRing(__pyx_v_geom); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":325 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":325 * if GEOSGeomTypeId(geom) == GEOS_POLYGON: * lr = GEOSGetExteriorRing(geom) * cs = GEOSGeom_getCoordSeq(lr) # <<<<<<<<<<<<<< @@ -1769,7 +1789,7 @@ } __pyx_L2:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":328 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":328 * else: * cs = GEOSGeom_getCoordSeq(geom) * GEOSCoordSeq_getSize(cs, &M) # <<<<<<<<<<<<<< @@ -1778,7 +1798,7 @@ */ GEOSCoordSeq_getSize(__pyx_v_cs,(&__pyx_v_M)); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":329 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":329 * cs = GEOSGeom_getCoordSeq(geom) * GEOSCoordSeq_getSize(cs, &M) * b = numpy.empty((M,2), numpy.float64) # <<<<<<<<<<<<<< @@ -1810,7 +1830,7 @@ __pyx_v_b = ((PyArrayObject *)__pyx_4); __pyx_4 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":330 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":330 * GEOSCoordSeq_getSize(cs, &M) * b = numpy.empty((M,2), numpy.float64) * bbuffer = <double *>b.data # <<<<<<<<<<<<<< @@ -1819,7 +1839,7 @@ */ __pyx_v_bbuffer = ((double *)__pyx_v_b->data); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":331 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":331 * b = numpy.empty((M,2), numpy.float64) * bbuffer = <double *>b.data * for i from 0 <= i < M: # <<<<<<<<<<<<<< @@ -1828,7 +1848,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":332 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":332 * bbuffer = <double *>b.data * for i from 0 <= i < M: * GEOSCoordSeq_getX(cs, i, &dx) # <<<<<<<<<<<<<< @@ -1837,7 +1857,7 @@ */ GEOSCoordSeq_getX(__pyx_v_cs,__pyx_v_i,(&__pyx_v_dx)); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":333 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":333 * for i from 0 <= i < M: * GEOSCoordSeq_getX(cs, i, &dx) * GEOSCoordSeq_getY(cs, i, &dy) # <<<<<<<<<<<<<< @@ -1846,7 +1866,7 @@ */ GEOSCoordSeq_getY(__pyx_v_cs,__pyx_v_i,(&__pyx_v_dy)); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":334 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":334 * GEOSCoordSeq_getX(cs, i, &dx) * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx # <<<<<<<<<<<<<< @@ -1855,7 +1875,7 @@ */ (__pyx_v_bbuffer[(2 * __pyx_v_i)]) = __pyx_v_dx; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":335 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":335 * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy # <<<<<<<<<<<<<< @@ -1864,7 +1884,7 @@ (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]) = __pyx_v_dy; } - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":336 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":336 * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy * return b # <<<<<<<<<<<<<< @@ -1892,6 +1912,7 @@ {&__pyx_n_ValueError, "ValueError"}, {&__pyx_n___class__, "__class__"}, {&__pyx_n___dealloc__, "__dealloc__"}, + {&__pyx_n___geos_version__, "__geos_version__"}, {&__pyx_n___init__, "__init__"}, {&__pyx_n___reduce__, "__reduce__"}, {&__pyx_n___version__, "__version__"}, @@ -1901,7 +1922,6 @@ {&__pyx_n_empty, "empty"}, {&__pyx_n_float64, "float64"}, {&__pyx_n_geom_type, "geom_type"}, - {&__pyx_n_geos_version, "geos_version"}, {&__pyx_n_get_coords, "get_coords"}, {&__pyx_n_intersection, "intersection"}, {&__pyx_n_intersects, "intersects"}, @@ -1922,6 +1942,7 @@ {&__pyx_k5p, __pyx_k5, sizeof(__pyx_k5), 0}, {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6), 0}, {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7), 0}, + {&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8), 0}, {0, 0, 0, 0} }; @@ -2568,9 +2589,7 @@ PyMODINIT_FUNC init_geos(void) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - int __pyx_5; + int __pyx_3; /*--- Libary function declarations ---*/ __pyx_init_filenames(); /*--- Module creation code ---*/ @@ -2580,11 +2599,10 @@ if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; /*--- Intern code ---*/ - __pyx_num_2 = PyInt_FromLong(2); if (unlikely(!__pyx_num_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; - __pyx_num_3 = PyInt_FromLong(3); if (unlikely(!__pyx_num_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; __pyx_num_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_num_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; __pyx_num_0 = PyInt_FromLong(0); if (unlikely(!__pyx_num_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; __pyx_num_1 = PyInt_FromLong(1); if (unlikely(!__pyx_num_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; + __pyx_num_2 = PyInt_FromLong(2); if (unlikely(!__pyx_num_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; /*--- String init code ---*/ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}; @@ -2616,7 +2634,7 @@ /*--- Type import code ---*/ /*--- Execution code ---*/ - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":1 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":1 * import sys # <<<<<<<<<<<<<< * import numpy * @@ -2625,7 +2643,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":2 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":2 * import sys * import numpy # <<<<<<<<<<<<<< * @@ -2635,7 +2653,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":4 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":4 * import numpy * * __version__ = "0.1" # <<<<<<<<<<<<<< @@ -2644,7 +2662,7 @@ */ if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k3p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":26 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":26 * * # Initialize numpy * import_array() # <<<<<<<<<<<<<< @@ -2653,60 +2671,43 @@ */ import_array(); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":121 - * - * # check library version - * geos_version = GEOS_VERSION_MAJOR,GEOS_VERSION_MINOR,GEOS_VERSION_PATCH # <<<<<<<<<<<<<< - * if geos_version != (2,2,3): + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":121 + * cdef geos_version(): + * return PyString_FromString(GEOSversion()) + * __geos_version__ = geos_version() # module variable. # <<<<<<<<<<<<<< + * if __geos_version__ != "2.2.3-CAPI-1.1.1": * raise ValueError('version 2.2.3 of the geos library is required') */ - __pyx_1 = PyInt_FromLong(GEOS_VERSION_MAJOR); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} - __pyx_2 = PyInt_FromLong(GEOS_VERSION_MINOR); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} - __pyx_3 = PyInt_FromLong(GEOS_VERSION_PATCH); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} - __pyx_4 = PyTuple_New(3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - PyTuple_SET_ITEM(__pyx_4, 2, __pyx_3); - __pyx_1 = 0; - __pyx_2 = 0; - __pyx_3 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_geos_version, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_1 = __pyx_f_5_geos_geos_version(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} + if (PyObject_SetAttr(__pyx_m, __pyx_n___geos_version__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":122 - * # check library version - * geos_version = GEOS_VERSION_MAJOR,GEOS_VERSION_MINOR,GEOS_VERSION_PATCH - * if geos_version != (2,2,3): # <<<<<<<<<<<<<< + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":122 + * return PyString_FromString(GEOSversion()) + * __geos_version__ = geos_version() # module variable. + * if __geos_version__ != "2.2.3-CAPI-1.1.1": # <<<<<<<<<<<<<< * raise ValueError('version 2.2.3 of the geos library is required') * # intialize GEOS (parameters are notice and error function callbacks). */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_geos_version); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} - __pyx_2 = PyTuple_New(3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} - Py_INCREF(__pyx_num_2); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_num_2); - Py_INCREF(__pyx_num_2); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_num_2); - Py_INCREF(__pyx_num_3); - PyTuple_SET_ITEM(__pyx_2, 2, __pyx_num_3); - __pyx_3 = PyObject_RichCompare(__pyx_1, __pyx_2, Py_NE); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___geos_version__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} + __pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_k4p, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (__pyx_5) { - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;} - Py_INCREF(__pyx_k4p); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k4p); - __pyx_1 = PyObject_CallObject(__pyx_builtin_ValueError, __pyx_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __Pyx_Raise(__pyx_1, 0, 0); + if (__pyx_3) { + __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;} + Py_INCREF(__pyx_k5p); + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k5p); + __pyx_2 = PyObject_CallObject(__pyx_builtin_ValueError, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_Raise(__pyx_2, 0, 0); + Py_DECREF(__pyx_2); __pyx_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":125 + /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":125 * raise ValueError('version 2.2.3 of the geos library is required') * # intialize GEOS (parameters are notice and error function callbacks... [truncated message content] |
From: <md...@us...> - 2007-11-15 20:26:08
|
Revision: 4320 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4320&view=rev Author: mdboom Date: 2007-11-15 12:26:03 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Fix gridlines in log scale. Modified Paths: -------------- branches/transforms/lib/matplotlib/lines.py Modified: branches/transforms/lib/matplotlib/lines.py =================================================================== --- branches/transforms/lib/matplotlib/lines.py 2007-11-15 20:05:46 UTC (rev 4319) +++ branches/transforms/lib/matplotlib/lines.py 2007-11-15 20:26:03 UTC (rev 4320) @@ -395,6 +395,8 @@ self._xorig = x self._yorig = y self.recache() + else: + self._transformed_path._invalid = self._transformed_path.INVALID_NON_AFFINE def recache(self): #if self.axes is None: print 'recache no axes' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 20:05:49
|
Revision: 4319 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4319&view=rev Author: mdboom Date: 2007-11-15 12:05:46 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Fix value display in log-scaled plots. Modified Paths: -------------- branches/transforms/lib/matplotlib/cbook.py Modified: branches/transforms/lib/matplotlib/cbook.py =================================================================== --- branches/transforms/lib/matplotlib/cbook.py 2007-11-15 18:39:36 UTC (rev 4318) +++ branches/transforms/lib/matplotlib/cbook.py 2007-11-15 20:05:46 UTC (rev 4319) @@ -176,7 +176,7 @@ def strip_math(s): 'remove latex formatting from mathtext' - remove = (r'\rm', '\cal', '\tt', '\it', '\\', '{', '}') + remove = (r'\mathdefault', r'\rm', r'\cal', r'\tt', r'\it', '\\', '{', '}') s = s[1:-1] for r in remove: s = s.replace(r,'') return s This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 18:39:38
|
Revision: 4318 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4318&view=rev Author: mdboom Date: 2007-11-15 10:39:36 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Merged revisions 4290-4317 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4290 | mdboom | 2007-11-14 14:43:31 -0500 (Wed, 14 Nov 2007) | 2 lines Fix flush callback in PNG file-like object writing. ........ r4315 | mdboom | 2007-11-15 13:36:27 -0500 (Thu, 15 Nov 2007) | 2 lines Clean up error message. ........ r4316 | mdboom | 2007-11-15 13:36:51 -0500 (Thu, 15 Nov 2007) | 2 lines Have backend_driver report times for each individual test. ........ r4317 | mdboom | 2007-11-15 13:37:57 -0500 (Thu, 15 Nov 2007) | 1 line Add tool to compare two different outputs of backend_driver.py ........ Modified Paths: -------------- branches/transforms/examples/backend_driver.py branches/transforms/src/_backend_agg.cpp Added Paths: ----------- branches/transforms/unit/compare_backend_driver_results.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4289 + /trunk/matplotlib:1-4317 Modified: branches/transforms/examples/backend_driver.py =================================================================== --- branches/transforms/examples/backend_driver.py 2007-11-15 18:37:57 UTC (rev 4317) +++ branches/transforms/examples/backend_driver.py 2007-11-15 18:39:36 UTC (rev 4318) @@ -123,9 +123,7 @@ os.system(' '.join(arglist)) def drive(backend, python=['python'], switches = []): - exclude = failbackend.get(backend, []) - switchstring = ' '.join(switches) # Strip off the format specifier, if any. if backend.startswith('cairo'): _backend = 'cairo' @@ -136,7 +134,7 @@ print '\tSkipping %s, known to fail on backend: %s'%backend continue - print '\tdriving %s %s' % (fname, switchstring) + print ('\tdriving %-40s' % (fname)), basename, ext = os.path.splitext(fname) outfile = basename + '_%s'%backend tmpfile_name = '_tmp_%s.py' % basename @@ -169,7 +167,10 @@ tmpfile.write('savefig("%s", dpi=150)' % outfile) tmpfile.close() + start_time = time.time() run(python + [tmpfile_name, switchstring]) + end_time = time.time() + print (end_time - start_time) #os.system('%s %s %s' % (python, tmpfile_name, switchstring)) os.remove(tmpfile_name) @@ -193,7 +194,8 @@ if not backends: backends = default_backends for backend in backends: - print 'testing %s' % backend + switchstring = ' '.join(switches) + print 'testing %s %s' % (backend, switchstring) t0 = time.time() drive(backend, python, switches) t1 = time.time() Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-11-15 18:37:57 UTC (rev 4317) +++ branches/transforms/src/_backend_agg.cpp 2007-11-15 18:39:36 UTC (rev 4318) @@ -1269,7 +1269,7 @@ static void flush_png_data(png_structp png_ptr) { PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr); - PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "write"); + PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush"); if (flush_method) { PyObject_CallFunction(flush_method, ""); } @@ -1297,7 +1297,7 @@ if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) { PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); if (!(write_method && PyCallable_Check(write_method))) - throw Py::TypeError("Object does not appear to be a Python file-like object"); + throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); } } Copied: branches/transforms/unit/compare_backend_driver_results.py (from rev 4317, trunk/matplotlib/unit/compare_backend_driver_results.py) =================================================================== --- branches/transforms/unit/compare_backend_driver_results.py (rev 0) +++ branches/transforms/unit/compare_backend_driver_results.py 2007-11-15 18:39:36 UTC (rev 4318) @@ -0,0 +1,71 @@ +import sys + +def parse_results(filename): + results = {} + fd = open(filename, 'r') + section = "???" + for line in fd.readlines(): + line = line.strip() + if line.startswith("testing"): + section = line.split(" ", 1)[1] + results.setdefault(section, {}) + elif line.startswith("driving"): + driving, test, time = [x.strip() for x in line.split()] + time = float(time) + results[section][test] = time + fd.close() + return results + + +def check_results_are_compatible(results_a, results_b): + for section in results_a.keys(): + if not section in results_b: + raise RuntimeError("Backend '%s' in first set, but not in second" % section) + + for section in results_b.keys(): + if not section in results_a: + raise RuntimeError("Backend '%s' in second set, but not in first" % section) + + +def compare_results(results_a, results_b): + check_results_are_compatible(results_a, results_b) + + sections = results_a.keys() + sections.sort() + for section in results_a.keys(): + print "backend %s" % section + print " %-40s %6s %6s %6s %6s" % ("test", "a", "b", "delta", "% diff") + print " " + '-' * 69 + deltas = [] + section_a = results_a[section] + section_b = results_b[section] + for test in section_a.keys(): + if test not in section_b: + deltas.append([None, None, section_a[test], None, test]) + else: + time_a = section_a[test] + time_b = section_b[test] + deltas.append([time_b / time_a, time_b - time_a, time_a, time_b, test]) + for test in section_b.keys(): + if test not in section_a: + deltas.append([None, None, None, section_b[test], test]) + + deltas.sort() + for diff, delta, time_a, time_b, test in deltas: + if diff is None: + if time_a is None: + print " %-40s ??? % 6.3f ??? ???" % (test, time_b) + else: + print " %-40s % 6.3f ??? ??? ???" % (test, time_a) + else: + print " %-40s % 6.3f % 6.3f % 6.3f %6d%%" % (test, time_a, time_b, delta, diff * 100) + + +if __name__ == '__main__': + results_a_filename = sys.argv[-2] + results_b_filename = sys.argv[-1] + + results_a = parse_results(results_a_filename) + results_b = parse_results(results_b_filename) + + compare_results(results_a, results_b) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 18:37:59
|
Revision: 4317 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4317&view=rev Author: mdboom Date: 2007-11-15 10:37:57 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Add tool to compare two different outputs of backend_driver.py Added Paths: ----------- trunk/matplotlib/unit/compare_backend_driver_results.py Added: trunk/matplotlib/unit/compare_backend_driver_results.py =================================================================== --- trunk/matplotlib/unit/compare_backend_driver_results.py (rev 0) +++ trunk/matplotlib/unit/compare_backend_driver_results.py 2007-11-15 18:37:57 UTC (rev 4317) @@ -0,0 +1,71 @@ +import sys + +def parse_results(filename): + results = {} + fd = open(filename, 'r') + section = "???" + for line in fd.readlines(): + line = line.strip() + if line.startswith("testing"): + section = line.split(" ", 1)[1] + results.setdefault(section, {}) + elif line.startswith("driving"): + driving, test, time = [x.strip() for x in line.split()] + time = float(time) + results[section][test] = time + fd.close() + return results + + +def check_results_are_compatible(results_a, results_b): + for section in results_a.keys(): + if not section in results_b: + raise RuntimeError("Backend '%s' in first set, but not in second" % section) + + for section in results_b.keys(): + if not section in results_a: + raise RuntimeError("Backend '%s' in second set, but not in first" % section) + + +def compare_results(results_a, results_b): + check_results_are_compatible(results_a, results_b) + + sections = results_a.keys() + sections.sort() + for section in results_a.keys(): + print "backend %s" % section + print " %-40s %6s %6s %6s %6s" % ("test", "a", "b", "delta", "% diff") + print " " + '-' * 69 + deltas = [] + section_a = results_a[section] + section_b = results_b[section] + for test in section_a.keys(): + if test not in section_b: + deltas.append([None, None, section_a[test], None, test]) + else: + time_a = section_a[test] + time_b = section_b[test] + deltas.append([time_b / time_a, time_b - time_a, time_a, time_b, test]) + for test in section_b.keys(): + if test not in section_a: + deltas.append([None, None, None, section_b[test], test]) + + deltas.sort() + for diff, delta, time_a, time_b, test in deltas: + if diff is None: + if time_a is None: + print " %-40s ??? % 6.3f ??? ???" % (test, time_b) + else: + print " %-40s % 6.3f ??? ??? ???" % (test, time_a) + else: + print " %-40s % 6.3f % 6.3f % 6.3f %6d%%" % (test, time_a, time_b, delta, diff * 100) + + +if __name__ == '__main__': + results_a_filename = sys.argv[-2] + results_b_filename = sys.argv[-1] + + results_a = parse_results(results_a_filename) + results_b = parse_results(results_b_filename) + + compare_results(results_a, results_b) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 18:36:57
|
Revision: 4316 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4316&view=rev Author: mdboom Date: 2007-11-15 10:36:51 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Have backend_driver report times for each individual test. Modified Paths: -------------- trunk/matplotlib/examples/backend_driver.py Modified: trunk/matplotlib/examples/backend_driver.py =================================================================== --- trunk/matplotlib/examples/backend_driver.py 2007-11-15 18:36:27 UTC (rev 4315) +++ trunk/matplotlib/examples/backend_driver.py 2007-11-15 18:36:51 UTC (rev 4316) @@ -123,9 +123,7 @@ os.system(' '.join(arglist)) def drive(backend, python=['python'], switches = []): - exclude = failbackend.get(backend, []) - switchstring = ' '.join(switches) # Strip off the format specifier, if any. if backend.startswith('cairo'): _backend = 'cairo' @@ -136,7 +134,7 @@ print '\tSkipping %s, known to fail on backend: %s'%backend continue - print '\tdriving %s %s' % (fname, switchstring) + print ('\tdriving %-40s' % (fname)), basename, ext = os.path.splitext(fname) outfile = basename + '_%s'%backend tmpfile_name = '_tmp_%s.py' % basename @@ -169,7 +167,10 @@ tmpfile.write('savefig("%s", dpi=150)' % outfile) tmpfile.close() + start_time = time.time() run(python + [tmpfile_name, switchstring]) + end_time = time.time() + print (end_time - start_time) #os.system('%s %s %s' % (python, tmpfile_name, switchstring)) os.remove(tmpfile_name) @@ -193,7 +194,8 @@ if not backends: backends = default_backends for backend in backends: - print 'testing %s' % backend + switchstring = ' '.join(switches) + print 'testing %s %s' % (backend, switchstring) t0 = time.time() drive(backend, python, switches) t1 = time.time() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 18:36:37
|
Revision: 4315 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4315&view=rev Author: mdboom Date: 2007-11-15 10:36:27 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Clean up error message. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2007-11-15 18:35:30 UTC (rev 4314) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-11-15 18:36:27 UTC (rev 4315) @@ -2294,7 +2294,7 @@ if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) { PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); if (!(write_method && PyCallable_Check(write_method))) - throw Py::TypeError("Object does not appear to be a Python file-like object"); + throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-15 18:35:32
|
Revision: 4314 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4314&view=rev Author: mdboom Date: 2007-11-15 10:35:30 -0800 (Thu, 15 Nov 2007) Log Message: ----------- Fix colorbar drawing. Modified Paths: -------------- branches/transforms/lib/matplotlib/colorbar.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/lib/matplotlib/colorbar.py =================================================================== --- branches/transforms/lib/matplotlib/colorbar.py 2007-11-15 18:32:22 UTC (rev 4313) +++ branches/transforms/lib/matplotlib/colorbar.py 2007-11-15 18:35:30 UTC (rev 4314) @@ -205,6 +205,8 @@ self.outline = lines.Line2D(x, y, color=mpl.rcParams['axes.edgecolor'], linewidth=mpl.rcParams['axes.linewidth']) ax.add_artist(self.outline) + self.outline.set_clip_box(None) + self.outline.set_clip_path(None) c = mpl.rcParams['axes.facecolor'] self.patch = patches.Polygon(zip(x,y), edgecolor=c, facecolor=c, Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-11-15 18:32:22 UTC (rev 4313) +++ branches/transforms/src/_backend_agg.cpp 2007-11-15 18:35:30 UTC (rev 4314) @@ -466,9 +466,6 @@ typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type; typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type; - rendererBase->reset_clipping(true); - theRasterizer->reset_clipping(); - args.verify_length(5, 6); Py::Object gc_obj = args[0]; @@ -525,7 +522,9 @@ unsigned strokeSize = scanlines.byte_size(); strokeCache = new agg::int8u[strokeSize]; // or any container scanlines.serialize(strokeCache); - + + theRasterizer->reset_clipping(); + rendererBase->reset_clipping(true); set_clipbox(gc.cliprect, rendererBase); bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans); @@ -885,6 +884,8 @@ GCAgg gc = GCAgg(gc_obj, dpi); facepair_t face = _get_rgba_face(face_obj, gc.alpha); + theRasterizer->reset_clipping(); + rendererBase->reset_clipping(true); set_clipbox(gc.cliprect, theRasterizer); bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-15 18:32:32
|
Revision: 4313 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4313&view=rev Author: jswhit Date: 2007-11-15 10:32:22 -0800 (Thu, 15 Nov 2007) Log Message: ----------- add new example Modified Paths: -------------- trunk/toolkits/basemap-testing/MANIFEST.in Modified: trunk/toolkits/basemap-testing/MANIFEST.in =================================================================== --- trunk/toolkits/basemap-testing/MANIFEST.in 2007-11-15 18:13:04 UTC (rev 4312) +++ trunk/toolkits/basemap-testing/MANIFEST.in 2007-11-15 18:32:22 UTC (rev 4313) @@ -34,6 +34,7 @@ include examples/plotmap_oo.py include examples/plotmap_masked.py include examples/contour_demo.py +include examples/customticks.py include examples/quiver_demo.py include examples/nytolondon.py include examples/ireland.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-15 18:13:07
|
Revision: 4312 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4312&view=rev Author: jswhit Date: 2007-11-15 10:13:04 -0800 (Thu, 15 Nov 2007) Log Message: ----------- new customticks.py example. Modified Paths: -------------- trunk/toolkits/basemap-testing/examples/README Added Paths: ----------- trunk/toolkits/basemap-testing/examples/customticks.py Modified: trunk/toolkits/basemap-testing/examples/README =================================================================== --- trunk/toolkits/basemap-testing/examples/README 2007-11-15 18:10:54 UTC (rev 4311) +++ trunk/toolkits/basemap-testing/examples/README 2007-11-15 18:13:04 UTC (rev 4312) @@ -10,6 +10,9 @@ contour_demo.py demonstrates the use of filled contours with map projections. +customticks.py shows how to create custom tick labels for a cylindrical +projection. + plotmap.py is the example on the matplotlib 'screenshots' page (included in test.py) which shows the ETOPO topography as an image on a Lambert Conformal projection (using imshow). Added: trunk/toolkits/basemap-testing/examples/customticks.py =================================================================== --- trunk/toolkits/basemap-testing/examples/customticks.py (rev 0) +++ trunk/toolkits/basemap-testing/examples/customticks.py 2007-11-15 18:13:04 UTC (rev 4312) @@ -0,0 +1,48 @@ +from matplotlib.toolkits.basemap import Basemap +import pylab, numpy +from matplotlib.ticker import FuncFormatter + +# example showing how to create custom tick labels for a cylindrical +# projection. + +def deg2str(deg, dir='E', fmt="%3.1f"): + min = 60 * (deg - numpy.floor(deg)) + deg = numpy.floor(deg) + if deg < 0: + if min != 0.0: + deg += 1.0 + min -= 60.0 + if dir=='E': + dir='W' + if dir=='N': + dir='S' + return (u"%d\N{DEGREE SIGN}" + fmt + "' %s") % (numpy.abs(deg), numpy.abs(min), dir) + +# create figure. +fig=pylab.figure() +# background color will be used for 'wet' areas. +fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua') +# create Basemap instance (regular lat/lon projection). +# suppress_ticks=False allows custom axes ticks to be used +# Ticks are suppressed by default, so Basemap methods +# drawparallels and drawmeridians used to draw labelled lat/lon grid. +m = Basemap(llcrnrlon=-156.5,llcrnrlat=18.75,urcrnrlon=-154.5,urcrnrlat=20.5, + resolution='h',projection='cyl',suppress_ticks=False) +# draw coastlines, fill land areas. +m.drawcoastlines() +m.fillcontinents(color="coral") +# get axes instance. +ax = pylab.gca() +# add custom ticks. +# This only works for projection='cyl'. +def xformat(x, pos=None): return deg2str(x, 'E', fmt="%2.0f") +xformatter = FuncFormatter(xformat) +ax.xaxis.set_major_formatter(xformatter) +def yformat(y, pos=None): return deg2str(y, 'N', fmt="%2.0f") +yformatter = FuncFormatter(yformat) +ax.yaxis.set_major_formatter(yformatter) +ax.fmt_xdata = lambda x: deg2str(x, 'E', fmt="%5.3f") +ax.fmt_ydata = lambda y: deg2str(y, 'N', fmt="%5.3f") +ax.grid() +ax.set_title('Hawaii') +pylab.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |