Changeset 7297 for issm/trunk


Ignore:
Timestamp:
02/03/11 14:43:40 (14 years ago)
Author:
jschierm
Message:

kml: Added swrite methods to all kml classes to write using string_buf.

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

Legend:

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

    r6480 r7297  
    160160        end
    161161       
     162%  string write the object
     163
     164        function [sbuf]=kml_swrite(kml,sbuf,indent)
     165
     166           if ~exist('sbuf','var') || isempty(sbuf)
     167               sbuf=string_buf;
     168           end
     169           if ~exist('indent','var') || isempty(indent)
     170               indent='';
     171           end
     172
     173%  loop over the colorstyles
     174
     175            for i=1:numel(kml)
     176                kmli=kml(i);
     177                if strcmp(class(kml),'kml_colorstyle')
     178                    if ~isempty(kmli.id)
     179                        sbuf=add(sbuf,sprintf('%s<!ColorStyle id="%s">\n',indent,kmli.id));
     180                    else
     181                        sbuf=add(sbuf,sprintf('%s<!ColorStyle>\n',indent));
     182                    end
     183                end
     184                sbuf=kml_swrite@kml_substyle(kmli,sbuf,indent);
     185                if ~isempty(kmli.color)
     186                    sbuf=add(sbuf,sprintf('%s  <color>%s</color>\n',indent,kmli.color));
     187                end
     188                if ~isempty(kmli.colormode)
     189                    sbuf=add(sbuf,sprintf('%s  <colorMode>%s</colorMode>\n',indent,kmli.colormode));
     190                end
     191                if strcmp(class(kml),'kml_colorstyle')
     192                    sbuf=add(sbuf,sprintf('%s</!ColorStyle>\n',indent));
     193                end
     194            end
     195
     196        end
     197       
    162198    end
    163199   
  • issm/trunk/src/m/kml/kml_container.m

    r6480 r7297  
    150150        end
    151151       
     152%  string write the object
     153
     154        function [sbuf]=kml_swrite(kml,sbuf,indent)
     155
     156           if ~exist('sbuf','var') || isempty(sbuf)
     157               sbuf=string_buf;
     158           end
     159           if ~exist('indent','var') || isempty(indent)
     160               indent='';
     161           end
     162
     163%  loop over the containers
     164
     165            for i=1:numel(kml)
     166                kmli=kml(i);
     167                if strcmp(class(kml),'kml_container')
     168                    if ~isempty(kmli.id)
     169                        sbuf=add(sbuf,sprintf('%s<!Container id="%s">\n',indent,kmli.id));
     170                    else
     171                        sbuf=add(sbuf,sprintf('%s<!Container>\n',indent));
     172                    end
     173                end
     174                sbuf=kml_swrite@kml_feature(kmli,sbuf,indent);
     175                if strcmp(class(kml),'kml_container')
     176                    sbuf=add(sbuf,sprintf('%s<!/Container>\n',indent));
     177                end
     178            end
     179
     180        end
     181       
    152182    end
    153183   
  • issm/trunk/src/m/kml/kml_document.m

    r6480 r7297  
    162162        end
    163163       
     164%  string write the object
     165
     166        function [sbuf]=kml_swrite(kml,sbuf,indent)
     167
     168           if ~exist('sbuf','var') || isempty(sbuf)
     169               sbuf=string_buf;
     170           end
     171           if ~exist('indent','var') || isempty(indent)
     172               indent='';
     173           end
     174
     175%  loop over the documents
     176
     177            for i=1:numel(kml)
     178                kmli=kml(i);
     179                if ~isempty(kmli.id)
     180                    sbuf=add(sbuf,sprintf('%s<Document id="%s">\n',indent,kmli.id));
     181                else
     182                    sbuf=add(sbuf,sprintf('%s<Document>\n',indent));
     183                end
     184                sbuf=kml_swrite@kml_container(kmli,sbuf,indent);
     185
     186%  loop over the features for each document
     187
     188                for j=1:numel(kmli.feature)
     189                    if ~isempty(kmli.feature{j})
     190                        if isa(kmli.feature{j},'kml_feature')
     191                            sbuf=kml_swrite(kmli.feature{j},sbuf,[indent '  ']);
     192                        else
     193                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
     194                                i,j,class(kmli.feature{j}),'kml_feature');
     195                        end
     196                    end
     197                end
     198
     199                sbuf=add(sbuf,sprintf('%s</Document>\n',indent));
     200            end
     201
     202        end
     203       
    164204    end
    165205   
  • issm/trunk/src/m/kml/kml_feature.m

    r6480 r7297  
    204204        end
    205205       
     206%  string write the object
     207
     208        function [sbuf]=kml_swrite(kml,sbuf,indent)
     209
     210           if ~exist('sbuf','var') || isempty(sbuf)
     211               sbuf=string_buf;
     212           end
     213           if ~exist('indent','var') || isempty(indent)
     214               indent='';
     215           end
     216
     217%  loop over the features
     218
     219            for i=1:numel(kml)
     220                kmli=kml(i);
     221                if strcmp(class(kml),'kml_feature')
     222                    if ~isempty(kmli.id)
     223                        sbuf=add(sbuf,sprintf('%s<!Feature id="%s">\n',indent,kmli.id));
     224                    else
     225                        sbuf=add(sbuf,sprintf('%s<!Feature>\n',indent));
     226                    end
     227                end
     228                sbuf=kml_swrite@kml_object(kmli,sbuf,indent);
     229                if ~isempty(kmli.name)
     230                    sbuf=add(sbuf,sprintf('%s  <name>%s</name>\n',indent,kmli.name));
     231                end
     232                sbuf=add(sbuf,sprintf('%s  <visibility>%d</visibility>\n',indent,kmli.visibility));
     233                sbuf=add(sbuf,sprintf('%s  <open>%d</open>\n',indent,kmli.open));
     234                if ~isempty(kmli.snippet)
     235                    sbuf=add(sbuf,sprintf('%s  <Snippet maxLines="2">%s</Snippet>\n',indent,kmli.snippet));
     236                end
     237                if ~isempty(kmli.descript)
     238                    sbuf=add(sbuf,sprintf('%s  <description>%s</description>\n',indent,kmli.descript));
     239                end
     240                if ~isempty(kmli.styleurl)
     241                    sbuf=add(sbuf,sprintf('%s  <styleUrl>%s</styleUrl>\n',indent,kmli.styleurl));
     242                end
     243
     244%  loop over the styles for each feature
     245
     246                for j=1:numel(kmli.style)
     247                    if ~isempty(kmli.style{j})
     248                        if isa(kmli.style{j},'kml_styleselector')
     249                            sbuf=kml_swrite(kmli.style{j},sbuf,[indent '  ']);
     250                        else
     251                            warning('kml(%d).style{%d} is a ''%s'' class object, not ''%s''.',...
     252                                i,j,class(kmli.style{j}),'kml_styleselector');
     253                        end
     254                    end
     255                end
     256
     257                if strcmp(class(kml),'kml_feature')
     258                    sbuf=add(sbuf,sprintf('%s<!/Feature>\n',indent));
     259                end
     260            end
     261
     262        end
     263       
    206264    end
    207265   
  • issm/trunk/src/m/kml/kml_folder.m

    r6480 r7297  
    162162        end
    163163       
     164%  string write the object
     165
     166        function [sbuf]=kml_swrite(kml,sbuf,indent)
     167
     168           if ~exist('sbuf','var') || isempty(sbuf)
     169               sbuf=string_buf;
     170           end
     171           if ~exist('indent','var') || isempty(indent)
     172               indent='';
     173           end
     174
     175%  loop over the folders
     176
     177            for i=1:numel(kml)
     178                kmli=kml(i);
     179                if ~isempty(kmli.id)
     180                    sbuf=add(sbuf,sprintf('%s<Folder id="%s">\n',indent,kmli.id));
     181                else
     182                    sbuf=add(sbuf,sprintf('%s<Folder>\n',indent));
     183                end
     184                sbuf=kml_swrite@kml_container(kmli,sbuf,indent);
     185
     186%  loop over the features for each folder
     187
     188                for j=1:numel(kmli.feature)
     189                    if ~isempty(kmli.feature{j})
     190                        if isa(kmli.feature{j},'kml_feature')
     191                            sbuf=kml_swrite(kmli.feature{j},sbuf,[indent '  ']);
     192                        else
     193                            warning('kml(%d).feature{%d} is a ''%s'' class object, not ''%s''.',...
     194                                i,j,class(kmli.feature{j}),'kml_feature');
     195                        end
     196                    end
     197                end
     198
     199                sbuf=add(sbuf,sprintf('%s</Folder>\n',indent));
     200            end
     201
     202        end
     203       
    164204    end
    165205   
  • issm/trunk/src/m/kml/kml_geometry.m

    r6480 r7297  
    143143        end
    144144       
     145%  string write the object
     146
     147        function [sbuf]=kml_swrite(kml,sbuf,indent)
     148
     149           if ~exist('sbuf','var') || isempty(sbuf)
     150               sbuf=string_buf;
     151           end
     152           if ~exist('indent','var') || isempty(indent)
     153               indent='';
     154           end
     155
     156%  loop over the geometries
     157
     158            for i=1:numel(kml)
     159                kmli=kml(i);
     160                if strcmp(class(kml),'kml_geometry')
     161                    if ~isempty(kmli.id)
     162                        sbuf=add(sbuf,sprintf('%s<!Geometry id="%s">\n',indent,kmli.id));
     163                    else
     164                        sbuf=add(sbuf,sprintf('%s<!Geometry>\n',indent));
     165                    end
     166                end
     167                sbuf=kml_swrite@kml_object(kmli,sbuf,indent);
     168                if strcmp(class(kml),'kml_geometry')
     169                    sbuf=add(sbuf,sprintf('%s</!Geometry>\n',indent));
     170                end
     171            end
     172
     173        end
     174       
    145175    end
    146176   
  • issm/trunk/src/m/kml/kml_linearring.m

    r6480 r7297  
    165165        end
    166166       
     167%  string write the object
     168
     169        function [sbuf]=kml_swrite(kml,sbuf,indent)
     170
     171            if ~exist('sbuf','var') || isempty(sbuf)
     172                sbuf=string_buf;
     173            end
     174            if ~exist('indent','var') || isempty(indent)
     175                indent='';
     176            end
     177
     178%  loop over the linearrings
     179
     180            for i=1:numel(kml)
     181                kmli=kml(i);
     182                if ~isempty(kmli.id)
     183                    sbuf=add(sbuf,sprintf('%s<LinearRing id="%s">\n',indent,kmli.id));
     184                else
     185                    sbuf=add(sbuf,sprintf('%s<LinearRing>\n',indent));
     186                end
     187                sbuf=kml_swrite@kml_geometry(kmli,sbuf,indent);
     188                sbuf=add(sbuf,sprintf('%s  <extrude>%d</extrude>\n',indent,kmli.extrude));
     189                sbuf=add(sbuf,sprintf('%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate));
     190                sbuf=add(sbuf,sprintf('%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode));
     191                sbuf=add(sbuf,sprintf('%s  <coordinates>\n',indent));
     192
     193%  loop over the coordinates for each linearring
     194
     195                for j=1:size(kmli.coords,1)
     196                    sbuf=add(sbuf,sprintf('%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:)));
     197                end
     198
     199                sbuf=add(sbuf,sprintf('%s  </coordinates>\n',indent));
     200                sbuf=add(sbuf,sprintf('%s</LinearRing>\n',indent));
     201            end
     202
     203        end
     204       
    167205    end
    168206   
  • issm/trunk/src/m/kml/kml_linestring.m

    r6480 r7297  
    165165        end
    166166       
     167%  string write the object
     168
     169        function [sbuf]=kml_swrite(kml,sbuf,indent)
     170
     171            if ~exist('sbuf','var') || isempty(sbuf)
     172                sbuf=string_buf;
     173            end
     174            if ~exist('indent','var') || isempty(indent)
     175                indent='';
     176            end
     177
     178%  loop over the linestrings
     179
     180            for i=1:numel(kml)
     181                kmli=kml(i);
     182                if ~isempty(kmli.id)
     183                    sbuf=add(sbuf,sprintf('%s<LineString id="%s">\n',indent,kmli.id));
     184                else
     185                    sbuf=add(sbuf,sprintf('%s<LineString>\n',indent));
     186                end
     187                sbuf=kml_swrite@kml_geometry(kmli,sbuf,indent);
     188                sbuf=add(sbuf,sprintf('%s  <extrude>%d</extrude>\n',indent,kmli.extrude));
     189                sbuf=add(sbuf,sprintf('%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate));
     190                sbuf=add(sbuf,sprintf('%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode));
     191                sbuf=add(sbuf,sprintf('%s  <coordinates>\n',indent));
     192
     193%  loop over the coordinates for each linestring
     194
     195                for j=1:size(kmli.coords,1)
     196                    sbuf=add(sbuf,sprintf('%s    %0.16g,%0.16g,%0.16g\n',indent,kmli.coords(j,:)));
     197                end
     198
     199                sbuf=add(sbuf,sprintf('%s  </coordinates>\n',indent));
     200                sbuf=add(sbuf,sprintf('%s</LineString>\n',indent));
     201            end
     202
     203        end
     204       
    167205    end
    168206   
  • issm/trunk/src/m/kml/kml_linestyle.m

    r6480 r7297  
    143143        end
    144144       
     145%  string write the object
     146
     147        function [sbuf]=kml_swrite(kml,sbuf,indent)
     148
     149           if ~exist('sbuf','var') || isempty(sbuf)
     150               sbuf=string_buf;
     151           end
     152           if ~exist('indent','var') || isempty(indent)
     153               indent='';
     154           end
     155
     156%  loop over the linestyles
     157
     158            for i=1:numel(kml)
     159                kmli=kml(i);
     160                if ~isempty(kmli.id)
     161                    sbuf=add(sbuf,sprintf('%s<LineStyle id="%s">\n',indent,kmli.id));
     162                else
     163                    sbuf=add(sbuf,sprintf('%s<LineStyle>\n',indent));
     164                end
     165                sbuf=kml_swrite@kml_colorstyle(kmli,sbuf,indent);
     166                sbuf=add(sbuf,sprintf('%s  <width>%d</width>\n',indent,kmli.width));
     167                sbuf=add(sbuf,sprintf('%s</LineStyle>\n',indent));
     168            end
     169
     170        end
     171       
    145172    end
    146173   
  • issm/trunk/src/m/kml/kml_mesh_write.m

    r7132 r7297  
    241241%%  write kml file
    242242
    243 kml_file_write(kdoc,filek);
    244 
    245 end
    246 
     243% kml_file_write(kdoc,filek);
     244kml_file_swrite(kdoc,filek);
     245
     246end
     247
  • issm/trunk/src/m/kml/kml_multigeometry.m

    r6480 r7297  
    155155        end
    156156       
     157%  string write the object
     158
     159        function [sbuf]=kml_swrite(kml,sbuf,indent)
     160
     161           if ~exist('sbuf','var') || isempty(sbuf)
     162               sbuf=string_buf;
     163           end
     164           if ~exist('indent','var') || isempty(indent)
     165               indent='';
     166           end
     167
     168%  loop over the multigeometry
     169
     170            for i=1:numel(kml)
     171                kmli=kml(i);
     172                if ~isempty(kmli.id)
     173                    sbuf=add(sbuf,sprintf('%s<MultiGeometry id="%s">\n',indent,kmli.id));
     174                else
     175                    sbuf=add(sbuf,sprintf('%s<MultiGeometry>\n',indent));
     176                end
     177                sbuf=kml_swrite@kml_geometry(kmli,sbuf,indent);
     178
     179%  loop over the geometry elements for each multigeometry
     180
     181                for j=1:numel(kmli.geometry)
     182                    kmlij=kmli.geometry{j};
     183                    if ~isempty(kmlij)
     184                        if isa(kmlij,'kml_geometry')
     185                            sbuf=kml_swrite(kmlij,sbuf,[indent '  ']);
     186                        else
     187                            warning('kml(%d).geometry{%d} is a ''%s'' class object, not ''%s''.',...
     188                                i,j,class(kmlij),'kml_geometry');
     189                        end
     190                    end
     191                end
     192
     193                sbuf=add(sbuf,sprintf('%s</MultiGeometry>\n',indent));
     194            end
     195
     196        end
     197       
    157198    end
    158199   
  • issm/trunk/src/m/kml/kml_object.m

    r6480 r7297  
    144144        end
    145145       
     146%  string write the object
     147
     148        function [sbuf]=kml_swrite(kml,sbuf,indent)
     149
     150           if ~exist('sbuf','var') || isempty(sbuf)
     151               sbuf=string_buf;
     152           end
     153           if ~exist('indent','var') || isempty(indent)
     154               indent='';
     155           end
     156
     157%  loop over the objects
     158
     159            for i=1:numel(kml)
     160                kmli=kml(i);
     161                if strcmp(class(kml),'kml_object')
     162                    if ~isempty(kmli.id)
     163                        sbuf=add(sbuf,sprintf('%s<!Object id="%s">\n',indent,kmli.id));
     164                    else
     165                        sbuf=add(sbuf,sprintf('%s<!Object>\n',indent));
     166                    end
     167                end
     168
     169                if strcmp(class(kml),'kml_object')
     170                    sbuf=add(sbuf,sprintf('%s</!Object>\n',indent));
     171                end
     172            end
     173
     174        end
     175       
    146176    end
    147177   
  • issm/trunk/src/m/kml/kml_placemark.m

    r6480 r7297  
    162162        end
    163163       
     164%  string write the object
     165
     166        function [sbuf]=kml_swrite(kml,sbuf,indent)
     167
     168           if ~exist('sbuf','var') || isempty(sbuf)
     169               sbuf=string_buf;
     170           end
     171           if ~exist('indent','var') || isempty(indent)
     172               indent='';
     173           end
     174
     175%  loop over the placemarks
     176
     177            for i=1:numel(kml)
     178                kmli=kml(i);
     179                if ~isempty(kmli.id)
     180                    sbuf=add(sbuf,sprintf('%s<Placemark id="%s">\n',indent,kmli.id));
     181                else
     182                    sbuf=add(sbuf,sprintf('%s<Placemark>\n',indent));
     183                end
     184                sbuf=kml_swrite@kml_feature(kmli,sbuf,indent);
     185
     186%  loop over the geometry elements for each placemark
     187
     188                for j=1:min(1,numel(kmli.geometry))
     189                    kmlij=kmli.geometry(j);
     190                    if ~isempty(kmlij)
     191                        if isa(kmlij,'kml_geometry')
     192                            sbuf=kml_swrite(kmlij,sbuf,[indent '  ']);
     193                        else
     194                            warning('kml(%d).geometry(%d) is a ''%s'' class object, not ''%s''.',...
     195                                i,j,class(kmlij),'kml_geometry');
     196                        end
     197                    end
     198                end
     199
     200                sbuf=add(sbuf,sprintf('%s</Placemark>\n',indent));
     201            end
     202
     203        end
     204       
    164205    end
    165206   
  • issm/trunk/src/m/kml/kml_polygon.m

    r6480 r7297  
    183183        end
    184184       
     185%  string write the object
     186
     187        function [sbuf]=kml_swrite(kml,sbuf,indent)
     188
     189           if ~exist('sbuf','var') || isempty(sbuf)
     190               sbuf=string_buf;
     191           end
     192           if ~exist('indent','var') || isempty(indent)
     193               indent='';
     194           end
     195
     196%  loop over the polygons
     197
     198            for i=1:numel(kml)
     199                kmli=kml(i);
     200                if ~isempty(kmli.id)
     201                    sbuf=add(sbuf,sprintf('%s<Polygon id="%s">\n',indent,kmli.id));
     202                else
     203                    sbuf=add(sbuf,sprintf('%s<Polygon>\n',indent));
     204                end
     205                sbuf=kml_swrite@kml_geometry(kmli,sbuf,indent);
     206                sbuf=add(sbuf,sprintf('%s  <extrude>%d</extrude>\n',indent,kmli.extrude));
     207                sbuf=add(sbuf,sprintf('%s  <tessellate>%d</tessellate>\n',indent,kmli.tessellate));
     208                sbuf=add(sbuf,sprintf('%s  <altitudeMode>%s</altitudeMode>\n',indent,kmli.altmode));
     209                sbuf=add(sbuf,sprintf('%s  <outerBoundaryIs>\n',indent));
     210                if isa(kmli.outer,'kml_linearring')
     211                    sbuf=kml_swrite(kmli.outer,sbuf,[indent '    ']);
     212                else
     213                    warning('kml(%d).outer is a ''%s'' class object, not ''%s''.',...
     214                        i,class(kmli.outer),'kml_linearring');
     215                end
     216                sbuf=add(sbuf,sprintf('%s  </outerBoundaryIs>\n',indent));
     217
     218%  loop over any inner boundaries for each polygon
     219
     220                if isa(kmli.inner,'kml_linearring')
     221                    for j=1:numel(kmli.inner)
     222                        sbuf=add(sbuf,sprintf('%s  <innerBoundaryIs>\n',indent));
     223                        sbuf=kml_swrite(kmli.inner(j),sbuf,[indent '    ']);
     224                        sbuf=add(sbuf,sprintf('%s  </innerBoundaryIs>\n',indent));
     225                    end
     226                else
     227                    warning('kml(%d).inner is a ''%s'' class object, not ''%s''.',...
     228                        i,class(kmli.inner),'kml_linearring');
     229                end
     230
     231                sbuf=add(sbuf,sprintf('%s</Polygon>\n',indent));
     232            end
     233
     234        end
     235       
    185236    end
    186237   
  • issm/trunk/src/m/kml/kml_polystyle.m

    r6480 r7297  
    148148        end
    149149       
     150%  string write the object
     151
     152        function [sbuf]=kml_swrite(kml,sbuf,indent)
     153
     154           if ~exist('sbuf','var') || isempty(sbuf)
     155               sbuf=string_buf;
     156           end
     157           if ~exist('indent','var') || isempty(indent)
     158               indent='';
     159           end
     160
     161%  loop over the polystyles
     162
     163            for i=1:numel(kml)
     164                kmli=kml(i);
     165                if ~isempty(kmli.id)
     166                    sbuf=add(sbuf,sprintf('%s<PolyStyle id="%s">\n',indent,kmli.id));
     167                else
     168                    sbuf=add(sbuf,sprintf('%s<PolyStyle>\n',indent));
     169                end
     170                sbuf=kml_swrite@kml_colorstyle(kmli,sbuf,indent);
     171                sbuf=add(sbuf,sprintf('%s  <fill>%d</fill>\n',indent,kmli.fill));
     172                sbuf=add(sbuf,sprintf('%s  <outline>%d</outline>\n',indent,kmli.outline));
     173                sbuf=add(sbuf,sprintf('%s</PolyStyle>\n',indent));
     174            end
     175
     176        end
     177       
    150178    end
    151179   
  • issm/trunk/src/m/kml/kml_style.m

    r6480 r7297  
    206206        end
    207207       
     208%  string write the object
     209
     210        function [sbuf]=kml_swrite(kml,sbuf,indent)
     211
     212           if ~exist('sbuf','var') || isempty(sbuf)
     213               sbuf=string_buf;
     214           end
     215           if ~exist('indent','var') || isempty(indent)
     216               indent='';
     217           end
     218
     219%  loop over the styles
     220
     221            for i=1:numel(kml)
     222                kmli=kml(i);
     223                if ~isempty(kmli.id)
     224                    sbuf=add(sbuf,sprintf('%s<Style id="%s">\n',indent,kmli.id));
     225                else
     226                    sbuf=add(sbuf,sprintf('%s<Style>\n',indent));
     227                end
     228                sbuf=kml_swrite@kml_styleselector(kmli,sbuf,indent);
     229%                 if isa(kmli.icon,'kml_iconstyle')
     230%                     sbuf=kml_swrite(kmli.icon,sbuf,[indent '  ']);
     231%                 else
     232%                     warning('kml(%d).icon is a ''%s'' class object, not ''%s''.',...
     233%                         i,class(kmli.icon),'kml_iconstyle');
     234%                 end
     235%                 if isa(kmli.label,'kml_labelstyle')
     236%                     sbuf=kml_swrite(kmli.label,sbuf,[indent '  ']);
     237%                 else
     238%                     warning('kml(%d).label is a ''%s'' class object, not ''%s''.',...
     239%                         i,class(kmli.label),'kml_labelstyle');
     240%                 end
     241                if isa(kmli.line,'kml_linestyle')
     242                    sbuf=kml_swrite(kmli.line,sbuf,[indent '  ']);
     243                else
     244                    warning('kml(%d).line is a ''%s'' class object, not ''%s''.',...
     245                        i,class(kmli.line),'kml_linestyle');
     246                end
     247                if isa(kmli.poly,'kml_polystyle')
     248                    sbuf=kml_swrite(kmli.poly,sbuf,[indent '  ']);
     249                else
     250                    warning('kml(%d).poly is a ''%s'' class object, not ''%s''.',...
     251                        i,class(kmli.poly),'kml_polystyle');
     252                end
     253%                 if isa(kmli.balloon,'kml_balloonstyle')
     254%                     sbuf=kml_swrite(kmli.balloon,sbuf,[indent '  ']);
     255%                 else
     256%                     warning('kml(%d).balloon is a ''%s'' class object, not ''%s''.',...
     257%                         i,class(kmli.balloon),'kml_balloonstyle');
     258%                 end
     259%                 if isa(kmli.list,'kml_liststyle')
     260%                     sbuf=kml_swrite(kmli.list,sbuf,[indent '  ']);
     261%                 else
     262%                     warning('kml(%d).list is a ''%s'' class object, not ''%s''.',...
     263%                         i,class(kmli.list),'kml_liststyle');
     264%                 end
     265                sbuf=add(sbuf,sprintf('%s</Style>\n',indent));
     266            end
     267
     268        end
     269       
    208270    end
    209271   
  • issm/trunk/src/m/kml/kml_styleselector.m

    r6480 r7297  
    143143        end
    144144       
     145%  string write the object
     146
     147        function [sbuf]=kml_swrite(kml,sbuf,indent)
     148
     149           if ~exist('sbuf','var') || isempty(sbuf)
     150               sbuf=string_buf;
     151           end
     152           if ~exist('indent','var') || isempty(indent)
     153               indent='';
     154           end
     155
     156%  loop over the styleselectors
     157
     158            for i=1:numel(kml)
     159                kmli=kml(i);
     160                if strcmp(class(kml),'kml_styleselector')
     161                    if ~isempty(kmli.id)
     162                        sbuf=add(sbuf,sprintf('%s<!StyleSelector id="%s">\n',indent,kmli.id));
     163                    else
     164                        sbuf=add(sbuf,sprintf('%s<!StyleSelector>\n',indent));
     165                    end
     166                end
     167                sbuf=kml_swrite@kml_object(kmli,sbuf,indent);
     168                if strcmp(class(kml),'kml_styleselector')
     169                    sbuf=add(sbuf,sprintf('%s</!StyleSelector>\n',indent));
     170                end
     171            end
     172
     173        end
     174       
    145175    end
    146176   
  • issm/trunk/src/m/kml/kml_substyle.m

    r6480 r7297  
    143143        end
    144144       
     145%  string write the object
     146
     147        function [sbuf]=kml_swrite(kml,sbuf,indent)
     148
     149           if ~exist('sbuf','var') || isempty(sbuf)
     150               sbuf=string_buf;
     151           end
     152           if ~exist('indent','var') || isempty(indent)
     153               indent='';
     154           end
     155
     156%  loop over the substyles
     157
     158            for i=1:numel(kml)
     159                kmli=kml(i);
     160                if strcmp(class(kml),'kml_substyle')
     161                    if ~isempty(kmli.id)
     162                        sbuf=add(sbuf,sprintf('%s<!SubStyle id="%s">\n',indent,kmli.id));
     163                    else
     164                        sbuf=add(sbuf,sprintf('%s<!SubStyle>\n',indent));
     165                    end
     166                end
     167                sbuf=kml_swrite@kml_object(kmli,sbuf,indent);
     168                if strcmp(class(kml),'kml_substyle')
     169                    sbuf=add(sbuf,sprintf('%s<!/SubStyle>\n',indent));
     170                end
     171            end
     172
     173        end
     174       
    145175    end
    146176   
  • issm/trunk/src/m/kml/string_buf.m

    r7270 r7297  
    2626%     properties (SetAccess = private, GetAccess = private)
    2727    properties (SetAccess = private)
    28         string    =[];
     28        string    ='';
    2929        size      =0;
    3030        len       =0;
     
    173173        end
    174174       
     175%  reset the object
     176
     177        function [sbuf]=reset(sbuf)
     178
     179            string    ='';
     180            size      =0;
     181            len       =0;
     182
     183        end
     184       
    175185    end
    176186   
Note: See TracChangeset for help on using the changeset viewer.