Changeset 6561


Ignore:
Timestamp:
11/12/10 11:15:30 (15 years ago)
Author:
jschierm
Message:

Extracted general function kml_file_write.m from kml_mesh_write.m.

Location:
issm/trunk/src/m/kml
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/kml/kml_mesh_write.m

    r6461 r6561  
    3333if (nargin >= 1)
    3434    filek=varargin{1};
    35 end
    36 if ~exist('filek' ,'var') || isempty(filek)
    37     filek=input('kml file to write?  ','s');
    38 end
    39 [pathstr,name,ext,versn] = fileparts(filek);
    40 if isempty(ext)
    41     ext='.kml';
    42 end
    43 filek2=fullfile(pathstr,[name ext versn]);
    44 
    45 display(sprintf('Opening kml file ''%s''.',filek2));
    46 fid=fopen(sprintf('%s',filek2),'w');
    47 if (fid < 0)
    48     error('File ''%s'' could not be opened.',filek2);
    4935end
    5036
     
    10894end
    10995
    110 %%  write kml file
    111 
    112 %  write header data
    113 
    114 fprintf(fid,'<?xml version="1.0" encoding="UTF-8"?>\n');
    115 fprintf(fid,'<kml xmlns="http://www.opengis.net/kml/2.2">\n');
     96%%  construct kml document
    11697
    11798kdoc=kml_document();
     
    255236end
    256237
    257 %  write document
    258 
    259 display(sprintf('Writing kml file ''%s''.',filek2));
    260 kml_write(kdoc,fid,'  ');
    261 
    262 %  write trailer data
    263 
    264 fprintf(fid,'</kml>\n');
    265 
    266 if (fclose(fid) < 0)
    267     error('File ''%s'' could not be closed.',filek2);
    268 else
    269     disp(['End of file ''' filek2 ''' successfully written.']);
    270 end
    271 
    272 end
    273 
     238%%  write kml file
     239
     240kml_file_write(kdoc,filek);
     241
     242end
     243
Note: See TracChangeset for help on using the changeset viewer.