Changeset 6461
- Timestamp:
- 11/01/10 15:54:12 (14 years ago)
- Location:
- issm/trunk/src/m/kml
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/kml/kml_mesh_elem.m
r6417 r6461 2 2 % create kml polygons for the element mesh. 3 3 % 4 % [ ]=kml_mesh_elem(fid,md,params)4 % [kfold]=kml_mesh_elem(md,params) 5 5 % 6 6 % where the required input is: 7 % fid (numeric, file ID of .kml file)8 7 % md (model, model class object) 9 8 % … … 18 17 % cmap (char or numeric, colormap definition) 19 18 % 20 function []=kml_mesh_elem(varargin) 19 % and the required output is: 20 % kfold (kml_folder, folder of polygon placemarks) 21 % 22 function [kfold]=kml_mesh_elem(varargin) 21 23 22 24 if ~nargin … … 29 31 iarg=1; 30 32 if (nargin >= 1) 31 fid=varargin{1}; 32 end 33 if ~exist('fid','var') || isempty(fid) || (fid < 0) 34 error('File ID ''%d'' must be open.',fid); 35 end 36 37 iarg=iarg+1; 38 if (nargin >= 2) 39 md=varargin{2}; 33 md=varargin{1}; 40 34 end 41 35 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 106 100 %% write folder for mesh 107 101 108 fprintf(fid,' <Folder>\n');102 kfold=kml_folder(); 109 103 if exist('cdata','var') && ~isempty(cdata) 110 fprintf(fid,' <name>Data: %s</name>\n',cdata);104 kfold.name =sprintf('Data: %s',cdata); 111 105 else 112 fprintf(fid,' <name>Mesh</name>\n');106 kfold.name =sprintf('Mesh'); 113 107 end 114 fprintf(fid,' <visibility>1</visibility>\n');115 fprintf(fid,' <description>Elements=%d, Grids=%d</description>\n',...108 kfold.visibility=1; 109 kfold.descript =sprintf('Elements=%d, Grids=%d',... 116 110 md.numberofelements,md.numberofgrids); 111 kfold.feature ={repmat(kml_placemark(),1,size(md.elements,1))}; 117 112 118 % write each element as a polygon 113 % write each element as a polygon placemark 119 114 120 115 disp(['Writing ' num2str(size(md.elements,1)) ' tria elements as KML polygons.']); 121 116 for i=1:size(md.elements,1) 122 fprintf(fid,' <Placemark>\n');123 fprintf(fid,' <name>Element %d</name>\n',i);124 fprintf(fid,' <visibility>1</visibility>\n');117 kplace=kml_placemark(); 118 kplace.name =sprintf('Element %d',i); 119 kplace.visibility=1; 125 120 if exist('edata','var') 126 fprintf(fid,' <description>Element data: %g</description>\n',edata(i));121 kplace.descript =sprintf('Element data: %g',edata(i)); 127 122 imap = fix((edata(i)-cmin)/(cmax-cmin)*size(cmap,1))+1; 128 123 if (imap >= 1) && (imap <= size(cmap,1)) 129 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',imap);124 kplace.styleurl =sprintf('#MatlabColor%d',imap); 130 125 elseif (edata(i) == cmax) 131 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',size(cmap,1));126 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 132 127 else 133 fprintf(fid,' <styleUrl>#BlackLineEmptyPoly</styleUrl>\n');128 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 134 129 end 135 130 else 136 fprintf(fid,' <styleUrl>#BlackLineRandomPoly</styleUrl>\n');131 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 137 132 end 138 fprintf(fid,' <Polygon>\n'); 139 fprintf(fid,' <extrude>1</extrude>\n'); 140 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 141 fprintf(fid,' <outerBoundaryIs>\n'); 142 fprintf(fid,' <LinearRing>\n'); 143 fprintf(fid,' <coordinates>\n'); 133 134 kpoly=kml_polygon(); 135 kpoly.extrude =1; 136 kpoly.altmode ='relativeToGround'; 137 138 kring=kml_linearring(); 139 kring.coords =zeros(size(md.elements,2)+1,3); 140 144 141 for j=1:size(md.elements,2) 145 [lat (j),long(j)]=mapxy(md.x(md.elements(i,j)),md.y(md.elements(i,j)),'s');146 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(j),lat(j),alt);142 [lat,long]=mapxy(md.x(md.elements(i,j)),md.y(md.elements(i,j)),'s'); 143 kring.coords(j,:)=[long lat alt]; 147 144 end 148 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(1),lat(1),alt);145 kring.coords(end,:)=kring.coords(1,:); 149 146 150 fprintf(fid,' </coordinates>\n'); 151 fprintf(fid,' </LinearRing>\n'); 152 fprintf(fid,' </outerBoundaryIs>\n'); 153 fprintf(fid,' </Polygon>\n'); 154 fprintf(fid,' </Placemark>\n'); 147 kpoly.outer=kring; 148 kplace.geometry=kpoly; 149 kfold.feature{1}(i)=kplace; 150 clear kring kpoly kplace 155 151 end 156 fprintf(fid,' </Folder>\n');157 152 158 153 end -
issm/trunk/src/m/kml/kml_mesh_write.m
r6417 r6461 114 114 fprintf(fid,'<?xml version="1.0" encoding="UTF-8"?>\n'); 115 115 fprintf(fid,'<kml xmlns="http://www.opengis.net/kml/2.2">\n'); 116 fprintf(fid,' <Document>\n'); 117 fprintf(fid,' <name>ISSM Mesh: %s</name>\n',md.name);118 fprintf(fid,' <open>1</open>\n');119 fprintf(fid,' <description>');116 117 kdoc=kml_document(); 118 kdoc.name =sprintf('ISSM Mesh: %s',md.name); 119 kdoc.open =1; 120 120 ifirst=true; 121 121 for i=1:numel(md.notes) 122 122 if ~isempty(md.notes{i}) 123 123 if ~ifirst 124 fprintf(fid,'\n');124 kdoc.descript =[kdoc.descript sprintf('\n')]; 125 125 end 126 126 ifirst=false; 127 fprintf(fid,'%s',md.notes{i}); 128 end 129 end 130 fprintf(fid,'</description>\n'); 127 kdoc.descript =[kdoc.descript sprintf('%s',md.notes{i})]; 128 end 129 end 130 clear ifirst 131 kdoc.style ={repmat(kml_style(),0,0)}; 132 kdoc.feature ={repmat(kml_folder(),0,0)}; 131 133 132 134 % write style templates for defaults and for each color of the matlab … … 142 144 end 143 145 144 fprintf(fid,' <Style id="BlackLineRandomPoly">\n'); 145 fprintf(fid,' <LineStyle>\n'); 146 fprintf(fid,' <color>ff000000</color>\n'); 147 fprintf(fid,' <colorMode>normal</colorMode>\n'); 148 fprintf(fid,' <width>%g</width>\n',lwidth); 149 fprintf(fid,' </LineStyle>\n'); 150 fprintf(fid,' <PolyStyle>\n'); 151 fprintf(fid,' <color>%02xffffff</color>\n',round(popac*255)); 152 fprintf(fid,' <colorMode>random</colorMode>\n'); 153 fprintf(fid,' </PolyStyle>\n'); 154 fprintf(fid,' </Style>\n'); 155 fprintf(fid,' <Style id="BlackLineEmptyPoly">\n'); 156 fprintf(fid,' <LineStyle>\n'); 157 fprintf(fid,' <color>ff000000</color>\n'); 158 fprintf(fid,' <colorMode>normal</colorMode>\n'); 159 fprintf(fid,' <width>%g</width>\n',lwidth); 160 fprintf(fid,' </LineStyle>\n'); 161 fprintf(fid,' <PolyStyle>\n'); 162 fprintf(fid,' <color>00ffffff</color>\n'); 163 fprintf(fid,' <colorMode>random</colorMode>\n'); 164 fprintf(fid,' </PolyStyle>\n'); 165 fprintf(fid,' </Style>\n'); 166 fprintf(fid,' <Style id="RedLineRedPoly">\n'); 167 fprintf(fid,' <LineStyle>\n'); 168 fprintf(fid,' <color>ff0000ff</color>\n'); 169 fprintf(fid,' <colorMode>normal</colorMode>\n'); 170 fprintf(fid,' <width>%g</width>\n',lwidth); 171 fprintf(fid,' </LineStyle>\n'); 172 fprintf(fid,' <PolyStyle>\n'); 173 fprintf(fid,' <color>%02x0000ff</color>\n',round(popac*255)); 174 fprintf(fid,' <colorMode>random</colorMode>\n'); 175 fprintf(fid,' </PolyStyle>\n'); 176 fprintf(fid,' </Style>\n'); 177 if exist('edata','var') 146 klsty=kml_linestyle(); 147 klsty.color ='ff000000'; 148 klsty.colormode ='normal'; 149 klsty.width =lwidth; 150 kpsty=kml_polystyle(); 151 kpsty.color =sprintf('%02xffffff',round(popac*255)); 152 kpsty.colormode ='random'; 153 kstyle=kml_style(); 154 kstyle.id =sprintf('BlackLineRandomPoly'); 155 kstyle.line =klsty; 156 kstyle.poly =kpsty; 157 kdoc.style{1}(end+1)=kstyle; 158 clear kstyle kpoly kline 159 160 klsty=kml_linestyle(); 161 klsty.color ='ff000000'; 162 klsty.colormode ='normal'; 163 klsty.width =lwidth; 164 kpsty=kml_polystyle(); 165 kpsty.color =sprintf('00ffffff'); 166 kpsty.colormode ='random'; 167 kstyle=kml_style(); 168 kstyle.id =sprintf('BlackLineEmptyPoly'); 169 kstyle.line =klsty; 170 kstyle.poly =kpsty; 171 kdoc.style{1}(end+1)=kstyle; 172 clear kstyle kpoly kline 173 174 klsty=kml_linestyle(); 175 klsty.color ='ff0000ff'; 176 klsty.colormode ='normal'; 177 klsty.width =lwidth; 178 kpsty=kml_polystyle(); 179 kpsty.color =sprintf('%02x0000ff',round(popac*255)); 180 kpsty.colormode ='random'; 181 kstyle=kml_style(); 182 kstyle.id =sprintf('RedLineRedPoly'); 183 kstyle.line =klsty; 184 kstyle.poly =kpsty; 185 kdoc.style{1}(end+1)=kstyle; 186 clear kstyle kpoly kline 178 187 179 188 % colormap command operates on a figure, so create an invisible one 180 189 % (could also directly call colormaps, e.g. jet(64), but risky) 181 190 191 if exist('edata','var') 182 192 hfig=figure('Visible','off'); 183 193 if exist('cmap','var') … … 189 199 disp(['Writing ' num2str(size(cmap,1)) ' Matlab colors as KML style templates.']); 190 200 for i=1:size(cmap,1) 191 fprintf(fid,' <Style id="MatlabColor%d">\n',i); 192 fprintf(fid,' <LineStyle>\n'); 193 fprintf(fid,' <color>ff000000</color>\n'); 194 fprintf(fid,' <colorMode>normal</colorMode>\n'); 195 fprintf(fid,' <width>%g</width>\n',lwidth); 196 fprintf(fid,' </LineStyle>\n'); 197 fprintf(fid,' <PolyStyle>\n'); 198 fprintf(fid,' <color>%02x%02x%02x%02x</color>\n',round(popac*255),... 201 klsty=kml_linestyle(); 202 klsty.color ='ff000000'; 203 klsty.colormode ='normal'; 204 klsty.width =lwidth; 205 kpsty=kml_polystyle(); 206 kpsty.color =sprintf('%02x%02x%02x%02x',round(popac*255),... 199 207 round(cmap(i,3)*255),round(cmap(i,2)*255),round(cmap(i,1)*255)); 200 fprintf(fid,' <colorMode>normal</colorMode>\n'); 201 fprintf(fid,' </PolyStyle>\n'); 202 fprintf(fid,' </Style>\n'); 208 kpsty.colormode ='normal'; 209 kstyle=kml_style(); 210 kstyle.id =sprintf('MatlabColor%d',i); 211 kstyle.line =klsty; 212 kstyle.poly =kpsty; 213 kdoc.style{1}(end+1)=kstyle; 214 clear kstyle kpoly kline 203 215 end 204 216 end … … 206 218 % write folder for mesh 207 219 208 k ml_mesh_elem(fid,md,varargin{3:end});220 kdoc.feature{1}(end+1)=kml_mesh_elem(md,varargin{3:end}); 209 221 210 222 % write folder for partition segments … … 212 224 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 213 225 md.npart 214 k ml_part_flagedges(fid,md,varargin{3:end});226 kdoc.feature{1}(end+1)=kml_part_flagedges(md,varargin{3:end}); 215 227 end 216 228 … … 219 231 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 220 232 md.npart 221 k ml_unsh_edges(fid,md,varargin{3:end});233 kdoc.feature{1}(end+1)=kml_unsh_edges(md,varargin{3:end}); 222 234 end 223 235 … … 226 238 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 227 239 md.npart 228 k ml_part_elems(fid,md,varargin{3:end});240 kdoc.feature{1}(end+1)=kml_part_elems(md,varargin{3:end}); 229 241 end 230 242 … … 233 245 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 234 246 md.npart 235 k ml_part_edges(fid,md,varargin{3:end});247 kdoc.feature{1}(end+1)=kml_part_edges(md,varargin{3:end}); 236 248 end 237 249 … … 240 252 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 241 253 md.npart 242 kml_partitions(fid,md,varargin{3:end}); 243 end 254 kdoc.feature{1}(end+1)=kml_partitions(md,varargin{3:end}); 255 end 256 257 % write document 258 259 display(sprintf('Writing kml file ''%s''.',filek2)); 260 kml_write(kdoc,fid,' '); 244 261 245 262 % write trailer data 246 263 247 fprintf(fid,' </Document>\n');248 264 fprintf(fid,'</kml>\n'); 249 265 -
issm/trunk/src/m/kml/kml_part_edges.m
r6417 r6461 2 2 % create kml linestrings for the partition edges. 3 3 % 4 % [ ]=kml_part_edges(fid,md,params)4 % [kfold]=kml_part_edges(md,params) 5 5 % 6 6 % where the required input is: 7 % fid (char, file ID of .kml file)8 7 % md (model, model class object) 9 8 % … … 19 18 % prtplt (char, 'off'/'no' for partition segment plot) 20 19 % 21 function []=kml_part_edges(varargin) 20 % and the required output is: 21 % kfold (kml_folder, folder of linestring placemarks) 22 % 23 function [kfold]=kml_part_edges(varargin) 22 24 23 25 if ~nargin … … 30 32 iarg=1; 31 33 if (nargin >= 1) 32 fid=varargin{1}; 33 end 34 if ~exist('fid','var') || isempty(fid) || (fid < 0) 35 error('File ID ''%d'' must be open.',fid); 36 end 37 38 iarg=iarg+1; 39 if (nargin >= 2) 40 md=varargin{2}; 34 md=varargin{1}; 41 35 end 42 36 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 109 103 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 110 104 md.npart 111 fprintf(fid,' <Folder>\n');112 fprintf(fid,' <name>Partition Edges</name>\n');113 fprintf(fid,' <visibility>1</visibility>\n');114 fprintf(fid,' <description>Partitions=%d, Nodes=%d</description>\n',...105 kfold=kml_folder(); 106 kfold.name ='Partition Edges'; 107 kfold.visibility=1; 108 kfold.descript =sprintf('Partitions=%d, Nodes=%d',... 115 109 md.npart,md.numberofgrids); 116 117 % write each partition loop as linestrings 110 kfold.feature ={repmat(kml_placemark(),0,0)}; 111 112 % write each partition loop as a linestring placemark 118 113 119 114 disp(['Writing ' num2str(md.npart) ' partitions as KML linestrings.']); … … 160 155 161 156 for i=1:length(iloop)-1 162 fprintf(fid,' <Placemark>\n');157 kplace=kml_placemark(); 163 158 if (length(iloop)-1 > 1) 164 fprintf(fid,' <name>Partition %d, Loop %d</name>\n',k,i);159 kplace.name =sprintf('Partition %d, Loop %d',k,i); 165 160 else 166 fprintf(fid,' <name>Partition %d</name>\n',k);167 end 168 fprintf(fid,' <visibility>1</visibility>\n');161 kplace.name =sprintf('Partition %d',k); 162 end 163 kplace.visibility=1; 169 164 if exist('pdata','var') 170 fprintf(fid,' <description>Partition data: %g</description>\n',pdata(k));165 kplace.descript =sprintf('Partition data: %g',pdata(k)); 171 166 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 172 167 if (imap >= 1) && (imap <= size(cmap,1)) 173 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',imap);168 kplace.styleurl =sprintf('#MatlabColor%d',imap); 174 169 elseif (pdata(k) == cmax) 175 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',size(cmap,1));170 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 176 171 else 177 fprintf(fid,' <styleUrl>#BlackLineEmptyPoly</styleUrl>\n');172 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 178 173 end 179 174 else 180 fprintf(fid,' <styleUrl>#BlackLineRandomPoly</styleUrl>\n'); 181 end 182 % fprintf(fid,' <Polygon>\n'); 183 % fprintf(fid,' <extrude>1</extrude>\n'); 184 % fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 185 % fprintf(fid,' <outerBoundaryIs>\n'); 186 % fprintf(fid,' <LinearRing>\n'); 187 fprintf(fid,' <LineString>\n'); 188 fprintf(fid,' <extrude>1</extrude>\n'); 189 fprintf(fid,' <tessellate>1</tessellate>\n'); 190 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 191 fprintf(fid,' <coordinates>\n'); 175 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 176 end 177 178 kline=kml_linestring(); 179 kline.extrude =1; 180 kline.tessellate=1; 181 kline.altmode ='relativeToGround'; 182 kline.coords =zeros(0,3); 183 192 184 elast=0; 193 185 nlast=0; … … 218 210 % if first edge, write out first node 219 211 if ~elast 220 [lat (end+1),long(end+1)]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s');221 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);212 [lat,long]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s'); 213 kline.coords(end+1,:)=[long lat alt]; 222 214 end 223 [lat (end+1),long(end+1)]=mapxy(md.x(edgeper(j,2)),md.y(edgeper(j,2)),'s');224 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);215 [lat,long]=mapxy(md.x(edgeper(j,2)),md.y(edgeper(j,2)),'s'); 216 kline.coords(end+1,:)=[long lat alt]; 225 217 elast=elemper(j); 226 218 nlast=edgeper(j,2); … … 309 301 % write out first node of first side for half-edge to midpoint 310 302 % disp(['segment j=' int2str(j) ' unshared half edge from node ' int2str(elemp(ielem,nlast)) ' (node ' int2str(nlast) ') on side ' int2str(slast) ' from element ' int2str(ielem) ' written.']) 311 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,nlast))),...312 313 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);303 [lat,long]=mapxy((md.x(elemp(ielem,nlast))),... 304 (md.y(elemp(ielem,nlast))),'s'); 305 kline.coords(end+1,:)=[long lat alt]; 314 306 end 315 307 nlast=0; 316 308 317 309 % write out midpoint of first side 318 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,slast))...319 320 321 322 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);310 [lat,long]=mapxy((md.x(elemp(ielem,slast))... 311 +md.x(elemp(ielem,mod(slast,3)+1)))/2.,... 312 (md.y(elemp(ielem,slast))... 313 +md.y(elemp(ielem,mod(slast,3)+1)))/2.,'s'); 314 kline.coords(end+1,:)=[long lat alt]; 323 315 end 324 316 … … 359 351 % write out half-edge from current node to midpoint of unshared side 360 352 % disp(['segment j=' int2str(j) ' unshared half edge from node ' int2str(elemp(ielem,nlast)) ' (node ' int2str(nlast) ') on side ' int2str(slast) ' from element ' int2str(ielem) ' written.']) 361 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,nlast))...362 363 364 365 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);353 [lat,long]=mapxy((md.x(elemp(ielem,nlast))... 354 +md.x(elemp(ielem,nnext)))/2.,... 355 (md.y(elemp(ielem,nlast))... 356 +md.y(elemp(ielem,nnext)))/2.,'s'); 357 kline.coords(end+1,:)=[long lat alt]; 366 358 nlast=0; 367 359 … … 393 385 % all different, so cut through centroid 394 386 % disp(['element ielem=' int2str(ielem) ' centroid written.']) 395 [lat (end+1),long(end+1)]=mapxy(sum(md.x(elemp(ielem,:)))/3.,...396 397 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);387 [lat,long]=mapxy(sum(md.x(elemp(ielem,:)))/3.,... 388 sum(md.y(elemp(ielem,:)))/3.,'s'); 389 kline.coords(end+1,:)=[long lat alt]; 398 390 end 399 391 % one node is in current partition, so cut off other two nodes … … 409 401 % write out midpoint of opposite side 410 402 % disp(['segment j=' int2str(j) ' internal edge from side ' int2str(slast) ' to side ' int2str(snext) ' from element ' int2str(ielem) ' written.']) 411 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,snext))...412 413 414 415 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);403 [lat,long]=mapxy((md.x(elemp(ielem,snext))... 404 +md.x(elemp(ielem,mod(snext,3)+1)))/2.,... 405 (md.y(elemp(ielem,snext))... 406 +md.y(elemp(ielem,mod(snext,3)+1)))/2.,'s'); 407 kline.coords(end+1,:)=[long lat alt]; 416 408 elast=ielem; 417 409 nlast=0; … … 442 434 end 443 435 % disp(['segment j=' int2str(j) ' unshared half edge on side ' int2str(slast) ' to node ' int2str(elemp(elast,nnext)) ' (node ' int2str(nnext) ') from element ' int2str(elast) ' written.']) 444 [lat (end+1),long(end+1)]=mapxy(md.x(elemp(elast,nnext)),...445 446 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);436 [lat,long]=mapxy(md.x(elemp(elast,nnext)),... 437 md.y(elemp(elast,nnext)),'s'); 438 kline.coords(end+1,:)=[long lat alt]; 447 439 break 448 440 % if not unshared, advance perimeter list and watch for end … … 461 453 end 462 454 end 463 % fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(iloop(i)),lat(iloop(i)),alt); 464 465 fprintf(fid,' </coordinates>\n'); 466 fprintf(fid,' </LineString>\n'); 467 % fprintf(fid,' </LinearRing>\n'); 468 % fprintf(fid,' </outerBoundaryIs>\n'); 469 % fprintf(fid,' </Polygon>\n'); 470 fprintf(fid,' </Placemark>\n'); 455 456 kplace.geometry=kline; 457 kfold.feature{1}(end+1)=kplace; 458 clear kline kplace 471 459 end 472 460 end 473 fprintf(fid,' </Folder>\n'); 474 end 475 476 end 477 461 end 462 463 end 464 -
issm/trunk/src/m/kml/kml_part_elems.m
r6417 r6461 2 2 % create kml polygons for the partition elements. 3 3 % 4 % [ ]=kml_part_elems(fid,md,params)4 % [kfold]=kml_part_elems(md,params) 5 5 % 6 6 % where the required input is: 7 % fid (char, file ID of .kml file)8 7 % md (model, model class object) 9 8 % … … 19 18 % prtplt (char, 'off'/'no' for partition segment plot) 20 19 % 21 function []=kml_part_elems(varargin) 20 % and the required output is: 21 % kfold (kml_folder, folder of polygon placemarks) 22 % 23 function [kfold]=kml_part_elems(varargin) 22 24 23 25 if ~nargin … … 30 32 iarg=1; 31 33 if (nargin >= 1) 32 fid=varargin{1}; 33 end 34 if ~exist('fid','var') || isempty(fid) || (fid < 0) 35 error('File ID ''%d'' must be open.',fid); 36 end 37 38 iarg=iarg+1; 39 if (nargin >= 2) 40 md=varargin{2}; 34 md=varargin{1}; 41 35 end 42 36 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 109 103 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 110 104 md.npart 111 fprintf(fid,' <Folder>\n');112 fprintf(fid,' <name>Partition Elements</name>\n');113 fprintf(fid,' <visibility>1</visibility>\n');114 fprintf(fid,' <description>Partitions=%d, Nodes=%d</description>\n',...105 kfold=kml_folder(); 106 kfold.name ='Partition Elements'; 107 kfold.visibility=1; 108 kfold.descript =sprintf('Partitions=%d, Nodes=%d\n',... 115 109 md.npart,md.numberofgrids); 110 kfold.feature ={repmat(kml_placemark(),0,0)}; 116 111 117 % write each partition loop as a polygon 112 % write each partition loop as a polygon placemark 118 113 119 114 disp(['Writing ' num2str(md.npart) ' partitions as KML polygons.']); … … 144 139 end 145 140 for i=1:length(iloop)-1 146 fprintf(fid,' <Placemark>\n');141 kplace=kml_placemark(); 147 142 if (length(iloop)-1 > 1) 148 fprintf(fid,' <name>Partition %d, Loop %d</name>\n',k,i);143 kplace.name =sprintf('Partition %d, Loop %d',k,i); 149 144 else 150 fprintf(fid,' <name>Partition %d</name>\n',k);145 kplace.name =sprintf('Partition %d',k); 151 146 end 152 fprintf(fid,' <visibility>1</visibility>\n');147 kplace.visibility=1; 153 148 if exist('pdata','var') 154 fprintf(fid,' <description>Partition data: %g</description>\n',pdata(k));149 kplace.descript =sprintf('Partition data: %g',pdata(k)); 155 150 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 156 151 if (imap >= 1) && (imap <= size(cmap,1)) 157 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',imap);152 kplace.styleurl =sprintf('#MatlabColor%d',imap); 158 153 elseif (pdata(k) == cmax) 159 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',size(cmap,1));154 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 160 155 else 161 fprintf(fid,' <styleUrl>#BlackLineEmptyPoly</styleUrl>\n');156 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 162 157 end 163 158 else 164 fprintf(fid,' <styleUrl>#BlackLineRandomPoly</styleUrl>\n');159 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 165 160 end 166 fprintf(fid,' <Polygon>\n'); 167 fprintf(fid,' <extrude>1</extrude>\n'); 168 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 169 fprintf(fid,' <outerBoundaryIs>\n'); 170 fprintf(fid,' <LinearRing>\n'); 171 fprintf(fid,' <coordinates>\n'); 161 162 kpoly=kml_polygon(); 163 kpoly.extrude =1; 164 kpoly.altmode ='relativeToGround'; 165 166 kring=kml_linearring(); 167 kring.coords =zeros(iloop(i+1)-iloop(i)+1,3); 168 172 169 for j=iloop(i):iloop(i+1)-1 173 [lat (j),long(j)]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s');174 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(j),lat(j),alt);170 [lat,long]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s'); 171 kring.coords(j-iloop(i)+1,:)=[long lat alt]; 175 172 end 176 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(iloop(i)),lat(iloop(i)),alt);173 kring.coords(end,:)=kring.coords(1,:); 177 174 178 fprintf(fid,' </coordinates>\n'); 179 fprintf(fid,' </LinearRing>\n'); 180 fprintf(fid,' </outerBoundaryIs>\n'); 181 fprintf(fid,' </Polygon>\n'); 182 fprintf(fid,' </Placemark>\n'); 175 kpoly.outer=kring; 176 kplace.geometry=kpoly; 177 kfold.feature{1}(end+1)=kplace; 178 clear kring kpoly kplace 183 179 end 184 180 end 185 fprintf(fid,' </Folder>\n');186 181 end 187 182 -
issm/trunk/src/m/kml/kml_part_flagedges.m
r6417 r6461 2 2 % create kml linestrings for the flagged partition edges. 3 3 % 4 % [ ]=kml_part_flagedges(fid,md,params)4 % [kfold]=kml_part_flagedges(md,params) 5 5 % 6 6 % where the required input is: 7 % fid (char, file ID of .kml file)8 7 % md (model, model class object) 9 8 % … … 13 12 % and the optional input is: 14 13 % alt (numeric, altitude for polygons, default 10000) 15 % prtplt (char, 'off'/'no' for partition segmentplot)14 % prtplt (char, 'off'/'no' for partition edge plot) 16 15 % 17 function []=kml_part_flagedges(varargin) 16 % and the required output is: 17 % kfold (kml_folder, folder of linestring placemarks) 18 % 19 function [kfold]=kml_part_flagedges(varargin) 18 20 19 21 if ~nargin … … 26 28 iarg=1; 27 29 if (nargin >= 1) 28 fid=varargin{1}; 29 end 30 if ~exist('fid','var') || isempty(fid) || (fid < 0) 31 error('File ID ''%d'' must be open.',fid); 32 end 33 34 iarg=iarg+1; 35 if (nargin >= 2) 36 md=varargin{2}; 30 md=varargin{1}; 37 31 end 38 32 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 66 60 md.npart 67 61 [xseg,yseg]=flagedges(md.elements,md.x,md.y,md.part); 68 fprintf(fid,' <Folder>\n');69 fprintf(fid,' <name>Partition Segments</name>\n');70 fprintf(fid,' <visibility>1</visibility>\n');71 fprintf(fid,' <description>Partitions=%d, Segments=%d</description>\n',...62 kfold=kml_folder(); 63 kfold.name ='Partition Segments'; 64 kfold.visibility=1; 65 kfold.descript =sprintf('Partitions=%d, Segments=%d',... 72 66 md.npart,size(xseg,1)); 67 kfold.feature ={repmat(kml_placemark(),1,size(xseg,1))}; 73 68 74 % write each segment as a linestring 69 % write each segment as a linestring placemark 75 70 76 71 disp(['Writing ' num2str(size(xseg,1)) ' partition segments as KML linestrings.']); 77 72 for i=1:size(xseg,1) 78 fprintf(fid,' <Placemark>\n'); 79 fprintf(fid,' <name>Segment %d</name>\n',i); 80 fprintf(fid,' <visibility>1</visibility>\n'); 81 fprintf(fid,' <styleUrl>#RedLineRedPoly</styleUrl>\n'); 82 fprintf(fid,' <LineString>\n'); 83 fprintf(fid,' <extrude>1</extrude>\n'); 84 fprintf(fid,' <tessellate>1</tessellate>\n'); 85 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 86 fprintf(fid,' <coordinates>\n'); 73 kplace=kml_placemark(); 74 kplace.name =sprintf('Segment %d',i); 75 kplace.visibility=1; 76 kplace.styleurl ='#RedLineRedPoly'; 77 78 kline=kml_linestring(); 79 kline.extrude =1; 80 kline.tessellate=1; 81 kline.altmode ='relativeToGround'; 82 kline.coords =zeros(2,3); 83 87 84 for j=1:2 88 [lat (j),long(j)]=mapxy(xseg(i,j),yseg(i,j),'s');89 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(j),lat(j),alt);85 [lat,long]=mapxy(xseg(i,j),yseg(i,j),'s'); 86 kline.coords(j,:)=[long lat alt]; 90 87 end 91 88 92 fprintf(fid,' </coordinates>\n');93 fprintf(fid,' </LineString>\n');94 fprintf(fid,' </Placemark>\n');89 kplace.geometry=kline; 90 kfold.feature{1}(i)=kplace; 91 clear kline kplace 95 92 end 96 fprintf(fid,' </Folder>\n');97 93 end 98 94 -
issm/trunk/src/m/kml/kml_partitions.m
r6417 r6461 2 2 % create kml polygons for the partitions. 3 3 % 4 % [ ]=kml_partitions(fid,md,params)4 % [kfold]=kml_partitions(fid,md,params) 5 5 % 6 6 % where the required input is: … … 19 19 % prtplt (char, 'off'/'no' for partition segment plot) 20 20 % 21 function []=kml_partitions(varargin) 21 % and the required output is: 22 % kfold (kml_folder, folder of polygon placemarks) 23 % 24 function [kfold]=kml_partitions(varargin) 22 25 23 26 if ~nargin … … 30 33 iarg=1; 31 34 if (nargin >= 1) 32 fid=varargin{1}; 33 end 34 if ~exist('fid','var') || isempty(fid) || (fid < 0) 35 error('File ID ''%d'' must be open.',fid); 36 end 37 38 iarg=iarg+1; 39 if (nargin >= 2) 40 md=varargin{2}; 35 md=varargin{1}; 41 36 end 42 37 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 109 104 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 110 105 md.npart 111 fprintf(fid,' <Folder>\n');112 fprintf(fid,' <name>Partitions</name>\n');113 fprintf(fid,' <visibility>1</visibility>\n');114 fprintf(fid,' <description>Partitions=%d, Nodes=%d</description>\n',...106 kfold=kml_folder(); 107 kfold.name ='Partitions'; 108 kfold.visibility=1; 109 kfold.descript =sprintf('Partitions=%d, Nodes=%d',... 115 110 md.npart,md.numberofgrids); 116 117 % write each partition loop as linestrings 111 kfold.feature ={repmat(kml_placemark(),0,0)}; 112 113 % write each partition loop as polygon placemark 118 114 119 115 disp(['Writing ' num2str(md.npart) ' partitions as KML polygons.']); … … 160 156 161 157 for i=1:length(iloop)-1 162 fprintf(fid,' <Placemark>\n');158 kplace=kml_placemark(); 163 159 if (length(iloop)-1 > 1) 164 fprintf(fid,' <name>Partition %d, Loop %d</name>\n',k,i);160 kplace.name =sprintf('Partition %d, Loop %d',k,i); 165 161 else 166 fprintf(fid,' <name>Partition %d</name>\n',k);167 end 168 fprintf(fid,' <visibility>1</visibility>\n');162 kplace.name =sprintf('Partition %d',k); 163 end 164 kplace.visibility=1; 169 165 if exist('pdata','var') 170 fprintf(fid,' <description>Partition data: %g</description>\n',pdata(k));166 kplace.descript =sprintf('Partition data: %g',pdata(k)); 171 167 imap = fix((pdata(k)-cmin)/(cmax-cmin)*size(cmap,1))+1; 172 168 if (imap >= 1) && (imap <= size(cmap,1)) 173 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',imap);169 kplace.styleurl =sprintf('#MatlabColor%d',imap); 174 170 elseif (pdata(k) == cmax) 175 fprintf(fid,' <styleUrl>#MatlabColor%d</styleUrl>\n',size(cmap,1));171 kplace.styleurl =sprintf('#MatlabColor%d',size(cmap,1)); 176 172 else 177 fprintf(fid,' <styleUrl>#BlackLineEmptyPoly</styleUrl>\n');173 kplace.styleurl =sprintf('#BlackLineEmptyPoly'); 178 174 end 179 175 else 180 fprintf(fid,' <styleUrl>#BlackLineRandomPoly</styleUrl>\n'); 181 end 182 fprintf(fid,' <Polygon>\n'); 183 fprintf(fid,' <extrude>1</extrude>\n'); 184 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 185 fprintf(fid,' <outerBoundaryIs>\n'); 186 fprintf(fid,' <LinearRing>\n'); 187 fprintf(fid,' <coordinates>\n'); 176 kplace.styleurl =sprintf('#BlackLineRandomPoly'); 177 end 178 179 kpoly=kml_polygon(); 180 kpoly.extrude =1; 181 kpoly.altmode ='relativeToGround'; 182 183 kring=kml_linearring(); 184 kring.coords =zeros(0,3); 185 188 186 elast=0; 189 187 nlast=0; … … 214 212 % if first edge, write out first node 215 213 if ~elast 216 [lat (end+1),long(end+1)]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s');217 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);214 [lat,long]=mapxy(md.x(edgeper(j,1)),md.y(edgeper(j,1)),'s'); 215 kring.coords(end+1,:)=[long lat alt]; 218 216 end 219 [lat (end+1),long(end+1)]=mapxy(md.x(edgeper(j,2)),md.y(edgeper(j,2)),'s');220 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);217 [lat,long]=mapxy(md.x(edgeper(j,2)),md.y(edgeper(j,2)),'s'); 218 kring.coords(end+1,:)=[long lat alt]; 221 219 elast=elemper(j); 222 220 nlast=edgeper(j,2); … … 305 303 % write out first node of first side for half-edge to midpoint 306 304 % disp(['segment j=' int2str(j) ' unshared half edge from node ' int2str(elemp(ielem,nlast)) ' (node ' int2str(nlast) ') on side ' int2str(slast) ' from element ' int2str(ielem) ' written.']) 307 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,nlast))),...308 309 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);305 [lat,long]=mapxy((md.x(elemp(ielem,nlast))),... 306 (md.y(elemp(ielem,nlast))),'s'); 307 kring.coords(end+1,:)=[long lat alt]; 310 308 end 311 309 nlast=0; 312 310 313 311 % write out midpoint of first side 314 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,slast))...315 316 317 318 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);312 [lat,long]=mapxy((md.x(elemp(ielem,slast))... 313 +md.x(elemp(ielem,mod(slast,3)+1)))/2.,... 314 (md.y(elemp(ielem,slast))... 315 +md.y(elemp(ielem,mod(slast,3)+1)))/2.,'s'); 316 kring.coords(end+1,:)=[long lat alt]; 319 317 end 320 318 … … 355 353 % write out half-edge from current node to midpoint of unshared side 356 354 % disp(['segment j=' int2str(j) ' unshared half edge from node ' int2str(elemp(ielem,nlast)) ' (node ' int2str(nlast) ') on side ' int2str(slast) ' from element ' int2str(ielem) ' written.']) 357 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,nlast))...358 359 360 361 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);355 [lat,long]=mapxy((md.x(elemp(ielem,nlast))... 356 +md.x(elemp(ielem,nnext)))/2.,... 357 (md.y(elemp(ielem,nlast))... 358 +md.y(elemp(ielem,nnext)))/2.,'s'); 359 kring.coords(end+1,:)=[long lat alt]; 362 360 nlast=0; 363 361 … … 389 387 % all different, so cut through centroid 390 388 % disp(['element ielem=' int2str(ielem) ' centroid written.']) 391 [lat (end+1),long(end+1)]=mapxy(sum(md.x(elemp(ielem,:)))/3.,...392 393 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);389 [lat,long]=mapxy(sum(md.x(elemp(ielem,:)))/3.,... 390 sum(md.y(elemp(ielem,:)))/3.,'s'); 391 kring.coords(end+1,:)=[long lat alt]; 394 392 end 395 393 % one node is in current partition, so cut off other two nodes … … 405 403 % write out midpoint of opposite side 406 404 % disp(['segment j=' int2str(j) ' internal edge from side ' int2str(slast) ' to side ' int2str(snext) ' from element ' int2str(ielem) ' written.']) 407 [lat (end+1),long(end+1)]=mapxy((md.x(elemp(ielem,snext))...408 409 410 411 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);405 [lat,long]=mapxy((md.x(elemp(ielem,snext))... 406 +md.x(elemp(ielem,mod(snext,3)+1)))/2.,... 407 (md.y(elemp(ielem,snext))... 408 +md.y(elemp(ielem,mod(snext,3)+1)))/2.,'s'); 409 kring.coords(end+1,:)=[long lat alt]; 412 410 elast=ielem; 413 411 nlast=0; … … 438 436 end 439 437 % disp(['segment j=' int2str(j) ' unshared half edge on side ' int2str(slast) ' to node ' int2str(elemp(elast,nnext)) ' (node ' int2str(nnext) ') from element ' int2str(elast) ' written.']) 440 [lat (end+1),long(end+1)]=mapxy(md.x(elemp(elast,nnext)),...441 442 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(end),lat(end),alt);438 [lat,long]=mapxy(md.x(elemp(elast,nnext)),... 439 md.y(elemp(elast,nnext)),'s'); 440 kring.coords(end+1,:)=[long lat alt]; 443 441 break 444 442 % if not unshared, advance perimeter list and watch for end … … 457 455 end 458 456 end 459 % fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(iloop(1)),lat(iloop(1)),alt); 460 461 fprintf(fid,' </coordinates>\n'); 462 fprintf(fid,' </LinearRing>\n'); 463 fprintf(fid,' </outerBoundaryIs>\n'); 464 fprintf(fid,' </Polygon>\n'); 465 fprintf(fid,' </Placemark>\n'); 457 458 kpoly.outer=kring; 459 kplace.geometry=kpoly; 460 kfold.feature{1}(end+1)=kplace; 461 clear kring kpoly kplace 466 462 end 467 463 end 468 fprintf(fid,' </Folder>\n'); 469 end 470 471 end 472 464 end 465 466 end 467 -
issm/trunk/src/m/kml/kml_unsh_edges.m
r6417 r6461 2 2 % create kml linestrings for the unshared element edges. 3 3 % 4 % [ ]=kml_unsh_edges(fid,md,params)4 % [kfold]=kml_unsh_edges(md,params) 5 5 % 6 6 % where the required input is: 7 % fid (char, file ID of .kml file)8 7 % md (model, model class object) 9 8 % … … 13 12 % and the optional input is: 14 13 % alt (numeric, altitude for polygons, default 10000) 15 % prtplt (char, 'off'/'no' for partition segmentplot)14 % prtplt (char, 'off'/'no' for partition edge plot) 16 15 % 17 function []=kml_unsh_edges(varargin) 16 % and the required output is: 17 % kfold (kml_folder, folder of linestring placemarks) 18 % 19 function [kfold]=kml_unsh_edges(varargin) 18 20 19 21 if ~nargin … … 26 28 iarg=1; 27 29 if (nargin >= 1) 28 fid=varargin{1}; 29 end 30 if ~exist('fid','var') || isempty(fid) || (fid < 0) 31 error('File ID ''%d'' must be open.',fid); 32 end 33 34 iarg=iarg+1; 35 if (nargin >= 2) 36 md=varargin{2}; 30 md=varargin{1}; 37 31 end 38 32 if ~exist('md','var') || isempty(md) || ~isa(md,'model') … … 72 66 edgeuns(i,2)=md.elements(irow(i),mod(icol(i),size(md.elements,2))+1); 73 67 end 74 fprintf(fid,' <Folder>\n');75 fprintf(fid,' <name>Unshared Edges</name>\n');76 fprintf(fid,' <visibility>1</visibility>\n');77 fprintf(fid,' <description>Partitions=%d, Edges=%d</description>\n',...68 kfold=kml_folder(); 69 kfold.name ='Unshared Edges'; 70 kfold.visibility=1; 71 kfold.descript =sprintf('Partitions=%d, Edges=%d',... 78 72 md.npart,size(edgeuns,1)); 73 kfold.feature ={repmat(kml_placemark(),1,size(edgeuns,1))}; 79 74 80 % write each edge as a linestring 75 % write each edge as a linestring placemark 81 76 82 77 disp(['Writing ' num2str(size(edgeuns,1)) ' unshared edges as KML linestrings.']); 83 78 for i=1:size(edgeuns,1) 84 fprintf(fid,' <Placemark>\n'); 85 fprintf(fid,' <name>Edge %d</name>\n',i); 86 fprintf(fid,' <visibility>1</visibility>\n'); 87 fprintf(fid,' <styleUrl>#RedLineRedPoly</styleUrl>\n'); 88 fprintf(fid,' <LineString>\n'); 89 fprintf(fid,' <extrude>1</extrude>\n'); 90 fprintf(fid,' <tessellate>1</tessellate>\n'); 91 fprintf(fid,' <altitudeMode>relativeToGround</altitudeMode>\n'); 92 fprintf(fid,' <coordinates>\n'); 79 kplace=kml_placemark(); 80 kplace.name =sprintf('Edge %d',i); 81 kplace.visibility=1; 82 kplace.styleurl ='#RedLineRedPoly'; 83 84 kline=kml_linestring(); 85 kline.extrude =1; 86 kline.tessellate=1; 87 kline.altmode ='relativeToGround'; 88 kline.coords =zeros(2,3); 89 93 90 for j=1:2 94 [lat (j),long(j)]=mapxy(md.x(edgeuns(i,j)),md.y(edgeuns(i,j)),'s');95 fprintf(fid,' %0.16g,%0.16g,%0.16g\n',long(j),lat(j),alt);91 [lat,long]=mapxy(md.x(edgeuns(i,j)),md.y(edgeuns(i,j)),'s'); 92 kline.coords(j,:)=[long lat alt]; 96 93 end 97 94 98 fprintf(fid,' </coordinates>\n');99 fprintf(fid,' </LineString>\n');100 fprintf(fid,' </Placemark>\n');95 kplace.geometry=kline; 96 kfold.feature{1}(i)=kplace; 97 clear kline kplace 101 98 end 102 fprintf(fid,' </Folder>\n');103 99 end 104 100
Note:
See TracChangeset
for help on using the changeset viewer.