Changeset 8747


Ignore:
Timestamp:
06/28/11 15:11:08 (14 years ago)
Author:
jschierm
Message:

Exp2Kmlx: Added styles for kml file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp

    r8741 r8747  
    2828
    2929        int     i,j,iret=0;
     30        int     lwidth=1;
     31        double  popac=0.50;
    3032        int     nprof;
    3133        int     *pnvert=NULL;
     
    3739        KML_File*          kfile =NULL;
    3840        KML_Document*      kdoc  =NULL;
     41        KML_Style*         kstyle=NULL;
     42        KML_LineStyle*     klsty =NULL;
     43        KML_PolyStyle*     kpsty =NULL;
    3944        KML_Folder*        kfold =NULL;
    4045        KML_Placemark*     kplace=NULL;
     
    6873        kdoc->open      =1;
    6974
     75/*  construct style templates for defaults  */
     76
     77        klsty =new KML_LineStyle();
     78        sprintf(klsty->color     ,"ff000000");
     79        sprintf(klsty->colormode ,"normal");
     80        klsty->width     =lwidth;
     81        kpsty =new KML_PolyStyle();
     82        sprintf(kpsty->color     ,"%02xffffff",(int)floor(popac*255+0.5));
     83        sprintf(kpsty->colormode ,"random");
     84        kstyle=new KML_Style();
     85        kstyle->AddAttrib("id","BlackLineRandomPoly");
     86        kstyle->line      =klsty;
     87        kstyle->poly      =kpsty;
     88        (kdoc->style     )->AddObject((Object*)kstyle);
     89
     90        klsty =new KML_LineStyle();
     91        sprintf(klsty->color     ,"ff000000");
     92        sprintf(klsty->colormode ,"normal");
     93        klsty->width     ,lwidth;
     94        kpsty =new KML_PolyStyle();
     95        sprintf(kpsty->color     ,"00ffffff");
     96        sprintf(kpsty->colormode ,"random");
     97        kstyle=new KML_Style();
     98        kstyle->AddAttrib("id","BlackLineEmptyPoly");
     99        kstyle->line      =klsty;
     100        kstyle->poly      =kpsty;
     101        (kdoc->style     )->AddObject((Object*)kstyle);
     102
     103        klsty =new KML_LineStyle();
     104        sprintf(klsty->color     ,"%02xffffff",(int)floor(popac*255+0.5));
     105        sprintf(klsty->colormode ,"random");
     106        klsty->width     =lwidth*2;
     107        kpsty =new KML_PolyStyle();
     108        sprintf(kpsty->color     ,"00ffffff");
     109        sprintf(kpsty->colormode ,"random");
     110        kstyle=new KML_Style();
     111        kstyle->AddAttrib("id","RandomLineEmptyPoly");
     112        kstyle->line      =klsty;
     113        kstyle->poly      =kpsty;
     114        (kdoc->style     )->AddObject((Object*)kstyle);
     115
    70116/*  construct kml folder for polygons  */
    71117
     
    86132                sprintf(kplace->name      ,"Polygon with Holes");
    87133                kplace->visibility=true;
     134                sprintf(kplace->styleurl  ,"#BlackLineRandomPoly");
    88135
    89136                kpoly =new KML_Polygon();
     
    147194                                sprintf(kplace->name      ,"Polygon %d",i+1);
    148195                                kplace->visibility=true;
     196                                sprintf(kplace->styleurl  ,"#BlackLineRandomPoly");
    149197
    150198                                kpoly =new KML_Polygon();
     
    175223                                sprintf(kplace->name      ,"LineString %d",i+1);
    176224                                kplace->visibility=true;
     225                                sprintf(kplace->styleurl  ,"#RandomLineEmptyPoly");
    177226
    178227                                kline =new KML_LineString();
Note: See TracChangeset for help on using the changeset viewer.