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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(12) |
2
(3) |
3
(3) |
4
(3) |
5
(6) |
6
(3) |
7
|
8
(2) |
9
|
10
(1) |
11
(2) |
12
(1) |
13
(9) |
14
(5) |
15
(7) |
16
(2) |
17
|
18
|
19
(7) |
20
(1) |
21
(2) |
22
|
23
|
24
|
25
(3) |
26
|
27
|
28
|
29
(2) |
|
Revision: 4966 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4966&view=rev Author: jswhit Date: 2008年02月14日 14:22:13 -0800 (2008年2月14日) Log Message: ----------- add new blue marble image. Modified Paths: -------------- trunk/toolkits/basemap/MANIFEST.in Modified: trunk/toolkits/basemap/MANIFEST.in =================================================================== --- trunk/toolkits/basemap/MANIFEST.in 2008年02月14日 22:20:44 UTC (rev 4965) +++ trunk/toolkits/basemap/MANIFEST.in 2008年02月14日 22:22:13 UTC (rev 4966) @@ -49,7 +49,7 @@ include examples/run_all.py include examples/polarmaps.py include examples/warpimage.py -include examples/land_shallow_topo_2048.jpg +include examples/bmng.jpg include examples/pnganim.py include examples/garp.py include examples/setwh.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4965 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4965&view=rev Author: jswhit Date: 2008年02月14日 14:20:44 -0800 (2008年2月14日) Log Message: ----------- put import PIL in try/except Modified Paths: -------------- trunk/toolkits/basemap/examples/warpimage.py Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008年02月14日 22:07:41 UTC (rev 4964) +++ trunk/toolkits/basemap/examples/warpimage.py 2008年02月14日 22:20:44 UTC (rev 4965) @@ -2,13 +2,16 @@ import numpy from mpl_toolkits.basemap import Basemap as Basemap1 from numpy import ma -from matplotlib.image import pil_to_array -from PIL import Image class Basemap(Basemap1): # subclass Basemap and add bluemarble method. def bluemarble(self,masked=False): """display 'blue marble next generation' image from http://visibleearth.nasa.gov/""" + try: + from PIL import Image + except ImportError: + raise ImportError('bluemarble method requires PIL (http://www.pythonware.com/products/pil/)') + from matplotlib.image import pil_to_array # read in jpeg image to rgba array of normalized floats. pilImage = Image.open('bmng.jpg') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4964 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4964&view=rev Author: jswhit Date: 2008年02月14日 14:07:41 -0800 (2008年2月14日) Log Message: ----------- subclass Basemap, make a 'bluemarble' method. Modified Paths: -------------- trunk/toolkits/basemap/examples/warpimage.py Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008年02月14日 21:51:58 UTC (rev 4963) +++ trunk/toolkits/basemap/examples/warpimage.py 2008年02月14日 22:07:41 UTC (rev 4964) @@ -1,30 +1,50 @@ import pylab as P import numpy -from mpl_toolkits.basemap import Basemap +from mpl_toolkits.basemap import Basemap as Basemap1 from numpy import ma from matplotlib.image import pil_to_array from PIL import Image -# shows how to warp an image from one map projection to another. -# 'blue marble next generation' image from http://visibleearth.nasa.gov/ +class Basemap(Basemap1): + # subclass Basemap and add bluemarble method. + def bluemarble(self,masked=False): + """display 'blue marble next generation' image from http://visibleearth.nasa.gov/""" + + # read in jpeg image to rgba array of normalized floats. + pilImage = Image.open('bmng.jpg') + rgba = pil_to_array(pilImage) + rgba = rgba.astype(numpy.float32)/255. # convert to normalized floats. + + # define lat/lon grid that image spans (projection='cyl'). + nlons = rgba.shape[1]; nlats = rgba.shape[0] + delta = 360./float(nlons) + lons = numpy.arange(-180.+0.5*delta,180.,delta) + lats = numpy.arange(-90.+0.5*delta,90.,delta) -# read in jpeg image to rgba array of normalized floats. -pilImage = Image.open('bmng.jpg') -rgba = pil_to_array(pilImage) -rgba = rgba.astype(numpy.float32)/255. # convert to normalized floats. + if self.projection != 'cyl': + # transform to nx x ny regularly spaced native projection grid + # nx and ny chosen to have roughly the same horizontal res as original image. + dx = 2.*numpy.pi*m.rmajor/float(nlons) + nx = int((self.xmax-self.xmin)/dx)+1; ny = int((self.ymax-self.ymin)/dx)+1 + rgba_warped = ma.zeros((ny,nx,4),numpy.float64) + # interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' + # if masked=True, values outside of projection limb will be masked. + for k in range(4): + rgba_warped[:,:,k] = self.transform_scalar(rgba[:,:,k],lons,lats,nx,ny,masked=masked) + # make points outside projection limb transparent. + rgba_warped = rgba_warped.filled(0.) + # plot warped rgba image. + im = self.imshow(rgba_warped) + else: + im = self.imshow(rgba) + return im -# define lat/lon grid that image spans (projection='cyl'). -nlons = rgba.shape[1]; nlats = rgba.shape[0] -delta = 360./float(nlons) -lons = numpy.arange(-180.+0.5*delta,180.,delta) -lats = numpy.arange(-90.+0.5*delta,90.,delta) - # create new figure fig=P.figure() # define cylindrical equidistant projection. m = Basemap(projection='cyl',llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90,resolution='l') # plot (unwarped) rgba image. -im = m.imshow(rgba) +im = m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines. @@ -37,19 +57,8 @@ fig=P.figure() # define orthographic projection centered on North America. m = Basemap(projection='ortho',lat_0=40,lon_0=40,resolution='l') -# transform to nx x ny regularly spaced native projection grid -# nx and ny chosen to have roughly the same horizontal res as original image. -dx = 2.*numpy.pi*m.rmajor/float(nlons) -nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 -rgba_warped = ma.zeros((ny,nx,4),numpy.float64) -# interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' -# values outside of projection limb will be masked. -for k in range(4): - rgba_warped[:,:,k] = m.transform_scalar(rgba[:,:,k],lons,lats,nx,ny,masked=True) -# make points outside projection limb transparent. -rgba_warped = rgba_warped.filled(0.) # plot warped rgba image. -im = m.imshow(rgba_warped) +im = m.bluemarble(masked=True) # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. @@ -64,16 +73,7 @@ m = Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\ rsphere=(6378137.00,6356752.3142),lat_1=50.,lon_0=-107.,\ resolution='i',area_thresh=1000.,projection='lcc') -# transform to nx x ny regularly spaced native projection grid -# nx and ny chosen to have roughly the same horizontal res as original image. -dx = 2.*P.pi*m.rmajor/float(nlons) -nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 -rgba_warped = numpy.zeros((ny,nx,4),numpy.float64) -# interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' -for k in range(4): - rgba_warped[:,:,k] = m.transform_scalar(rgba[:,:,k],lons,lats,nx,ny) -# plot warped rgba image. -im = m.imshow(rgba_warped) +im = m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw parallels and meridians. @@ -91,19 +91,8 @@ m = Basemap(height=24000000,width=12000000, resolution=None,projection='omerc',\ lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) -# transform to nx x ny regularly spaced native projection grid -# nx and ny chosen to have roughly the same horizontal res as original image. -dx = 2.*numpy.pi*m.rmajor/float(nlons) -nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 -rgba_warped = ma.zeros((ny,nx,4),numpy.float64) -# interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' -# values outside of projection limb will be masked. -for k in range(4): - rgba_warped[:,:,k] = m.transform_scalar(rgba[:,:,k],lons,lats,nx,ny,masked=False) -# make points outside projection limb transparent. -rgba_warped = rgba_warped.filled(0.) # plot warped rgba image. -im = m.imshow(rgba_warped) +im = m.bluemarble() # draw lat/lon grid lines every 20 degrees. m.drawmeridians(numpy.arange(0,360,20),color='0.5') m.drawparallels(numpy.arange(-80,81,20),color='0.5') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4963 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4963&view=rev Author: jswhit Date: 2008年02月14日 13:51:58 -0800 (2008年2月14日) Log Message: ----------- update blue marble image Modified Paths: -------------- trunk/toolkits/basemap/examples/warpimage.py Added Paths: ----------- trunk/toolkits/basemap/examples/bmng.jpg Added: trunk/toolkits/basemap/examples/bmng.jpg =================================================================== (Binary files differ) Property changes on: trunk/toolkits/basemap/examples/bmng.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008年02月13日 21:48:38 UTC (rev 4962) +++ trunk/toolkits/basemap/examples/warpimage.py 2008年02月14日 21:51:58 UTC (rev 4963) @@ -6,10 +6,10 @@ from PIL import Image # shows how to warp an image from one map projection to another. -# image from http://visibleearth.nasa.gov/ +# 'blue marble next generation' image from http://visibleearth.nasa.gov/ # read in jpeg image to rgba array of normalized floats. -pilImage = Image.open('land_shallow_topo_2048.jpg') +pilImage = Image.open('bmng.jpg') rgba = pil_to_array(pilImage) rgba = rgba.astype(numpy.float32)/255. # convert to normalized floats. @@ -84,4 +84,30 @@ m.drawmeridians(meridians,labels=[1,1,0,1],color='0.5') P.title("Blue Marble image warped from 'cyl' to 'lcc' projection",fontsize=12) print 'warp to lambert conformal map ...' + +# create new figure +fig=P.figure() +# define oblique mercator map. +m = Basemap(height=24000000,width=12000000, + resolution=None,projection='omerc',\ + lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) +# transform to nx x ny regularly spaced native projection grid +# nx and ny chosen to have roughly the same horizontal res as original image. +dx = 2.*numpy.pi*m.rmajor/float(nlons) +nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 +rgba_warped = ma.zeros((ny,nx,4),numpy.float64) +# interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' +# values outside of projection limb will be masked. +for k in range(4): + rgba_warped[:,:,k] = m.transform_scalar(rgba[:,:,k],lons,lats,nx,ny,masked=False) +# make points outside projection limb transparent. +rgba_warped = rgba_warped.filled(0.) +# plot warped rgba image. +im = m.imshow(rgba_warped) +# draw lat/lon grid lines every 20 degrees. +m.drawmeridians(numpy.arange(0,360,20),color='0.5') +m.drawparallels(numpy.arange(-80,81,20),color='0.5') +P.title("Blue Marble image warped from 'cyl' to 'omerc' projection",fontsize=12) +print 'warp to oblique mercator map ...' + P.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4962 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4962&view=rev Author: jswhit Date: 2008年02月13日 13:48:38 -0800 (2008年2月13日) Log Message: ----------- added no_rot keyword Modified Paths: -------------- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008年02月13日 21:24:21 UTC (rev 4961) +++ trunk/toolkits/basemap/Changelog 2008年02月13日 21:48:38 UTC (rev 4962) @@ -8,7 +8,8 @@ support re-enabled. * changed _geos to _geoslib, so as not to conflict with the python module bundled with the GEOS library. - * some fixes/enhancements for omerc projection. + * some fixes/enhancements for omerc projection (added 'no_rot' + flag). version 0.9.9.1 (svn revision 4808) * require python 2.4 (really only needed for building). Once namespace packages are re-enabled in matplotlib, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4961 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4961&view=rev Author: jswhit Date: 2008年02月13日 13:24:21 -0800 (2008年2月13日) Log Message: ----------- added no_rot parameter (only relevant for omerc projection) Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年02月13日 17:15:11 UTC (rev 4960) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年02月13日 21:24:21 UTC (rev 4961) @@ -79,7 +79,7 @@ projection_params = {'cyl' : 'corners only (no width/height)', 'merc' : 'corners plus lat_ts (no width/height)', 'tmerc' : 'lon_0,lat_0', - 'omerc' : 'lat_0,lat_1,lat_2,lon_1,lon_2', + 'omerc' : 'lon_0,lat_0,lat_1,lat_2,lon_1,lon_2,no_rot', 'mill' : 'corners only (no width/height)', 'lcc' : 'lon_0,lat_0,lat_1,lat_2', 'laea' : 'lon_0,lat_0', @@ -215,6 +215,9 @@ for oblique mercator. lon_2 - longitude of one of the two points on the projection centerline for oblique mercator. + no_rot - only used by oblique mercator. If set to True, the map projection + coordinates will not be rotated to true North. Default is False (projection + coordinates are automatically rotated). lat_0 - central latitude (y-axis origin) - used by all projections, Must be equator for mercator projection. lon_0 - central meridian (x-axis origin) - used by all projections, @@ -336,6 +339,7 @@ lat_1=None, lat_2=None, lat_0=None, lon_0=None, lon_1=None, lon_2=None, + no_rot=False, suppress_ticks=True, satellite_height=35786000, boundinglat=None, @@ -527,13 +531,15 @@ self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat elif projection == 'omerc': - if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None or lat_0 is None: - raise ValueError, 'must specify lat_0 and lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' + if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None: + raise ValueError, 'must specify lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' projparams['lat_1'] = lat_1 projparams['lon_1'] = lon_1 projparams['lat_2'] = lat_2 projparams['lon_2'] = lon_2 projparams['lat_0'] = lat_0 + if no_rot: + projparams['no_rot']='' #if not using_corners: # raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners' if not using_corners: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4960 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4960&view=rev Author: jswhit Date: 2008年02月13日 09:15:11 -0800 (2008年2月13日) Log Message: ----------- renamed _geos to _geoslib, fixes for omerc Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/examples/test.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py trunk/toolkits/basemap/setup.py Added Paths: ----------- trunk/toolkits/basemap/src/_geoslib.c trunk/toolkits/basemap/src/_geoslib.pyx Removed Paths: ------------- trunk/toolkits/basemap/src/_geos.c trunk/toolkits/basemap/src/_geos.pyx Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008年02月13日 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/Changelog 2008年02月13日 17:15:11 UTC (rev 4960) @@ -6,6 +6,9 @@ namespace package, so basemap can now be installed if matplotlib is installed as an egg. Python 2.3 support re-enabled. + * changed _geos to _geoslib, so as not to conflict with + the python module bundled with the GEOS library. + * some fixes/enhancements for omerc projection. version 0.9.9.1 (svn revision 4808) * require python 2.4 (really only needed for building). Once namespace packages are re-enabled in matplotlib, Modified: trunk/toolkits/basemap/examples/test.py =================================================================== --- trunk/toolkits/basemap/examples/test.py 2008年02月13日 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/examples/test.py 2008年02月13日 17:15:11 UTC (rev 4960) @@ -196,10 +196,9 @@ # create new figure fig=figure() # setup oblique mercator basemap. -m = Basemap(llcrnrlon=-130.,llcrnrlat=39,urcrnrlon=-124.,urcrnrlat=60.,\ +m = Basemap(height=16700000,width=12000000, resolution='l',area_thresh=1000.,projection='omerc',\ - lon_2=-140,lat_2=55,lon_1=-120,lat_1=40) -fig.add_axes([0.125,0.2,0.6,0.6]) + lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) # transform to nx x ny regularly spaced native projection grid nx = int((m.xmax-m.xmin)/20000.)+1; ny = int((m.ymax-m.ymin)/20000.)+1 topodat = m.transform_scalar(topoin,lons,lats,nx,ny) @@ -216,13 +215,9 @@ m.drawcountries() m.drawstates() # draw parallels -delat = 3. -circles = arange(40,60,delat) -m.drawparallels(circles,labels=[1,0,0,0],fontsize=10) +m.drawparallels(arange(-80,81,20),labels=[1,0,0,0],fontsize=10) # draw meridians -delon = 3. -meridians = arange(-140,-120,delon) -m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10) +m.drawmeridians(arange(-180,181,30),labels=[0,0,0,1],fontsize=10) title('Oblique Mercator Projection') print 'plotting Oblique Mercator example ...' print m.srs Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年02月13日 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年02月13日 17:15:11 UTC (rev 4960) @@ -36,7 +36,7 @@ import numpy as npy from numpy import linspace, squeeze, ma from shapelib import ShapeFile -import _geos, pupynere, netcdftime +import _geoslib, pupynere, netcdftime # basemap data files now installed in lib/matplotlib/toolkits/basemap/data basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) @@ -79,7 +79,7 @@ projection_params = {'cyl' : 'corners only (no width/height)', 'merc' : 'corners plus lat_ts (no width/height)', 'tmerc' : 'lon_0,lat_0', - 'omerc' : 'lon_0,lat_0,lat_1,lat_2,lon_1,lon_2,no width/height', + 'omerc' : 'lat_0,lat_1,lat_2,lon_1,lon_2', 'mill' : 'corners only (no width/height)', 'lcc' : 'lon_0,lat_0,lat_1,lat_2', 'laea' : 'lon_0,lat_0', @@ -527,14 +527,23 @@ self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat elif projection == 'omerc': - if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None: - raise ValueError, 'must specify lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' + if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None or lat_0 is None: + raise ValueError, 'must specify lat_0 and lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' projparams['lat_1'] = lat_1 projparams['lon_1'] = lon_1 projparams['lat_2'] = lat_2 projparams['lon_2'] = lon_2 + projparams['lat_0'] = lat_0 + #if not using_corners: + # raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners' if not using_corners: - raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners' + if width is None or height is None: + raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters' + if lon_0 is None or lat_0 is None: + raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region' + llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams) + self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat + self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat elif projection == 'aeqd': if lat_0 is None or lon_0 is None: raise ValueError, 'must specify lat_0 and lon_0 for Azimuthal Equidistant basemap' @@ -736,12 +745,12 @@ polygon_types = [] # coastlines are polygons, other boundaries are line segments. if name == 'gshhs': - Shape = _geos.Polygon + Shape = _geoslib.Polygon else: - Shape = _geos.LineString + Shape = _geoslib.LineString # see if map projection region polygon contains a pole. - NPole = _geos.Point(self(0.,90.)) - SPole = _geos.Point(self(0.,-90.)) + NPole = _geoslib.Point(self(0.,90.)) + SPole = _geoslib.Point(self(0.,-90.)) boundarypolyxy = self._boundarypolyxy boundarypolyll = self._boundarypolyll hasNP = NPole.within(boundarypolyxy) @@ -749,7 +758,8 @@ containsPole = hasNP or hasSP # these projections cannot cross pole. if containsPole and\ - self.projection in ['tmerc','cass','omerc','merc','mill','cyl','robin','moll','sinu','geos']: + self.projection in ['merc','mill','cyl','robin','moll','sinu','geos']: + #self.projection in ['tmerc','omerc','cass','merc','mill','cyl','robin','moll','sinu','geos']: raise ValueError('%s projection cannot cross pole'%(self.projection)) # make sure orthographic projection has containsPole=True # we will compute the intersections in stereographic @@ -770,7 +780,7 @@ b = self._boundarypolyll.boundary blons = b[:,0]; blats = b[:,1] b[:,0], b[:,1] = maptran(blons, blats) - boundarypolyxy = _geos.Polygon(b) + boundarypolyxy = _geoslib.Polygon(b) for line in bdatmetafile: linesplit = line.split() area = float(linesplit[1]) @@ -817,7 +827,7 @@ lats.append(-90.) b = npy.empty((len(lons),2),npy.float64) b[:,0] = lons; b[:,1] = lats - poly = _geos.Polygon(b) + poly = _geoslib.Polygon(b) antart = True else: poly = Shape(b) @@ -940,7 +950,7 @@ y = rminor*npy.sin(thetas) + rminor b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) # compute proj instance for full disk, if necessary. if not self._fulldisk: projparms = self.projparams.copy() @@ -979,7 +989,7 @@ x, y = maptran(lons,lats) b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) else: # all other projections are rectangular. # left side (x = xmin, ymin <= y <= ymax) yy = linspace(self.ymin, self.ymax, ny)[:-1] @@ -1000,7 +1010,7 @@ b = npy.empty((4,2),npy.float64) b[:,0]=[self.xmin,self.xmin,self.xmax,self.xmax] b[:,1]=[self.ymin,self.ymax,self.ymax,self.ymin] - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) if self.projection in ['mill','merc','cyl']: # make sure map boundary doesn't quite include pole. if self.urcrnrlat > 89.9999: @@ -1016,7 +1026,7 @@ x, y = self(lons, lats) b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) else: if self.projection not in ['moll','robin','sinu']: lons, lats = maptran(x,y,inverse=True) @@ -1034,7 +1044,7 @@ n = n + 1 b = npy.empty((len(lons),2),npy.float64) b[:,0]=lons; b[:,1]=lats - boundaryll = _geos.Polygon(b) + boundaryll = _geoslib.Polygon(b) return boundaryll, boundaryxy Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008年02月13日 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/setup.py 2008年02月13日 17:15:11 UTC (rev 4960) @@ -31,7 +31,7 @@ else: return [("HAVE_UPDATE_HEADER", "0")] -def check_geosversion(GEOS_dir): +def checkversion(GEOS_dir): """check geos C-API header file (geos_c.h)""" try: f = open(os.path.join(GEOS_dir,'include/geos_c.h')) @@ -54,7 +54,7 @@ # if GEOS_dir not set, check a few standard locations. GEOS_dirs = ['/usr/local','/sw','/opt','/opt/local',os.path.expanduser('~')] for direc in GEOS_dirs: - geos_version = check_geosversion(direc) + geos_version = checkversion(direc) print 'checking for GEOS lib in %s ....' % direc if geos_version != '"2.2.3"': continue @@ -63,7 +63,7 @@ GEOS_dir = direc break else: - geos_version = check_geosversion(GEOS_dir) + geos_version = checkversion(GEOS_dir) #if geos_version != '"2.2.3"': # raise SystemExit(""" #Can't find geos library version 2.2.3. Please set the @@ -81,15 +81,15 @@ deps = glob.glob('src/*.c') deps.remove(os.path.join('src','_proj.c')) deps.remove(os.path.join('src','_geod.c')) -deps.remove(os.path.join('src','_geos.c')) +deps.remove(os.path.join('src','_geoslib.c')) packages = ['mpl_toolkits','mpl_toolkits.basemap'] package_dirs = {'':'lib'} extensions = [Extension("mpl_toolkits.basemap._proj",deps+['src/_proj.c'],include_dirs = ['src'],)] extensions.append(Extension("mpl_toolkits.basemap._geod",deps+['src/_geod.c'],include_dirs = ['src'],)) # for some reason, pickling won't work if this extension is installed -# as "matplotlib.toolkits.basemap._geos" -extensions.append(Extension("_geos",['src/_geos.c'], +# as "matplotlib.toolkits.basemap._geoslib" +extensions.append(Extension("_geoslib",['src/_geoslib.c'], library_dirs=geos_library_dirs, runtime_library_dirs=geos_library_dirs, include_dirs=geos_include_dirs, Deleted: trunk/toolkits/basemap/src/_geos.c =================================================================== --- trunk/toolkits/basemap/src/_geos.c 2008年02月13日 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/src/_geos.c 2008年02月13日 17:15:11 UTC (rev 4960) @@ -1,3119 +0,0 @@ -/* Generated by Cython 0.9.6.8 on Thu Nov 15 13:56:55 2007 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) -#endif -#ifndef WIN32 - #define __stdcall - #define __cdecl -#endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif -#include <math.h> -#include "numpy/arrayobject.h" -#include "geos_c.h" - - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE -#endif - -typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ -typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/ - -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if (x == Py_False) return 0; - else return PyObject_IsTrue(x); -} - - - -static int __pyx_skip_dispatch = 0; - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static int __pyx_lineno; -static char *__pyx_filename; -static char **__pyx_f; - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_WriteUnraisable(char *name); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(char *name); /*proto*/ - -static void __Pyx_AddTraceback(char *funcname); /*proto*/ - -static int __Pyx_RegisterCleanup(); /*proto*/ -static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/ -static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0}; - -/* Declarations from numpy */ - - -/* Declarations from _geos */ - -struct __pyx_obj_5_geos_BaseGeometry { - PyObject_HEAD - GEOSGeom *_geom; - unsigned int _npts; - PyObject *boundary; -}; - -struct __pyx_obj_5_geos_Polygon { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; -}; - -struct __pyx_obj_5_geos_LineString { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; -}; - -struct __pyx_obj_5_geos_Point { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; - PyObject *x; - PyObject *y; -}; - - - - - -static PyTypeObject *__pyx_ptype_5_geos_ndarray = 0; -static PyTypeObject *__pyx_ptype_5_geos_BaseGeometry = 0; -static PyTypeObject *__pyx_ptype_5_geos_Polygon = 0; -static PyTypeObject *__pyx_ptype_5_geos_LineString = 0; -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[] = "2.2.3-CAPI-1.1.1"; -static char __pyx_k5[] = "version 2.2.3 of the geos library is required"; - -static PyObject *__pyx_n_is_valid; -static PyObject *__pyx_n_geom_type; -static PyObject *__pyx_n_within; -static PyObject *__pyx_n_intersects; -static PyObject *__pyx_n_intersection; -static PyObject *__pyx_n_get_coords; -static PyObject *__pyx_n___dealloc__; -static PyObject *__pyx_n___reduce__; -static PyObject *__pyx_n___init__; -static PyObject *__pyx_n_area; -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_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_k6p; - -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; - PyObject *__pyx_v_message; - PyObject *__pyx_v_warn_msg; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_v_format = Py_None; Py_INCREF(Py_None); - __pyx_v_message = Py_None; Py_INCREF(Py_None); - __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - - /* "/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 = 101; goto __pyx_L1;} - Py_DECREF(__pyx_v_format); - __pyx_v_format = __pyx_1; - __pyx_1 = 0; - - /* "/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 = 102; goto __pyx_L1;} - Py_DECREF(__pyx_v_message); - __pyx_v_message = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":103 - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) - * try: # <<<<<<<<<<<<<< - * warn_msg = format % message - * except: - */ - /*try:*/ { - __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; - } - goto __pyx_L3; - __pyx_L2:; - Py_XDECREF(__pyx_1); __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":105 - * try: - * warn_msg = format % message - * except: # <<<<<<<<<<<<<< - * warn_msg = format - * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) - */ - /*except:*/ { - __Pyx_AddTraceback("_geos.notice_h"); - 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; - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/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 = 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 = 107; 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 = 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 = 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; - - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_WriteUnraisable("_geos.notice_h"); - __pyx_L0:; - Py_DECREF(__pyx_v_format); - Py_DECREF(__pyx_v_message); - Py_DECREF(__pyx_v_warn_msg); -} - -static PyObject *__pyx_n_stderr; - -static PyObject *__pyx_k7p; - -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; - PyObject *__pyx_v_message; - PyObject *__pyx_v_warn_msg; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_v_format = Py_None; Py_INCREF(Py_None); - __pyx_v_message = Py_None; Py_INCREF(Py_None); - __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - - /* "/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 = 110; goto __pyx_L1;} - Py_DECREF(__pyx_v_format); - __pyx_v_format = __pyx_1; - __pyx_1 = 0; - - /* "/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 = 111; goto __pyx_L1;} - Py_DECREF(__pyx_v_message); - __pyx_v_message = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":112 - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) - * try: # <<<<<<<<<<<<<< - * warn_msg = format % message - * except: - */ - /*try:*/ { - __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; - } - goto __pyx_L3; - __pyx_L2:; - Py_XDECREF(__pyx_1); __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":114 - * try: - * warn_msg = format % message - * except: # <<<<<<<<<<<<<< - * warn_msg = format - * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) - */ - /*except:*/ { - __Pyx_AddTraceback("_geos.error_h"); - 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; - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/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 = 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 = 116; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __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 = 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; - - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_WriteUnraisable("_geos.error_h"); - __pyx_L0:; - Py_DECREF(__pyx_v_format); - Py_DECREF(__pyx_v_message); - 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; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":134 - * def is_valid(self): - * cdef char valid - * valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<< - * if valid: - * return True - */ - __pyx_v_valid = GEOSisValid(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":135 - * cdef char valid - * valid = GEOSisValid(self._geom) - * if valid: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_valid; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = PyString_FromString(GEOSGeomType(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; 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.BaseGeometry.geom_type"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - char __pyx_v_answer; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - 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;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":146 - * cdef GEOSGeom *g1, *g2 - * cdef char answer - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":147 - * cdef char answer - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * answer = GEOSWithin(g1, g2) - * if answer: - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":148 - * g1 = self._geom - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<< - * if answer: - * return True - */ - __pyx_v_answer = GEOSWithin(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":149 - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) - * if answer: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_answer; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - __Pyx_AddTraceback("_geos.BaseGeometry.within"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - char __pyx_v_answer; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - 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;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":157 - * cdef GEOSGeom *g1, *g2 - * cdef char answer - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":158 - * cdef char answer - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * answer = GEOSIntersects(g1, g2) - * if answer: - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":159 - * g1 = self._geom - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<< - * if answer: - * return True - */ - __pyx_v_answer = GEOSIntersects(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":160 - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) - * if answer: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_answer; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - __Pyx_AddTraceback("_geos.BaseGeometry.intersects"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_n_append; -static PyObject *__pyx_n_NotImplementedError; - -static PyObject *__pyx_k8p; - -static PyObject *__pyx_builtin_NotImplementedError; - -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) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - GEOSGeom *__pyx_v_g3; - GEOSGeom *__pyx_v_gout; - int __pyx_v_numgeoms; - int __pyx_v_i; - int __pyx_v_typeid; - PyObject *__pyx_v_b; - PyObject *__pyx_v_p; - PyObject *__pyx_v_pout; - PyObject *__pyx_v_type; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_geom); - __pyx_v_b = Py_None; Py_INCREF(Py_None); - __pyx_v_p = Py_None; Py_INCREF(Py_None); - __pyx_v_pout = Py_None; Py_INCREF(Py_None); - __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;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":169 - * cdef char answer - * cdef int numgeoms, i, typeid - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":170 - * cdef int numgeoms, i, typeid - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":171 - * g1 = self._geom - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<< - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: - */ - __pyx_v_g3 = GEOSIntersection(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":172 - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<< - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) - */ - __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":173 - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<< - * b = _get_coords(g3) - * p = Polygon(b) - */ - __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":174 - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) # <<<<<<<<<<<<<< - * p = Polygon(b) - * pout = [p] - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":175 - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) - * p = Polygon(b) # <<<<<<<<<<<<<< - * pout = [p] - * elif typeid == GEOS_LINESTRING: - */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":176 - * b = _get_coords(g3) - * p = Polygon(b) - * pout = [p] # <<<<<<<<<<<<<< - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) - */ - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_2; - __pyx_2 = 0; - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":178 - * pout = [p] - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) # <<<<<<<<<<<<<< - * p = LineString(b) - * pout = [p] - */ - __pyx_3 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":179 - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) - * p = LineString(b) # <<<<<<<<<<<<<< - * pout = [p] - * elif typeid == GEOS_MULTIPOLYGON: - */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":180 - * b = _get_coords(g3) - * p = LineString(b) - * pout = [p] # <<<<<<<<<<<<<< - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) - */ - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_2; - __pyx_2 = 0; - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":182 - * pout = [p] - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< - * pout = [] - * for i from 0 <= i < numgeoms: - */ - __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":183 - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - */ - __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;} - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":184 - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] - * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":185 - * pout = [] - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< - * b = _get_coords(gout) - * p = Polygon(b) - */ - __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":186 - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) # <<<<<<<<<<<<<< - * p = Polygon(b) - * pout.append(p) - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":187 - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - * p = Polygon(b) # <<<<<<<<<<<<<< - * pout.append(p) - * elif typeid == GEOS_MULTILINESTRING: - */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b); - __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":188 - * b = _get_coords(gout) - * p = Polygon(b) - * pout.append(p) # <<<<<<<<<<<<<< - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) - */ - __pyx_3 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_p); - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":190 - * pout.append(p) - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< - * pout = [] - * for i from 0 <= i < numgeoms: - */ - __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":191 - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - */ - __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;} - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":192 - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] - * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":193 - * pout = [] - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< - * b = _get_coords(gout) - * p = LineString(b) - */ - __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":194 - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) # <<<<<<<<<<<<<< - * p = LineString(b) - * pout.append(p) - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":195 - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - * p = LineString(b) # <<<<<<<<<<<<<< - * pout.append(p) - * else: - */ - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":196 - * b = _get_coords(gout) - * p = LineString(b) - * pout.append(p) # <<<<<<<<<<<<<< - * else: - * type = PyString_FromString(GEOSGeomType(g3)) - */ - __pyx_2 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - goto __pyx_L2; - } - /*else*/ { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":198 - * pout.append(p) - * else: - * type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<< - * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) - * GEOSGeom_destroy(g3) - */ - __pyx_2 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} - Py_DECREF(__pyx_v_type); - __pyx_v_type = __pyx_2; - __pyx_2 = 0; - - /* "/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_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; - __pyx_2 = PyObject_CallObject(__pyx_builtin_NotImplementedError, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} - } - __pyx_L2:; - - /* "/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) # <<<<<<<<<<<<<< - * return pout - * - */ - GEOSGeom_destroy(__pyx_v_g3); - - /* "/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 # <<<<<<<<<<<<<< - * - * def get_coords(self): - */ - Py_INCREF(__pyx_v_pout); - __pyx_r = __pyx_v_pout; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - __Pyx_AddTraceback("_geos.BaseGeometry.intersection"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_b); - Py_DECREF(__pyx_v_p); - Py_DECREF(__pyx_v_pout); - Py_DECREF(__pyx_v_type); - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = __pyx_f_5_geos__get_coords(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; 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.BaseGeometry.get_coords"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self) { - Py_INCREF(__pyx_v_self); - GEOSGeom_destroy(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); - - Py_DECREF(__pyx_v_self); -} - -static PyObject *__pyx_n___class__; - -static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static char __pyx_doc_5_geos_12BaseGeometry___reduce__[] = "special method that allows geos instance to be pickled"; -static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - Py_INCREF(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary); - PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); - __pyx_1 = 0; - __pyx_2 = 0; - __pyx_r = __pyx_3; - __pyx_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_AddTraceback("_geos.BaseGeometry.__reduce__"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_num_neg_1; -static PyObject *__pyx_num_0; -static PyObject *__pyx_num_1; - -static PyObject *__pyx_n_copy; -static PyObject *__pyx_n_shape; - -static int __pyx_pf_5_geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_5_geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_b = 0; - unsigned int __pyx_v_M; - unsigned int __pyx_v_m; - unsigned int __pyx_v_i; - double __pyx_v_dx; - double __pyx_v_dy; - double *__pyx_v_bbuffer; - GEOSCoordSeq *__pyx_v_cs; - GEOSGeom *__pyx_v_lr; - int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - unsigned int __pyx_5; - PyObject *__pyx_6 = 0; - static char *__pyx_argnames[] = {"b",0}; - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) return -1; - Py_INCREF((PyObject *)__pyx_v_self); - 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;} - - /* "/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): # <<<<<<<<<<<<<< - * b = b.copy() - * - */ - __pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b)); - if (__pyx_1) { - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_v_b)); - __pyx_v_b = ((PyArrayObject *)__pyx_3); - __pyx_3 = 0; - goto __pyx_L2; - } - __pyx_L2:; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":228 - * b = b.copy() - * - * m = b.shape[0] # <<<<<<<<<<<<<< - * - * # Add closing coordinates to sequence? - */ - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) { - __pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); - } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) { - __pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); - } else { - __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_v_m = __pyx_5; - - /* "/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]: # <<<<<<<<<<<<<< - * M = m + 1 - * else: - */ - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_neg_1); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); - __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_0); - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); - __pyx_6 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_6, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - if (!__pyx_1) { - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_neg_1); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); - Py_INCREF(__pyx_num_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_1); - __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_6 = PyTuple_New(2); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_num_0); - Py_INCREF(__pyx_num_1); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_num_1); - __pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_... [truncated message content]
Revision: 4959 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4959&view=rev Author: jdh2358 Date: 2008年02月13日 05:50:29 -0800 (2008年2月13日) Log Message: ----------- Applied Erik's right-click backend_bases fix Modified Paths: -------------- trunk/matplotlib/examples/ginput_demo.py trunk/matplotlib/examples/lasso_demo.py trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/examples/ginput_demo.py =================================================================== --- trunk/matplotlib/examples/ginput_demo.py 2008年02月13日 08:34:53 UTC (rev 4958) +++ trunk/matplotlib/examples/ginput_demo.py 2008年02月13日 13:50:29 UTC (rev 4959) @@ -2,5 +2,5 @@ t = arange(10) plot(t, sin(t)) print "Please click" -ginput(3, verbose=True) +x = ginput(3, verbose=True) show() Modified: trunk/matplotlib/examples/lasso_demo.py =================================================================== --- trunk/matplotlib/examples/lasso_demo.py 2008年02月13日 08:34:53 UTC (rev 4958) +++ trunk/matplotlib/examples/lasso_demo.py 2008年02月13日 13:50:29 UTC (rev 4959) @@ -37,7 +37,7 @@ facecolors = [d.color for d in data] self.xys = [(d.x, d.y) for d in data] - + fig = ax.figure self.collection = RegularPolyCollection( fig.dpi, 6, sizes=(100,), facecolors=facecolors, @@ -47,6 +47,7 @@ ax.add_collection(self.collection) self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) + self.ind = None def callback(self, verts): facecolors = self.collection.get_facecolors() @@ -60,7 +61,7 @@ self.canvas.draw_idle() self.canvas.widgetlock.release(self.lasso) del self.lasso - + self.ind = ind def onpress(self, event): if self.canvas.widgetlock.locked(): return if event.inaxes is None: return @@ -68,10 +69,12 @@ # acquire a lock on the widget drawing self.canvas.widgetlock(self.lasso) -data = [Datum(*xy) for xy in rand(100, 2)] +if 0: -fig = figure() -ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) -lman = LassoManager(ax, data) + data = [Datum(*xy) for xy in rand(100, 2)] -show() + fig = figure() + ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) + lman = LassoManager(ax, data) + + show() Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年02月13日 08:34:53 UTC (rev 4958) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年02月13日 13:50:29 UTC (rev 4959) @@ -1556,11 +1556,11 @@ if a.get_xscale()=='log': alpha=npy.log(Xmax/Xmin)/npy.log(x1/x0) rx1=pow(Xmin/x0,alpha)*Xmin - x2=pow(Xmax/x0,alpha)*Xmin + rx2=pow(Xmax/x0,alpha)*Xmin else: alpha=(Xmax-Xmin)/(x1-x0) rx1=alpha*(Xmin-x0)+Xmin - x2=alpha*(Xmax-x0)+Xmin + rx2=alpha*(Xmax-x0)+Xmin if a.get_yscale()=='log': alpha=npy.log(Ymax/Ymin)/npy.log(y1/y0) ry1=pow(Ymin/y0,alpha)*Ymin Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年02月13日 08:34:53 UTC (rev 4958) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年02月13日 13:50:29 UTC (rev 4959) @@ -1943,7 +1943,13 @@ except NotImplementedError: return False else: return b +def safe_isinf(x): + 'isnan for arbitrary types' + try: b = npy.isinf(x) + except NotImplementedError: return False + else: return b + def rec_append_field(rec, name, arr, dtype=None): 'return a new record array with field name populated with data from array arr' arr = npy.asarray(arr) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4958 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4958&view=rev Author: efiring Date: 2008年02月13日 00:34:53 -0800 (2008年2月13日) Log Message: ----------- Fixed bugs in pcolorfast and in quadmesh rendering with svg, pdf Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py trunk/matplotlib/lib/matplotlib/image.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年02月13日 02:31:45 UTC (rev 4957) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年02月13日 08:34:53 UTC (rev 4958) @@ -5035,7 +5035,8 @@ if (npy.ptp(dx) < 0.01*npy.abs(dx.mean()) and npy.ptp(dy) < 0.01*npy.abs(dy.mean())): style = "image" - style = "pcolorimage" + else: + style = "pcolorimage" elif x.ndim == 2 and y.ndim == 2: style = "quadmesh" else: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py 2008年02月13日 02:31:45 UTC (rev 4957) +++ trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py 2008年02月13日 08:34:53 UTC (rev 4958) @@ -89,7 +89,7 @@ if w > 0 and h > 0: image = frombuffer(buffer, w, h, True) image.is_grayscale = False - + image.flipud_out() self._renderer.draw_image(l, height - b - h, image, None) self._raster_renderer = None self._rasterizing = False Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008年02月13日 02:31:45 UTC (rev 4957) +++ trunk/matplotlib/lib/matplotlib/image.py 2008年02月13日 08:34:53 UTC (rev 4958) @@ -451,8 +451,8 @@ A = self._rgbacache vl = self.axes.viewLim im = _image.pcolor2(self._Ax, self._Ay, A, - self.axes.bbox.height, - self.axes.bbox.width, + height, + width, (vl.x0, vl.x1, vl.y0, vl.y1), bg) im.is_grayscale = self.is_grayscale This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4957 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4957&view=rev Author: efiring Date: 2008年02月12日 18:31:45 -0800 (2008年2月12日) Log Message: ----------- Fix bug in pcolorfast with single argument Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年02月13日 02:10:23 UTC (rev 4956) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年02月13日 02:31:45 UTC (rev 4957) @@ -5020,8 +5020,8 @@ nr, nc = C.shape if len(args) == 1: style = "image" - x = [0, nc+1] - y = [0, nr+1] + x = [0, nc] + y = [0, nr] elif len(args) == 3: x, y = args[:2] x = npy.asarray(x) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4956 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4956&view=rev Author: jdh2358 Date: 2008年02月12日 18:10:23 -0800 (2008年2月12日) Log Message: ----------- committed eriks span selector patch Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/widgets.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月13日 02:09:06 UTC (rev 4955) +++ trunk/matplotlib/CHANGELOG 2008年02月13日 02:10:23 UTC (rev 4956) @@ -1,3 +1,5 @@ +2008年02月12日 - Applied Erik Tollerud's span selector patch - JDH + 2008年02月11日 Update plotting() doc string to refer to getp/setp. - JKS 2008年02月10日 Fixed a problem with square roots in the pdf backend with Modified: trunk/matplotlib/lib/matplotlib/widgets.py =================================================================== --- trunk/matplotlib/lib/matplotlib/widgets.py 2008年02月13日 02:09:06 UTC (rev 4955) +++ trunk/matplotlib/lib/matplotlib/widgets.py 2008年02月13日 02:10:23 UTC (rev 4956) @@ -827,16 +827,14 @@ assert direction in ['horizontal', 'vertical'], 'Must choose horizontal or vertical for direction' self.direction = direction - self.ax = ax + self.ax = None + self.canvas = None self.visible = True - self.canvas = ax.figure.canvas - self.canvas.mpl_connect('motion_notify_event', self.onmove) - self.canvas.mpl_connect('button_press_event', self.press) - self.canvas.mpl_connect('button_release_event', self.release) - self.canvas.mpl_connect('draw_event', self.update_background) + self.cids=[] self.rect = None self.background = None + self.pressv = None self.rectprops = rectprops self.onselect = onselect @@ -847,8 +845,23 @@ # Needed when dragging out of axes self.buttonDown = False self.prev = (0, 0) - - if self.direction == 'horizontal': + + self.new_axes(ax) + + + def new_axes(self,ax): + self.ax = ax + if self.canvas is not ax.figure.canvas: + for cid in self.cids: + self.canvas.mpl_disconnect(cid) + + self.canvas = ax.figure.canvas + + self.cids.append(self.canvas.mpl_connect('motion_notify_event', self.onmove)) + self.cids.append(self.canvas.mpl_connect('button_press_event', self.press)) + self.cids.append(self.canvas.mpl_connect('button_release_event', self.release)) + self.cids.append(self.canvas.mpl_connect('draw_event', self.update_background)) + if self.direction == 'horizontal': trans = blended_transform_factory(self.ax.transData, self.ax.transAxes) w,h = 0,1 else: @@ -859,9 +872,8 @@ visible=False, **self.rectprops ) - + if not self.useblit: self.ax.add_patch(self.rect) - self.pressv = None def update_background(self, event): 'force an update of the background' @@ -931,10 +943,10 @@ minv, maxv = v, self.pressv if minv>maxv: minv, maxv = maxv, minv if self.direction == 'horizontal': - self.rect.xy[0] = minv + self.rect.set_x(minv) self.rect.set_width(maxv-minv) else: - self.rect.xy[1] = minv + self.rect.set_y(minv) self.rect.set_height(maxv-minv) if self.onmove_callback is not None: @@ -1155,8 +1167,8 @@ miny, maxy = self.eventpress.ydata, y # click-y and actual mouse-y if minx>maxx: minx, maxx = maxx, minx # get them in the right order if miny>maxy: miny, maxy = maxy, miny - self.to_draw.xy[0] = minx # set lower left of box - self.to_draw.xy[1] = miny + self.to_draw.set_x(minx) # set lower left of box + self.to_draw.set_y(miny) self.to_draw.set_width(maxx-minx) # set width and height of box self.to_draw.set_height(maxy-miny) self.update() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4955 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4955&view=rev Author: efiring Date: 2008年02月12日 18:09:06 -0800 (2008年2月12日) Log Message: ----------- Improve colorbar handling of "hold" state Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/colorbar.py Modified: trunk/matplotlib/lib/matplotlib/colorbar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colorbar.py 2008年02月13日 01:30:03 UTC (rev 4954) +++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008年02月13日 02:09:06 UTC (rev 4955) @@ -272,15 +272,20 @@ ''' Draw the colors using pcolor; optionally add separators. ''' - ## Change to pcolormesh if/when it is fixed to handle alpha - ## correctly. + ## Change to pcolorfast after fixing bugs in some backends... if self.orientation == 'vertical': args = (X, Y, C) else: args = (npy.transpose(Y), npy.transpose(X), npy.transpose(C)) kw = {'cmap':self.cmap, 'norm':self.norm, 'shading':'flat', 'alpha':self.alpha} + # Save, set, and restore hold state to keep pcolor from + # clearing the axes. Ordinarily this will not be needed, + # since the axes object should already have hold set. + _hold = self.ax.ishold() + self.ax.hold(True) col = self.ax.pcolor(*args, **kw) + self.ax.hold(_hold) #self.add_observer(col) # We should observe, not be observed... self.solids = col if self.drawedges: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4954 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4954&view=rev Author: efiring Date: 2008年02月12日 17:30:03 -0800 (2008年2月12日) Log Message: ----------- Make colorbar work regardless of "hold" state Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年02月12日 14:10:41 UTC (rev 4953) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年02月13日 01:30:03 UTC (rev 4954) @@ -748,7 +748,6 @@ def cla(self): 'Clear the current axes' - self.xaxis.cla() self.yaxis.cla() Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008年02月12日 14:10:41 UTC (rev 4953) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008年02月13日 01:30:03 UTC (rev 4954) @@ -98,8 +98,8 @@ class BlockingMouseInput(object): - """ Class that creates a callable object to retrieve mouse clicks in a - blocking way. + """ Class that creates a callable object to retrieve mouse clicks in a + blocking way. """ def __init__(self, fig): self.fig = fig @@ -123,8 +123,8 @@ elif event.inaxes: # If it's a valid click, append the coordinates to the list self.clicks.append((event.xdata, event.ydata)) - if self.verbose: - print "input %i: %f,%f" % (len(self.clicks), + if self.verbose: + print "input %i: %f,%f" % (len(self.clicks), event.xdata, event.ydata) if self.show_clicks: self.marks.extend( @@ -135,7 +135,7 @@ def __call__(self, n=1, timeout=30, verbose=False, show_clicks=True): - """ Blocking call to retrieve n coordinate pairs through mouse + """ Blocking call to retrieve n coordinate pairs through mouse clicks. """ self.verbose = verbose @@ -147,10 +147,10 @@ assert isinstance(n, int), "Requires an integer argument" self.n = n - # Ensure that the figure is shown + # Ensure that the figure is shown self.fig.show() # connect the click events to the on_click function call - self.callback = self.fig.canvas.mpl_connect('button_press_event', + self.callback = self.fig.canvas.mpl_connect('button_press_event', self.on_click) # wait for n clicks counter = 0 @@ -160,8 +160,8 @@ # check for a timeout counter += 1 - if timeout > 0 and counter > timeout/0.01: - print "ginput timeout"; + if timeout > 0 and counter > timeout/0.01: + print "ginput timeout"; break; # Disconnect the event, clean the figure, and return what we have @@ -936,6 +936,7 @@ ax = self.gca() if cax is None: cax, kw = cbar.make_axes(ax, **kw) + cax.hold(True) cb = cbar.Colorbar(cax, mappable, **kw) mappable.add_observer(cb) mappable.set_colorbar(cb, cax) @@ -973,10 +974,10 @@ def ginput(self, n=1, timeout=30, verbose=False, show_clicks=True): """ ginput(self, n=1, timeout=30, verbose=False, show_clicks=True) - - Blocking call to interact with the figure. - This will wait for n clicks from the user and return a list of the + Blocking call to interact with the figure. + + This will wait for n clicks from the user and return a list of the coordinates of each click. If timeout is negative, does not timeout. If n is negative, accumulate clicks until a middle click terminates the input. Right clicking cancels last input. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4953 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4953&view=rev Author: jdh2358 Date: 2008年02月12日 06:10:41 -0800 (2008年2月12日) Log Message: ----------- applied stefans intro patch Modified Paths: -------------- trunk/py4science/doc/rest_basics.txt trunk/py4science/intro_talk/intro_python_scicomp.lyx Modified: trunk/py4science/doc/rest_basics.txt =================================================================== --- trunk/py4science/doc/rest_basics.txt 2008年02月11日 19:46:52 UTC (rev 4952) +++ trunk/py4science/doc/rest_basics.txt 2008年02月12日 14:10:41 UTC (rev 4953) @@ -1,6 +1,6 @@ -_================================= +================================= reST (reSTructured Text) basics -=================================k +================================= .. Author: Fernando Perez .. Contact: Fer...@co... .. Time-stamp: "2007-08-29 15:50:06 fperez" Modified: trunk/py4science/intro_talk/intro_python_scicomp.lyx =================================================================== --- trunk/py4science/intro_talk/intro_python_scicomp.lyx 2008年02月11日 19:46:52 UTC (rev 4952) +++ trunk/py4science/intro_talk/intro_python_scicomp.lyx 2008年02月12日 14:10:41 UTC (rev 4953) @@ -1261,7 +1261,7 @@ \begin_layout Standard \align center \begin_inset Graphics - filename ../../../talks/0708_ncar/fig/Fluidlab5.png + filename fig/Fluidlab5.png lyxscale 50 width 90text% keepAspectRatio @@ -1278,7 +1278,7 @@ \begin_layout Standard \align center \begin_inset Graphics - filename ../../../talks/0708_ncar/fig/Fluidlab6.png + filename fig/Fluidlab6.png lyxscale 50 width 90text% keepAspectRatio @@ -1313,7 +1313,7 @@ \begin_layout Standard \align center \begin_inset Graphics - filename ../../../talks/0708_ncar/fig/sage-cube5plot-medium.jpg + filename fig/sage_notebook-medium.jpg lyxscale 50 width 90text% keepAspectRatio This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4952 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4952&view=rev Author: jouni Date: 2008年02月11日 11:46:52 -0800 (2008年2月11日) Log Message: ----------- Merged revisions 4951 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r4951 | jouni | 2008年02月11日 21:40:18 +0200 (2008年2月11日) | 1 line Update plotting() doc string to refer to getp/setp. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-4946 + /branches/v0_91_maint:1-4946,4951 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月11日 19:40:18 UTC (rev 4951) +++ trunk/matplotlib/CHANGELOG 2008年02月11日 19:46:52 UTC (rev 4952) @@ -1,3 +1,5 @@ +2008年02月11日 Update plotting() doc string to refer to getp/setp. - JKS + 2008年02月10日 Fixed a problem with square roots in the pdf backend with usetex. - JKS Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008年02月11日 19:40:18 UTC (rev 4951) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008年02月11日 19:46:52 UTC (rev 4952) @@ -981,7 +981,7 @@ gca - return the current axes gcf - return the current figure gci - get the current image, or None - get - get a handle graphics property + getp - get a handle graphics property hist - make a histogram hold - set the hold state on current axes legend - add a legend to the axes @@ -997,7 +997,7 @@ rc - control the default params savefig - save the current figure scatter - make a scatter plot - set - set a handle graphics property + setp - set a handle graphics property semilogx - log x axis semilogy - log y axis show - show the figures This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4951 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4951&view=rev Author: jouni Date: 2008年02月11日 11:40:18 -0800 (2008年2月11日) Log Message: ----------- Update plotting() doc string to refer to getp/setp. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/pyplot.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年02月10日 15:21:56 UTC (rev 4950) +++ branches/v0_91_maint/CHANGELOG 2008年02月11日 19:40:18 UTC (rev 4951) @@ -1,3 +1,5 @@ +2008年02月11日 Update plotting() doc string to refer to getp/setp. - JKS + 2008年02月01日 Fix doubly-included font problem in Postscript backend - MGD 2008年02月01日 Fix reference leak in ft2font Glyph objects. - MGD Modified: branches/v0_91_maint/lib/matplotlib/pyplot.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/pyplot.py 2008年02月10日 15:21:56 UTC (rev 4950) +++ branches/v0_91_maint/lib/matplotlib/pyplot.py 2008年02月11日 19:40:18 UTC (rev 4951) @@ -933,7 +933,7 @@ gca - return the current axes gcf - return the current figure gci - get the current image, or None - get - get a handle graphics property + getp - get a handle graphics property hist - make a histogram hold - set the hold state on current axes legend - add a legend to the axes @@ -949,7 +949,7 @@ rc - control the default params savefig - save the current figure scatter - make a scatter plot - set - set a handle graphics property + setp - set a handle graphics property semilogx - log x axis semilogy - log y axis show - show the figures This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4950 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4950&view=rev Author: jouni Date: 2008年02月10日 07:21:56 -0800 (2008年2月10日) Log Message: ----------- Fixed a problem with square roots in the pdf backend with usetex. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月08日 21:09:33 UTC (rev 4949) +++ trunk/matplotlib/CHANGELOG 2008年02月10日 15:21:56 UTC (rev 4950) @@ -1,3 +1,6 @@ +2008年02月10日 Fixed a problem with square roots in the pdf backend with + usetex. - JKS + 2008年02月08日 Fixed minor __str__ bugs so getp(gca()) works. - JKS 2008年02月05日 Added getters for title, xlabel, ylabel, as requested Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008年02月08日 21:09:33 UTC (rev 4949) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008年02月10日 15:21:56 UTC (rev 4950) @@ -35,7 +35,7 @@ from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, \ LOAD_NO_HINTING, KERNING_UNFITTED from matplotlib.mathtext import MathTextParser -from matplotlib.transforms import Bbox, BboxBase +from matplotlib.transforms import Affine2D, Bbox, BboxBase from matplotlib.path import Path from matplotlib import ttconv @@ -1331,14 +1331,6 @@ page = iter(dvi).next() dvi.close() - if angle == 0: # avoid rounding errors in common case - def mytrans(x1, y1): - return x+x1, y+y1 - else: - def mytrans(x1, y1, x=x, y=y, a=angle / 180.0 * pi): - return x + cos(a)*x1 - sin(a)*y1, \ - y + sin(a)*x1 + cos(a)*y1 - # Gather font information and do some setup for combining # characters into strings. oldfont, seq = None, [] @@ -1354,7 +1346,6 @@ seq += [['font', pdfname, dvifont.size]] oldfont = dvifont seq += [['text', x1, y1, [chr(glyph)], x1+width]] - seq += [('end',)] # Find consecutive text strings with constant x coordinate and # combine into a sequence of strings and kerns, or just one @@ -1374,7 +1365,10 @@ continue i += 1 - # Now do the actual output. + # Create a transform to map the dvi contents to the canvas. + mytrans = Affine2D().rotate_deg(angle).translate(x, y) + + # Output the text. self.check_gc(gc, gc._rgb) self.file.output(Op.begin_text) curx, cury, oldx, oldy = 0, 0, 0, 0 @@ -1382,7 +1376,7 @@ if elt[0] == 'font': self.file.output(elt[1], elt[2], Op.selectfont) elif elt[0] == 'text': - curx, cury = mytrans(elt[1], elt[2]) + curx, cury = mytrans.transform((elt[1], elt[2])) self._setup_textpos(curx, cury, angle, oldx, oldy) oldx, oldy = curx, cury if len(elt[3]) == 1: @@ -1390,20 +1384,20 @@ else: self.file.output(elt[3], Op.showkern) else: - assert elt[0] == 'end' + assert False self.file.output(Op.end_text) - # Finally output the boxes (used for the variable-length lines - # in square roots and the like). + # Then output the boxes (e.g. variable-length lines of square + # roots). boxgc = self.new_gc() boxgc.copy_properties(gc) boxgc.set_linewidth(0) + pathops = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, + Path.CLOSEPOLY] for x1, y1, h, w in page.boxes: - (x1, y1), (x2, y2), (x3, y3), (x4, y4) = \ - mytrans(x1, y1), mytrans(x1+w, y1), \ - mytrans(x1+w, y1+h), mytrans(x1, y1+h) - self.draw_polygon(boxgc, gc._rgb, - ((x1,y1), (x2,y2), (x3,y3), (x4,y4))) + path = Path([[x1, y1], [x1+w, y1], [x1+w, y1+h], [x1, y1+h], + [0,0]], pathops) + self.draw_path(boxgc, path, mytrans, gc._rgb) def encode_string(self, s, fonttype): if fonttype == 3: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4949 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4949&view=rev Author: jouni Date: 2008年02月08日 13:09:33 -0800 (2008年2月08日) Log Message: ----------- Fixed minor __str__ bugs so getp(gca()) works. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axis.py trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月08日 17:56:12 UTC (rev 4948) +++ trunk/matplotlib/CHANGELOG 2008年02月08日 21:09:33 UTC (rev 4949) @@ -1,3 +1,5 @@ +2008年02月08日 Fixed minor __str__ bugs so getp(gca()) works. - JKS + 2008年02月05日 Added getters for title, xlabel, ylabel, as requested by Brandon Kieth - EF Modified: trunk/matplotlib/lib/matplotlib/axis.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axis.py 2008年02月08日 17:56:12 UTC (rev 4948) +++ trunk/matplotlib/lib/matplotlib/axis.py 2008年02月08日 21:09:33 UTC (rev 4949) @@ -498,8 +498,8 @@ OFFSETTEXTPAD = 3 def __str__(self): - return str(self.__class__).split('.')[-1] \ - + "(%d,%d)"%self.axes.transAxes.xy_tup((0,0)) + return self.__class__.__name__ \ + + "(%f,%f)"%tuple(self.axes.transAxes.transform_point((0,0))) def __init__(self, axes, pickradius=15): """ Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008年02月08日 17:56:12 UTC (rev 4948) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008年02月08日 21:09:33 UTC (rev 4949) @@ -344,8 +344,8 @@ """ def __str__(self): - return str(self.__class__).split('.')[-1] \ - + "(%g,%g;%gx%g)" % tuple(self._bbox.bounds) + return self.__class__.__name__ \ + + "(%g,%g;%gx%g)" % (self._x, self._y, self._width, self._height) def __init__(self, xy, width, height, **kwargs): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4948 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4948&view=rev Author: jrevans Date: 2008年02月08日 09:56:12 -0800 (2008年2月08日) Log Message: ----------- Removed a reference to nx, replaced with numpy. Modified Paths: -------------- branches/v0_91_maint/examples/units/units_sample.py Modified: branches/v0_91_maint/examples/units/units_sample.py =================================================================== --- branches/v0_91_maint/examples/units/units_sample.py 2008年02月06日 14:03:15 UTC (rev 4947) +++ branches/v0_91_maint/examples/units/units_sample.py 2008年02月08日 17:56:12 UTC (rev 4948) @@ -8,9 +8,10 @@ """ from basic_units import cm, inch -from pylab import figure, show, nx +from pylab import figure, show +import numpy -cms = cm *nx.arange(0, 10, 2) +cms = cm *numpy.arange(0, 10, 2) fig = figure() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4947 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4947&view=rev Author: mdboom Date: 2008年02月06日 06:03:15 -0800 (2008年2月06日) Log Message: ----------- Merged revisions 4928-4946 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r4946 | mdboom | 2008年02月06日 09:02:11 -0500 (2008年2月06日) | 1 line Updating changelog ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-4927 + /branches/v0_91_maint:1-4946 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月06日 14:02:11 UTC (rev 4946) +++ trunk/matplotlib/CHANGELOG 2008年02月06日 14:03:15 UTC (rev 4947) @@ -12,6 +12,8 @@ 2008年02月03日 Force dpi=72 in pdf backend to fix picture size bug. - JKS +2008年02月01日 Fix doubly-included font problem in Postscript backend - MGD + 2008年02月01日 Fix reference leak in ft2font Glyph objects. - MGD 2008年01月31日 Don't use unicode strings with usetex by default - DSD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4946 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4946&view=rev Author: mdboom Date: 2008年02月06日 06:02:11 -0800 (2008年2月06日) Log Message: ----------- Updating changelog Modified Paths: -------------- branches/v0_91_maint/CHANGELOG Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年02月06日 06:30:44 UTC (rev 4945) +++ branches/v0_91_maint/CHANGELOG 2008年02月06日 14:02:11 UTC (rev 4946) @@ -1,3 +1,5 @@ +2008年02月01日 Fix doubly-included font problem in Postscript backend - MGD + 2008年02月01日 Fix reference leak in ft2font Glyph objects. - MGD 2008年01月31日 Don't use unicode strings with usetex by default - DSD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4945 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4945&view=rev Author: efiring Date: 2008年02月05日 22:30:44 -0800 (2008年2月05日) Log Message: ----------- Added getters for title, xlabel, ylabel (Brandon Kieth) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月05日 23:31:32 UTC (rev 4944) +++ trunk/matplotlib/CHANGELOG 2008年02月06日 06:30:44 UTC (rev 4945) @@ -1,3 +1,6 @@ +2008年02月05日 Added getters for title, xlabel, ylabel, as requested + by Brandon Kieth - EF + 2008年02月05日 Applied Gael's ginput patch and created examples/ginput_demo.py - JDH Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年02月05日 23:31:32 UTC (rev 4944) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年02月06日 06:30:44 UTC (rev 4945) @@ -2225,6 +2225,12 @@ #### Labelling + def get_title(self): + """ + Get the title text string. + """ + return self.title.get_text() + def set_title(self, label, fontdict=None, **kwargs): """ SET_TITLE(label, fontdict=None, **kwargs): @@ -2250,6 +2256,13 @@ return self.title set_title.__doc__ = cbook.dedent(set_title.__doc__) % martist.kwdocd + def get_xlabel(self): + """ + Get the xlabel text string. + """ + label = self.xaxis.get_label() + return label.get_text() + def set_xlabel(self, xlabel, fontdict=None, **kwargs): """ SET_XLABEL(xlabel, fontdict=None, **kwargs) @@ -2269,6 +2282,13 @@ return label set_xlabel.__doc__ = cbook.dedent(set_xlabel.__doc__) % martist.kwdocd + def get_ylabel(self): + """ + Get the ylabel text string. + """ + label = self.yaxis.get_label() + return label.get_text() + def set_ylabel(self, ylabel, fontdict=None, **kwargs): """ SET_YLABEL(ylabel, fontdict=None, **kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4944 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4944&view=rev Author: pkienzle Date: 2008年02月05日 15:31:32 -0800 (2008年2月05日) Log Message: ----------- Put output from each backend in a separate directory Modified Paths: -------------- trunk/matplotlib/examples/backend_driver.py Modified: trunk/matplotlib/examples/backend_driver.py =================================================================== --- trunk/matplotlib/examples/backend_driver.py 2008年02月05日 23:17:34 UTC (rev 4943) +++ trunk/matplotlib/examples/backend_driver.py 2008年02月05日 23:31:32 UTC (rev 4944) @@ -131,6 +131,16 @@ _backend = 'cairo' else: _backend = backend + + # Clear the destination directory for the examples + path = backend + if os.path.exists(path): + import glob + for fname in os.listdir(path): + os.unlink(os.path.join(path,fname)) + else: + os.mkdir(backend) + for fname in files: if fname in exclude: print '\tSkipping %s, known to fail on backend: %s'%backend @@ -138,7 +148,7 @@ print ('\tdriving %-40s' % (fname)), basename, ext = os.path.splitext(fname) - outfile = basename + '_%s'%backend + outfile = os.path.join(path,basename) tmpfile_name = '_tmp_%s.py' % basename tmpfile = file(tmpfile_name, 'w') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4943 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4943&view=rev Author: pkienzle Date: 2008年02月05日 15:17:34 -0800 (2008年2月05日) Log Message: ----------- Move flush_events to canvas as in other backends; remove Yield loop on gui_repaint; fix showfig callback in FigureManager Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年02月05日 21:52:04 UTC (rev 4942) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008年02月05日 23:17:34 UTC (rev 4943) @@ -889,6 +889,9 @@ if repaint: self.gui_repaint() + def flush_events(self): + wx.Yield() + def _get_imagesave_wildcards(self): 'return the wildcard string for the filesave dialog' default_filetype = self.get_default_filetype() @@ -921,7 +924,7 @@ drawDC.BeginDrawing() drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() - wx.GetApp().Yield() + #wx.GetApp().Yield() filetypes = FigureCanvasBase.filetypes.copy() filetypes['bmp'] = 'Windows bitmap' @@ -1301,9 +1304,6 @@ wxapp.Yield() return True - def flush_events(self): - wx.Yield() - class FigureManagerWx(FigureManagerBase): """ This class contains the FigureCanvas and GUI frame @@ -1332,9 +1332,9 @@ self.canvas.figure.add_axobserver(notify_axes_change) def showfig(*args): - figwin.frame.Show() - figwin.canvas.realize() - figwin.canvas.draw() + frame.Show() + canvas.realize() + canvas.draw() # attach a show method to the figure self.canvas.figure.show = showfig This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4942 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4942&view=rev Author: jdh2358 Date: 2008年02月05日 13:52:04 -0800 (2008年2月05日) Log Message: ----------- added ginput example Modified Paths: -------------- trunk/matplotlib/CHANGELOG Added Paths: ----------- trunk/matplotlib/examples/ginput_demo.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年02月05日 21:50:58 UTC (rev 4941) +++ trunk/matplotlib/CHANGELOG 2008年02月05日 21:52:04 UTC (rev 4942) @@ -1,3 +1,6 @@ +2008年02月05日 Applied Gael's ginput patch and created + examples/ginput_demo.py - JDH + 2008年02月03日 Expose interpnames, a list of valid interpolation methods, as an AxesImage class attribute. - EF Added: trunk/matplotlib/examples/ginput_demo.py =================================================================== --- trunk/matplotlib/examples/ginput_demo.py (rev 0) +++ trunk/matplotlib/examples/ginput_demo.py 2008年02月05日 21:52:04 UTC (rev 4942) @@ -0,0 +1,6 @@ +from pylab import arange, plot, sin, ginput, show +t = arange(10) +plot(t, sin(t)) +print "Please click" +ginput(3, verbose=True) +show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.