Changeset 7460


Ignore:
Timestamp:
02/16/11 10:00:20 (14 years ago)
Author:
jschierm
Message:

kml: added destructor methods to kml classes (among other changes to speed execution).

Location:
issm/trunk/src/m/kml
Files:
24 edited

Legend:

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

    r7297 r7460  
    11%
    2 %  definition for the kml_colorstyle super (base) and sub (derived) class.
     2%  definition for the kml_colorstyle super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_colorstyle(varargin)
     
    9696%  set the properties of the object
    9797
    98         function [kml]=set(kml,varargin)
     98        function [kml]=setprops(kml,varargin)
    9999
    100100            kmlref=feval(class(kml));
     
    139139
    140140            for i=1:numel(kml)
    141                 if strcmp(class(kml),'kml_colorstyle')
    142                     if ~isempty(kml(i).id)
    143                         fprintf(fid,'%s<!ColorStyle id="%s">\n',indent,kml(i).id);
     141                kmli=kml(i);
     142                if strcmp(class(kml),'kml_colorstyle')
     143                    if ~isempty(kmli.id)
     144                        fprintf(fid,'%s<!ColorStyle id="%s">\n',indent,kmli.id);
    144145                    else
    145146                        fprintf(fid,'%s<!ColorStyle>\n',indent);
    146147                    end
    147148                end
    148                 kml_write@kml_substyle(kml(i),fid,indent);
    149                 if ~isempty(kml(i).color)
    150                     fprintf(fid,'%s  <color>%s</color>\n',indent,kml(i).color);
    151                 end
    152                 if ~isempty(kml(i).colormode)
    153                     fprintf(fid,'%s  <colorMode>%s</colorMode>\n',indent,kml(i).colormode);
     149                kml_write@kml_substyle(kmli,fid,indent);
     150                if ~isempty(kmli.color)
     151                    fprintf(fid,'%s  <color>%s</color>\n',indent,kmli.color);
     152                end
     153                if ~isempty(kmli.colormode)
     154                    fprintf(fid,'%s  <colorMode>%s</colorMode>\n',indent,kmli.colormode);
    154155                end
    155156                if strcmp(class(kml),'kml_colorstyle')
  • issm/trunk/src/m/kml/kml_container.m

    r7297 r7460  
    11%
    2 %  definition for the kml_container super (base) and sub (derived) class.
     2%  definition for the kml_container super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_container(varargin)
     
    9292%  set the properties of the object
    9393
    94         function [kml]=set(kml,varargin)
     94        function [kml]=setprops(kml,varargin)
    9595
    9696            kmlref=feval(class(kml));
     
    135135
    136136            for i=1:numel(kml)
     137                kmli=kml(i);
    137138                if strcmp(class(kml),'kml_container')
    138                     if ~isempty(kml(i).id)
    139                         fprintf(fid,'%s<!Container id="%s">\n',indent,kml(i).id);
     139                    if ~isempty(kmli.id)
     140                        fprintf(fid,'%s<!Container id="%s">\n',indent,kmli.id);
    140141                    else
    141142                        fprintf(fid,'%s<!Container>\n',indent);
    142143                    end
    143144                end
    144                 kml_write@kml_feature(kml(i),fid,indent);
     145                kml_write@kml_feature(kmli,fid,indent);
    145146                if strcmp(class(kml),'kml_container')
    146147                    fprintf(fid,'%s<!/Container>\n',indent);
     
    180181        end
    181182       
     183%  delete the object
     184
     185        function []=delete(kml)
     186
     187%  loop over the containers
     188
     189            for i=numel(kml):-1:1
     190                kmli=kml(i);
     191                delete@kml_feature(kmli);
     192            end
     193
     194        end
     195       
    182196    end
    183197   
  • issm/trunk/src/m/kml/kml_document.m

    r7297 r7460  
    9494%  set the properties of the object
    9595
    96         function [kml]=set(kml,varargin)
     96        function [kml]=setprops(kml,varargin)
    9797
    9898            kmlref=feval(class(kml));
     
    137137
    138138            for i=1:numel(kml)
    139                 if ~isempty(kml(i).id)
    140                     fprintf(fid,'%s<Document id="%s">\n',indent,kml(i).id);
     139                kmli=kml(i);
     140                if ~isempty(kmli.id)
     141                    fprintf(fid,'%s<Document id="%s">\n',indent,kmli.id);
    141142                else
    142143                    fprintf(fid,'%s<Document>\n',indent);
    143144                end
    144                 kml_write@kml_container(kml(i),fid,indent);
     145                kml_write@kml_container(kmli,fid,indent);
    145146
    146147%  loop over the features for each document
    147148
    148                 for j=1:numel(kml(i).feature)
    149                     if ~isempty(kml(i).feature{j})
    150                         if isa(kml(i).feature{j},'kml_feature')
    151                             kml_write(kml(i).feature{j},fid,[indent '  ']);
     149                for j=1:numel(kmli.feature)
     150                    if ~isempty(kmli.feature{j})
     151                        if isa(kmli.feature{j},'kml_feature')
     152                            kml_write(kmli.feature{j},fid,[indent '  ']);
    152153                        else
    153154                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
    154                                 i,j,class(kml(i).feature{j}),'kml_feature');
     155                                i,j,class(kmli.feature{j}),'kml_feature');
    155156                        end
    156157                    end
     
    202203        end
    203204       
     205%  delete the object
     206
     207        function []=delete(kml)
     208
     209%  loop over the documents
     210
     211            for i=numel(kml):-1:1
     212                kmli=kml(i);
     213                delete@kml_container(kmli);
     214
     215%  loop over the features for each document
     216
     217                for j=numel(kmli.feature):-1:1
     218                    if ~isempty(kmli.feature{j})
     219                        if isa(kmli.feature{j},'kml_feature')
     220                            delete(kmli.feature{j});
     221                        else
     222                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
     223                                i,j,class(kmli.feature{j}),'kml_feature');
     224                        end
     225                    end
     226                end
     227                kmli.feature   ={};
     228
     229            end
     230
     231        end
     232       
    204233    end
    205234   
  • issm/trunk/src/m/kml/kml_feature.m

    r7297 r7460  
    11%
    2 %  definition for the kml_feature super (base) and sub (derived) class.
     2%  definition for the kml_feature super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_feature(varargin)
     
    118118%  set the properties of the object
    119119
    120         function [kml]=set(kml,varargin)
     120        function [kml]=setprops(kml,varargin)
    121121
    122122            kmlref=feval(class(kml));
     
    161161
    162162            for i=1:numel(kml)
    163                 if strcmp(class(kml),'kml_feature')
    164                     if ~isempty(kml(i).id)
    165                         fprintf(fid,'%s<!Feature id="%s">\n',indent,kml(i).id);
     163                kmli=kml(i);
     164                if strcmp(class(kml),'kml_feature')
     165                    if ~isempty(kmli.id)
     166                        fprintf(fid,'%s<!Feature id="%s">\n',indent,kmli.id);
    166167                    else
    167168                        fprintf(fid,'%s<!Feature>\n',indent);
    168169                    end
    169170                end
    170                 kml_write@kml_object(kml(i),fid,indent);
    171                 if ~isempty(kml(i).name)
    172                     fprintf(fid,'%s  <name>%s</name>\n',indent,kml(i).name);
    173                 end
    174                 fprintf(fid,'%s  <visibility>%d</visibility>\n',indent,kml(i).visibility);
    175                 fprintf(fid,'%s  <open>%d</open>\n',indent,kml(i).open);
    176                 if ~isempty(kml(i).snippet)
    177                     fprintf(fid,'%s  <Snippet maxLines="2">%s</Snippet>\n',indent,kml(i).snippet);
    178                 end
    179                 if ~isempty(kml(i).descript)
    180                     fprintf(fid,'%s  <description>%s</description>\n',indent,kml(i).descript);
    181                 end
    182                 if ~isempty(kml(i).styleurl)
    183                     fprintf(fid,'%s  <styleUrl>%s</styleUrl>\n',indent,kml(i).styleurl);
     171                kml_write@kml_object(kmli,fid,indent);
     172                if ~isempty(kmli.name)
     173                    fprintf(fid,'%s  <name>%s</name>\n',indent,kmli.name);
     174                end
     175                fprintf(fid,'%s  <visibility>%d</visibility>\n',indent,kmli.visibility);
     176                fprintf(fid,'%s  <open>%d</open>\n',indent,kmli.open);
     177                if ~isempty(kmli.snippet)
     178                    fprintf(fid,'%s  <Snippet maxLines="2">%s</Snippet>\n',indent,kmli.snippet);
     179                end
     180                if ~isempty(kmli.descript)
     181                    fprintf(fid,'%s  <description>%s</description>\n',indent,kmli.descript);
     182                end
     183                if ~isempty(kmli.styleurl)
     184                    fprintf(fid,'%s  <styleUrl>%s</styleUrl>\n',indent,kmli.styleurl);
    184185                end
    185186
    186187%  loop over the styles for each feature
    187188
    188                 for j=1:numel(kml(i).style)
    189                     if ~isempty(kml(i).style{j})
    190                         if isa(kml(i).style{j},'kml_styleselector')
    191                             kml_write(kml(i).style{j},fid,[indent '  ']);
     189                for j=1:numel(kmli.style)
     190                    if ~isempty(kmli.style{j})
     191                        if isa(kmli.style{j},'kml_styleselector')
     192                            kml_write(kmli.style{j},fid,[indent '  ']);
    192193                        else
    193194                            warning('kml(%d).style{%d} is a ''%s'' class object, not ''%s''.',...
    194                                 i,j,class(kml(i).style{j}),'kml_styleselector');
     195                                i,j,class(kmli.style{j}),'kml_styleselector');
    195196                        end
    196197                    end
     
    262263        end
    263264       
     265%  delete the object
     266
     267        function []=delete(kml)
     268
     269%  loop over the features
     270
     271            for i=numel(kml):-1:1
     272                kmli=kml(i);
     273
     274%  loop over the styles for each feature
     275
     276                for j=numel(kmli.style):-1:1
     277                    if ~isempty(kmli.style{j})
     278                        if isa(kmli.style{j},'kml_styleselector')
     279                            delete(kmli.style{j});
     280                        else
     281                            warning('kml(%d).style{%d} is a ''%s'' class object, not ''%s''.',...
     282                                i,j,class(kmli.style{j}),'kml_styleselector');
     283                        end
     284                    end
     285                end
     286                kmli.style     ={};
     287
     288            end
     289
     290        end
     291       
    264292    end
    265293   
  • issm/trunk/src/m/kml/kml_folder.m

    r7297 r7460  
    9494%  set the properties of the object
    9595
    96         function [kml]=set(kml,varargin)
     96        function [kml]=setprops(kml,varargin)
    9797
    9898            kmlref=feval(class(kml));
     
    137137
    138138            for i=1:numel(kml)
    139                 if ~isempty(kml(i).id)
    140                     fprintf(fid,'%s<Folder id="%s">\n',indent,kml(i).id);
     139                kmli=kml(i);
     140                if ~isempty(kmli.id)
     141                    fprintf(fid,'%s<Folder id="%s">\n',indent,kmli.id);
    141142                else
    142143                    fprintf(fid,'%s<Folder>\n',indent);
    143144                end
    144                 kml_write@kml_container(kml(i),fid,indent);
     145                kml_write@kml_container(kmli,fid,indent);
    145146
    146147%  loop over the features for each folder
    147148
    148                 for j=1:numel(kml(i).feature)
    149                     if ~isempty(kml(i).feature{j})
    150                         if isa(kml(i).feature{j},'kml_feature')
    151                             kml_write(kml(i).feature{j},fid,[indent '  ']);
     149                for j=1:numel(kmli.feature)
     150                    if ~isempty(kmli.feature{j})
     151                        if isa(kmli.feature{j},'kml_feature')
     152                            kml_write(kmli.feature{j},fid,[indent '  ']);
    152153                        else
    153154                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
    154                                 i,j,class(kml(i).feature{j}),'kml_feature');
     155                                i,j,class(kmli.feature{j}),'kml_feature');
    155156                        end
    156157                    end
     
    202203        end
    203204       
     205%  delete the object
     206
     207        function []=delete(kml)
     208
     209%  loop over the folders
     210
     211            for i=numel(kml):-1:1
     212                kmli=kml(i);
     213                delete@kml_container(kmli);
     214
     215%  loop over the features for each folder
     216
     217                for j=numel(kmli.feature):-1:1
     218                    if ~isempty(kmli.feature{j})
     219                        if isa(kmli.feature{j},'kml_feature')
     220                            delete(kmli.feature{j});
     221                        else
     222                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
     223                                i,j,class(kmli.feature{j}),'kml_feature');
     224                        end
     225                    end
     226                end
     227                kmli.feature   ={};
     228
     229            end
     230
     231        end
     232       
    204233    end
    205234   
  • issm/trunk/src/m/kml/kml_geometry.m

    r7297 r7460  
    11%
    2 %  definition for the kml_geometry super (base) and sub (derived) class.
     2%  definition for the kml_geometry super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_geometry(varargin)
     
    8585%  set the properties of the object
    8686
    87         function [kml]=set(kml,varargin)
     87        function [kml]=setprops(kml,varargin)
    8888
    8989            kmlref=feval(class(kml));
     
    128128
    129129            for i=1:numel(kml)
     130                kmli=kml(i);
    130131                if strcmp(class(kml),'kml_geometry')
    131                     if ~isempty(kml(i).id)
    132                         fprintf(fid,'%s<!Geometry id="%s">\n',indent,kml(i).id);
     132                    if ~isempty(kmli.id)
     133                        fprintf(fid,'%s<!Geometry id="%s">\n',indent,kmli.id);
    133134                    else
    134135                        fprintf(fid,'%s<!Geometry>\n',indent);
    135136                    end
    136137                end
    137                 kml_write@kml_object(kml(i),fid,indent);
     138                kml_write@kml_object(kmli,fid,indent);
    138139                if strcmp(class(kml),'kml_geometry')
    139140                    fprintf(fid,'%s</!Geometry>\n',indent);
  • issm/trunk/src/m/kml/kml_linearring.m

    r7297 r7460  
    9999%  set the properties of the object
    100100
    101         function [kml]=set(kml,varargin)
     101        function [kml]=setprops(kml,varargin)
    102102
    103103            kmlref=feval(class(kml));
     
    142142
    143143            for i=1:numel(kml)
    144                 if ~isempty(kml(i).id)
    145                     fprintf(fid,'%s<LinearRing id="%s">\n',indent,kml(i).id);
     144                kmli=kml(i);
     145                if ~isempty(kmli.id)
     146                    fprintf(fid,'%s<LinearRing id="%s">\n',indent,kmli.id);
    146147                else
    147148                    fprintf(fid,'%s<LinearRing>\n',indent);
    148149                end
    149                 kml_write@kml_geometry(kml(i),fid,indent);
    150                 fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
    151                 fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
    152                 fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
     150                kml_write@kml_geometry(kmli,fid,indent);
     151%                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
     152%                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
     153%                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
     154                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,0);
     155                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,0);
     156                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,'clampToGround');
    153157                fprintf(fid,'%s  <coordinates>\n',indent);
    154158
    155159%  loop over the coordinates for each linearring
    156160
    157                 for j=1:size(kml(i).coords,1)
    158                     fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kml(i).coords(j,:));
     161                for j=1:size(kmli.coords,1)
     162                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:));
    159163                end
    160164
  • issm/trunk/src/m/kml/kml_linestring.m

    r7297 r7460  
    9999%  set the properties of the object
    100100
    101         function [kml]=set(kml,varargin)
     101        function [kml]=setprops(kml,varargin)
    102102
    103103            kmlref=feval(class(kml));
     
    142142
    143143            for i=1:numel(kml)
    144                 if ~isempty(kml(i).id)
    145                     fprintf(fid,'%s<LineString id="%s">\n',indent,kml(i).id);
     144                kmli=kml(i);
     145                if ~isempty(kmli.id)
     146                    fprintf(fid,'%s<LineString id="%s">\n',indent,kmli.id);
    146147                else
    147148                    fprintf(fid,'%s<LineString>\n',indent);
    148149                end
    149                 kml_write@kml_geometry(kml(i),fid,indent);
    150                 fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
    151                 fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
    152                 fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
     150                kml_write@kml_geometry(kmli,fid,indent);
     151                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
     152                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
     153                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
    153154                fprintf(fid,'%s  <coordinates>\n',indent);
    154155
    155156%  loop over the coordinates for each linestring
    156157
    157                 for j=1:size(kml(i).coords,1)
    158                     fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kml(i).coords(j,:));
     158                for j=1:size(kmli.coords,1)
     159                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:));
    159160                end
    160161
  • issm/trunk/src/m/kml/kml_linestyle.m

    r7297 r7460  
    8888%  set the properties of the object
    8989
    90         function [kml]=set(kml,varargin)
     90        function [kml]=setprops(kml,varargin)
    9191
    9292            kmlref=feval(class(kml));
     
    131131
    132132            for i=1:numel(kml)
    133                 if ~isempty(kml(i).id)
    134                     fprintf(fid,'%s<LineStyle id="%s">\n',indent,kml(i).id);
     133                kmli=kml(i);
     134                if ~isempty(kmli.id)
     135                    fprintf(fid,'%s<LineStyle id="%s">\n',indent,kmli.id);
    135136                else
    136137                    fprintf(fid,'%s<LineStyle>\n',indent);
    137138                end
    138                 kml_write@kml_colorstyle(kml(i),fid,indent);
    139                 fprintf(fid,'%s  <width>%d</width>\n',indent,kml(i).width);
     139                kml_write@kml_colorstyle(kmli,fid,indent);
     140                fprintf(fid,'%s  <width>%d</width>\n',indent,kmli.width);
    140141                fprintf(fid,'%s</LineStyle>\n',indent);
    141142            end
  • issm/trunk/src/m/kml/kml_mesh_elem.m

    r7418 r7460  
    125125kfold.descript  =sprintf('Elements=%d, Grids=%d',...
    126126    md.numberofelements,md.numberofgrids);
    127 kfold.feature   ={repmat(kml_placemark(),1,size(md.elements,1))};
     127% see matlab_oop, "initializing a handle object array"
     128%kfold.feature   ={repmat(kml_placemark(),1,size(md.elements,1))};
     129kfeat(size(md.elements,1))=kml_placemark();
     130kfold.feature={kfeat};
    128131
    129132%  write each element as a polygon placemark
     
    131134disp(['Writing ' num2str(size(md.elements,1)) ' tria elements as KML polygons.']);
    132135for i=1:size(md.elements,1)
     136%for i=1:5000
    133137    kplace=kml_placemark();
    134138    kplace.name      =sprintf('Element %d',i);
    135139    kplace.visibility=1;
    136140    if exist('edata','var')
    137         kplace.descript  =sprintf('Element data: %g',edata(i));
     141%        kplace.descript  =sprintf('Element data: %g',edata(i));
     142        kplace.descript  =sprintf('campaign{\n  deformation %g quad_pol ascending right asap;\n}',edata(i));
    138143        imap = fix((edata(i)-cmin)/(cmax-cmin)*size(cmap,1))+1;
    139144        if     (imap >= 1) && (imap <= size(cmap,1))
     
    163168    kplace.geometry=kpoly;
    164169    kfold.feature{1}(i)=kplace;
    165     clear kring kpoly kplace
     170%    clear kring kpoly kplace
     171
     172    if ~mod(i,1000)
     173        disp(['  ' num2str(i) ' tria elements written.']);
     174    end
    166175end
    167176
  • issm/trunk/src/m/kml/kml_mesh_write.m

    r7418 r7460  
    153153kstyle.poly      =kpsty;
    154154kdoc.style{1}(end+1)=kstyle;
    155 clear kstyle kpoly kline
     155clear kstyle kpsty klsty
    156156
    157157klsty=kml_linestyle();
     
    167167kstyle.poly      =kpsty;
    168168kdoc.style{1}(end+1)=kstyle;
    169 clear kstyle kpoly kline
     169clear kstyle kpsty klsty
    170170
    171171klsty=kml_linestyle();
     
    181181kstyle.poly      =kpsty;
    182182kdoc.style{1}(end+1)=kstyle;
    183 clear kstyle kpoly kline
     183clear kstyle kpsty klsty
    184184
    185185%  colormap command operates on a figure, so create an invisible one
     
    209209        kstyle.poly      =kpsty;
    210210        kdoc.style{1}(end+1)=kstyle;
    211         clear kstyle kpoly kline
     211        clear kstyle kpsty klsty
    212212    end
    213213end
     
    256256kml_file_write(kdoc,filek);
    257257% kml_file_swrite(kdoc,filek);
    258 
    259 end
    260 
     258delete(kdoc);
     259
     260end
     261
  • issm/trunk/src/m/kml/kml_multigeometry.m

    r7297 r7460  
    8787%  set the properties of the object
    8888
    89         function [kml]=set(kml,varargin)
     89        function [kml]=setprops(kml,varargin)
    9090
    9191            kmlref=feval(class(kml));
     
    130130
    131131            for i=1:numel(kml)
    132                 if ~isempty(kml(i).id)
    133                     fprintf(fid,'%s<MultiGeometry id="%s">\n',indent,kml(i).id);
     132                kmli=kml(i);
     133                if ~isempty(kmli.id)
     134                    fprintf(fid,'%s<MultiGeometry id="%s">\n',indent,kmli.id);
    134135                else
    135136                    fprintf(fid,'%s<MultiGeometry>\n',indent);
    136137                end
    137                 kml_write@kml_geometry(kml(i),fid,indent);
     138                kml_write@kml_geometry(kmli,fid,indent);
    138139
    139140%  loop over the geometry elements for each multigeometry
    140141
    141                 for j=1:numel(kml(i).geometry)
    142                     if ~isempty(kml(i).geometry{j})
    143                         if isa(kml(i).geometry{j},'kml_geometry')
    144                             kml_write(kml(i).geometry{j},fid,[indent '  ']);
     142                for j=1:numel(kmli.geometry)
     143                    kmlij=kmli.geometry{j};
     144                    if ~isempty(kmlij)
     145                        if isa(kmlij,'kml_geometry')
     146                            kml_write(kmlij,fid,[indent '  ']);
    145147                        else
    146148                            warning('kml(%d).geometry{%d} is a ''%s'' class object, not ''%s''.',...
    147                                 i,j,class(kml(i).geometry{j}),'kml_geometry');
     149                                i,j,class(kmlij),'kml_geometry');
    148150                        end
    149151                    end
     
    196198        end
    197199       
     200%  delete the object
     201
     202        function []=delete(kml)
     203
     204%  loop over the multigeometry
     205
     206            for i=numel(kml):-1:1
     207                kmli=kml(i);
     208
     209%  loop over the geometry elements for each multigeometry
     210
     211                for j=numel(kmli.geometry):-1:1
     212                    kmlij=kmli.geometry{j};
     213                    if ~isempty(kmlij)
     214                        if isa(kmlij,'kml_geometry')
     215                            delete(kmlij);
     216                        else
     217                            warning('kml(%d).geometry{%d} is a ''%s'' class object, not ''%s''.',...
     218                                i,j,class(kmlij),'kml_geometry');
     219                        end
     220                    end
     221                end
     222                kmli.geometry  ={};
     223
     224            end
     225
     226        end
     227       
    198228    end
    199229   
  • issm/trunk/src/m/kml/kml_object.m

    r7336 r7460  
    11%
    2 %  definition for the kml_object super (base) class.
     2%  definition for the kml_object super (base) abstract class.
    33%
    44%  [kml]=kml_object(varargin)
     
    8686%  set the properties of the object
    8787
    88         function [kml]=set(kml,varargin)
     88        function [kml]=setprops(kml,varargin)
    8989
    9090            kmlref=feval(class(kml));
     
    129129
    130130            for i=1:numel(kml)
     131                kmli=kml(i);
    131132                if strcmp(class(kml),'kml_object')
    132                     if ~isempty(kml(i).id)
    133                         fprintf(fid,'%s<!Object id="%s">\n',indent,kml(i).id);
     133                    if ~isempty(kmli.id)
     134                        fprintf(fid,'%s<!Object id="%s">\n',indent,kmli.id);
    134135                    else
    135136                        fprintf(fid,'%s<!Object>\n',indent);
  • issm/trunk/src/m/kml/kml_part_edges.m

    r7418 r7460  
    471471
    472472            kmgeom.geometry{1}(i)=kline;
    473             clear kline
     473%            clear kline
    474474        end
    475475
    476476        kplace.geometry=kmgeom;
    477477        kfold.feature{1}(k)=kplace;
    478         clear kmgeom kplace
    479     end
    480 end
    481 
    482 end
    483 
     478%        clear kmgeom kplace
     479    end
     480end
     481
     482end
     483
  • issm/trunk/src/m/kml/kml_part_elems.m

    r7418 r7460  
    205205            kpoly.outer=kring;
    206206            kmgeom.geometry{1}(i)=kpoly;
    207             clear kring kpoly
     207%            clear kring kpoly
    208208        end
    209209
    210210        kplace.geometry=kmgeom;
    211211        kfold.feature{1}(k)=kplace;
    212         clear kmgeom kplace
    213     end
    214 end
    215 
    216 end
    217 
     212%        clear kmgeom kplace
     213    end
     214end
     215
     216end
     217
  • issm/trunk/src/m/kml/kml_part_flagedges.m

    r7418 r7460  
    103103        kplace.geometry=kline;
    104104        kfold.feature{1}(i)=kplace;
    105         clear kline kplace
     105%        clear kline kplace
    106106    end
    107107end
  • issm/trunk/src/m/kml/kml_partitions.m

    r7418 r7460  
    474474            kpoly.outer=kring;
    475475            kmgeom.geometry{1}(i)=kpoly;
    476             clear kring kpoly
     476%            clear kring kpoly
    477477        end
    478478
    479479        kplace.geometry=kmgeom;
    480480        kfold.feature{1}(k)=kplace;
    481         clear kmgeom kplace
    482     end
    483 end
    484 
    485 end
    486 
     481%        clear kmgeom kplace
     482    end
     483end
     484
     485end
     486
  • issm/trunk/src/m/kml/kml_placemark.m

    r7297 r7460  
    9494%  set the properties of the object
    9595
    96         function [kml]=set(kml,varargin)
     96        function [kml]=setprops(kml,varargin)
    9797
    9898            kmlref=feval(class(kml));
     
    137137
    138138            for i=1:numel(kml)
    139                 if ~isempty(kml(i).id)
    140                     fprintf(fid,'%s<Placemark id="%s">\n',indent,kml(i).id);
     139                kmli=kml(i);
     140                if ~isempty(kmli.id)
     141                    fprintf(fid,'%s<Placemark id="%s">\n',indent,kmli.id);
    141142                else
    142143                    fprintf(fid,'%s<Placemark>\n',indent);
    143144                end
    144                 kml_write@kml_feature(kml(i),fid,indent);
     145                kml_write@kml_feature(kmli,fid,indent);
    145146
    146147%  loop over the geometry elements for each placemark
    147148
    148                 for j=1:min(1,numel(kml(i).geometry))
    149                     if ~isempty(kml(i).geometry(j))
    150                         if isa(kml(i).geometry(j),'kml_geometry')
    151                             kml_write(kml(i).geometry(j),fid,[indent '  ']);
     149                for j=1:min(1,numel(kmli.geometry))
     150                    kmlij=kmli.geometry(j);
     151                    if ~isempty(kmlij)
     152                        if isa(kmlij,'kml_geometry')
     153                            kml_write(kmlij,fid,[indent '  ']);
    152154                        else
    153155                            warning('kml(%d).geometry(%d) is a ''%s'' class object, not ''%s''.',...
    154                                 i,j,class(kml(i).geometry(j)),'kml_geometry');
     156                                i,j,class(kmlij),'kml_geometry');
    155157                        end
    156158                    end
     
    203205        end
    204206       
     207%  delete the object
     208
     209        function []=delete(kml)
     210
     211%  loop over the placemarks
     212
     213            for i=numel(kml):-1:1
     214                kmli=kml(i);
     215                delete@kml_feature(kmli);
     216
     217%  loop over the geometry elements for each placemark
     218
     219                for j=min(1,numel(kmli.geometry)):-1:1
     220                    kmlij=kmli.geometry(j);
     221                    if ~isempty(kmlij)
     222                        if isa(kmlij,'kml_geometry')
     223                            delete(kmlij);
     224                        else
     225                            warning('kml(%d).geometry(%d) is a ''%s'' class object, not ''%s''.',...
     226                                i,j,class(kmlij),'kml_geometry');
     227                        end
     228                    end
     229                end
     230                kmli.geometry  =kml_geometry.empty();
     231
     232            end
     233
     234        end
     235       
    205236    end
    206237   
  • issm/trunk/src/m/kml/kml_polygon.m

    r7297 r7460  
    2121        tessellate=false;
    2222        altmode   ='clampToGround';
    23         outer     =kml_linearring();
     23        outer     =kml_linearring.empty();
    2424        inner     =kml_linearring.empty();
    2525    end
     
    104104%  set the properties of the object
    105105
    106         function [kml]=set(kml,varargin)
     106        function [kml]=setprops(kml,varargin)
    107107
    108108            kmlref=feval(class(kml));
     
    147147
    148148            for i=1:numel(kml)
    149                 if ~isempty(kml(i).id)
    150                     fprintf(fid,'%s<Polygon id="%s">\n',indent,kml(i).id);
     149                kmli=kml(i);
     150                if ~isempty(kmli.id)
     151                    fprintf(fid,'%s<Polygon id="%s">\n',indent,kmli.id);
    151152                else
    152153                    fprintf(fid,'%s<Polygon>\n',indent);
    153154                end
    154                 kml_write@kml_geometry(kml(i),fid,indent);
    155                 fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
    156                 fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
    157                 fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
     155                kml_write@kml_geometry(kmli,fid,indent);
     156                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
     157                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
     158                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
    158159                fprintf(fid,'%s  <outerBoundaryIs>\n',indent);
    159                 if isa(kml(i).outer,'kml_linearring')
    160                     kml_write(kml(i).outer,fid,[indent '    ']);
     160                if isa(kmli.outer,'kml_linearring')
     161                    kml_write(kmli.outer,fid,[indent '    ']);
    161162                else
    162163                    warning('kml(%d).outer is a ''%s'' class object, not ''%s''.',...
    163                         i,class(kml(i).outer),'kml_linearring');
     164                        i,class(kmli.outer),'kml_linearring');
    164165                end
    165166                fprintf(fid,'%s  </outerBoundaryIs>\n',indent);
     
    167168%  loop over any inner boundaries for each polygon
    168169
    169                 if isa(kml(i).inner,'kml_linearring')
    170                     for j=1:numel(kml(i).inner)
     170                if isa(kmli.inner,'kml_linearring')
     171                    for j=1:numel(kmli.inner)
    171172                        fprintf(fid,'%s  <innerBoundaryIs>\n',indent);
    172                         kml_write(kml(i).inner(j),fid,[indent '    ']);
     173                        kml_write(kmli.inner(j),fid,[indent '    ']);
    173174                        fprintf(fid,'%s  </innerBoundaryIs>\n',indent);
    174175                    end
    175176                else
    176177                    warning('kml(%d).inner is a ''%s'' class object, not ''%s''.',...
    177                         i,class(kml(i).inner),'kml_linearring');
     178                        i,class(kmli.inner),'kml_linearring');
    178179                end
    179180
     
    234235        end
    235236       
     237%  delete the object
     238
     239        function []=delete(kml)
     240
     241%  loop over the polygons
     242
     243            for i=numel(kml):-1:1
     244                kmli=kml(i);
     245                if isa(kmli.outer,'kml_linearring')
     246                    delete(kmli.outer);
     247                else
     248                    warning('kml(%d).outer is a ''%s'' class object, not ''%s''.',...
     249                        i,class(kmli.outer),'kml_linearring');
     250                end
     251                kmli.outer     =kml_linearring.empty();
     252
     253%  loop over any inner boundaries for each polygon
     254
     255                if isa(kmli.inner,'kml_linearring')
     256                    for j=numel(kmli.inner):-1:1
     257                        delete(kmli.inner(j));
     258                    end
     259                else
     260                    warning('kml(%d).inner is a ''%s'' class object, not ''%s''.',...
     261                        i,class(kmli.inner),'kml_linearring');
     262                end
     263                kmli.inner     =kml_linearring.empty();
     264
     265            end
     266
     267        end
     268       
    236269    end
    237270   
  • issm/trunk/src/m/kml/kml_polystyle.m

    r7297 r7460  
    9292%  set the properties of the object
    9393
    94         function [kml]=set(kml,varargin)
     94        function [kml]=setprops(kml,varargin)
    9595
    9696            kmlref=feval(class(kml));
     
    135135
    136136            for i=1:numel(kml)
    137                 if ~isempty(kml(i).id)
    138                     fprintf(fid,'%s<PolyStyle id="%s">\n',indent,kml(i).id);
     137                kmli=kml(i);
     138                if ~isempty(kmli.id)
     139                    fprintf(fid,'%s<PolyStyle id="%s">\n',indent,kmli.id);
    139140                else
    140141                    fprintf(fid,'%s<PolyStyle>\n',indent);
    141142                end
    142                 kml_write@kml_colorstyle(kml(i),fid,indent);
    143                 fprintf(fid,'%s  <fill>%d</fill>\n',indent,kml(i).fill);
    144                 fprintf(fid,'%s  <outline>%d</outline>\n',indent,kml(i).outline);
     143                kml_write@kml_colorstyle(kmli,fid,indent);
     144                fprintf(fid,'%s  <fill>%d</fill>\n',indent,kmli.fill);
     145                fprintf(fid,'%s  <outline>%d</outline>\n',indent,kmli.outline);
    145146                fprintf(fid,'%s</PolyStyle>\n',indent);
    146147            end
  • issm/trunk/src/m/kml/kml_style.m

    r7297 r7460  
    116116%  set the properties of the object
    117117
    118         function [kml]=set(kml,varargin)
     118        function [kml]=setprops(kml,varargin)
    119119
    120120            kmlref=feval(class(kml));
     
    159159
    160160            for i=1:numel(kml)
    161                 if ~isempty(kml(i).id)
    162                     fprintf(fid,'%s<Style id="%s">\n',indent,kml(i).id);
     161                kmli=kml(i);
     162                if ~isempty(kmli.id)
     163                    fprintf(fid,'%s<Style id="%s">\n',indent,kmli.id);
    163164                else
    164165                    fprintf(fid,'%s<Style>\n',indent);
    165166                end
    166                 kml_write@kml_styleselector(kml(i),fid,indent);
    167 %                 if isa(kml(i).icon,'kml_iconstyle')
    168 %                     kml_write(kml(i).icon,fid,[indent '  ']);
     167                kml_write@kml_styleselector(kmli,fid,indent);
     168%                 if isa(kmli.icon,'kml_iconstyle')
     169%                     kml_write(kmli.icon,fid,[indent '  ']);
    169170%                 else
    170171%                     warning('kml(%d).icon is a ''%s'' class object, not ''%s''.',...
    171 %                         i,class(kml(i).icon),'kml_iconstyle');
    172 %                 end
    173 %                 if isa(kml(i).label,'kml_labelstyle')
    174 %                     kml_write(kml(i).label,fid,[indent '  ']);
     172%                         i,class(kmli.icon),'kml_iconstyle');
     173%                 end
     174%                 if isa(kmli.label,'kml_labelstyle')
     175%                     kml_write(kmli.label,fid,[indent '  ']);
    175176%                 else
    176177%                     warning('kml(%d).label is a ''%s'' class object, not ''%s''.',...
    177 %                         i,class(kml(i).label),'kml_labelstyle');
    178 %                 end
    179                 if isa(kml(i).line,'kml_linestyle')
    180                     kml_write(kml(i).line,fid,[indent '  ']);
     178%                         i,class(kmli.label),'kml_labelstyle');
     179%                 end
     180                if isa(kmli.line,'kml_linestyle')
     181                    kml_write(kmli.line,fid,[indent '  ']);
    181182                else
    182183                    warning('kml(%d).line is a ''%s'' class object, not ''%s''.',...
    183                         i,class(kml(i).line),'kml_linestyle');
    184                 end
    185                 if isa(kml(i).poly,'kml_polystyle')
    186                     kml_write(kml(i).poly,fid,[indent '  ']);
     184                        i,class(kmli.line),'kml_linestyle');
     185                end
     186                if isa(kmli.poly,'kml_polystyle')
     187                    kml_write(kmli.poly,fid,[indent '  ']);
    187188                else
    188189                    warning('kml(%d).poly is a ''%s'' class object, not ''%s''.',...
    189                         i,class(kml(i).poly),'kml_polystyle');
    190                 end
    191 %                 if isa(kml(i).balloon,'kml_balloonstyle')
    192 %                     kml_write(kml(i).balloon,fid,[indent '  ']);
     190                        i,class(kmli.poly),'kml_polystyle');
     191                end
     192%                 if isa(kmli.balloon,'kml_balloonstyle')
     193%                     kml_write(kmli.balloon,fid,[indent '  ']);
    193194%                 else
    194195%                     warning('kml(%d).balloon is a ''%s'' class object, not ''%s''.',...
    195 %                         i,class(kml(i).balloon),'kml_balloonstyle');
    196 %                 end
    197 %                 if isa(kml(i).list,'kml_liststyle')
    198 %                     kml_write(kml(i).list,fid,[indent '  ']);
     196%                         i,class(kmli.balloon),'kml_balloonstyle');
     197%                 end
     198%                 if isa(kmli.list,'kml_liststyle')
     199%                     kml_write(kmli.list,fid,[indent '  ']);
    199200%                 else
    200201%                     warning('kml(%d).list is a ''%s'' class object, not ''%s''.',...
    201 %                         i,class(kml(i).list),'kml_liststyle');
     202%                         i,class(kmli.list),'kml_liststyle');
    202203%                 end
    203204                fprintf(fid,'%s</Style>\n',indent);
     
    268269        end
    269270       
     271%  delete the object
     272
     273        function []=delete(kml)
     274
     275%  loop over the styles
     276
     277            for i=numel(kml):-1:1
     278                kmli=kml(i);
     279%                 if isa(kmli.icon,'kml_iconstyle')
     280%                     delete(kmli.icon);
     281%                 else
     282%                     warning('kml(%d).icon is a ''%s'' class object, not ''%s''.',...
     283%                         i,class(kmli.icon),'kml_iconstyle');
     284%                 end
     285%                 kmli.icon      =kml_iconstyle.empty();
     286%                 if isa(kmli.label,'kml_labelstyle')
     287%                     delete(kmli.label);
     288%                 else
     289%                     warning('kml(%d).label is a ''%s'' class object, not ''%s''.',...
     290%                         i,class(kmli.label),'kml_labelstyle');
     291%                 end
     292%                 kmli.label     =kml_labelstyle.empty();
     293                if isa(kmli.line,'kml_linestyle')
     294                    delete(kmli.line);
     295                else
     296                    warning('kml(%d).line is a ''%s'' class object, not ''%s''.',...
     297                        i,class(kmli.line),'kml_linestyle');
     298                end
     299                kmli.line      =kml_linestyle.empty();
     300                if isa(kmli.poly,'kml_polystyle')
     301                    delete(kmli.poly);
     302                else
     303                    warning('kml(%d).poly is a ''%s'' class object, not ''%s''.',...
     304                        i,class(kmli.poly),'kml_polystyle');
     305                end
     306                kmli.poly      =kml_polystyle.empty();
     307%                 if isa(kmli.balloon,'kml_balloonstyle')
     308%                     delete(kmli.balloon);
     309%                 else
     310%                     warning('kml(%d).balloon is a ''%s'' class object, not ''%s''.',...
     311%                         i,class(kmli.balloon),'kml_balloonstyle');
     312%                 end
     313%                 kmli.balloon   =kml_balloonstyle.empty();
     314%                 if isa(kmli.list,'kml_liststyle')
     315%                     delete(kmli.list);
     316%                 else
     317%                     warning('kml(%d).list is a ''%s'' class object, not ''%s''.',...
     318%                         i,class(kmli.list),'kml_liststyle');
     319%                 end
     320%                 kmli.list      =kml_liststyle.empty();
     321            end
     322
     323        end
     324       
    270325    end
    271326   
  • issm/trunk/src/m/kml/kml_styleselector.m

    r7297 r7460  
    11%
    2 %  definition for the kml_styleselector super (base) and sub (derived) class.
     2%  definition for the kml_styleselector super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_styleselector(varargin)
     
    8585%  set the properties of the object
    8686
    87         function [kml]=set(kml,varargin)
     87        function [kml]=setprops(kml,varargin)
    8888
    8989            kmlref=feval(class(kml));
     
    128128
    129129            for i=1:numel(kml)
     130                kmli=kml(i);
    130131                if strcmp(class(kml),'kml_styleselector')
    131                     if ~isempty(kml(i).id)
    132                         fprintf(fid,'%s<!StyleSelector id="%s">\n',indent,kml(i).id);
     132                    if ~isempty(kmli.id)
     133                        fprintf(fid,'%s<!StyleSelector id="%s">\n',indent,kmli.id);
    133134                    else
    134135                        fprintf(fid,'%s<!StyleSelector>\n',indent);
    135136                    end
    136137                end
    137                 kml_write@kml_object(kml(i),fid,indent);
     138                kml_write@kml_object(kmli,fid,indent);
    138139                if strcmp(class(kml),'kml_styleselector')
    139140                    fprintf(fid,'%s</!StyleSelector>\n',indent);
  • issm/trunk/src/m/kml/kml_substyle.m

    r7297 r7460  
    11%
    2 %  definition for the kml_substyle super (base) and sub (derived) class.
     2%  definition for the kml_substyle super (base) and sub (derived) abstract class.
    33%
    44%  [kml]=kml_substyle(varargin)
     
    8585%  set the properties of the object
    8686
    87         function [kml]=set(kml,varargin)
     87        function [kml]=setprops(kml,varargin)
    8888
    8989            kmlref=feval(class(kml));
     
    128128
    129129            for i=1:numel(kml)
     130                kmli=kml(i);
    130131                if strcmp(class(kml),'kml_substyle')
    131                     if ~isempty(kml(i).id)
    132                         fprintf(fid,'%s<!SubStyle id="%s">\n',indent,kml(i).id);
     132                    if ~isempty(kmli.id)
     133                        fprintf(fid,'%s<!SubStyle id="%s">\n',indent,kmli.id);
    133134                    else
    134135                        fprintf(fid,'%s<!SubStyle>\n',indent);
    135136                    end
    136137                end
    137                 kml_write@kml_object(kml(i),fid,indent);
     138                kml_write@kml_object(kmli,fid,indent);
    138139                if strcmp(class(kml),'kml_substyle')
    139140                    fprintf(fid,'%s<!/SubStyle>\n',indent);
  • issm/trunk/src/m/kml/kml_unsh_edges.m

    r7418 r7460  
    109109        kplace.geometry=kline;
    110110        kfold.feature{1}(i)=kplace;
    111         clear kline kplace
     111%        clear kline kplace
    112112    end
    113113end
Note: See TracChangeset for help on using the changeset viewer.