Index: /issm/trunk/src/m/kml/kml_colorstyle.m
===================================================================
--- /issm/trunk/src/m/kml/kml_colorstyle.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_colorstyle.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_colorstyle super (base) and sub (derived) class.
+%  definition for the kml_colorstyle super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_colorstyle(varargin)
@@ -96,5 +96,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -139,17 +139,18 @@
 
             for i=1:numel(kml)
-                if strcmp(class(kml),'kml_colorstyle')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!ColorStyle id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if strcmp(class(kml),'kml_colorstyle')
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!ColorStyle id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!ColorStyle>\n',indent);
                     end
                 end
-                kml_write@kml_substyle(kml(i),fid,indent);
-                if ~isempty(kml(i).color)
-                    fprintf(fid,'%s  <color>%s</color>\n',indent,kml(i).color);
-                end
-                if ~isempty(kml(i).colormode)
-                    fprintf(fid,'%s  <colorMode>%s</colorMode>\n',indent,kml(i).colormode);
+                kml_write@kml_substyle(kmli,fid,indent);
+                if ~isempty(kmli.color)
+                    fprintf(fid,'%s  <color>%s</color>\n',indent,kmli.color);
+                end
+                if ~isempty(kmli.colormode)
+                    fprintf(fid,'%s  <colorMode>%s</colorMode>\n',indent,kmli.colormode);
                 end
                 if strcmp(class(kml),'kml_colorstyle')
Index: /issm/trunk/src/m/kml/kml_container.m
===================================================================
--- /issm/trunk/src/m/kml/kml_container.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_container.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_container super (base) and sub (derived) class.
+%  definition for the kml_container super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_container(varargin)
@@ -92,5 +92,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -135,12 +135,13 @@
 
             for i=1:numel(kml)
+                kmli=kml(i);
                 if strcmp(class(kml),'kml_container')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!Container id="%s">\n',indent,kml(i).id);
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!Container id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!Container>\n',indent);
                     end
                 end
-                kml_write@kml_feature(kml(i),fid,indent);
+                kml_write@kml_feature(kmli,fid,indent);
                 if strcmp(class(kml),'kml_container')
                     fprintf(fid,'%s<!/Container>\n',indent);
@@ -180,4 +181,17 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the containers
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+                delete@kml_feature(kmli);
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_document.m
===================================================================
--- /issm/trunk/src/m/kml/kml_document.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_document.m	(revision 7460)
@@ -94,5 +94,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -137,20 +137,21 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<Document id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<Document id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<Document>\n',indent);
                 end
-                kml_write@kml_container(kml(i),fid,indent);
+                kml_write@kml_container(kmli,fid,indent);
 
 %  loop over the features for each document
 
-                for j=1:numel(kml(i).feature)
-                    if ~isempty(kml(i).feature{j})
-                        if isa(kml(i).feature{j},'kml_feature')
-                            kml_write(kml(i).feature{j},fid,[indent '  ']);
+                for j=1:numel(kmli.feature)
+                    if ~isempty(kmli.feature{j})
+                        if isa(kmli.feature{j},'kml_feature')
+                            kml_write(kmli.feature{j},fid,[indent '  ']);
                         else
                             warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
-                                i,j,class(kml(i).feature{j}),'kml_feature');
+                                i,j,class(kmli.feature{j}),'kml_feature');
                         end
                     end
@@ -202,4 +203,32 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the documents
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+                delete@kml_container(kmli);
+
+%  loop over the features for each document
+
+                for j=numel(kmli.feature):-1:1
+                    if ~isempty(kmli.feature{j})
+                        if isa(kmli.feature{j},'kml_feature')
+                            delete(kmli.feature{j});
+                        else
+                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
+                                i,j,class(kmli.feature{j}),'kml_feature');
+                        end
+                    end
+                end
+                kmli.feature   ={};
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_feature.m
===================================================================
--- /issm/trunk/src/m/kml/kml_feature.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_feature.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_feature super (base) and sub (derived) class.
+%  definition for the kml_feature super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_feature(varargin)
@@ -118,5 +118,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -161,36 +161,37 @@
 
             for i=1:numel(kml)
-                if strcmp(class(kml),'kml_feature')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!Feature id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if strcmp(class(kml),'kml_feature')
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!Feature id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!Feature>\n',indent);
                     end
                 end
