- sclkart.cpt ©
[..] La conception [cpt] lls_gdhoscl
Code
int lls_gdho_cpt(){
int ierr = -1;
char *sfps = ∅;
char *stafile =∅, *stafilepath = ∅;
double **stax, **stay; int cgn;
void **sta = ∅;
int *stn=∅;
int cgi, sti, std, stf, stk;
int cregion, dregion;
int **region = ∅;
tab_t vstax, vstay;
size_t sode;
tab_t vstn;
double *qt;
int cgx;
int lonn, loni, latn, lati;
double eps;
double reglon[12]; int hemisphere[12];
double **regx =∅, **regy =∅;
int **regi = ∅;
int *mn = ∅;
char *linespec=∅, *imgname=∅, *imgpath=∅, *title=∅;
scltracefa(§, ƒ, ∅);
scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), scltemps(0));
//std::string sfps = std::string(/*1, */sclfps());
sfps = sclfps();
/*std::string stafile = "terremergee.sta";*/
stafile = newchar(0, "terremergee.sta");
/*std::string stafilepath = std::string(sclrep()) + sfps + "map" + sfps + stafile;*/
strstag(&stafilepath, sclrep(), sfps, /*"map"*/"kart", sfps, stafile, ∅);
/*finfo_sta(stafilepath);*/ //🔬
// Geographic polygon is loaded
sta = fscan_sta(stafilepath, &cgn);
// In case of loading error
if (sta==∅) {
scltracerr(§, ƒ, ∅, "fscan_sta() error!\n");
scltracefe(§, ƒ, ∅);
return ierr;
} ierr--;
scltracefc("cgn : %d\n", cgn);
stn=(int*)sta[0]; stax=(double**)sta[1]; stay=(double**)sta[2];
// Coverage polygon number
//cout << "Coverage polygon number=" << cgn << endl; //🔬
region = (int**)malloc(cgn*sizeof(int*));
/*std::vector<double*> vstax, vstay;*/
sode = sizeof(double*);
/*vstax.sot=sode; vstax.taba=NULL; vstax.tab=NULL;
vstax.tabm=NULL; vstax.tabe=NULL;*/
initab_t(&vstax, sode);
/*vstay.sot=sode; vstay.taba=NULL; vstay.tab=NULL;
vstay.tabm=NULL; vstay.tabe=NULL;*/
initab_t(&vstay, sode);
/*std::vector<int> vstn;*/
int soi = sizeof(int);
/*vstn.sot=soi; vstn.taba=NULL; vstn.tab=NULL;
vstn.tabm=NULL; vstn.tabe=NULL;*/
initab_t(&vstn, soi);
/*double coslon, sinlon*/;
for(cgi=0;cgi<cgn;cgi++){
/*stn = (int)stax[cgi].size(); */ std=0; stf=0;
deg_rad(stn[cgi], stax[cgi], stax[cgi]);
deg_rad(stn[cgi], stay[cgi], stay[cgi]);
region[cgi] = (int*)malloc(stn[cgi]*sizeof(int));
lls_gdho(stn[cgi], stax[cgi], stay[cgi], stax[cgi], stay[cgi], region[cgi]);
cregion = region[cgi][0];
for(sti=1;sti<stn[cgi];sti++){
dregion = region[cgi][sti];
// On ne doit pas afficher un segment dont les extremites sont dans
// des regions differentes
if(dregion!=cregion){
stk=stf-std+1;
if (stk>1){
/*vstax.push_back(&stax[cgi][std]);*/
qt = &stax[cgi][std];
queuetab(vstax.sot, &vstax.taba, &vstax.tab,
&vstax.tabm, &vstax.tabe, &qt);
/*vstay.push_back(&stay[cgi][std]);*/
qt = &stay[cgi][std];
queuetab(vstay.sot, &vstay.taba, &vstay.tab,
&vstay.tabm, &vstay.tabe, &qt);
/*vstn.push_back(stk);*/
queuetab(vstn.sot, &vstn.taba, &vstn.tab,
&vstn.tabm, &vstn.tabe, &stk);
}
std=sti+1;
}
else{ stf=sti; }
cregion = dregion;
}
// Derniere courbe a ajouter
stk=stf-std+1;
if (stk>1){
/*vstax.push_back(&stax[cgi][std]);*/
qt = &stax[cgi][std];
queuetab(vstax.sot, &vstax.taba, &vstax.tab,
&vstax.tabm, &vstax.tabe, &qt);
/*vstay.push_back(&stay[cgi][std]);*/
qt = &stay[cgi][std];
queuetab(vstay.sot, &vstay.taba, &vstay.tab,
&vstay.tabm, &vstay.tabe, &qt);
/*vstn.push_back(stk);*/
queuetab(vstn.sot, &vstn.taba, &vstn.tab,
&vstn.tabm, &vstn.tabe, &stk);
}
}
cgx = (int)((vstn.tabm-vstn.tab)/vstn.sot + 1);
scltracefc("cgx : %d\n", /*vstn.size()*/cgx);
lonn=12; latn=101;
scltracefc("lonn : %d\n", lonn);
eps = scleps();
//---------------------------------------------------------------------
// Limite de region
reglon[ 0] = 100/180*π; /* 100.0 [deg]*/ hemisphere[ 0]=1; // nord
reglon[ 1] = 100/180*π+eps; /* 100.0 [deg]*/ hemisphere[ 1]=1;
reglon[ 2] = -100/180*π-eps; /*-100.0 [deg]*/ hemisphere[ 2]=1;
reglon[ 3] = -100/180*π+eps; /*-100.0 [deg]*/ hemisphere[ 3]=1;
reglon[ 4] = 20/180*π-eps; /* 20.0 [deg]*/ hemisphere[ 4]=1;
reglon[ 5] = 20/180*π+eps; /* 20.0 [deg]*/ hemisphere[ 5]=1;
reglon[ 6] = 20/180*π-eps; /* 20.0 [deg]*/ hemisphere[ 6]=0; // sud
reglon[ 7] = 20/180*π+eps; /* 20.0 [deg]*/ hemisphere[ 7]=0;
reglon[ 8] = 140/180*π-eps; /* 140.0 [deg]*/ hemisphere[ 8]=0;
reglon[ 9] = 140/180*π+eps; /* 140.0 [deg]*/ hemisphere[ 9]=0;
reglon[10] = - 60/180*π-eps; /*- 60.0 [deg]*/ hemisphere[10]=0;
reglon[11] = - 60/180*π+eps; /*- 60.0 [deg]*/ hemisphere[11]=0;
//---------------------------------------------------------------------
regx = (double**)newmat(sizeof(double),lonn, latn);
regy = (double**)newmat(sizeof(double),lonn, latn);
regi = (int**)newmat(sizeof(int),lonn, latn);
/*int *mn = newtab<int>(lonn, latn);*/
mn = (int*)malloc(lonn*sizeof(int));
for(loni=0;loni<lonn;loni++){ mn[loni]=latn; }
for(loni=0;loni<lonn;loni++){
/*inittab<double>(latn, reglon[loni], regx[loni]);*/
for(lati=0;lati<latn;lati++){ regx[loni][lati]=reglon[loni]; }
if(hemisphere[loni]>0){ newtablin(latn, 0, π/2, regy[loni]); }
else{ newtablin(latn, -π/2, 0, regy[loni]); }
lls_gdho(latn, regx[loni], regy[loni], regx[loni], regy[loni], regi[loni]);
}
/*std::string linespec="-"; for(cgi=1;cgi<(int)vstn.size();cgi++){ linespec+=";-"; }*/
linespec=newchar(0,"-");
for(cgi=1;cgi<cgx;cgi++){ strstag(&linespec, linespec, ";-", ∅); }
for(loni=0;loni<lonn;loni++){
/*linespec+=";-p";*/
strstag(&linespec, linespec, ";-p", ∅);
}
//---------------------------------------------------------------------
//[>PLOT]
//---------------------------------------------------------------------
/*scl::string_c imgname=scl::string_c(__FUNCTION__)+ ".svg",
imgpath="./srt/"+imgname;*/
strstag(&imgname, ƒ, ".svg", ∅);
strstag(&imgpath, "./srt/", imgname, ∅);
/*scl::string_c title = "Projection homolosine de Goode (version oc\x9A\x61nique)";*/
title = newchar(0, "Projection homolosine de Goode (version océanique)");
DVR_SCL_QUOU;
graf_dis(imgpath, 0, ∅, ∅,
"curvex", /*(int)vstn.size()*/cgx, (int*)vstn.tab, (double**)vstax.tab, (double**)vstay.tab,
"curvex", lonn, mn, regx, regy,
/*"title", title.c_str(),*/ "subtitlex", title,
"linespec", linespec, "axis", "equal",
"axis", "off", "linespeca","-a", ∅);
DVR_SCL_QUOU;
// Format *.pdf pour generer un *.png propre avec ImageMagick
strstag(&imgname, ƒ, ".pdf", ∅);
strstag(&imgpath, "./srt/", imgname, ∅);
graf_dis(imgpath, 0, ∅, ∅,
"curvex", /*(int)vstn.size()*/cgx, vstn.tab, vstax.tab, vstay.tab,
"curvex", lonn, mn, regx, regy,
/*"title", title.c_str(),*/ "subtitlex", title,
"linespec", linespec, "axis", "equal",
"axis", "off", "linespeca","-a", ∅);
//---------------------------------------------------------------------
//[<PLOT]
//---------------------------------------------------------------------
DVR_SCL_QUOU;
//---------------------------------------------------------------------
//[>LIBERE MEMOIRE]
//---------------------------------------------------------------------
free(imgname); imgname=∅; free(imgpath); imgpath=∅;
free(title); title=∅;
//---------------------------------------------------------------------
//[<LIBERE MEMOIRE]
//---------------------------------------------------------------------
scltracefe(§, ƒ, ∅);
return 0;
}
/* ƒ décorée par
le 27-03-2025 20:28:50 */
Sortie
[>..\cpt\src\sclkart.cpt.c.lls_gdho_cpt]
scl-25.03 (gwin64) : 2025-03-24 23:14:17
cgn : 576
cgx : 662
lonn : 12
[<..\cpt\src\sclkart.cpt.c.lls_gdho_cpt>] ligne 2518
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 27.03.2025 Time : 20:28:50 Pageformat: DA4L <<
<< Vectors : 22879 Warnings: 0 Fileformat: SVG <<
<< Metafile: ./srt/lls_gdho_cpt.svg <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\cpt\src\sclkart.cpt.c.lls_gdho_cpt>] ligne 2528
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 27.03.2025 Time : 20:28:50 Pageformat: DA4L <<
<< Vectors : 22879 Warnings: 0 Fileformat: PDF <<
<< Metafile: ./srt/lls_gdho_cpt.pdf <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\cpt\src\sclkart.cpt.c.lls_gdho_cpt>] ligne 2543
[<..\cpt\src\sclkart.cpt.c.lls_gdho_cpt]