]> Creatis software - CreaPhase.git/blob - octave_packages/geometry-1.5.0/io/@svg/loadsvgdata.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / geometry-1.5.0 / io / @svg / loadsvgdata.m
1 %% Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
2 %% 
3 %%    This program is free software: you can redistribute it and/or modify
4 %%    it under the terms of the GNU General Public License as published by
5 %%    the Free Software Foundation, either version 3 of the License, or
6 %%    any later version.
7 %%
8 %%    This program is distributed in the hope that it will be useful,
9 %%    but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 %%    GNU General Public License for more details.
12 %%
13 %%    You should have received a copy of the GNU General Public License
14 %%    along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 function data = loadsvgdata (obj, svg, varargin)
17
18   here   = which ("@svg/loadsvgdata");
19   here   = fileparts (here);
20   script = fullfile (here, 'parseSVGData.py');
21
22   %% Call python script
23   if exist (svg,'file')
24   % read from file  
25     [st str]=system (sprintf ('python %s %s', script, svg));
26     
27   else
28   % inline SVG  
29     [st str]=system (sprintf ('python %s < %s', script, svg));
30   end
31   
32   %% Parse ouput
33   strdata = strsplit (str(1:end-1), '$', true);
34   eval (strdata);
35
36 endfunction