-                kml_write@kml_object(kml(i),fid,indent);
-                if ~isempty(kml(i).name)
-                    fprintf(fid,'%s  <name>%s</name>\n',indent,kml(i).name);
-                end
-                fprintf(fid,'%s  <visibility>%d</visibility>\n',indent,kml(i).visibility);
-                fprintf(fid,'%s  <open>%d</open>\n',indent,kml(i).open);
-                if ~isempty(kml(i).snippet)
-                    fprintf(fid,'%s  <Snippet maxLines="2">%s</Snippet>\n',indent,kml(i).snippet);
-                end
-                if ~isempty(kml(i).descript)
-                    fprintf(fid,'%s  <description>%s</description>\n',indent,kml(i).descript);
-                end
-                if ~isempty(kml(i).styleurl)
-                    fprintf(fid,'%s  <styleUrl>%s</styleUrl>\n',indent,kml(i).styleurl);
+                kml_write@kml_object(kmli,fid,indent);
+                if ~isempty(kmli.name)
+                    fprintf(fid,'%s  <name>%s</name>\n',indent,kmli.name);
+                end
+                fprintf(fid,'%s  <visibility>%d</visibility>\n',indent,kmli.visibility);
+                fprintf(fid,'%s  <open>%d</open>\n',indent,kmli.open);
+                if ~isempty(kmli.snippet)
+                    fprintf(fid,'%s  <Snippet maxLines="2">%s</Snippet>\n',indent,kmli.snippet);
+                end
+                if ~isempty(kmli.descript)
+                    fprintf(fid,'%s  <description>%s</description>\n',indent,kmli.descript);
+                end
+                if ~isempty(kmli.styleurl)
+                    fprintf(fid,'%s  <styleUrl>%s</styleUrl>\n',indent,kmli.styleurl);
                 end
 
 %  loop over the styles for each feature
 
-                for j=1:numel(kml(i).style)
-                    if ~isempty(kml(i).style{j})
-                        if isa(kml(i).style{j},'kml_styleselector')
-                            kml_write(kml(i).style{j},fid,[indent '  ']);
+                for j=1:numel(kmli.style)
+                    if ~isempty(kmli.style{j})
+                        if isa(kmli.style{j},'kml_styleselector')
+                            kml_write(kmli.style{j},fid,[indent '  ']);
                         else
                             warning('kml(%d).style{%d} is a ''%s'' class object, not ''%s''.',...
-                                i,j,class(kml(i).style{j}),'kml_styleselector');
+                                i,j,class(kmli.style{j}),'kml_styleselector');
                         end
                     end
@@ -262,4 +263,31 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the features
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+
+%  loop over the styles for each feature
+
+                for j=numel(kmli.style):-1:1
+                    if ~isempty(kmli.style{j})
+                        if isa(kmli.style{j},'kml_styleselector')
+                            delete(kmli.style{j});
+                        else
+                            warning('kml(%d).style{%d} is a ''%s'' class object, not ''%s''.',...
+                                i,j,class(kmli.style{j}),'kml_styleselector');
+                        end
+                    end
+                end
+                kmli.style     ={};
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_folder.m
===================================================================
--- /issm/trunk/src/m/kml/kml_folder.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_folder.m	(revision 7460)
@@ -94,5 +94,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -137,20 +137,21 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<Folder id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<Folder id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<Folder>\n',indent);
                 end
-                kml_write@kml_container(kml(i),fid,indent);
+                kml_write@kml_container(kmli,fid,indent);
 
 %  loop over the features for each folder
 
-                for j=1:numel(kml(i).feature)
-                    if ~isempty(kml(i).feature{j})
-                        if isa(kml(i).feature{j},'kml_feature')
-                            kml_write(kml(i).feature{j},fid,[indent '  ']);
+                for j=1:numel(kmli.feature)
+                    if ~isempty(kmli.feature{j})
+                        if isa(kmli.feature{j},'kml_feature')
+                            kml_write(kmli.feature{j},fid,[indent '  ']);
                         else
                             warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
-                                i,j,class(kml(i).feature{j}),'kml_feature');
+                                i,j,class(kmli.feature{j}),'kml_feature');
                         end
                     end
