From 41445f00ca72670febb506b485c3df216ee55cd6 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 9 Nov 2018 14:13:01 +0100 Subject: [PATCH] model listing --- classes.cpp | 30 ++++++++++++++++++++++++++++++ classes.h | 41 +++++++++++++++++++++++++++++++++++++++++ conformal.cpp | 28 ++++++++++------------------ hyper.h | 9 --------- 4 files changed, 81 insertions(+), 27 deletions(-) diff --git a/classes.cpp b/classes.cpp index 11822baa..36e12356 100644 --- a/classes.cpp +++ b/classes.cpp @@ -1684,4 +1684,34 @@ geometryinfo ginf[gGUARD] = { {"Archimedean", "A", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::pure} }; +#define X3(x) x, x, x + +const modelinfo models[int(mdPolynomial)+1] = { + {X3("disk"), mf::azimuthal | mf::conformal}, + {"half-plane", "inversion", "half-plane", mf::conformal}, + {"band", "band", "Mercator", mf::band | mf::conformal}, + {X3("polygonal"), mf::conformal}, + {X3("formula"), 0}, + {X3("azimuthal equidistant"), mf::azimuthal | mf::equidistant | mf::euc_boring}, + {X3("azimuthal equi-area"), mf::azimuthal | mf::equiarea | mf::euc_boring}, + {X3("ball model"), mf::conformal | mf::azimuthal | mf::space}, + {"Minkowski hyperboloid", "plane", "sphere", mf::conformal | mf::space | mf::euc_boring}, + {"hemisphere", "sphere", "sphere", mf::conformal | mf::space}, + {X3("band equidistant"), mf::band | mf::equidistant | mf::euc_boring}, + {X3("band equi-area"), mf::band | mf::equiarea | mf::euc_boring}, + {X3("sinusoidal"), mf::quasiband | mf::equiarea | mf::euc_boring}, + {X3("two-point equidistant"), mf::equidistant | mf::euc_boring}, + {X3("fisheye"), 0}, + {X3("Joukowsky transform"), mf::hyper_only | mf::conformal}, + {X3("Joukowsky+inversion"), mf::hyper_only | mf::conformal}, + {X3("rotated hyperboles"), mf::hyper_only}, + {X3("spiral"), mf::hyper_or_torus | mf::quasiband}, + {X3(""), 0}, + {X3(""), 0}, + {X3(""), 0}, + {X3("polynomial"), mf::conformal} + }; + +#undef X3 + } diff --git a/classes.h b/classes.h index a5ce2aa0..04cf9fdd 100644 --- a/classes.h +++ b/classes.h @@ -247,4 +247,45 @@ enum cpatterntype { struct landtacinfo { eLand l; int tries, multiplier; }; +enum eModel { + mdDisk, mdHalfplane, mdBand, mdPolygonal, mdFormula, + mdEquidistant, mdEquiarea, mdBall, mdHyperboloid, + mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint, + mdFisheye, mdJoukowsky, mdJoukowskyInverted, + mdRotatedHyperboles, mdSpiral, + mdGUARD, mdUnchanged, mdHyperboloidFlat, mdPolynomial + }; + +typedef unsigned long long flagtype; + +namespace mf { + static const flagtype azimuthal = 1; + static const flagtype band = 2 + 512; + static const flagtype equiarea = 4; + static const flagtype equidistant = 8; + static const flagtype conformal = 16; + static const flagtype euc_boring = 32; + static const flagtype space = 64; + static const flagtype hyper_only = 128; + static const flagtype hyper_or_torus = 256; + static const flagtype quasiband = 512; + }; + +struct modelinfo { + const char *name_hyperbolic; + const char *name_euclidean; + const char *name_spherical; + + flagtype flags; + + int is_azimuthal; + int is_band; + int is_equiarea; + int is_equidistant; + int is_conformal; + const char* name; + }; + +extern const modelinfo models[int(mdPolynomial)+1]; + } diff --git a/conformal.cpp b/conformal.cpp index 712a1299..c687a7f8 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -556,24 +556,6 @@ namespace conformal { } #endif - const char *modelnames[MODELCOUNT] = { - "disk", "half-plane", "band", "polygonal", "formula", - "azimuthal equidistant", "azimuthal equi-area", - "ball model", "Minkowski hyperboloid", "hemisphere", - "band equidistant", "band equi-area", "sinusoidal", "two-point equidistant", - "fisheye", "Joukowsky transform", "Joukowsky+inversion", "rotated hyperboles" - }; - - string get_model_name(eModel pm) { - return XLAT( - pm == mdBand && sphere ? "Mercator" : - pm == mdHalfplane && euclid ? "inversion" : - pm == mdHemisphere && !hyperbolic ? "sphere" : - pm == mdHyperboloid && euclid ? "plane" : - pm == mdHyperboloid && sphere ? "sphere" : - modelnames[pm]); - } - bool model_available(eModel pm) { if(sphere && (pm == mdHalfplane || pm == mdBall)) return false; @@ -590,6 +572,16 @@ namespace conformal { } int editpos = 0; + + string get_model_name(eModel m) { + if(sphere) + return models[m].name_spherical; + if(euclid) + return models[m].name_euclidean; + if(hyperbolic) + return models[m].name_hyperbolic; + return "?"; + } void model_menu() { cmode = sm::SIDE | sm::MAYDARK | sm::CENTER; diff --git a/hyper.h b/hyper.h index 9273bff6..8c7bff02 100644 --- a/hyper.h +++ b/hyper.h @@ -1270,15 +1270,6 @@ extern ld ruggo; #define HASLINEVIEW -enum eModel { - mdDisk, mdHalfplane, mdBand, mdPolygonal, mdFormula, - mdEquidistant, mdEquiarea, mdBall, mdHyperboloid, - mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint, - mdFisheye, mdJoukowsky, mdJoukowskyInverted, - mdRotatedHyperboles, - mdGUARD, mdUnchanged, mdHyperboloidFlat, mdPolynomial - }; - namespace conformal { extern bool on; extern vector > killhistory;