Changeset 7342
- Timestamp:
- 02/04/11 14:43:13 (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
r7132 r7342 11 11 % 12 12 % and the optional input is: 13 % latsgn (numeric, +1/-1 for north/south latitude) 13 14 % data (numeric, element or nodal results data) 14 15 % alt (numeric, altitude for polygons, default 10000) … … 43 44 if ischar(varargin{iarg}) 44 45 if ~isempty(strmatch(varargin{iarg},... 45 {' data','alt',...46 {'latsgn','data','alt',... 46 47 'cmin','cmax','cmap'},... 47 48 'exact')) … … 58 59 end 59 60 iarg=iarg+2; 61 end 62 63 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 64 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 65 if ~exist('latsgn') 66 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 67 elseif (abs(latsgn) ~= 1) 68 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 69 else 70 display('Converting x/y data to lat/long data.'); 71 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 72 end 60 73 end 61 74 … … 143 156 144 157 for j=1:size(md.elements,2) 145 [lat,long]=xy2ll(md.x(md.elements(i,j)),md.y(md.elements(i,j)),-1); 146 kring.coords(j,:)=[long lat alt]; 158 kring.coords(j,:)=[md.long(md.elements(i,j)) md.lat(md.elements(i,j)) alt]; 147 159 end 148 160 kring.coords(end,:)=kring.coords(1,:); -
issm/trunk/src/m/kml/kml_mesh_write.m
r7338 r7342 12 12 % 13 13 % and the optional input is: 14 % lats (numeric, +1/-1 for north/south latitude) 14 15 % data (numeric, element or nodal results data) 15 16 % alt (numeric, altitude for polygons, default 10000) … … 49 50 if ischar(varargin{iarg}) 50 51 if ~isempty(strmatch(varargin{iarg},... 51 {' data','alt','lwidth','popac',...52 {'latsgn','data','alt','lwidth','popac',... 52 53 'cmin','cmax','cmap','prtplt'},... 53 54 'exact')) … … 64 65 end 65 66 iarg=iarg+2; 67 end 68 69 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 70 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 71 if ~exist('latsgn') 72 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 73 elseif (abs(latsgn) ~= 1) 74 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 75 else 76 display('Converting x/y data to lat/long data.'); 77 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 78 end 66 79 end 67 80 -
issm/trunk/src/m/kml/kml_part_edges.m
r7132 r7342 11 11 % 12 12 % and the optional input is: 13 % latsgn (numeric, +1/-1 for north/south latitude) 13 14 % data (numeric, element or nodal results data) 14 15 % alt (numeric, altitude for polygons, default 10000) … … 44 45 if ischar(varargin{iarg}) 45 46 if ~isempty(strmatch(varargin{iarg},... 46 {' data','alt',...47 {'latsgn','data','alt',... 47 48 'cmin','cmax','cmap','prtplt'},... 48 49 'exact')) … … 59 60 end 60 61 iarg=iarg+2; 62 end 63 64 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 65 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 66 if ~exist('latsgn') 67 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 68 elseif (abs(latsgn) ~= 1) 69 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 70 else 71 display('Converting x/y data to lat/long data.'); 72 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 73 end 61 74 end 62 75 … … 221 234 % if first edge, write out first node 222 235 if ~elast 223 [lat,long]=xy2ll(md.x(edgeper(j,1)),md.y(edgeper(j,1)),-1); 224 kline.coords(end+1,:)=[long lat alt]; 236 kline.coords(end+1,:)=[md.long(edgeper(j,1)) md.lat(edgeper(j,1)) alt]; 225 237 end 226 [lat,long]=xy2ll(md.x(edgeper(j,2)),md.y(edgeper(j,2)),-1); 227 kline.coords(end+1,:)=[long lat alt]; 238 kline.coords(end+1,:)=[md.long(edgeper(j,2)) md.lat(edgeper(j,2)) alt]; 228 239 elast=elemper(j); 229 240 nlast=edgeper(j,2); … … 312 323 % write out first node of first side for half-edge to midpoint 313 324 % 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.']) 314 [lat,long]=xy2ll((md.x(elemp(ielem,nlast))),... 315 (md.y(elemp(ielem,nlast))),-1); 316 kline.coords(end+1,:)=[long lat alt]; 325 kline.coords(end+1,:)=[md.long(elemp(ielem,nlast)) ... 326 md.lat(elemp(ielem,nlast)) alt]; 317 327 end 318 328 nlast=0; 319 329 320 330 % write out midpoint of first side 321 [lat,long]=xy2ll((md.x(elemp(ielem,slast))... 322 +md.x(elemp(ielem,mod(slast,3)+1)))/2.,... 323 (md.y(elemp(ielem,slast))... 324 +md.y(elemp(ielem,mod(slast,3)+1)))/2.,-1); 325 kline.coords(end+1,:)=[long lat alt]; 331 kline.coords(end+1,:)=[(md.long(elemp(ielem,slast))... 332 +md.long(elemp(ielem,mod(slast,3)+1)))/2. ... 333 (md.lat(elemp(ielem,slast))... 334 +md.lat(elemp(ielem,mod(slast,3)+1)))/2. alt]; 326 335 end 327 336 … … 362 371 % write out half-edge from current node to midpoint of unshared side 363 372 % 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.']) 364 [lat,long]=xy2ll((md.x(elemp(ielem,nlast))... 365 +md.x(elemp(ielem,nnext)))/2.,... 366 (md.y(elemp(ielem,nlast))... 367 +md.y(elemp(ielem,nnext)))/2.,-1); 368 kline.coords(end+1,:)=[long lat alt]; 373 kline.coords(end+1,:)=[(md.long(elemp(ielem,nlast))... 374 +md.long(elemp(ielem,nnext)))/2. ... 375 (md.lat(elemp(ielem,nlast))... 376 +md.lat(elemp(ielem,nnext)))/2. alt]; 369 377 nlast=0; 370 378 … … 396 404 % all different, so cut through centroid 397 405 % disp(['element ielem=' int2str(ielem) ' centroid written.']) 398 [lat,long]=xy2ll(sum(md.x(elemp(ielem,:)))/3.,... 399 sum(md.y(elemp(ielem,:)))/3.,-1); 400 kline.coords(end+1,:)=[long lat alt]; 406 kline.coords(end+1,:)=[sum(md.long(elemp(ielem,:)))/3. ... 407 sum(md.lat(elemp(ielem,:)))/3. alt]; 401 408 end 402 409 % one node is in current partition, so cut off other two nodes … … 412 419 % write out midpoint of opposite side 413 420 % disp(['segment j=' int2str(j) ' internal edge from side ' int2str(slast) ' to side ' int2str(snext) ' from element ' int2str(ielem) ' written.']) 414 [lat,long]=xy2ll((md.x(elemp(ielem,snext))... 415 +md.x(elemp(ielem,mod(snext,3)+1)))/2.,... 416 (md.y(elemp(ielem,snext))... 417 +md.y(elemp(ielem,mod(snext,3)+1)))/2.,-1); 418 kline.coords(end+1,:)=[long lat alt]; 421 kline.coords(end+1,:)=[(md.long(elemp(ielem,snext))... 422 +md.long(elemp(ielem,mod(snext,3)+1)))/2. ... 423 (md.lat(elemp(ielem,snext))... 424 +md.lat(elemp(ielem,mod(snext,3)+1)))/2. alt]; 419 425 elast=ielem; 420 426 nlast=0; … … 445 451 end 446 452 % 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.']) 447 [lat,long]=xy2ll(md.x(elemp(elast,nnext)),... 448 md.y(elemp(elast,nnext)),-1); 449 kline.coords(end+1,:)=[long lat alt]; 453 kline.coords(end+1,:)=[md.long(elemp(elast,nnext)) ... 454 md.lat(elemp(elast,nnext)) alt]; 450 455 break 451 456 % if not unshared, advance perimeter list and watch for end -
issm/trunk/src/m/kml/kml_part_elems.m
r7132 r7342 11 11 % 12 12 % and the optional input is: 13 % latsgn (numeric, +1/-1 for north/south latitude) 13 14 % data (numeric, element or nodal results data) 14 15 % alt (numeric, altitude for polygons, default 10000) … … 44 45 if ischar(varargin{iarg}) 45 46 if ~isempty(strmatch(varargin{iarg},... 46 {' data','alt',...47 {'latsgn','data','alt',... 47 48 'cmin','cmax','cmap','prtplt'},... 48 49 'exact')) … … 59 60 end 60 61 iarg=iarg+2; 62 end 63 64 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 65 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 66 if ~exist('latsgn') 67 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 68 elseif (abs(latsgn) ~= 1) 69 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 70 else 71 display('Converting x/y data to lat/long data.'); 72 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 73 end 61 74 end 62 75 … … 186 199 187 200 for j=1:size(elem,2) 188 [lat,long]=xy2ll(md.x(elem(i,j)),md.y(elem(i,j)),-1); 189 kring.coords(j,:)=[long lat alt]; 201 kring.coords(j,:)=[md.long(elem(i,j)) md.lat(elem(i,j)) alt]; 190 202 end 191 203 kring.coords(end,:)=kring.coords(1,:); -
issm/trunk/src/m/kml/kml_part_flagedges.m
r7132 r7342 11 11 % 12 12 % and the optional input is: 13 % latsgn (numeric, +1/-1 for north/south latitude) 13 14 % alt (numeric, altitude for polygons, default 10000) 14 15 % prtplt (char, 'off'/'no' for partition edge plot) … … 40 41 if ischar(varargin{iarg}) 41 42 if ~isempty(strmatch(varargin{iarg},... 42 {' alt','prtplt'},...43 {'latsgn','alt','prtplt'},... 43 44 'exact')) 44 45 eval([varargin{iarg} '=varargin{iarg+1};']); … … 53 54 end 54 55 56 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 57 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 58 if ~exist('latsgn') 59 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 60 elseif (abs(latsgn) ~= 1) 61 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 62 else 63 display('Converting x/y data to lat/long data.'); 64 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 65 end 66 end 67 55 68 if ~exist('alt','var') 56 69 alt=10000; … … 61 74 if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ... 62 75 md.npart 63 [ xseg,yseg]=flagedges(md.elements,md.x,md.y,md.part);76 [latseg,lonseg]=flagedges(md.elements,md.lat,md.long,md.part); 64 77 kfold=kml_folder(); 65 78 kfold.name ='Partition Segments'; 66 79 kfold.visibility=1; 67 80 kfold.descript =sprintf('Partitions=%d, Segments=%d',... 68 md.npart,size( xseg,1));69 kfold.feature ={repmat(kml_placemark(),1,size( xseg,1))};81 md.npart,size(latseg,1)); 82 kfold.feature ={repmat(kml_placemark(),1,size(latseg,1))}; 70 83 71 84 % write each segment as a linestring placemark 72 85 73 disp(['Writing ' num2str(size( xseg,1)) ' partition segments as KML linestrings.']);74 for i=1:size( xseg,1)86 disp(['Writing ' num2str(size(latseg,1)) ' partition segments as KML linestrings.']); 87 for i=1:size(latseg,1) 75 88 kplace=kml_placemark(); 76 89 kplace.name =sprintf('Segment %d',i); … … 85 98 86 99 for j=1:2 87 [lat,long]=xy2ll(xseg(i,j),yseg(i,j),-1); 88 kline.coords(j,:)=[long lat alt]; 100 kline.coords(j,:)=[lonseg(i,j) latseg(i,j) alt]; 89 101 end 90 102 -
issm/trunk/src/m/kml/kml_partitions.m
r7132 r7342 12 12 % 13 13 % and the optional input is: 14 % latsgn (numeric, +1/-1 for north/south latitude) 14 15 % data (numeric, element or nodal results data) 15 16 % alt (numeric, altitude for polygons, default 10000) … … 45 46 if ischar(varargin{iarg}) 46 47 if ~isempty(strmatch(varargin{iarg},... 47 {' data','alt',...48 {'latsgn','data','alt',... 48 49 'cmin','cmax','cmap','prtplt'},... 49 50 'exact')) … … 60 61 end 61 62 iarg=iarg+2; 63 end 64 65 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 66 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 67 if ~exist('latsgn') 68 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 69 elseif (abs(latsgn) ~= 1) 70 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 71 else 72 display('Converting x/y data to lat/long data.'); 73 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 74 end 62 75 end 63 76 … … 223 236 % if first edge, write out first node 224 237 if ~elast 225 [lat,long]=xy2ll(md.x(edgeper(j,1)),md.y(edgeper(j,1)),-1); 226 kring.coords(end+1,:)=[long lat alt]; 238 kring.coords(end+1,:)=[md.long(edgeper(j,1)) md.lat(edgeper(j,1)) alt]; 227 239 end 228 [lat,long]=xy2ll(md.x(edgeper(j,2)),md.y(edgeper(j,2)),-1); 229 kring.coords(end+1,:)=[long lat alt]; 240 kring.coords(end+1,:)=[md.long(edgeper(j,2)) md.lat(edgeper(j,2)) alt]; 230 241 elast=elemper(j); 231 242 nlast=edgeper(j,2); … … 314 325 % write out first node of first side for half-edge to midpoint 315 326 % 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.']) 316 [lat,long]=xy2ll((md.x(elemp(ielem,nlast))),... 317 (md.y(elemp(ielem,nlast))),-1); 318 kring.coords(end+1,:)=[long lat alt]; 327 kring.coords(end+1,:)=[md.long(elemp(ielem,nlast)) ... 328 md.lat(elemp(ielem,nlast)) alt]; 319 329 end 320 330 nlast=0; 321 331 322 332 % write out midpoint of first side 323 [lat,long]=xy2ll((md.x(elemp(ielem,slast))... 324 +md.x(elemp(ielem,mod(slast,3)+1)))/2.,... 325 (md.y(elemp(ielem,slast))... 326 +md.y(elemp(ielem,mod(slast,3)+1)))/2.,-1); 327 kring.coords(end+1,:)=[long lat alt]; 333 kring.coords(end+1,:)=[(md.long(elemp(ielem,slast))... 334 +md.long(elemp(ielem,mod(slast,3)+1)))/2. ... 335 (md.lat(elemp(ielem,slast))... 336 +md.lat(elemp(ielem,mod(slast,3)+1)))/2. alt]; 328 337 end 329 338 … … 364 373 % write out half-edge from current node to midpoint of unshared side 365 374 % 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.']) 366 [lat,long]=xy2ll((md.x(elemp(ielem,nlast))... 367 +md.x(elemp(ielem,nnext)))/2.,... 368 (md.y(elemp(ielem,nlast))... 369 +md.y(elemp(ielem,nnext)))/2.,-1); 370 kring.coords(end+1,:)=[long lat alt]; 375 kring.coords(end+1,:)=[(md.long(elemp(ielem,nlast))... 376 +md.long(elemp(ielem,nnext)))/2. ... 377 (md.lat(elemp(ielem,nlast))... 378 +md.lat(elemp(ielem,nnext)))/2. alt]; 371 379 nlast=0; 372 380 … … 398 406 % all different, so cut through centroid 399 407 % disp(['element ielem=' int2str(ielem) ' centroid written.']) 400 [lat,long]=xy2ll(sum(md.x(elemp(ielem,:)))/3.,... 401 sum(md.y(elemp(ielem,:)))/3.,-1); 402 kring.coords(end+1,:)=[long lat alt]; 408 kring.coords(end+1,:)=[sum(md.long(elemp(ielem,:)))/3. ... 409 sum(md.lat(elemp(ielem,:)))/3. alt]; 403 410 end 404 411 % one node is in current partition, so cut off other two nodes … … 414 421 % write out midpoint of opposite side 415 422 % disp(['segment j=' int2str(j) ' internal edge from side ' int2str(slast) ' to side ' int2str(snext) ' from element ' int2str(ielem) ' written.']) 416 [lat,long]=xy2ll((md.x(elemp(ielem,snext))... 417 +md.x(elemp(ielem,mod(snext,3)+1)))/2.,... 418 (md.y(elemp(ielem,snext))... 419 +md.y(elemp(ielem,mod(snext,3)+1)))/2.,-1); 420 kring.coords(end+1,:)=[long lat alt]; 423 kring.coords(end+1,:)=[(md.long(elemp(ielem,snext))... 424 +md.long(elemp(ielem,mod(snext,3)+1)))/2. ... 425 (md.lat(elemp(ielem,snext))... 426 +md.lat(elemp(ielem,mod(snext,3)+1)))/2. alt]; 421 427 elast=ielem; 422 428 nlast=0; … … 447 453 end 448 454 % 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.']) 449 [lat,long]=xy2ll(md.x(elemp(elast,nnext)),... 450 md.y(elemp(elast,nnext)),-1); 451 kring.coords(end+1,:)=[long lat alt]; 455 kring.coords(end+1,:)=[md.long(elemp(elast,nnext)) ... 456 md.lat(elemp(elast,nnext)) alt]; 452 457 break 453 458 % if not unshared, advance perimeter list and watch for end -
issm/trunk/src/m/kml/kml_unsh_edges.m
r7132 r7342 11 11 % 12 12 % and the optional input is: 13 % latsgn (numeric, +1/-1 for north/south latitude) 13 14 % alt (numeric, altitude for polygons, default 10000) 14 15 % prtplt (char, 'off'/'no' for partition edge plot) … … 40 41 if ischar(varargin{iarg}) 41 42 if ~isempty(strmatch(varargin{iarg},... 42 {' alt','prtplt'},...43 {'latsgn','alt','prtplt'},... 43 44 'exact')) 44 45 eval([varargin{iarg} '=varargin{iarg+1};']); … … 51 52 end 52 53 iarg=iarg+2; 54 end 55 56 if isempty(md.lat) || ((numel(md.lat) == 1) && isnan(md.lat)) || ... 57 isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long)) 58 if ~exist('latsgn') 59 error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']); 60 elseif (abs(latsgn) ~= 1) 61 error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']); 62 else 63 display('Converting x/y data to lat/long data.'); 64 [md.lat,md.long]=xy2ll(md.x,md.y,latsgn); 65 end 53 66 end 54 67 … … 91 104 92 105 for j=1:2 93 [lat,long]=xy2ll(md.x(edgeuns(i,j)),md.y(edgeuns(i,j)),-1); 94 kline.coords(j,:)=[long lat alt]; 106 kline.coords(j,:)=[md.long(edgeuns(i,j)) md.lat(edgeuns(i,j)) alt]; 95 107 end 96 108
Note:
See TracChangeset
for help on using the changeset viewer.