@@ -202,4 +203,32 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the folders
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+                delete@kml_container(kmli);
+
+%  loop over the features for each folder
+
+                for j=numel(kmli.feature):-1:1
+                    if ~isempty(kmli.feature{j})
+                        if isa(kmli.feature{j},'kml_feature')
+                            delete(kmli.feature{j});
+                        else
+                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
+                                i,j,class(kmli.feature{j}),'kml_feature');
+                        end
+                    end
+                end
+                kmli.feature   ={};
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_geometry.m
===================================================================
--- /issm/trunk/src/m/kml/kml_geometry.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_geometry.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_geometry super (base) and sub (derived) class.
+%  definition for the kml_geometry super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_geometry(varargin)
@@ -85,5 +85,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -128,12 +128,13 @@
 
             for i=1:numel(kml)
+                kmli=kml(i);
                 if strcmp(class(kml),'kml_geometry')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!Geometry id="%s">\n',indent,kml(i).id);
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!Geometry id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!Geometry>\n',indent);
                     end
                 end
-                kml_write@kml_object(kml(i),fid,indent);
+                kml_write@kml_object(kmli,fid,indent);
                 if strcmp(class(kml),'kml_geometry')
                     fprintf(fid,'%s</!Geometry>\n',indent);
Index: /issm/trunk/src/m/kml/kml_linearring.m
===================================================================
--- /issm/trunk/src/m/kml/kml_linearring.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_linearring.m	(revision 7460)
@@ -99,5 +99,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -142,19 +142,23 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<LinearRing id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<LinearRing id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<LinearRing>\n',indent);
                 end
-                kml_write@kml_geometry(kml(i),fid,indent);
-                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
-                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
-                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
+                kml_write@kml_geometry(kmli,fid,indent);
+%                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
+%                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
+%                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
+                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,0);
+                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,0);
+                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,'clampToGround');
                 fprintf(fid,'%s  <coordinates>\n',indent);
 
 %  loop over the coordinates for each linearring
 
-                for j=1:size(kml(i).coords,1)
-                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kml(i).coords(j,:));
+                for j=1:size(kmli.coords,1)
+                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:));
                 end
 
Index: /issm/trunk/src/m/kml/kml_linestring.m
===================================================================
--- /issm/trunk/src/m/kml/kml_linestring.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_linestring.m	(revision 7460)
@@ -99,5 +99,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -142,19 +142,20 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<LineString id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<LineString id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<LineString>\n',indent);
                 end
-                kml_write@kml_geometry(kml(i),fid,indent);
-                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
-                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
-                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
+                kml_write@kml_geometry(kmli,fid,indent);
+                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
+                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
+                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
                 fprintf(fid,'%s  <coordinates>\n',indent);
 
 %  loop over the coordinates for each linestring
 
