Changeset 6299


Ignore:
Timestamp:
10/14/10 15:02:17 (15 years ago)
Author:
jschierm
Message:

Addition of unshared edges to 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

    r6278 r6299  
    1212%
    1313%  and the optional input is:
    14 %    data          (numeric, results data)
     14%    data          (numeric, element or nodal results data)
    1515%    alt           (numeric, altitude for polygons, default 10000)
    1616%    lwidth        (numeric, line width in pixels, default 1)
    1717%    popac         (numeric, polygon opacity, default 0.50)
    18 %    cmin          (numeric, minimum of color scale)
    19 %    cmax          (numeric, maximum of color scale)
     18%    cmin          (numeric, minimum of color map)
     19%    cmax          (numeric, maximum of color map)
    2020%    cmap          (char or numeric, colormap definition)
     21%    prtplt        (char, 'off'/'no' for partition segment plot)
    2122%
    2223function []=kml_mesh_write(varargin)
     
    256257%  write folder for partition segments
    257258
    258 if md.npart
     259if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ...
     260    md.npart
    259261    [xseg,yseg]=flagedges(md.elements,md.x,md.y,md.part);
    260262    fprintf(fid,'    <Folder>\n');
     
    264266        md.npart,size(xseg,1));
    265267
    266 %  write each element as a polygon
     268%  write each segment as a linestring
    267269
    268270    disp(['Writing ' num2str(size(xseg,1)) ' partition segments as KML linestrings.']);
     
    289291end
    290292
     293%  write folder for partition edges
     294
     295if (~exist('prtplt','var') || strncmpi(prtplt,'on' ,2) || strncmpi(prtplt,'y',1)) && ...
     296    md.npart
     297    [edgeadj,edgeuns,elemuns]=edgeadjacency(md.elements,md.nodeconnectivity);
     298    fprintf(fid,'    <Folder>\n');
     299    fprintf(fid,'      <name>Partition Edges</name>\n');
     300    fprintf(fid,'      <visibility>1</visibility>\n');
     301    fprintf(fid,'      <description>Partitions=%d, Edges=%d</description>\n',...
     302        md.npart,size(edgeuns,1));
     303
     304%  write each partition edge as a linestring
     305
     306    disp(['Writing ' num2str(size(edgeuns,1)) ' partition edges as KML linestrings.']);
     307    for i=1:size(edgeuns,1)
     308        fprintf(fid,'      <Placemark>\n');
     309        fprintf(fid,'        <name>Edge %d</name>\n',i);
     310        fprintf(fid,'        <visibility>1</visibility>\n');
     311        fprintf(fid,'        <styleUrl>#RedLineRedPoly</styleUrl>\n');
     312        fprintf(fid,'        <LineString>\n');
     313        fprintf(fid,'          <extrude>1</extrude>\n');
     314        fprintf(fid,'          <tessellate>1</tessellate>\n');
     315        fprintf(fid,'          <altitudeMode>relativeToGround</altitudeMode>\n');
     316        fprintf(fid,'          <coordinates>\n');
     317        for j=1:2
     318            [lat(j),long(j)]=mapxy(md.x(edgeuns(i,j)),md.y(edgeuns(i,j)),'s');
     319            fprintf(fid,'            %0.16g,%0.16g,%0.16g\n',long(j),lat(j),alt);
     320        end
     321
     322        fprintf(fid,'          </coordinates>\n');
     323        fprintf(fid,'        </LineString>\n');
     324        fprintf(fid,'      </Placemark>\n');
     325    end
     326    fprintf(fid,'    </Folder>\n');
     327end
     328
    291329%  write trailer data
    292330
Note: See TracChangeset for help on using the changeset viewer.