You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.3 KiB

#include "modgmt_objects.h"
template<> const std::string ObjectGMTCoord::type="GMTCoord";
template<> const std::string ObjectGMTRegion::type="GMTRegion";
template<> const std::string ObjectGMTProjection::type="GMTProjection";
template<> const std::string ObjectGMTColor::type="GMTColor";
template<> const std::string ObjectGMTDash::type="GMTDash";
template<> const std::string ObjectGMTPen::type="GMTPen";
template<> const std::string ObjectGMTFont::type="GMTFont";
template<> const std::string ObjectGMTLayer::type="GMTLayer";
template<> const int8_t* ObjectGMTLayer::Blob(size_t* size) const
{
if(s.Shifted())
{
std::string b=s.BeginShift();
std::string e=s.EndShift();
int8_t* p=new int8_t[b.size()+s.data->size()+e.size()];
memcpy(p,b.data(),b.size());
memcpy(p+b.size(),s.data->data(),s.data->size());
memcpy(p+b.size()+s.data->size(),e.data(),e.size());
return p;
}
else
{
*size=s.data->size();
return reinterpret_cast<const int8_t*>(s.data->data());
}
}
template<> void ObjectGMTLayer::DeallocBlob(const int8_t* ptr) const
{
if(s.Shifted()) delete[] ptr;
}
std::map<std::string,gmt_projection::projection> gmt_projection::projnames;
void gmt_projection::FillProjNames()
{
projnames["(xy|decart)"]=XY;
projnames["c[ylindrical][( |_)]equidistant"]=CYL_EQU;
projnames["mercator"]=MERCATOR;
projnames["t[ransverse][( |_)]mercator"]=TRANSMERCATOR;
projnames["o[blique][( |_)]mercator"]=OBLIQMERCATOR;
projnames["cassini"]=CASSINI;
projnames["c[ylindrical][( |_)]eq[ua(l|l-)]area"]=CYL_EQA;
projnames["[c[ylindrical][( |_)]]miller"]=MILLER;
projnames["c[ylindrical][( |_)]stereographic"]=CYL_STERE;
}
bool gmt_font::FillFontNames()
{
families.insert("Helvetica");
families.insert("Helvetica-Bold");
families.insert("Helvetica-Oblique");
families.insert("Helvetica-BoldOblique");
families.insert("Times-Roman");
families.insert("Times-Bold");
families.insert("Times-Italic");
families.insert("Times-BoldItalic");
families.insert("Courier");
families.insert("Courier-Bold");
families.insert("Courier-Oblique");
families.insert("Courier-BoldOblique");
families.insert("Symbol");
families.insert("AvantGarde-Book");
families.insert("AvantGarde-BookOblique");
families.insert("AvantGarde-Demi");
families.insert("AvantGarde-DemiOblique");
families.insert("Bookman-Demi");
families.insert("Bookman-DemiItalic");
families.insert("Bookman-Light");
families.insert("Bookman-LightItalic");
families.insert("Helvetica-Narrow");
families.insert("Helvetica-Narrow-Bold");
families.insert("Helvetica-Narrow-Oblique");
families.insert("Helvetica-Narrow-BoldOblique");
families.insert("NewCenturySchlbk-Roman");
families.insert("NewCenturySchlbk-Italic");
families.insert("NewCenturySchlbk-Bold");
families.insert("NewCenturySchlbk-BoldItalic");
families.insert("Palatino-Roman");
families.insert("Palatino-Italic");
families.insert("Palatino-Bold");
families.insert("Palatino-BoldItalic");
families.insert("ZapfChancery-MediumItalic");
families.insert("ZapfDingbats");
default_family="Times-Roman";
return true;
}
const double gmt_projection::default_width=10.0;
const double gmt_pen::default_width=1.0;
const double gmt_dash::default_width=gmt_pen::default_width;
const double gmt_font::default_size=12.0;
std::string gmt_font::default_family;
std::set<std::string> gmt_font::families;