-                for j=1:size(kml(i).coords,1)
-                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kml(i).coords(j,:));
+                for j=1:size(kmli.coords,1)
+                    fprintf(fid,'%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:));
                 end
 
Index: /issm/trunk/src/m/kml/kml_linestyle.m
===================================================================
--- /issm/trunk/src/m/kml/kml_linestyle.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_linestyle.m	(revision 7460)
@@ -88,5 +88,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -131,11 +131,12 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<LineStyle id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<LineStyle id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<LineStyle>\n',indent);
                 end
-                kml_write@kml_colorstyle(kml(i),fid,indent);
-                fprintf(fid,'%s  <width>%d</width>\n',indent,kml(i).width);
+                kml_write@kml_colorstyle(kmli,fid,indent);
+                fprintf(fid,'%s  <width>%d</width>\n',indent,kmli.width);
                 fprintf(fid,'%s</LineStyle>\n',indent);
             end
Index: /issm/trunk/src/m/kml/kml_mesh_elem.m
===================================================================
--- /issm/trunk/src/m/kml/kml_mesh_elem.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_mesh_elem.m	(revision 7460)
@@ -125,5 +125,8 @@
 kfold.descript  =sprintf('Elements=%d, Grids=%d',...
     md.numberofelements,md.numberofgrids);
-kfold.feature   ={repmat(kml_placemark(),1,size(md.elements,1))};
+% see matlab_oop, "initializing a handle object array"
+%kfold.feature   ={repmat(kml_placemark(),1,size(md.elements,1))};
+kfeat(size(md.elements,1))=kml_placemark();
+kfold.feature={kfeat};
 
 %  write each element as a polygon placemark
@@ -131,9 +134,11 @@
 disp(['Writing ' num2str(size(md.elements,1)) ' tria elements as KML polygons.']);
 for i=1:size(md.elements,1)
+%for i=1:5000
     kplace=kml_placemark();
     kplace.name      =sprintf('Element %d',i);
     kplace.visibility=1;
     if exist('edata','var')
-        kplace.descript  =sprintf('Element data: %g',edata(i));
+%        kplace.descript  =sprintf('Element data: %g',edata(i));
+        kplace.descript  =sprintf('campaign{\n  deformation %g quad_pol ascending right asap;\n}',edata(i));
         imap = fix((edata(i)-cmin)/(cmax-cmin)*size(cmap,1))+1;
         if     (imap >= 1) && (imap <= size(cmap,1))
@@ -163,5 +168,9 @@
     kplace.geometry=kpoly;
     kfold.feature{1}(i)=kplace;
-    clear kring kpoly kplace
+%    clear kring kpoly kplace
+
+    if ~mod(i,1000)
+        disp(['  ' num2str(i) ' tria elements written.']);
+    end
 end
 
Index: /issm/trunk/src/m/kml/kml_mesh_write.m
===================================================================
--- /issm/trunk/src/m/kml/kml_mesh_write.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_mesh_write.m	(revision 7460)
@@ -153,5 +153,5 @@
 kstyle.poly      =kpsty;
 kdoc.style{1}(end+1)=kstyle;
-clear kstyle kpoly kline
+clear kstyle kpsty klsty
 
 klsty=kml_linestyle();
@@ -167,5 +167,5 @@
 kstyle.poly      =kpsty;
 kdoc.style{1}(end+1)=kstyle;
-clear kstyle kpoly kline
+clear kstyle kpsty klsty
 
 klsty=kml_linestyle();
@@ -181,5 +181,5 @@
 kstyle.poly      =kpsty;
 kdoc.style{1}(end+1)=kstyle;
-clear kstyle kpoly kline
+clear kstyle kpsty klsty
 
 %  colormap command operates on a figure, so create an invisible one
@@ -209,5 +209,5 @@
         kstyle.poly      =kpsty;
         kdoc.style{1}(end+1)=kstyle;
-        clear kstyle kpoly kline
+        clear kstyle kpsty klsty
     end
 end
@@ -256,5 +256,6 @@
 kml_file_write(kdoc,filek);
 % kml_file_swrite(kdoc,filek);
-
-end
-
+delete(kdoc);
+
+end
+
Index: /issm/trunk/src/m/kml/kml_multigeometry.m
===================================================================
--- /issm/trunk/src/m/kml/kml_multigeometry.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_multigeometry.m	(revision 7460)
@@ -87,5 +87,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -130,20 +130,22 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<MultiGeometry id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<MultiGeometry id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<MultiGeometry>\n',indent);
                 end
-                kml_write@kml_geometry(kml(i),fid,indent);
+                kml_write@kml_geometry(kmli,fid,indent);
 
 %  loop over the geometry elements for each multigeometry
 
-                for j=1:numel(kml(i).geometry)
-                    if ~isempty(kml(i).geometry{j})
-                        if isa(kml(i).geometry{j},'kml_geometry')
-                            kml_write(kml(i).geometry{j},fid,[indent '  ']);
+                for j=1:numel(kmli.geometry)
+                    kmlij=kmli.geometry{j};
+                    if ~isempty(kmlij)
+                        if isa(kmlij,'kml_geometry')
+                            kml_write(kmlij,fid,[indent '  ']);
                         else
                             warning('kml(%d).geometry{%d} is a ''%s'' class object, not ''%s''.',...
-                                i,j,class(kml(i).geometry{j}),'kml_geometry');
+                                i,j,class(kmlij),'kml_geometry');
                         end
                     end
@@ -196,4 +198,32 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the multigeometry
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+
+%  loop over the geometry elements for each multigeometry
+
+                for j=numel(kmli.geometry):-1:1
+                    kmlij=kmli.geometry{j};
+                    if ~isempty(kmlij)
+                        if isa(kmlij,'kml_geometry')
+                            delete(kmlij);
+                        else
+                            warning('kml(%d).geometry{%d} is a ''%s'' class object, not ''%s''.',...
+                                i,j,class(kmlij),'kml_geometry');
+                        end
+                    end
+                end
+                kmli.geometry  ={};
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_object.m
===================================================================
--- /issm/trunk/src/m/kml/kml_object.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_object.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_object super (base) class.
+%  definition for the kml_object super (base) abstract class.
 %
 %  [kml]=kml_object(varargin)
