|
|
@ -98,8 +98,8 @@ struct gmt_coord: public gmt_struct |
|
|
|
|
|
|
|
|
|
|
|
std::string Value() const |
|
|
|
std::string Value() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!isdeg) return std::to_string(r); |
|
|
|
if(!isdeg) return ToString(r); |
|
|
|
else return (sign?"":"-")+std::to_string(d)+":"+std::to_string(m)+(s==0?"":":"+std::to_string(s)); |
|
|
|
else return (sign?"":"-")+ToString(d)+":"+ToString(m)+(s==0?"":":"+ToString(s)); |
|
|
|
} |
|
|
|
} |
|
|
|
operator double() const |
|
|
|
operator double() const |
|
|
|
{ |
|
|
|
{ |
|
|
@ -254,24 +254,24 @@ struct gmt_projection: public gmt_struct |
|
|
|
std::string ret; |
|
|
|
std::string ret; |
|
|
|
switch(proj) |
|
|
|
switch(proj) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case(XY): {ret="-JX"+std::to_string(width)+"c/"+std::to_string(x.height)+"c"; break;} |
|
|
|
case(XY): {ret="-JX"+ToString(width)+"c/"+ToString(x.height)+"c"; break;} |
|
|
|
case(CYL_EQU): {ret="-JQ"+q.cmer.Value()+"/"+q.stpar.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(CYL_EQU): {ret="-JQ"+q.cmer.Value()+"/"+q.stpar.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(MERCATOR): {ret="-JM"+m.cmer.Value()+"/"+m.stpar.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(MERCATOR): {ret="-JM"+m.cmer.Value()+"/"+m.stpar.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(TRANSMERCATOR): {ret="-JT"+t.cmer.Value()+"/"+t.orlat.Value()+"/"+std::to_string(width)+"c --PROJ_SCALE_FACTOR="+std::to_string(t.scale); break;} |
|
|
|
case(TRANSMERCATOR): {ret="-JT"+t.cmer.Value()+"/"+t.orlat.Value()+"/"+ToString(width)+"c --PROJ_SCALE_FACTOR="+ToString(t.scale); break;} |
|
|
|
case(OBLIQMERCATOR): |
|
|
|
case(OBLIQMERCATOR): |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch(o.type) |
|
|
|
switch(o.type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case(OType::A): {ret="-JOa"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.azimuth.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(OType::A): {ret="-JOa"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.azimuth.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(OType::B): {ret="-JOb"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.eqlon.Value()+"/"+o.eqlat.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(OType::B): {ret="-JOb"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.eqlon.Value()+"/"+o.eqlat.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(OType::C): {ret="-JOb"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.polelon.Value()+"/"+o.polelat.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(OType::C): {ret="-JOb"+o.clon.Value()+"/"+o.clat.Value()+"/"+o.polelon.Value()+"/"+o.polelat.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
default: return ""; |
|
|
|
default: return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case(CASSINI): {ret="-JC"+c.clon.Value()+"/"+c.clat.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(CASSINI): {ret="-JC"+c.clon.Value()+"/"+c.clat.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(CYL_EQA): {ret="-JY"+y.stpar.Value()+"/"+y.cmer.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(CYL_EQA): {ret="-JY"+y.stpar.Value()+"/"+y.cmer.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(MILLER): {ret="-JJ"+j.cmer.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(MILLER): {ret="-JJ"+j.cmer.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
case(CYL_STERE): {ret="-JCyl_stere"+cyl_stere.stpar.Value()+"/"+cyl_stere.cmer.Value()+"/"+std::to_string(width)+"c"; break;} |
|
|
|
case(CYL_STERE): {ret="-JCyl_stere"+cyl_stere.stpar.Value()+"/"+cyl_stere.cmer.Value()+"/"+ToString(width)+"c"; break;} |
|
|
|
default: return ""; |
|
|
|
default: return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
ret+=" "+region.Value(); |
|
|
|
ret+=" "+region.Value(); |
|
|
@ -310,13 +310,13 @@ struct gmt_color: public gmt_struct |
|
|
|
double transparency; |
|
|
|
double transparency; |
|
|
|
std::string Value() const |
|
|
|
std::string Value() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string trans=(transparency!=0)?("@"+std::to_string(transparency)):""; |
|
|
|
std::string trans=(transparency!=0)?("@"+ToString(transparency)):""; |
|
|
|
switch(model) |
|
|
|
switch(model) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case(RGB): return std::to_string(r)+"/"+std::to_string(g)+"/"+std::to_string(b)+trans; |
|
|
|
case(RGB): return ToString(r)+"/"+ToString(g)+"/"+ToString(b)+trans; |
|
|
|
case(GRAY): return std::to_string(gray)+trans; |
|
|
|
case(GRAY): return ToString(gray)+trans; |
|
|
|
case(HSV): return std::to_string(hue)+"-"+std::to_string(saturation)+"-"+std::to_string(value)+trans; |
|
|
|
case(HSV): return ToString(hue)+"-"+ToString(saturation)+"-"+ToString(value)+trans; |
|
|
|
case(CMYK): return std::to_string(cyan)+"/"+std::to_string(magenta)+"/"+std::to_string(yellow)+"/"+std::to_string(black)+trans; |
|
|
|
case(CMYK): return ToString(cyan)+"/"+ToString(magenta)+"/"+ToString(yellow)+"/"+ToString(black)+trans; |
|
|
|
} |
|
|
|
} |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
@ -620,9 +620,9 @@ struct gmt_dash: public gmt_struct |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string ret; |
|
|
|
std::string ret; |
|
|
|
if(dash.empty()) return ret; |
|
|
|
if(dash.empty()) return ret; |
|
|
|
for(auto i:dash) ret+=std::to_string((wisrel?width:1.0)*i/10.0)+"_"; |
|
|
|
for(auto i:dash) ret+=ToString((wisrel?width:1.0)*i/10.0)+"_"; |
|
|
|
ret.back()=':'; |
|
|
|
ret.back()=':'; |
|
|
|
ret+=std::to_string(shift)+"c"; |
|
|
|
ret+=ToString(shift)+"c"; |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
operator bool() const {return !dash.empty();} |
|
|
|
operator bool() const {return !dash.empty();} |
|
|
@ -679,7 +679,7 @@ struct gmt_pen: public gmt_struct |
|
|
|
struct gmt_color color; |
|
|
|
struct gmt_color color; |
|
|
|
struct gmt_dash dash; |
|
|
|
struct gmt_dash dash; |
|
|
|
static const double default_width; |
|
|
|
static const double default_width; |
|
|
|
std::string Value() const {return std::to_string(width/10.0)+"c,"+color.Value()+(dash?(","+dash.Value()):"");} |
|
|
|
std::string Value() const {return ToString(width/10.0)+"c,"+color.Value()+(dash?(","+dash.Value()):"");} |
|
|
|
|
|
|
|
|
|
|
|
// Interpret one numeric argument as width value
|
|
|
|
// Interpret one numeric argument as width value
|
|
|
|
bool Convert(double in) |
|
|
|
bool Convert(double in) |
|
|
|