Ignore:
Timestamp:
06/01/11 09:13:35 (14 years ago)
Author:
jschierm
Message:

KML: Addition of KMLFileRead module and KML_Attribute class, along with many other changes during freeze.

File:
1 edited

Legend:

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

    r8293 r8461  
    8181        if (geometry->Size())
    8282                for (i=0; i<geometry->Size(); i++) {
    83                         _printf_(flag,"%s      geometry: [%d] begin\n" ,indent,i);
     83                        _printf_(flag,"%s      geometry: -------- begin [%d] --------\n" ,indent,i);
    8484                        ((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2);
    85                         _printf_(flag,"%s      geometry: [%d] end\n"  ,indent,i);
     85                        _printf_(flag,"%s      geometry: --------  end  [%d] --------\n" ,indent,i);
    8686                }
    8787        else
     
    9898        char  indent2[81];
    9999
    100         if (this->id && strlen(this->id))
    101                 fprintf(filout,"%s<MultiGeometry id=\"%s\">\n",indent,this->id);
    102         else
    103                 fprintf(filout,"%s<MultiGeometry>\n",indent);
     100        fprintf(filout,"%s<MultiGeometry",indent);
     101        WriteAttrib(filout," ");
     102        fprintf(filout,">\n");
    104103
    105104        KML_Geometry::Write(filout,indent);
     
    122121void  KML_MultiGeometry::Read(FILE* fid,char* kstr){
    123122
     123        char*        kstri;
     124        KML_Object*  kobj;
     125
     126/*  get object attributes  */
     127
     128        KMLFileTagAttrib(this,
     129                                         kstr);
     130
     131/*  loop over and process fields within opening and closing tags  */
     132
     133        while (kstri=KMLFileToken(fid)) {
     134                if      (!strncmp(kstri,"</MultiGeometry",15)) {
     135                        xfree((void**)&kstri);
     136                        break;
     137                }
     138                else if (!strncmp(kstri,"</",2))
     139                        _error_("KML_MultiGeometry::Read -- Unexpected closing tag %s.\n",kstri);
     140                else if (strncmp(kstri,"<",1))
     141                        _error_("KML_MultiGeometry::Read -- Unexpected field \"%s\".\n",kstri);
     142
     143//              else if (!strncmp(kstri,"<Point", 6)) {
     144//                      kobj=(KML_Object*)new KML_Point();
     145//                      kobj->Read(fid,kstri);
     146//                      geometry  ->AddObject((Object*)kobj);
     147//              }
     148
     149                else if (!strncmp(kstri,"<LineString",11)) {
     150                        kobj=(KML_Object*)new KML_LineString();
     151                        kobj->Read(fid,kstri);
     152                        geometry  ->AddObject((Object*)kobj);
     153                }
     154
     155                else if (!strncmp(kstri,"<LinearRing",11)) {
     156                        kobj=(KML_Object*)new KML_LinearRing();
     157                        kobj->Read(fid,kstri);
     158                        geometry  ->AddObject((Object*)kobj);
     159                }
     160
     161                else if (!strncmp(kstri,"<Polygon", 8)) {
     162                        kobj=(KML_Object*)new KML_Polygon();
     163                        kobj->Read(fid,kstri);
     164                        geometry  ->AddObject((Object*)kobj);
     165                }
     166
     167                else if (!strncmp(kstri,"<MultiGeometry",14)) {
     168                        kobj=(KML_Object*)new KML_MultiGeometry();
     169                        kobj->Read(fid,kstri);
     170                        geometry  ->AddObject((Object*)kobj);
     171                }
     172
     173                else if (!strncmp(kstri,"<",1))
     174                        KML_Geometry::Read(fid,kstri);
     175
     176                xfree((void**)&kstri);
     177        }
    124178
    125179        return;
Note: See TracChangeset for help on using the changeset viewer.