@@ -86,5 +86,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -129,7 +129,8 @@
 
             for i=1:numel(kml)
+                kmli=kml(i);
                 if strcmp(class(kml),'kml_object')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!Object id="%s">\n',indent,kml(i).id);
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!Object id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!Object>\n',indent);
Index: /issm/trunk/src/m/kml/kml_part_edges.m
===================================================================
--- /issm/trunk/src/m/kml/kml_part_edges.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_part_edges.m	(revision 7460)
@@ -471,13 +471,13 @@
 
             kmgeom.geometry{1}(i)=kline;
-            clear kline
+%            clear kline
         end
 
         kplace.geometry=kmgeom;
         kfold.feature{1}(k)=kplace;
-        clear kmgeom kplace
-    end
-end
-
-end
-
+%        clear kmgeom kplace
+    end
+end
+
+end
+
Index: /issm/trunk/src/m/kml/kml_part_elems.m
===================================================================
--- /issm/trunk/src/m/kml/kml_part_elems.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_part_elems.m	(revision 7460)
@@ -205,13 +205,13 @@
             kpoly.outer=kring;
             kmgeom.geometry{1}(i)=kpoly;
-            clear kring kpoly
+%            clear kring kpoly
         end
 
         kplace.geometry=kmgeom;
         kfold.feature{1}(k)=kplace;
-        clear kmgeom kplace
-    end
-end
-
-end
-
+%        clear kmgeom kplace
+    end
+end
+
+end
+
Index: /issm/trunk/src/m/kml/kml_part_flagedges.m
===================================================================
--- /issm/trunk/src/m/kml/kml_part_flagedges.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_part_flagedges.m	(revision 7460)
@@ -103,5 +103,5 @@
         kplace.geometry=kline;
         kfold.feature{1}(i)=kplace;
-        clear kline kplace
+%        clear kline kplace
     end
 end
Index: /issm/trunk/src/m/kml/kml_partitions.m
===================================================================
--- /issm/trunk/src/m/kml/kml_partitions.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_partitions.m	(revision 7460)
@@ -474,13 +474,13 @@
             kpoly.outer=kring;
             kmgeom.geometry{1}(i)=kpoly;
-            clear kring kpoly
+%            clear kring kpoly
         end
 
         kplace.geometry=kmgeom;
         kfold.feature{1}(k)=kplace;
-        clear kmgeom kplace
-    end
-end
-
-end
-
+%        clear kmgeom kplace
+    end
+end
+
+end
+
Index: /issm/trunk/src/m/kml/kml_placemark.m
===================================================================
--- /issm/trunk/src/m/kml/kml_placemark.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_placemark.m	(revision 7460)
@@ -94,5 +94,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -137,20 +137,22 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<Placemark id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<Placemark id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<Placemark>\n',indent);
                 end
-                kml_write@kml_feature(kml(i),fid,indent);
+                kml_write@kml_feature(kmli,fid,indent);
 
 %  loop over the geometry elements for each placemark
 
-                for j=1:min(1,numel(kml(i).geometry))
-                    if ~isempty(kml(i).geometry(j))
-                        if isa(kml(i).geometry(j),'kml_geometry')
-                            kml_write(kml(i).geometry(j),fid,[indent '  ']);
+                for j=1:min(1,numel(kmli.geometry))
+                    kmlij=kmli.geometry(j);
+                    if ~isempty(kmlij)
+                        if isa(kmlij,'kml_geometry')
+                            kml_write(kmlij,fid,[indent '  ']);
                         else
                             warning('kml(%d).geometry(%d) is a ''%s'' class object, not ''%s''.',...
-                                i,j,class(kml(i).geometry(j)),'kml_geometry');
+                                i,j,class(kmlij),'kml_geometry');
                         end
                     end
@@ -203,4 +205,33 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the placemarks
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+                delete@kml_feature(kmli);
+
+%  loop over the geometry elements for each placemark
+
+                for j=min(1,numel(kmli.geometry)):-1:1
+                    kmlij=kmli.geometry(j);
+                    if ~isempty(kmlij)
+                        if isa(kmlij,'kml_geometry')
+                            delete(kmlij);
+                        else
+                            warning('kml(%d).geometry(%d) is a ''%s'' class object, not ''%s''.',...
+                                i,j,class(kmlij),'kml_geometry');
+                        end
+                    end
+                end
+                kmli.geometry  =kml_geometry.empty();
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_polygon.m
===================================================================
--- /issm/trunk/src/m/kml/kml_polygon.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_polygon.m	(revision 7460)
@@ -21,5 +21,5 @@
         tessellate=false;
         altmode   ='clampToGround';
