Changeset 24885


Ignore:
Timestamp:
05/22/20 09:30:15 (5 years ago)
Author:
Eric.Larour
Message:

NEW: added new export routine to export 3D shape files in lat,long coordinates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/mesh3dsurface.m

    r24852 r24885  
    200200                        format=getfieldvalue(options,'format','shp');
    201201                        geometry=getfieldvalue(options,'geometry','line');
     202                        index=getfieldvalue(options,'index',[]);
     203                        proj=getfieldvalue(options,'projection','');
    202204
    203205                        %prepare contours:
     
    233235                                end
    234236                        elseif strcmpi(geometry,'polygon'),
    235                                 counter=1;
    236                                 for i=1:self.numberofelements,
    237                                         el=self.elements(i,:);
    238                                         contours(i).x=[self.long(el(1)) self.long(el(2)) self.long(el(3)) self.long(el(1))];
    239                                         contours(i).y=[self.lat(el(1)) self.lat(el(2)) self.lat(el(3)) self.lat(el(1))];
    240                                         contours(i).Geometry = 'Polygon';
     237                                if isempty(index),
     238                                        counter=1;
     239                                        for i=1:self.numberofelements,
     240                                                el=self.elements(i,:);
     241                                                contours(i).x=[self.long(el(1)) self.long(el(2)) self.long(el(3)) self.long(el(1))];
     242                                                contours(i).y=[self.lat(el(1)) self.lat(el(2)) self.lat(el(3)) self.lat(el(1))];
     243                                                contours(i).Geometry = 'Polygon';
     244                                                contours(i).Id = i;
     245                                        end
     246                                else
     247                                        counter=1;
     248                                        for i=1:length(index),
     249                                                el=self.elements(index(i),:);
     250                                                contours(i).x=[self.long(el(1)) self.long(el(2)) self.long(el(3)) self.long(el(1))];
     251                                                contours(i).y=[self.lat(el(1)) self.lat(el(2)) self.lat(el(3)) self.lat(el(1))];
     252                                                contours(i).id = index(i);
     253                                                contours(i).Geometry = 'Polygon';
     254                                        end
    241255                                end
    242256                        else
     
    253267                        end
    254268
     269                        %write projection file:
     270                        if ~isempty(proj),
     271                                proj2shpprj(filename,proj);
     272                        end
     273
     274                        %write style file:
     275                        applyqgisstyle(filename,'mesh');
     276
     277
    255278
    256279
Note: See TracChangeset for help on using the changeset viewer.