Ignore:
Timestamp:
11/22/11 12:06:01 (13 years ago)
Author:
jschierm
Message:

KML: Addition of KML_Comment class to save and regurgitate KML comments.

Location:
issm/trunk/src/c/objects/KML
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp

    r10629 r10840  
    2020/*}}}*/
    2121
    22 /*FUNCTION  KMLFileToken(FILE* fid) {{{1*/
    23 char* KMLFileToken(FILE* fid){
     22/*FUNCTION  KMLFileToken(FILE* fid,int* pncom=NULL,char*** ppcom=NULL) {{{1*/
     23char* KMLFileToken(FILE* fid,
     24                                   int* pncom=NULL,char*** ppcom=NULL){
    2425
    2526/*  get the next token (tag or field) in the file  */
     
    5455                                }
    5556                                else {
    56                                         xfree((void**)&bufferc);
     57                                        if (pncom && ppcom) {
     58                                                (*pncom)++;
     59                                                *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
     60                                                (*ppcom)[*pncom-1]=bufferc;
     61                                        }
     62                                        else
     63                                                xfree((void**)&bufferc);
    5764                                        inew=1;
    5865                                        continue;
     
    8390                /*  accumulate field, including newlines  */
    8491                else if (ifield) {
    85                         /*  distinguish between closing tag or comment  */
     92                        /*  distinguish between another tag or comment  */
    8693                        if (c == '<') {
    8794                                ungetc(c,fid);
     
    8996                                        break;
    9097                                else
    91                                         xfree((void**)&bufferc);
     98                                        if (pncom && ppcom) {
     99                                                (*pncom)++;
     100                                                *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
     101                                                (*ppcom)[*pncom-1]=bufferc;
     102                                        }
     103                                        else
     104                                                xfree((void**)&bufferc);
    92105                        }
    93106                        else {
     
    275288/*  get next token and convert to appropriate format  */
    276289
    277         if (!(kstr=KMLFileToken(fid)) ||
     290        if (!(kstr=KMLFileToken(fid,
     291                                                        NULL,NULL)) ||
    278292                (kstr[0] == '<'))
    279293                _error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
     
    285299
    286300        if (ktag)
    287                 if (!(kstr=KMLFileToken(fid)) ||
     301                if (!(kstr=KMLFileToken(fid,
     302                                                                NULL,NULL)) ||
    288303                        (kstr[0] != '<') ||
    289304                        (kstr[1] != '/') ||
     
    309324/*  get next token and convert to appropriate format  */
    310325
    311         if (!(kstr=KMLFileToken(fid)) ||
     326        if (!(kstr=KMLFileToken(fid,
     327                                                        NULL,NULL)) ||
    312328                (kstr[0] == '<'))
    313329                _error_("KMLFileTokenParse -- Missing bool field for %s.\n",ktag);
     
    320336
    321337        if (ktag)
    322                 if (!(kstr=KMLFileToken(fid)) ||
     338                if (!(kstr=KMLFileToken(fid,
     339                                                                NULL,NULL)) ||
    323340                        (kstr[0] != '<') ||
    324341                        (kstr[1] != '/') ||
     
    344361/*  get next token and allocate if necessary  */
    345362
    346         if (!(kstr=KMLFileToken(fid)) ||
     363        if (!(kstr=KMLFileToken(fid,
     364                                                        NULL,NULL)) ||
    347365                (kstr[0] == '<'))
    348366                _error_("KMLFileTokenParse -- Missing string field for %s.\n",ktag);
     
    372390
    373391        if (ktag)
    374                 if (!(kstr=KMLFileToken(fid)) ||
     392                if (!(kstr=KMLFileToken(fid,
     393                                                                NULL,NULL)) ||
    375394                        (kstr[0] != '<') ||
    376395                        (kstr[1] != '/') ||
     
    395414/*  get next token and convert to appropriate format  */
    396415
    397         if (!(kstr=KMLFileToken(fid)) ||
     416        if (!(kstr=KMLFileToken(fid,
     417                                                        NULL,NULL)) ||
    398418                (kstr[0] == '<'))
    399419                _error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
     
    405425
    406426        if (ktag)
    407                 if (!(kstr=KMLFileToken(fid)) ||
     427                if (!(kstr=KMLFileToken(fid,
     428                                                                NULL,NULL)) ||
    408429                        (kstr[0] != '<') ||
    409430                        (kstr[1] != '/') ||
     
    428449/*  get next token and convert to appropriate format  */
    429450
    430         if (!(kstr=KMLFileToken(fid)) ||
     451        if (!(kstr=KMLFileToken(fid,
     452                                                        NULL,NULL)) ||
    431453                (kstr[0] == '<'))
    432454                _error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
     
    438460
    439461        if (ktag)
    440                 if (!(kstr=KMLFileToken(fid)) ||
     462                if (!(kstr=KMLFileToken(fid,
     463                                                                NULL,NULL)) ||
    441464                        (kstr[0] != '<') ||
    442465                        (kstr[1] != '/') ||
     
    464487/*  get next token and allocate if necessary  */
    465488
    466         if (!(kstr=KMLFileToken(fid)) ||
     489        if (!(kstr=KMLFileToken(fid,
     490                                                        NULL,NULL)) ||
    467491                (kstr[0] == '<'))
    468492                _error_("KMLFileTokenParse -- Missing double [m] field for %s.\n",ktag);
     
    495519
    496520        if (ktag)
    497                 if (!(kstr=KMLFileToken(fid)) ||
     521                if (!(kstr=KMLFileToken(fid,
     522                                                                NULL,NULL)) ||
    498523                        (kstr[0] != '<') ||
    499524                        (kstr[1] != '/') ||
     
    523548/*  get next token and allocate if necessary  */
    524549
    525         if (!(kstr=KMLFileToken(fid)) ||
     550        if (!(kstr=KMLFileToken(fid,
     551                                                        NULL,NULL)) ||
    526552                (kstr[0] == '<'))
    527553                _error_("KMLFileTokenParse -- Missing double [m x 3] field for %s.\n",ktag);
     
    561587
    562588        if (ktag)
    563                 if (!(kstr=KMLFileToken(fid)) ||
     589                if (!(kstr=KMLFileToken(fid,
     590                                                                NULL,NULL)) ||
    564591                        (kstr[0] != '<') ||
    565592                        (kstr[1] != '/') ||
     
    590617/*  if next token is a closing tag, compare to input  */
    591618
    592         while (kstr=KMLFileToken(fid)) {
     619        while (kstr=KMLFileToken(fid,
     620                                                         NULL,NULL)) {
    593621                if      ((kstr[0] == '<') &&
    594622                                 (kstr[1] == '/') &&
  • issm/trunk/src/c/objects/KML/KMLFileReadUtils.h

    r10629 r10840  
    1515
    1616/* local prototypes: */
    17 char* KMLFileToken(FILE* fid);
     17char* KMLFileToken(FILE* fid,
     18                                   int* pncom,char*** ppcom);
    1819char* KMLFileTokenComment(FILE* fid);
    1920void KMLFileTokenBuffer(char** pbuffer,int* pibuf,int* pbuflen,
  • issm/trunk/src/c/objects/KML/KML_Document.cpp

    r10629 r10840  
    7878        WriteAttrib(filout," ");
    7979        fprintf(filout,">\n");
     80        WriteCommnt(filout,indent);
    8081
    8182        KML_Container::Write(filout,indent);
     
    9192
    9293        char*        kstri;
     94        int          ncom=0;
     95        char**       pcom=NULL;
    9396
    9497/*  get object attributes and check for solo tag  */
     
    100103/*  loop over and process fields within opening and closing tags  */
    101104
    102         while (kstri=KMLFileToken(fid)) {
     105        while (kstri=KMLFileToken(fid,
     106                                                          &ncom,&pcom)) {
    103107                if      (!strncmp(kstri,"</Document",10)) {
    104108                        xfree((void**)&kstri);
     
    116120        }
    117121
     122        this->AddCommnt(ncom,pcom);
     123
     124        for (ncom; ncom>0; ncom--)
     125                xfree((void**)&(pcom[ncom-1]));
     126        xfree((void**)&pcom);
     127
    118128        return;
    119129}
  • issm/trunk/src/c/objects/KML/KML_File.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Object::Write(filout,indent);
     
    125126
    126127        char*        kstri;
     128        int          ncom=0;
     129        char**       pcom=NULL;
    127130        KML_Object*  kobj;
    128131
     
    135138/*  loop over and process fields within opening and closing tags  */
    136139
    137         while (kstri=KMLFileToken(fid)) {
     140        while (kstri=KMLFileToken(fid,
     141                                                          &ncom,&pcom)) {
    138142                if      (!strncmp(kstri,"</kml", 5)) {
    139143                        xfree((void**)&kstri);
     
    253257        }
    254258
     259        this->AddCommnt(ncom,pcom);
     260
     261        for (ncom; ncom>0; ncom--)
     262                xfree((void**)&(pcom[ncom-1]));
     263        xfree((void**)&pcom);
     264
    255265        return;
    256266}
  • issm/trunk/src/c/objects/KML/KML_Folder.cpp

    r10629 r10840  
    7878        WriteAttrib(filout," ");
    7979        fprintf(filout,">\n");
     80        WriteCommnt(filout,indent);
    8081
    8182        KML_Container::Write(filout,indent);
     
    9192
    9293        char*        kstri;
     94        int          ncom=0;
     95        char**       pcom=NULL;
    9396
    9497/*  get object attributes and check for solo tag  */
     
    100103/*  loop over and process fields within opening and closing tags  */
    101104
    102         while (kstri=KMLFileToken(fid)) {
     105        while (kstri=KMLFileToken(fid,
     106                                                          &ncom,&pcom)) {
    103107                if      (!strncmp(kstri,"</Folder", 8)) {
    104108                        xfree((void**)&kstri);
     
    116120        }
    117121
     122        this->AddCommnt(ncom,pcom);
     123
     124        for (ncom; ncom>0; ncom--)
     125                xfree((void**)&(pcom[ncom-1]));
     126        xfree((void**)&pcom);
     127
    118128        return;
    119129}
  • issm/trunk/src/c/objects/KML/KML_GroundOverlay.cpp

    r10629 r10840  
    102102        WriteAttrib(filout," ");
    103103        fprintf(filout,">\n");
     104        WriteCommnt(filout,indent);
    104105
    105106        KML_Overlay::Write(filout,indent);
     
    124125
    125126        char*        kstri;
     127        int          ncom=0;
     128        char**       pcom=NULL;
    126129
    127130/*  get object attributes and check for solo tag  */
     
    133136/*  loop over and process fields within opening and closing tags  */
    134137
    135         while (kstri=KMLFileToken(fid)) {
     138        while (kstri=KMLFileToken(fid,
     139                                                          &ncom,&pcom)) {
    136140                if      (!strncmp(kstri,"</GroundOverlay",15)) {
    137141                        xfree((void**)&kstri);
     
    162166        }
    163167
     168        this->AddCommnt(ncom,pcom);
     169
     170        for (ncom; ncom>0; ncom--)
     171                xfree((void**)&(pcom[ncom-1]));
     172        xfree((void**)&pcom);
     173
    164174        return;
    165175}
  • issm/trunk/src/c/objects/KML/KML_Icon.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Object::Write(filout,indent);
     
    130131
    131132        char*        kstri;
     133        int          ncom=0;
     134        char**       pcom=NULL;
    132135
    133136/*  get object attributes and check for solo tag  */
     
    139142/*  loop over and process fields within opening and closing tags  */
    140143
    141         while (kstri=KMLFileToken(fid)) {
     144        while (kstri=KMLFileToken(fid,
     145                                                          &ncom,&pcom)) {
    142146                if      (!strncmp(kstri,"</Icon", 6)) {
    143147                        xfree((void**)&kstri);
     
    188192        }
    189193
    190         return;
    191 }
    192 /*}}}*/
    193 
     194        this->AddCommnt(ncom,pcom);
     195
     196        for (ncom; ncom>0; ncom--)
     197                xfree((void**)&(pcom[ncom-1]));
     198        xfree((void**)&pcom);
     199
     200        return;
     201}
     202/*}}}*/
     203
  • issm/trunk/src/c/objects/KML/KML_LatLonBox.cpp

    r10629 r10840  
    9494        WriteAttrib(filout," ");
    9595        fprintf(filout,">\n");
     96        WriteCommnt(filout,indent);
    9697
    9798        KML_Object::Write(filout,indent);
     
    113114
    114115        char*        kstri;
     116        int          ncom=0;
     117        char**       pcom=NULL;
    115118
    116119/*  get object attributes and check for solo tag  */
     
    122125/*  loop over and process fields within opening and closing tags  */
    123126
    124         while (kstri=KMLFileToken(fid)) {
     127        while (kstri=KMLFileToken(fid,
     128                                                          &ncom,&pcom)) {
    125129                if      (!strncmp(kstri,"</LatLonBox",11)) {
    126130                        xfree((void**)&kstri);
     
    159163        }
    160164
     165        this->AddCommnt(ncom,pcom);
     166
     167        for (ncom; ncom>0; ncom--)
     168                xfree((void**)&(pcom[ncom-1]));
     169        xfree((void**)&pcom);
     170
    161171        return;
    162172}
  • issm/trunk/src/c/objects/KML/KML_LineString.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Geometry::Write(filout,indent);
     
    128129
    129130        char*        kstri;
     131        int          ncom=0;
     132        char**       pcom=NULL;
    130133
    131134/*  get object attributes and check for solo tag  */
     
    137140/*  loop over and process fields within opening and closing tags  */
    138141
    139         while (kstri=KMLFileToken(fid)) {
     142        while (kstri=KMLFileToken(fid,
     143                                                          &ncom,&pcom)) {
    140144                if      (!strncmp(kstri,"</LineString",12)) {
    141145                        xfree((void**)&kstri);
     
    170174        }
    171175
     176        this->AddCommnt(ncom,pcom);
     177
     178        for (ncom; ncom>0; ncom--)
     179                xfree((void**)&(pcom[ncom-1]));
     180        xfree((void**)&pcom);
     181
    172182        return;
    173183}
  • issm/trunk/src/c/objects/KML/KML_LineStyle.cpp

    r10629 r10840  
    8383        WriteAttrib(filout," ");
    8484        fprintf(filout,">\n");
     85        WriteCommnt(filout,indent);
    8586
    8687        KML_ColorStyle::Write(filout,indent);
     
    9899
    99100        char*        kstri;
     101        int          ncom=0;
     102        char**       pcom=NULL;
    100103
    101104/*  get object attributes and check for solo tag  */
     
    107110/*  loop over and process fields within opening and closing tags  */
    108111
    109         while (kstri=KMLFileToken(fid)) {
     112        while (kstri=KMLFileToken(fid,
     113                                                          &ncom,&pcom)) {
    110114                if      (!strncmp(kstri,"</LineStyle",11)) {
    111115                        xfree((void**)&kstri);
     
    128132        }
    129133
     134        this->AddCommnt(ncom,pcom);
     135
     136        for (ncom; ncom>0; ncom--)
     137                xfree((void**)&(pcom[ncom-1]));
     138        xfree((void**)&pcom);
     139
    130140        return;
    131141}
  • issm/trunk/src/c/objects/KML/KML_LinearRing.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Geometry::Write(filout,indent);
     
    128129
    129130        char*        kstri;
     131        int          ncom=0;
     132        char**       pcom=NULL;
    130133
    131134/*  get object attributes and check for solo tag  */
     
    137140/*  loop over and process fields within opening and closing tags  */
    138141
    139         while (kstri=KMLFileToken(fid)) {
     142        while (kstri=KMLFileToken(fid,
     143                                                          &ncom,&pcom)) {
    140144                if      (!strncmp(kstri,"</LinearRing",12)) {
    141145                        xfree((void**)&kstri);
     
    169173                xfree((void**)&kstri);
    170174        }
     175
     176        this->AddCommnt(ncom,pcom);
     177
     178        for (ncom; ncom>0; ncom--)
     179                xfree((void**)&(pcom[ncom-1]));
     180        xfree((void**)&pcom);
    171181
    172182        return;
  • issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Geometry::Write(filout,indent);
     
    125126
    126127        char*        kstri;
     128        int          ncom=0;
     129        char**       pcom=NULL;
    127130        KML_Object*  kobj;
    128131
     
    135138/*  loop over and process fields within opening and closing tags  */
    136139
    137         while (kstri=KMLFileToken(fid)) {
     140        while (kstri=KMLFileToken(fid,
     141                                                          &ncom,&pcom)) {
    138142                if      (!strncmp(kstri,"</MultiGeometry",15)) {
    139143                        xfree((void**)&kstri);
     
    181185        }
    182186
     187        this->AddCommnt(ncom,pcom);
     188
     189        for (ncom; ncom>0; ncom--)
     190                xfree((void**)&(pcom[ncom-1]));
     191        xfree((void**)&pcom);
     192
    183193        return;
    184194}
  • issm/trunk/src/c/objects/KML/KML_Object.cpp

    r9761 r10840  
    2525
    2626        attrib    =new DataSet;
     27        commnt    =new DataSet;
    2728
    2829}
     
    3536                attrib    =NULL;
    3637        }
     38        if (commnt) {
     39                delete commnt;
     40                commnt    =NULL;
     41        }
    3742
    3843}
     
    4651
    4752        _printf_(flag,"        attrib: (size=%d)\n" ,attrib->Size());
     53        _printf_(flag,"        commnt: (size=%d)\n" ,commnt->Size());
    4854
    4955        return;
     
    7783                _printf_(flag,"%s        attrib: [empty]\n"    ,indent);
    7884
     85/*  loop over the comments for the object  */
     86
     87        if (commnt->Size())
     88                for (i=0; i<commnt->Size(); i++) {
     89                        ((KML_Comment *)commnt->GetObjectByOffset(i))->DeepEcho(indent);
     90                }
     91        else
     92                _printf_(flag,"%s        commnt: [empty]\n"    ,indent);
     93
    7994        return;
    8095}
     
    85100
    86101//  attributes always written in keyword line of derived classes
     102//  comments always written after keyword line of derived classes
    87103
    88104        ;
     
    158174                *pvalue=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
    159175                memcpy(*pvalue,deflt,(strlen(deflt)+1)*sizeof(char));
    160 
    161176        }
    162177
     
    182197/*}}}*/
    183198
     199/*FUNCTION KML_Object::AddCommnt {{{1*/
     200void  KML_Object::AddCommnt(int ncom,char** pcom){
     201
     202        int   i;
     203        KML_Comment* kcom=NULL;
     204
     205        for (i=0; i<ncom; i++) {
     206                kcom=new KML_Comment();
     207                kcom->Alloc(pcom[i]);
     208                kcom->Add(commnt);
     209        }
     210
     211        return;
     212}
     213/*}}}*/
     214
     215/*FUNCTION KML_Object::AddCommnt {{{1*/
     216void  KML_Object::AddCommnt(char* value){
     217
     218        KML_Comment* kcom=NULL;
     219
     220        kcom=new KML_Comment();
     221        kcom->Alloc(value);
     222        kcom->Add(commnt);
     223
     224        return;
     225}
     226/*}}}*/
     227
     228/*FUNCTION KML_Object::FindCommnt {{{1*/
     229void  KML_Object::FindCommnt(char** pvalue,int inum){
     230
     231        KML_Comment* kcom=NULL;
     232
     233/*  loop over any comments for the object  */
     234
     235        if (inum <= commnt->Size())
     236                kcom=(KML_Comment *)commnt->GetObjectByOffset(inum-1);
     237
     238/*  if found, get the value; otherwise use the NULL  */
     239
     240        if (kcom)
     241                kcom->Get(pvalue);
     242
     243        return;
     244}
     245/*}}}*/
     246
     247/*FUNCTION KML_Object::WriteCommnt {{{1*/
     248void  KML_Object::WriteCommnt(FILE* filout,char* indent){
     249
     250        int   i;
     251
     252//  comments always written after keyword line of kml_object
     253
     254/*  loop over any comments for the object  */
     255
     256        if (commnt->Size())
     257                for (i=0; i<commnt->Size(); i++)
     258                        ((KML_Comment *)commnt->GetObjectByOffset(i))->Write(filout,indent);
     259
     260        return;
     261}
     262/*}}}*/
     263
  • issm/trunk/src/c/objects/KML/KML_Object.h

    r9883 r10840  
    2020
    2121                DataSet* attrib;
     22                DataSet* commnt;
    2223
    2324                /*KML_Object constructors, destructors {{{1*/
     
    4546                virtual void  FindAttrib(char** pvalue,char* name,char* deflt);
    4647                virtual void  WriteAttrib(FILE* fid,char* indent);
     48                virtual void  AddCommnt(int ncom,char** pcom);
     49                virtual void  AddCommnt(char* value);
     50                virtual void  FindCommnt(char** pvalue,int inum);
     51                virtual void  WriteCommnt(FILE* fid,char* indent);
    4752
    4853};
  • issm/trunk/src/c/objects/KML/KML_Placemark.cpp

    r10629 r10840  
    103103        WriteAttrib(filout," ");
    104104        fprintf(filout,">\n");
     105        WriteCommnt(filout,indent);
    105106
    106107        KML_Feature::Write(filout,indent);
     
    125126
    126127        char*        kstri;
     128        int          ncom=0;
     129        char**       pcom=NULL;
    127130        KML_Object*  kobj;
    128131
     
    135138/*  loop over and process fields within opening and closing tags  */
    136139
    137         while (kstri=KMLFileToken(fid)) {
     140        while (kstri=KMLFileToken(fid,
     141                                                          &ncom,&pcom)) {
    138142                if      (!strncmp(kstri,"</Placemark",11)) {
    139143                        xfree((void**)&kstri);
     
    180184                xfree((void**)&kstri);
    181185        }
     186
     187        this->AddCommnt(ncom,pcom);
     188
     189        for (ncom; ncom>0; ncom--)
     190                xfree((void**)&(pcom[ncom-1]));
     191        xfree((void**)&pcom);
    182192
    183193        return;
  • issm/trunk/src/c/objects/KML/KML_Point.cpp

    r10629 r10840  
    9292        WriteAttrib(filout," ");
    9393        fprintf(filout,">\n");
     94        WriteCommnt(filout,indent);
    9495
    9596        KML_Geometry::Write(filout,indent);
     
    111112        double*      pcoords=&coords[0];
    112113        char*        kstri;
     114        int          ncom=0;
     115        char**       pcom=NULL;
    113116
    114117/*  get object attributes and check for solo tag  */
     
    120123/*  loop over and process fields within opening and closing tags  */
    121124
    122         while (kstri=KMLFileToken(fid)) {
     125        while (kstri=KMLFileToken(fid,
     126                                                          &ncom,&pcom)) {
    123127                if      (!strncmp(kstri,"</Point", 7)) {
    124128                        xfree((void**)&kstri);
     
    149153        }
    150154
     155        this->AddCommnt(ncom,pcom);
     156
     157        for (ncom; ncom>0; ncom--)
     158                xfree((void**)&(pcom[ncom-1]));
     159        xfree((void**)&pcom);
     160
    151161        return;
    152162}
  • issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp

    r10629 r10840  
    8686        WriteAttrib(filout," ");
    8787        fprintf(filout,">\n");
     88        WriteCommnt(filout,indent);
    8889
    8990        KML_ColorStyle::Write(filout,indent);
     
    102103
    103104        char*        kstri;
     105        int          ncom=0;
     106        char**       pcom=NULL;
    104107
    105108/*  get object attributes and check for solo tag  */
     
    111114/*  loop over and process fields within opening and closing tags  */
    112115
    113         while (kstri=KMLFileToken(fid)) {
     116        while (kstri=KMLFileToken(fid,
     117                                                          &ncom,&pcom)) {
    114118                if      (!strncmp(kstri,"</PolyStyle",11)) {
    115119                        xfree((void**)&kstri);
     
    136140        }
    137141
     142        this->AddCommnt(ncom,pcom);
     143
     144        for (ncom; ncom>0; ncom--)
     145                xfree((void**)&(pcom[ncom-1]));
     146        xfree((void**)&pcom);
     147
    138148        return;
    139149}
  • issm/trunk/src/c/objects/KML/KML_Polygon.cpp

    r10629 r10840  
    128128        WriteAttrib(filout," ");
    129129        fprintf(filout,">\n");
     130        WriteCommnt(filout,indent);
    130131
    131132        KML_Geometry::Write(filout,indent);
     
    165166        char*        kstri;
    166167        char*        kstrj;
     168        int          ncom=0;
     169        char**       pcom=NULL;
    167170        KML_Object*  kobj;
    168171
     
    175178/*  loop over and process fields within opening and closing tags  */
    176179
    177         while (kstri=KMLFileToken(fid)) {
     180        while (kstri=KMLFileToken(fid,
     181                                                          &ncom,&pcom)) {
    178182                if      (!strncmp(kstri,"</Polygon", 9)) {
    179183                        xfree((void**)&kstri);
     
    202206/*  loop over and process fields within outer boundary  */
    203207
    204                         while (kstrj=KMLFileToken(fid)) {
     208                        while (kstrj=KMLFileToken(fid,
     209                                                                          &ncom,&pcom)) {
    205210                                if      (!strncmp(kstrj,"</outerBoundaryIs",17)) {
    206211                                        xfree((void**)&kstrj);
     
    228233/*  loop over and process fields within inner boundaries  */
    229234
    230                         while (kstrj=KMLFileToken(fid)) {
     235                        while (kstrj=KMLFileToken(fid,
     236                                                                          &ncom,&pcom)) {
    231237                                if      (!strncmp(kstrj,"</innerBoundaryIs",17)) {
    232238                                        xfree((void**)&kstrj);
     
    257263        }
    258264
     265        this->AddCommnt(ncom,pcom);
     266
     267        for (ncom; ncom>0; ncom--)
     268                xfree((void**)&(pcom[ncom-1]));
     269        xfree((void**)&pcom);
     270
    259271        return;
    260272}
  • issm/trunk/src/c/objects/KML/KML_Style.cpp

    r10629 r10840  
    149149        WriteAttrib(filout," ");
    150150        fprintf(filout,">\n");
     151        WriteCommnt(filout,indent);
    151152
    152153        KML_StyleSelector::Write(filout,indent);
     
    179180
    180181        char*        kstri;
     182        int          ncom=0;
     183        char**       pcom=NULL;
    181184
    182185/*  get object attributes and check for solo tag  */
     
    188191/*  loop over and process fields within opening and closing tags  */
    189192
    190         while (kstri=KMLFileToken(fid)) {
     193        while (kstri=KMLFileToken(fid,
     194                                                          &ncom,&pcom)) {
    191195                if      (!strncmp(kstri,"</Style", 7)) {
    192196                        xfree((void**)&kstri);
     
    234238        }
    235239
    236         return;
    237 }
    238 /*}}}*/
    239 
     240        this->AddCommnt(ncom,pcom);
     241
     242        for (ncom; ncom>0; ncom--)
     243                xfree((void**)&(pcom[ncom-1]));
     244        xfree((void**)&pcom);
     245
     246        return;
     247}
     248/*}}}*/
     249
Note: See TracChangeset for help on using the changeset viewer.