-        outer     =kml_linearring();
+        outer     =kml_linearring.empty();
         inner     =kml_linearring.empty();
     end
@@ -104,5 +104,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -147,19 +147,20 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<Polygon id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<Polygon id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<Polygon>\n',indent);
                 end
-                kml_write@kml_geometry(kml(i),fid,indent);
-                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kml(i).extrude);
-                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kml(i).tessellate);
-                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kml(i).altmode);
+                kml_write@kml_geometry(kmli,fid,indent);
+                fprintf(fid,'%s  <extrude>%d</extrude>\n',indent,kmli.extrude);
+                fprintf(fid,'%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate);
+                fprintf(fid,'%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode);
                 fprintf(fid,'%s  <outerBoundaryIs>\n',indent);
-                if isa(kml(i).outer,'kml_linearring')
-                    kml_write(kml(i).outer,fid,[indent '    ']);
+                if isa(kmli.outer,'kml_linearring')
+                    kml_write(kmli.outer,fid,[indent '    ']);
                 else
                     warning('kml(%d).outer is a ''%s'' class object, not ''%s''.',...
-                        i,class(kml(i).outer),'kml_linearring');
+                        i,class(kmli.outer),'kml_linearring');
                 end
                 fprintf(fid,'%s  </outerBoundaryIs>\n',indent);
@@ -167,13 +168,13 @@
 %  loop over any inner boundaries for each polygon
 
-                if isa(kml(i).inner,'kml_linearring')
-                    for j=1:numel(kml(i).inner)
+                if isa(kmli.inner,'kml_linearring')
+                    for j=1:numel(kmli.inner)
                         fprintf(fid,'%s  <innerBoundaryIs>\n',indent);
-                        kml_write(kml(i).inner(j),fid,[indent '    ']);
+                        kml_write(kmli.inner(j),fid,[indent '    ']);
                         fprintf(fid,'%s  </innerBoundaryIs>\n',indent);
                     end
                 else
                     warning('kml(%d).inner is a ''%s'' class object, not ''%s''.',...
-                        i,class(kml(i).inner),'kml_linearring');
+                        i,class(kmli.inner),'kml_linearring');
                 end
 
@@ -234,4 +235,36 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the polygons
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+                if isa(kmli.outer,'kml_linearring')
+                    delete(kmli.outer);
+                else
+                    warning('kml(%d).outer is a ''%s'' class object, not ''%s''.',...
+                        i,class(kmli.outer),'kml_linearring');
+                end
+                kmli.outer     =kml_linearring.empty();
+
+%  loop over any inner boundaries for each polygon
+
+                if isa(kmli.inner,'kml_linearring')
+                    for j=numel(kmli.inner):-1:1
+                        delete(kmli.inner(j));
+                    end
+                else
+                    warning('kml(%d).inner is a ''%s'' class object, not ''%s''.',...
+                        i,class(kmli.inner),'kml_linearring');
+                end
+                kmli.inner     =kml_linearring.empty();
+
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_polystyle.m
===================================================================
--- /issm/trunk/src/m/kml/kml_polystyle.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_polystyle.m	(revision 7460)
@@ -92,5 +92,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -135,12 +135,13 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<PolyStyle id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<PolyStyle id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<PolyStyle>\n',indent);
                 end
-                kml_write@kml_colorstyle(kml(i),fid,indent);
-                fprintf(fid,'%s  <fill>%d</fill>\n',indent,kml(i).fill);
-                fprintf(fid,'%s  <outline>%d</outline>\n',indent,kml(i).outline);
+                kml_write@kml_colorstyle(kmli,fid,indent);
+                fprintf(fid,'%s  <fill>%d</fill>\n',indent,kmli.fill);
+                fprintf(fid,'%s  <outline>%d</outline>\n',indent,kmli.outline);
                 fprintf(fid,'%s</PolyStyle>\n',indent);
             end
Index: /issm/trunk/src/m/kml/kml_style.m
===================================================================
--- /issm/trunk/src/m/kml/kml_style.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_style.m	(revision 7460)
@@ -116,5 +116,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -159,45 +159,46 @@
 
             for i=1:numel(kml)
-                if ~isempty(kml(i).id)
-                    fprintf(fid,'%s<Style id="%s">\n',indent,kml(i).id);
+                kmli=kml(i);
+                if ~isempty(kmli.id)
+                    fprintf(fid,'%s<Style id="%s">\n',indent,kmli.id);
                 else
                     fprintf(fid,'%s<Style>\n',indent);
                 end
-                kml_write@kml_styleselector(kml(i),fid,indent);
-%                 if isa(kml(i).icon,'kml_iconstyle')
-%                     kml_write(kml(i).icon,fid,[indent '  ']);
+                kml_write@kml_styleselector(kmli,fid,indent);
+%                 if isa(kmli.icon,'kml_iconstyle')
+%                     kml_write(kmli.icon,fid,[indent '  ']);
 %                 else
 %                     warning('kml(%d).icon is a ''%s'' class object, not ''%s''.',...
-%                         i,class(kml(i).icon),'kml_iconstyle');
-%                 end
-%                 if isa(kml(i).label,'kml_labelstyle')
-%                     kml_write(kml(i).label,fid,[indent '  ']);
+%                         i,class(kmli.icon),'kml_iconstyle');
+%                 end
+%                 if isa(kmli.label,'kml_labelstyle')
+%                     kml_write(kmli.label,fid,[indent '  ']);
 %                 else
 %                     warning('kml(%d).label is a ''%s'' class object, not ''%s''.',...
-%                         i,class(kml(i).label),'kml_labelstyle');
-%                 end
-                if isa(kml(i).line,'kml_linestyle')
-                    kml_write(kml(i).line,fid,[indent '  ']);
+%                         i,class(kmli.label),'kml_labelstyle');
+%                 end
+                if isa(kmli.line,'kml_linestyle')
+                    kml_write(kmli.line,fid,[indent '  ']);
                 else
                     warning('kml(%d).line is a ''%s'' class object, not ''%s''.',...
-                        i,class(kml(i).line),'kml_linestyle');
-                end
-                if isa(kml(i).poly,'kml_polystyle')
-                    kml_write(kml(i).poly,fid,[indent '  ']);
+                        i,class(kmli.line),'kml_linestyle');
+                end
+                if isa(kmli.poly,'kml_polystyle')
+                    kml_write(kmli.poly,fid,[indent '  ']);
                 else
                     warning('kml(%d).poly is a ''%s'' class object, not ''%s''.',...
-                        i,class(kml(i).poly),'kml_polystyle');
-                end
-%                 if isa(kml(i).balloon,'kml_balloonstyle')
-%                     kml_write(kml(i).balloon,fid,[indent '  ']);
+                        i,class(kmli.poly),'kml_polystyle');
+                end
+%                 if isa(kmli.balloon,'kml_balloonstyle')
+%                     kml_write(kmli.balloon,fid,[indent '  ']);
 %                 else
 %                     warning('kml(%d).balloon is a ''%s'' class object, not ''%s''.',...
-%                         i,class(kml(i).balloon),'kml_balloonstyle');
-%                 end
-%                 if isa(kml(i).list,'kml_liststyle')
-%                     kml_write(kml(i).list,fid,[indent '  ']);
+%                         i,class(kmli.balloon),'kml_balloonstyle');
+%                 end
+%                 if isa(kmli.list,'kml_liststyle')
+%                     kml_write(kmli.list,fid,[indent '  ']);
 %                 else
 %                     warning('kml(%d).list is a ''%s'' class object, not ''%s''.',...
-%                         i,class(kml(i).list),'kml_liststyle');
+%                         i,class(kmli.list),'kml_liststyle');
 %                 end
                 fprintf(fid,'%s</Style>\n',indent);
@@ -268,4 +269,58 @@
         end
         
+%  delete the object
+
+        function []=delete(kml)
+
+%  loop over the styles
+
+            for i=numel(kml):-1:1
+                kmli=kml(i);
+%                 if isa(kmli.icon,'kml_iconstyle')
+%                     delete(kmli.icon);
+%                 else
+%                     warning('kml(%d).icon is a ''%s'' class object, not ''%s''.',...
+%                         i,class(kmli.icon),'kml_iconstyle');
+%                 end
+%                 kmli.icon      =kml_iconstyle.empty();
+%                 if isa(kmli.label,'kml_labelstyle')
+%                     delete(kmli.label);
+%                 else
+%                     warning('kml(%d).label is a ''%s'' class object, not ''%s''.',...
+%                         i,class(kmli.label),'kml_labelstyle');
+%                 end
+%                 kmli.label     =kml_labelstyle.empty();
+                if isa(kmli.line,'kml_linestyle')
+                    delete(kmli.line);
+                else
+                    warning('kml(%d).line is a ''%s'' class object, not ''%s''.',...
+                        i,class(kmli.line),'kml_linestyle');
+                end
+                kmli.line      =kml_linestyle.empty();
+                if isa(kmli.poly,'kml_polystyle')
+                    delete(kmli.poly);
+                else
+                    warning('kml(%d).poly is a ''%s'' class object, not ''%s''.',...
+                        i,class(kmli.poly),'kml_polystyle');
+                end
+                kmli.poly      =kml_polystyle.empty();
+%                 if isa(kmli.balloon,'kml_balloonstyle')
+%                     delete(kmli.balloon);
+%                 else
+%                     warning('kml(%d).balloon is a ''%s'' class object, not ''%s''.',...
+%                         i,class(kmli.balloon),'kml_balloonstyle');
+%                 end
+%                 kmli.balloon   =kml_balloonstyle.empty();
+%                 if isa(kmli.list,'kml_liststyle')
+%                     delete(kmli.list);
+%                 else
+%                     warning('kml(%d).list is a ''%s'' class object, not ''%s''.',...
+%                         i,class(kmli.list),'kml_liststyle');
+%                 end
+%                 kmli.list      =kml_liststyle.empty();
+            end
+
+        end
+        
     end
     
Index: /issm/trunk/src/m/kml/kml_styleselector.m
===================================================================
--- /issm/trunk/src/m/kml/kml_styleselector.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_styleselector.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_styleselector super (base) and sub (derived) class.
+%  definition for the kml_styleselector super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_styleselector(varargin)
@@ -85,5 +85,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -128,12 +128,13 @@
 
             for i=1:numel(kml)
+                kmli=kml(i);
                 if strcmp(class(kml),'kml_styleselector')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!StyleSelector id="%s">\n',indent,kml(i).id);
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!StyleSelector id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!StyleSelector>\n',indent);
                     end
                 end
-                kml_write@kml_object(kml(i),fid,indent);
+                kml_write@kml_object(kmli,fid,indent);
                 if strcmp(class(kml),'kml_styleselector')
                     fprintf(fid,'%s</!StyleSelector>\n',indent);
Index: /issm/trunk/src/m/kml/kml_substyle.m
===================================================================
--- /issm/trunk/src/m/kml/kml_substyle.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_substyle.m	(revision 7460)
@@ -1,4 +1,4 @@
 %
-%  definition for the kml_substyle super (base) and sub (derived) class.
+%  definition for the kml_substyle super (base) and sub (derived) abstract class.
 %
 %  [kml]=kml_substyle(varargin)
@@ -85,5 +85,5 @@
 %  set the properties of the object
 
-        function [kml]=set(kml,varargin)
+        function [kml]=setprops(kml,varargin)
 
             kmlref=feval(class(kml));
@@ -128,12 +128,13 @@
 
             for i=1:numel(kml)
+                kmli=kml(i);
                 if strcmp(class(kml),'kml_substyle')
-                    if ~isempty(kml(i).id)
-                        fprintf(fid,'%s<!SubStyle id="%s">\n',indent,kml(i).id);
+                    if ~isempty(kmli.id)
+                        fprintf(fid,'%s<!SubStyle id="%s">\n',indent,kmli.id);
                     else
                         fprintf(fid,'%s<!SubStyle>\n',indent);
                     end
                 end
-                kml_write@kml_object(kml(i),fid,indent);
+                kml_write@kml_object(kmli,fid,indent);
                 if strcmp(class(kml),'kml_substyle')
                     fprintf(fid,'%s<!/SubStyle>\n',indent);
Index: /issm/trunk/src/m/kml/kml_unsh_edges.m
===================================================================
--- /issm/trunk/src/m/kml/kml_unsh_edges.m	(revision 7459)
+++ /issm/trunk/src/m/kml/kml_unsh_edges.m	(revision 7460)
@@ -109,5 +109,5 @@
         kplace.geometry=kline;
         kfold.feature{1}(i)=kplace;
-        clear kline kplace
+%        clear kline kplace
     end
 end
