Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,6 +23,7 @@ namespace tools {
|
||||
|
||||
class args {
|
||||
#ifdef TOOLS_MEM
|
||||
public:
|
||||
TOOLS_SCLASS(tools::args)
|
||||
#endif
|
||||
public:
|
||||
|
||||
@@ -25,9 +25,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
bool set_is_log(bool a_v) {if(m_is_log==a_v) return false;m_is_log = a_v;return true;}
|
||||
bool set_min_value(float a_v) {if(m_min_value==a_v) return false;m_min_value = a_v;return true;}
|
||||
bool set_max_value(float a_v) {if(m_max_value==a_v) return false;m_max_value = a_v;return true;}
|
||||
#ifdef tools_data_axis //g4tools backcomp :
|
||||
bool is_log(bool a_v) {if(m_is_log==a_v) return false;m_is_log = a_v;return true;}
|
||||
bool min_value(float a_v) {if(m_min_value==a_v) return false;m_min_value = a_v;return true;}
|
||||
bool max_value(float a_v) {if(m_max_value==a_v) return false;m_max_value = a_v;return true;}
|
||||
#endif
|
||||
float min_value() const {return m_min_value;}
|
||||
float max_value() const {return m_max_value;}
|
||||
bool is_log() const {return m_is_log;}
|
||||
|
||||
@@ -42,6 +42,7 @@ TOOLS_GLOBAL_STRING(format_lua)
|
||||
TOOLS_GLOBAL_STRING(format_py)
|
||||
TOOLS_GLOBAL_STRING(format_kumac)
|
||||
TOOLS_GLOBAL_STRING(format_insh)
|
||||
TOOLS_GLOBAL_STRING(format_shp)
|
||||
|
||||
#define TOOLS_GLOBAL_EXT(a_name)\
|
||||
inline const std::string& s_ext_##a_name() {\
|
||||
@@ -81,6 +82,7 @@ TOOLS_GLOBAL_EXT(lua)
|
||||
TOOLS_GLOBAL_EXT(py)
|
||||
TOOLS_GLOBAL_EXT(kumac)
|
||||
TOOLS_GLOBAL_EXT(insh)
|
||||
TOOLS_GLOBAL_EXT(shp)
|
||||
|
||||
#undef TOOLS_GLOBAL_EXT
|
||||
|
||||
@@ -116,6 +118,7 @@ inline void formats(std::vector<std::string>& a_v) {
|
||||
a_v.push_back(s_format_py());
|
||||
a_v.push_back(s_format_kumac());
|
||||
a_v.push_back(s_format_insh());
|
||||
a_v.push_back(s_format_shp());
|
||||
}
|
||||
|
||||
inline std::string ext_fmt(const std::string& a_ext) {
|
||||
@@ -151,6 +154,7 @@ inline std::string ext_fmt(const std::string& a_ext) {
|
||||
if(a_ext==s_ext_py()) return s_format_py();
|
||||
if(a_ext==s_ext_kumac()) return s_format_kumac();
|
||||
if(a_ext==s_ext_insh()) return s_format_insh();
|
||||
if(a_ext==s_ext_shp()) return s_format_shp();
|
||||
return s_format_guessed();
|
||||
}
|
||||
|
||||
@@ -185,6 +189,7 @@ inline bool need_placement(const std::string& a_format) {
|
||||
//if(a_format==s_format_py()) return true;
|
||||
//if(a_format==s_format_kumac()) return true;
|
||||
//if(a_format==s_format_insh()) return true;
|
||||
//if(a_format==s_format_shp()) return true; //load in dynamic_sg.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -319,4 +319,26 @@ inline bool is_heprep(const std::string& a_file,bool& a_is){
|
||||
|
||||
}}
|
||||
|
||||
#include <climits>
|
||||
|
||||
namespace tools {
|
||||
namespace file {
|
||||
|
||||
inline bool is_shp(const std::string& a_file,bool& a_is){
|
||||
long sz;
|
||||
if(!size(a_file,sz)) {a_is = false;return false;}
|
||||
// below logic from shapelib-1.5.0/shpopen.c.
|
||||
unsigned char head[100];
|
||||
{unsigned int num = 100;
|
||||
if(!signature(a_file,head,num)) {a_is = false;return false;}
|
||||
if(num!=100) {a_is = false;return true;}}
|
||||
unsigned int _sz = (static_cast<unsigned int>(head[24])<<24)|(head[25]<<16)|(head[26]<<8)|head[27];
|
||||
if(_sz<(UINT_MAX/2)) _sz *= 2;
|
||||
else _sz = (UINT_MAX/2)*2;
|
||||
a_is = sz==long(_sz)?true:false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2413,12 +2413,12 @@ static void tools_gl2psParseFeedbackBuffer(tools_GLint used)
|
||||
case TOOLS_GL2PS_LINE_CAP_TOKEN :
|
||||
current += 2;
|
||||
used -= 2;
|
||||
lcap = current[1];
|
||||
lcap = (tools_GLint)current[1]; //G.Barrand : _MSC_VER : cast.
|
||||
break;
|
||||
case TOOLS_GL2PS_LINE_JOIN_TOKEN :
|
||||
current += 2;
|
||||
used -= 2;
|
||||
ljoin = current[1];
|
||||
ljoin = (tools_GLint)current[1]; //G.Barrand : _MSC_VER : cast.
|
||||
break;
|
||||
case TOOLS_GL2PS_LINE_WIDTH_TOKEN :
|
||||
current += 2;
|
||||
@@ -4359,7 +4359,8 @@ static int tools_tools_tools_gl2psPrintPDFShaderStreamDataCoord(tools_GL2PSverte
|
||||
int offs = 0;
|
||||
unsigned long imap;
|
||||
tools_GLfloat diff;
|
||||
double dmax = ~1UL;
|
||||
//double dmax = ~1UL;
|
||||
double dmax = (double)~1UL; //G.Barrand : clang10 : cast.
|
||||
char edgeflag = 0;
|
||||
|
||||
/* FIXME: temp bux fix for 64 bit archs: */
|
||||
@@ -4402,7 +4403,8 @@ static int tools_tools_tools_gl2psPrintPDFShaderStreamDataRGB(tools_GL2PSvertex
|
||||
{
|
||||
int offs = 0;
|
||||
unsigned long imap;
|
||||
double dmax = ~1UL;
|
||||
//double dmax = ~1UL;
|
||||
double dmax = (double)~1UL; //G.Barrand : clang10 : cast.
|
||||
|
||||
/* FIXME: temp bux fix for 64 bit archs: */
|
||||
if(sizeof(unsigned long) == 8) dmax = dmax - 2048.;
|
||||
@@ -4427,7 +4429,8 @@ static int tools_tools_tools_gl2psPrintPDFShaderStreamDataAlpha(tools_GL2PSverte
|
||||
{
|
||||
int offs = 0;
|
||||
unsigned long imap;
|
||||
double dmax = ~1UL;
|
||||
//double dmax = ~1UL;
|
||||
double dmax = (double)~1UL; //G.Barrand : clang10 : cast.
|
||||
|
||||
/* FIXME: temp bux fix for 64 bit archs: */
|
||||
if(sizeof(unsigned long) == 8) dmax = dmax - 2048.;
|
||||
@@ -6412,7 +6415,7 @@ TOOLS_GL2PSDLL_API tools_GLint tools_gl2psLineJoin(tools_GLint value)
|
||||
if(!tools_gl2ps_context) return TOOLS_GL2PS_UNINITIALIZED;
|
||||
|
||||
tools_glPassThrough(TOOLS_GL2PS_LINE_JOIN_TOKEN);
|
||||
tools_glPassThrough(value);
|
||||
tools_glPassThrough((tools_GLfloat)value); //G.Barrand : _MSC_VER : cast.
|
||||
|
||||
return TOOLS_GL2PS_SUCCESS;
|
||||
}
|
||||
@@ -6422,7 +6425,7 @@ TOOLS_GL2PSDLL_API tools_GLint tools_gl2psLineWidth(tools_GLfloat value)
|
||||
if(!tools_gl2ps_context) return TOOLS_GL2PS_UNINITIALIZED;
|
||||
|
||||
tools_glPassThrough(TOOLS_GL2PS_LINE_WIDTH_TOKEN);
|
||||
tools_glPassThrough(value);
|
||||
tools_glPassThrough((tools_GLfloat)value); //G.Barrand : _MSC_VER : cast.
|
||||
|
||||
return TOOLS_GL2PS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -606,10 +606,10 @@ inline bool hatcher::compute_single_polyline (vec3f* tabPoints,unsigned int aNum
|
||||
fNormal[2]*AB[0]-fNormal[0]*AB[2],
|
||||
fNormal[0]*AB[1]-fNormal[1]*AB[0]);
|
||||
|
||||
float normAB =(float)std::sqrt(std::pow(AB[0],2)+
|
||||
float normAB =(float)sqrt(std::pow(AB[0],2)+
|
||||
std::pow(AB[1],2)+
|
||||
std::pow(AB[2],2));
|
||||
float normABPerpVector =(float)std::sqrt(std::pow(ABPerpVector[0],2)+
|
||||
float normABPerpVector =(float)sqrt(std::pow(ABPerpVector[0],2)+
|
||||
std::pow(ABPerpVector[1],2)+
|
||||
std::pow(ABPerpVector[2],2));
|
||||
|
||||
@@ -643,7 +643,7 @@ inline bool hatcher::compute_single_polyline (vec3f* tabPoints,unsigned int aNum
|
||||
|
||||
// normalize vector to match the shift size
|
||||
float param = 1.0f;
|
||||
param = (float)std::sqrt((std::pow(fShift,2))/(
|
||||
param = (float)sqrt((std::pow(fShift,2))/(
|
||||
std::pow(dirShiftVector[0],2)+
|
||||
std::pow(dirShiftVector[1],2)+
|
||||
std::pow(dirShiftVector[2],2)));
|
||||
|
||||
@@ -172,6 +172,42 @@ public:
|
||||
return value;
|
||||
}
|
||||
|
||||
bool min_bin_height_with_entries(TH& a_value) const {
|
||||
TH value = 0;
|
||||
bool first = true;
|
||||
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
if(!histo::is_out(parent::m_axes,ibin) && (parent::m_bin_entries[ibin]>0) ) {
|
||||
TH vbin = get_bin_height(ibin);
|
||||
if(first) {
|
||||
first = false;
|
||||
value = vbin;
|
||||
} else {
|
||||
if(vbin<=value) value = vbin;
|
||||
}
|
||||
}
|
||||
}
|
||||
a_value = value;
|
||||
return first?false:true; //return true if at least one bin with entries processed.
|
||||
}
|
||||
|
||||
bool max_bin_height_with_entries(TH& a_value) const {
|
||||
TH value = 0;
|
||||
bool first = true;
|
||||
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
if(!histo::is_out(parent::m_axes,ibin) && (parent::m_bin_entries[ibin]>0) ) {
|
||||
TH vbin = get_bin_height(ibin);
|
||||
if(first) {
|
||||
first = false;
|
||||
value = vbin;
|
||||
} else {
|
||||
if(vbin>=value) value = vbin;
|
||||
}
|
||||
}
|
||||
}
|
||||
a_value = value;
|
||||
return first?false:true; //return true if at least one bin with entries processed.
|
||||
}
|
||||
|
||||
bool has_entries_per_bin() const { //to detect histos coming from TH streaming out of a root file.
|
||||
// it assumes that update_fast_getters() had been applied.
|
||||
if(parent::m_in_range_entries) return true;
|
||||
|
||||
@@ -314,6 +314,16 @@ public:\
|
||||
}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
bool is_diagonal() const {\
|
||||
unsigned int _D = dimension();\
|
||||
for(unsigned int r=0;r<_D;r++) {\
|
||||
for(unsigned int c=0;c<_D;c++) {\
|
||||
if(c!=r) {if(value(r,c)!=zero()) return false;}\
|
||||
}\
|
||||
}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
template <class PREC>\
|
||||
bool is_diagonal_prec(const PREC& a_prec,PREC(*a_fabs)(const T&)) const {\
|
||||
@@ -325,6 +335,33 @@ public:\
|
||||
}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
bool is_identity() const {\
|
||||
unsigned int _D = dimension();\
|
||||
{for(unsigned int r=0;r<_D;r++) {\
|
||||
if(value(r,r)!=one()) return false;\
|
||||
}}\
|
||||
{for(unsigned int r=0;r<_D;r++) {\
|
||||
for(unsigned int c=0;c<_D;c++) {\
|
||||
if(c!=r) {if(value(r,c)!=zero()) return false;}\
|
||||
}\
|
||||
}}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
template <class PREC>\
|
||||
bool is_identity_prec(const PREC& a_prec,PREC(*a_fabs)(const T&)) const {\
|
||||
unsigned int _D = dimension();\
|
||||
{for(unsigned int r=0;r<_D;r++) {\
|
||||
if(!numbers_are_equal(value(r,r),one(),a_prec,a_fabs)) return false;\
|
||||
}}\
|
||||
{for(unsigned int r=0;r<_D;r++) {\
|
||||
for(unsigned int c=0;c<_D;c++) {\
|
||||
if(c!=r) {if(!is_zero(value(r,c),a_prec,a_fabs)) return false;}\
|
||||
}\
|
||||
}}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
const T* data() const {return m_vec;}\
|
||||
unsigned int size() const {return dim2();}\
|
||||
|
||||
@@ -260,6 +260,40 @@ public:
|
||||
a_m.v33(w*w + x*x + y*y + z*z);
|
||||
}
|
||||
|
||||
template <class MAT3>
|
||||
T value_3(MAT3& a_m) const {
|
||||
//Return this rotation in the form of a 3D matrix.
|
||||
//NOTE : in coin3d/SbRotation, it looks as if "w <-> -w", but coin3d/SbMatrix logic is transposed relative to us.
|
||||
|
||||
const T x = m_quat.v0();
|
||||
const T y = m_quat.v1();
|
||||
const T z = m_quat.v2();
|
||||
const T w = m_quat.v3();
|
||||
// q = w + x * i + y * j + z * k
|
||||
|
||||
// first row :
|
||||
a_m.v00(w*w + x*x - y*y - z*z);
|
||||
a_m.v01(2*x*y - 2*w*z);
|
||||
a_m.v02(2*x*z + 2*w*y);
|
||||
|
||||
// second row :
|
||||
a_m.v10(2*x*y + 2*w*z);
|
||||
a_m.v11(w*w - x*x + y*y - z*z);
|
||||
a_m.v12(2*y*z - 2*w*x);
|
||||
|
||||
// third row :
|
||||
a_m.v20(2*x*z - 2*w*y);
|
||||
a_m.v21(2*y*z + 2*w*x);
|
||||
a_m.v22(w*w - x*x - y*y + z*z);
|
||||
|
||||
// fourth row :
|
||||
//a_m.v30(0);
|
||||
//a_m.v31(0);
|
||||
//a_m.v32(0);
|
||||
//a_m.v33(w*w + x*x + y*y + z*z);
|
||||
return w*w + x*x + y*y + z*z; //should be 1.
|
||||
}
|
||||
|
||||
void mul_vec(const VEC3& a_in,VEC3& a_out) const {
|
||||
const T x = m_quat.v0();
|
||||
const T y = m_quat.v1();
|
||||
|
||||
@@ -42,13 +42,14 @@ template <class K,class V> inline void clear(std::map<K,V*>& a_m){safe_clear<K,V
|
||||
#endif
|
||||
|
||||
template <class K,class V>
|
||||
inline void delete_key(std::map<K,V*>& a_m,const K& a_key){
|
||||
inline bool delete_key(std::map<K,V*>& a_m,const K& a_key){
|
||||
typedef typename std::map<K,V*>::iterator it_t;
|
||||
it_t it = a_m.find(a_key);
|
||||
if(it==a_m.end()) return;
|
||||
if(it==a_m.end()) return false;
|
||||
V* obj = (*it).second;
|
||||
a_m.erase(it);
|
||||
delete obj;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class K,class V>
|
||||
|
||||
@@ -79,6 +79,11 @@ inline bool dpow(const double& a_x,const double& a_y,double& a_v) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline double dgaussian(const double& a_x,const double& a_mean,const double& a_sigma) {
|
||||
double _tmp = (a_x-a_mean)/a_sigma;
|
||||
return ::exp(-_tmp*_tmp/2.0)/(a_sigma*::sqrt(2*pi()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,12 +45,16 @@ inline bool is_Android() {return false;}
|
||||
|
||||
|
||||
#if defined(ANDROID) || TARGET_OS_IPHONE
|
||||
inline bool small_screen() {return true;}
|
||||
inline bool no_cursor() {return true;}
|
||||
inline bool stop_app_button() {return true;}
|
||||
inline bool small_screen() {return true;}
|
||||
//inline bool no_cursor() {return true;}
|
||||
inline bool stop_app_button() {return true;} //the device has a button to stop the app.
|
||||
#elif defined(EMSCRIPTEN)
|
||||
inline bool small_screen() {return false;}
|
||||
//inline bool no_cursor() {return false;}
|
||||
inline bool stop_app_button() {return true;} //the device has a button to stop the app.
|
||||
#else
|
||||
inline bool small_screen() {return false;}
|
||||
inline bool no_cursor() {return false;}
|
||||
//inline bool no_cursor() {return false;}
|
||||
inline bool stop_app_button() {return false;}
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
@@ -100,6 +104,8 @@ inline const char* os() {
|
||||
static const char s_s[] = "iOS";
|
||||
#elif defined(ANDROID)
|
||||
static const char s_s[] = "Android";
|
||||
#elif defined(EMSCRIPTEN)
|
||||
static const char s_s[] = "emscripten";
|
||||
#elif defined(_WIN32)
|
||||
static const char s_s[] = "Windows_NT";
|
||||
#elif __APPLE__
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
return m_mean + displ;
|
||||
}
|
||||
FLAT& flat() {return m_flat;}
|
||||
void set_seed(unsigned int a_seed) {m_flat.set_seed(a_seed);}
|
||||
protected:
|
||||
FLAT& m_flat;
|
||||
REAL m_mean;
|
||||
@@ -85,6 +86,7 @@ public:
|
||||
return -a_log(v)/m_rate;
|
||||
}
|
||||
FLAT& flat() {return m_flat;}
|
||||
void set_seed(unsigned int a_seed) {m_flat.set_seed(a_seed);}
|
||||
protected:
|
||||
FLAT& m_flat;
|
||||
REAL m_rate;
|
||||
@@ -112,6 +114,7 @@ public:
|
||||
a_y = REAL(2) * u * v / s;
|
||||
}
|
||||
FLAT& flat() {return m_flat;}
|
||||
void set_seed(unsigned int a_seed) {m_flat.set_seed(a_seed);}
|
||||
protected:
|
||||
FLAT& m_flat;
|
||||
};
|
||||
@@ -140,6 +143,7 @@ public:
|
||||
a_y *= a;
|
||||
}
|
||||
FLAT& flat() {return m_flat;}
|
||||
void set_seed(unsigned int a_seed) {m_flat.set_seed(a_seed);}
|
||||
protected:
|
||||
FLAT& m_flat;
|
||||
};
|
||||
@@ -188,6 +192,48 @@ protected:
|
||||
REAL m_mean;
|
||||
};
|
||||
|
||||
template <class FLAT,class REAL,class UINT>
|
||||
class rbinomial {
|
||||
public:
|
||||
rbinomial(FLAT& a_flat,UINT a_n = 1,REAL a_p = REAL(0.5)):m_flat(a_flat),m_n(a_n),m_p(a_p){}
|
||||
virtual ~rbinomial(){}
|
||||
public:
|
||||
rbinomial(const rbinomial& a_from):m_flat(a_from.m_flat),m_n(a_from.m_n),m_p(a_from.m_p){}
|
||||
rbinomial& operator=(const rbinomial& a_from) {
|
||||
m_n = a_from.m_n;
|
||||
m_p = a_from.m_p;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
UINT shoot() const {
|
||||
// from ROOT/TRandom.cxx.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Generates a random integer N according to the binomial law.
|
||||
/// Coded from Los Alamos report LA-5061-MS.
|
||||
///
|
||||
/// N is binomially distributed between 0 and ntot inclusive
|
||||
/// with mean prob*ntot and prob is between 0 and 1.
|
||||
///
|
||||
/// Note: This function should not be used when ntot is large (say >100).
|
||||
/// The normal approximation is then recommended instead
|
||||
/// (with mean =*ntot+0.5 and standard deviation sqrt(ntot*prob*(1-prob)).
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if((m_p<REAL(0))||(REAL(1)<m_p)) return 0;
|
||||
UINT n = 0;
|
||||
for(UINT i=0;i<m_n;i++) {
|
||||
if(m_flat.shoot()>m_p) continue;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
FLAT& flat() {return m_flat;}
|
||||
void set_seed(unsigned int a_seed) {m_flat.set_seed(a_seed);}
|
||||
protected:
|
||||
FLAT& m_flat;
|
||||
UINT m_n;
|
||||
REAL m_p;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,15 +7,59 @@
|
||||
#include "randT"
|
||||
#include "rtausmed"
|
||||
|
||||
#include "S_STRING"
|
||||
#include "scast"
|
||||
|
||||
namespace tools {
|
||||
|
||||
class rgaussd : public rgauss<rtausmed,double> {
|
||||
class irandd {
|
||||
public:
|
||||
virtual ~irandd() {}
|
||||
public:
|
||||
virtual void* cast(const std::string&) const = 0;
|
||||
public:
|
||||
virtual double shootd() const = 0;
|
||||
};
|
||||
|
||||
class rbinomiald : public virtual irandd, public rbinomial<rtausmed,double,unsigned int> {
|
||||
typedef rbinomial<rtausmed,double,unsigned int> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rbinomiald)
|
||||
public:
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<rbinomiald>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual double shootd() const {return shoot();}
|
||||
public:
|
||||
rbinomiald(unsigned int a_n = 1,double a_p = 0.5):parent(m_flat,a_n,a_p),m_flat(){}
|
||||
virtual ~rbinomiald(){}
|
||||
public:
|
||||
rbinomiald(const rbinomiald& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rbinomiald& operator=(const rbinomiald& a_from) {
|
||||
parent::operator=(a_from);
|
||||
m_flat = a_from.m_flat;
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
rtausmed m_flat;
|
||||
};
|
||||
|
||||
class rgaussd : public virtual irandd, public rgauss<rtausmed,double> {
|
||||
typedef rgauss<rtausmed,double> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rgaussd)
|
||||
public:
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<rgaussd>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual double shootd() const {return shoot();}
|
||||
public:
|
||||
rgaussd(double a_mean = 0,double a_std_dev = 1):parent(m_flat,a_mean,a_std_dev),m_flat(){}
|
||||
virtual ~rgaussd(){}
|
||||
public:
|
||||
rgaussd(const rgaussd& a_from):parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rgaussd(const rgaussd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rgaussd& operator=(const rgaussd& a_from) {
|
||||
parent::operator=(a_from);
|
||||
m_flat = a_from.m_flat;
|
||||
@@ -27,13 +71,21 @@ protected:
|
||||
rtausmed m_flat;
|
||||
};
|
||||
|
||||
class rexpd : public rexp<rtausmed,double> {
|
||||
class rexpd : public virtual irandd, public rexp<rtausmed,double> {
|
||||
typedef rexp<rtausmed,double> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rexpd)
|
||||
public:
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<rexpd>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual double shootd() const {return shoot();}
|
||||
public:
|
||||
rexpd(double a_rate = 1):parent(m_flat,a_rate),m_flat(){}
|
||||
virtual ~rexpd(){}
|
||||
public:
|
||||
rexpd(const rexpd& a_from):parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rexpd(const rexpd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rexpd& operator=(const rexpd& a_from) {
|
||||
parent::operator=(a_from);
|
||||
m_flat = a_from.m_flat;
|
||||
@@ -47,6 +99,8 @@ protected:
|
||||
|
||||
class rdir2d : public rdir2<rtausmed,double> {
|
||||
typedef rdir2<rtausmed,double> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rdir2d)
|
||||
public:
|
||||
rdir2d():parent(m_flat),m_flat(){}
|
||||
virtual ~rdir2d(){}
|
||||
@@ -63,6 +117,8 @@ protected:
|
||||
|
||||
class rdir3d : public rdir3<rtausmed,double> {
|
||||
typedef rdir3<rtausmed,double> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rdir3d)
|
||||
public:
|
||||
rdir3d():parent(m_flat),m_flat(){}
|
||||
virtual ~rdir3d(){}
|
||||
@@ -87,13 +143,21 @@ protected:
|
||||
|
||||
namespace tools {
|
||||
|
||||
class rbwd : public rbw<rtausmed,double> {
|
||||
class rbwd : public virtual irandd, public rbw<rtausmed,double> {
|
||||
typedef rbw<rtausmed,double> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rbwd)
|
||||
public:
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<rbwd>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual double shootd() const {return shoot();}
|
||||
public:
|
||||
rbwd(double a_mean = 0,double a_gamma = 1):parent(m_flat,a_mean,a_gamma),m_flat(){}
|
||||
virtual ~rbwd(){}
|
||||
public:
|
||||
rbwd(const rbwd& a_from):parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rbwd(const rbwd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rbwd& operator=(const rbwd& a_from) {
|
||||
parent::operator=(a_from);
|
||||
m_flat = a_from.m_flat;
|
||||
@@ -111,14 +175,21 @@ protected:
|
||||
|
||||
namespace tools {
|
||||
|
||||
// NOTE : not used yet.
|
||||
class rpoissd : public rpoiss<rtausmed,double,uint64> {
|
||||
class rpoissd : public virtual irandd, public rpoiss<rtausmed,double,uint64> {
|
||||
typedef rpoiss<rtausmed,double,uint64> parent;
|
||||
public:
|
||||
TOOLS_SCLASS(tools::rpoissd)
|
||||
public:
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<rpoissd>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual double shootd() const {return double(shoot());}
|
||||
public:
|
||||
rpoissd(double a_mean = 1):parent(m_flat,a_mean),m_flat(){}
|
||||
virtual ~rpoissd(){}
|
||||
public:
|
||||
rpoissd(const rpoissd& a_from):parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rpoissd(const rpoissd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
|
||||
rpoissd& operator=(const rpoissd& a_from) {
|
||||
parent::operator=(a_from);
|
||||
m_flat = a_from.m_flat;
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#ifndef tools_sg_GL_action
|
||||
#define tools_sg_GL_action
|
||||
|
||||
#include <tools/sg/render_action>
|
||||
|
||||
#include "GL_manager"
|
||||
|
||||
#include <tools/sg/render_action>
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
@@ -526,6 +526,7 @@ public:
|
||||
}
|
||||
|
||||
::glLineWidth(_state.m_line_width);
|
||||
|
||||
::glPointSize(_state.m_point_size);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
@@ -130,6 +130,7 @@ public:
|
||||
it += 4;
|
||||
}}
|
||||
#endif //__APPLE__
|
||||
clean_gstos();
|
||||
reset_touched();
|
||||
}
|
||||
if(xyzs.empty()) return;
|
||||
|
||||
@@ -74,6 +74,9 @@ public:
|
||||
virtual void render(render_action& a_action) {
|
||||
_mult_matrix(a_action);
|
||||
set_state(a_action);
|
||||
//{mat4f& _mtx = a_action.projection_matrix();
|
||||
// a_action.out() << "debug : tools::sg::base_camera::render : proj :" << std::endl;
|
||||
// a_action.out() << _mtx << std::endl;}
|
||||
a_action.load_proj_matrix(a_action.projection_matrix());
|
||||
a_action.load_model_matrix(a_action.model_matrix());
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
virtual bool write(io::iwbuf&) = 0;
|
||||
virtual bool read(io::irbuf&) = 0;
|
||||
virtual bool dump(std::ostream&) = 0;
|
||||
//virtual bool s_value(std::string& a_s) const = 0;
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s_value(std::string&) const = 0;
|
||||
virtual bool s2value(const std::string&) = 0;
|
||||
protected:
|
||||
field():m_touched(true){
|
||||
#ifdef TOOLS_MEM
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
#define tools_sg_GL_manager
|
||||
|
||||
#include "gl"
|
||||
#include "../glbuf"
|
||||
|
||||
#include <tools/sg/render_manager>
|
||||
#include <tools/mapmanip>
|
||||
|
||||
#include <cmath> //::sqrt
|
||||
|
||||
#include "../glbuf"
|
||||
|
||||
#ifdef TOOLS_MEM
|
||||
#include <tools/mem>
|
||||
#endif
|
||||
|
||||
@@ -138,9 +138,17 @@ public: //plottable
|
||||
}
|
||||
}
|
||||
public: //bins1D
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx) const {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx,bool a_with_entries) const {
|
||||
if(a_with_entries && m_data.has_entries_per_bin()) {
|
||||
double mn,mx;
|
||||
m_data.min_bin_height_with_entries(mn);
|
||||
m_data.max_bin_height_with_entries(mx);
|
||||
a_mn = float(mn);
|
||||
a_mx = float(mx);
|
||||
} else {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
}
|
||||
}
|
||||
virtual unsigned int bins() const {return m_data.axis().bins();}
|
||||
virtual float axis_min() const {return (float)m_data.axis().lower_edge();}
|
||||
@@ -148,6 +156,9 @@ public: //bins1D
|
||||
virtual float bin_lower_edge(int aI) const {return (float)m_data.axis().bin_lower_edge(aI);}
|
||||
virtual float bin_upper_edge(int aI) const {return (float)m_data.axis().bin_upper_edge(aI);}
|
||||
|
||||
virtual bool has_entries_per_bin() const {return m_data.has_entries_per_bin();}
|
||||
virtual unsigned int bin_entries(int aI) const {return m_data.bin_entries(aI);}
|
||||
|
||||
virtual float bin_Sw(int aI) const {return (float)m_data.bin_height(aI);}
|
||||
|
||||
virtual float bin_error(int aI) const {return (float)m_data.bin_error(aI);}
|
||||
@@ -241,9 +252,17 @@ public: //plottable
|
||||
}
|
||||
}
|
||||
public: //bins2D
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx) const {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx,bool a_with_entries) const {
|
||||
if(a_with_entries && m_data.has_entries_per_bin()) {
|
||||
double mn,mx;
|
||||
m_data.min_bin_height_with_entries(mn);
|
||||
m_data.max_bin_height_with_entries(mx);
|
||||
a_mn = float(mn);
|
||||
a_mx = float(mx);
|
||||
} else {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
}
|
||||
}
|
||||
virtual unsigned int x_bins() const {return m_data.axis_x().bins();}
|
||||
virtual unsigned int y_bins() const {return m_data.axis_y().bins();}
|
||||
@@ -347,9 +366,17 @@ public:
|
||||
public:
|
||||
virtual unsigned int bins() const {return m_data.axis().bins();}
|
||||
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx) const {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
virtual void bins_Sw_range(float& a_mn,float& a_mx,bool a_with_entries) const {
|
||||
if(a_with_entries && m_data.has_entries_per_bin()) {
|
||||
double mn,mx;
|
||||
m_data.min_bin_height_with_entries(mn);
|
||||
m_data.max_bin_height_with_entries(mx);
|
||||
a_mn = float(mn);
|
||||
a_mx = float(mx);
|
||||
} else {
|
||||
a_mn = (float)m_data.min_bin_height();
|
||||
a_mx = (float)m_data.max_bin_height();
|
||||
}
|
||||
}
|
||||
|
||||
virtual float axis_min() const {return (float)m_data.axis().lower_edge();}
|
||||
@@ -357,6 +384,7 @@ public:
|
||||
virtual float bin_lower_edge(int aI) const {return (float)m_data.axis().bin_lower_edge(aI);}
|
||||
virtual float bin_upper_edge(int aI) const {return (float)m_data.axis().bin_upper_edge(aI);}
|
||||
|
||||
virtual bool has_entries_per_bin() const {return m_data.has_entries_per_bin();}
|
||||
virtual unsigned int bin_entries(int aI) const {return m_data.bin_entries(aI);}
|
||||
|
||||
virtual float bin_Sw(int aI) const {return (float)m_data.bin_height(aI);}
|
||||
|
||||
@@ -9,14 +9,33 @@
|
||||
// of holder copy(), the new holder receives a null object.
|
||||
|
||||
#include "node"
|
||||
|
||||
#include "sf_string"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
class base_holder : public node {
|
||||
TOOLS_NODE(base_holder,tools::sg::base_holder,node)
|
||||
public:
|
||||
base_holder(const std::string& a_name):parent(),m_name(a_name) {}
|
||||
virtual ~base_holder(){}
|
||||
public:
|
||||
base_holder(const base_holder& a_from):parent(a_from),m_name(a_from.m_name) {}
|
||||
base_holder& operator=(const base_holder& a_from){
|
||||
parent::operator=(a_from);
|
||||
m_name = a_from.m_name;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
const std::string& name() const {return m_name;}
|
||||
protected:
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class holder : public node {
|
||||
typedef node parent;
|
||||
class holder : public base_holder {
|
||||
typedef base_holder parent;
|
||||
public:
|
||||
//WARNING : we do not put the T class name in the name of this class.
|
||||
// We put it in the class_name field.
|
||||
@@ -46,10 +65,9 @@ private:
|
||||
}
|
||||
public:
|
||||
holder(T* a_obj = 0,const std::string& a_name = "")
|
||||
:parent()
|
||||
:parent(a_name)
|
||||
,class_name(T::s_class())
|
||||
,m_obj(a_obj) //it takes a_obj ownership.
|
||||
,m_name(a_name)
|
||||
{
|
||||
add_fields();
|
||||
}
|
||||
@@ -61,27 +79,24 @@ public:
|
||||
:parent(a_from)
|
||||
,class_name(std::string())
|
||||
,m_obj(0)
|
||||
,m_name()
|
||||
{
|
||||
parent::m_name.clear();
|
||||
add_fields();
|
||||
}
|
||||
holder& operator=(const holder& a_from){
|
||||
parent::operator=(a_from);
|
||||
class_name.value().clear();
|
||||
m_obj = 0;
|
||||
m_name.clear();
|
||||
parent::m_name.clear();
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
const T* object() const {return m_obj;}
|
||||
T* object() {return m_obj;}
|
||||
const std::string& name() const {return m_name;}
|
||||
protected:
|
||||
T* m_obj;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
inline holder<T>* cast_holder(node& a_node) {
|
||||
typedef holder<T> h_t;
|
||||
@@ -90,6 +105,29 @@ inline holder<T>* cast_holder(node& a_node) {
|
||||
return (_h->class_name.value()==T::s_class()?_h:0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const holder<T>* cast_holder(const node& a_node) {
|
||||
typedef holder<T> h_t;
|
||||
h_t* _h = (h_t*)a_node.cast(h_t::s_class());
|
||||
if(!_h) return 0;
|
||||
return (_h->class_name.value()==T::s_class()?_h:0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T* cast_holder_object(const node& a_node) {
|
||||
typedef holder<T> h_t;
|
||||
h_t* _h = (h_t*)a_node.cast(h_t::s_class());
|
||||
if(!_h) return 0;
|
||||
return (_h->class_name.value()==T::s_class()?_h->object():0);
|
||||
}
|
||||
template <class T>
|
||||
inline T* cast_holder_object(node& a_node) {
|
||||
typedef holder<T> h_t;
|
||||
h_t* _h = (h_t*)a_node.cast(h_t::s_class());
|
||||
if(!_h) return 0;
|
||||
return (_h->class_name.value()==T::s_class()?_h->object():0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void remove_holders(std::vector<node*>& a_vec){
|
||||
typedef holder<T> h_t;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "../stype"
|
||||
#include "render_action"
|
||||
#include "pick_action"
|
||||
#include "bbox_action"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -40,14 +41,32 @@ public:
|
||||
}
|
||||
|
||||
virtual void pick(pick_action& a_action) {
|
||||
tools_vforcit(line_t,lines.values(),it) {
|
||||
a_action.add_line_strip(*it,true);
|
||||
if(a_action.done()) {
|
||||
a_action.set_node(this);
|
||||
return;
|
||||
if(a_action.stop_at_first()){
|
||||
tools_vforcit(line_t,lines.values(),it) {
|
||||
a_action.add_line_strip(*it);
|
||||
if(a_action.done()) {
|
||||
a_action.set_node(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tools_vforcit(line_t,lines.values(),it) {
|
||||
a_action.set_done(false);
|
||||
a_action.zs().clear();
|
||||
a_action.ws().clear();
|
||||
a_action.add_line_strip(*it);
|
||||
if(a_action.done()) {
|
||||
a_action.add_pick(*this,a_action.zs(),a_action.ws(),a_action.state());
|
||||
a_action.set_done(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void bbox(bbox_action& a_action) {
|
||||
tools_vforcit(line_t,lines.values(),it) {
|
||||
a_action.add_points(*it);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
mf(){}
|
||||
mf(const T& a_v):parent(a_v){}
|
||||
@@ -90,6 +92,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
mf_string():parent(){}
|
||||
mf_string(const std::string& a_v):parent(a_v){}
|
||||
@@ -153,6 +157,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
mf_enum():parent(){}
|
||||
mf_enum(const T& a_v):parent(a_v){}
|
||||
@@ -247,6 +253,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
mf_vec():parent(){}
|
||||
mf_vec(const T& a_v):parent(a_v){}
|
||||
@@ -292,6 +300,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
mf_std_vec():parent(){}
|
||||
mf_std_vec(const T& a_v):parent(a_v){}
|
||||
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
// return parent::is_a(a_class);
|
||||
// }
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<node>(this,a_class)) {return p;}
|
||||
else return 0;
|
||||
if(void* p = cmp_cast<node>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
virtual const std::string& s_cls() const = 0;
|
||||
public:
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
path.push_back(this);
|
||||
a_action.add_path(path);
|
||||
if(a_action.stop_at_first()) a_action.set_done(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void get_matrix(get_matrix_action& a_action) {
|
||||
@@ -103,7 +103,8 @@ public:
|
||||
tools_vforcit(field*,m_fields,it) (*it)->reset_touched();
|
||||
}
|
||||
public:
|
||||
node(){
|
||||
node()
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
@@ -114,12 +115,15 @@ public:
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
node(const node&){
|
||||
node(const node&)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
node& operator=(const node&){return *this;}
|
||||
node& operator=(const node&){
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
void add_field(field* a_field) {
|
||||
m_fields.push_back(a_field); //it does not take ownerhship.
|
||||
@@ -246,6 +250,30 @@ public:
|
||||
//WARNING : touchy.
|
||||
return *((field*)((char*)this+a_desc.offset()));
|
||||
}
|
||||
void dump_field_descs(std::ostream& a_out) const {
|
||||
a_out << "field descs of node class " << s_cls() << " :" << std::endl;
|
||||
const std::vector<field_desc>& fds = node_desc_fields();
|
||||
tools_vforcit(field_desc,fds,itd) {
|
||||
a_out << "name " << (*itd).name()
|
||||
<< ", class " << (*itd).cls()
|
||||
<< ", offset " << (*itd).offset()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
field* find_field_by_name(const std::string& a_name) const {
|
||||
// a_name is of the form <class>.<field>. For example for color on sg::text, there are :
|
||||
// tools::sg::back_area.color
|
||||
// tools::sg::text.color
|
||||
const std::vector<field_desc>& fds = node_desc_fields();
|
||||
tools_vforcrit(field_desc,fds,it) {
|
||||
if((*it).name()==a_name) {
|
||||
tools_vforcit(field*,m_fields,itf) {
|
||||
if(field_offset(*itf)==(*it).offset()) return (*itf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
protected:
|
||||
field_desc::offset_t field_offset(const field* a_field) const {
|
||||
//WARNING : touchy.
|
||||
@@ -253,15 +281,6 @@ protected:
|
||||
}
|
||||
|
||||
field* find_field(const field_desc& a_rdesc) const {
|
||||
/*
|
||||
//WARNING : must not use field name since, through inheritance, a node can have two field with same name.
|
||||
// (For exa sg::text has one field "color" and another one coming from back_area).
|
||||
//::printf("debug : find_field : %s ...\n",a_rdesc.name().c_str());
|
||||
tools_vforcit(field*,m_fields,it) {
|
||||
//::printf("debug : find_field : look : %s\n",field_name(*(*it)).c_str());
|
||||
if(field_offset(*it)==a_rdesc.offset()) return (*it);
|
||||
}
|
||||
*/
|
||||
const std::vector<field_desc>& fds = node_desc_fields();
|
||||
tools_vforcit(field_desc,fds,it) {
|
||||
if((*it).name()==a_rdesc.name()) {
|
||||
@@ -274,17 +293,6 @@ protected:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dump_field_descs(std::ostream& a_out) const {
|
||||
a_out << "field descs of node class " << s_cls() << " :" << std::endl;
|
||||
const std::vector<field_desc>& fds = node_desc_fields();
|
||||
tools_vforcit(field_desc,fds,itd) {
|
||||
a_out << "name " << (*itd).name()
|
||||
<< ", class " << (*itd).cls()
|
||||
<< ", offset " << (*itd).offset()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void check_fields(std::ostream& a_out) const {
|
||||
const std::vector<field_desc>& fds = node_desc_fields();
|
||||
tools_vforcit(field*,m_fields,it) {
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
sf<bool> border_visible;
|
||||
sf<float> border_width;
|
||||
sf<float> border_height;
|
||||
sf<float> border_z;
|
||||
sf<float> border_scale;
|
||||
sf_vec<colorf,float> border_color;
|
||||
|
||||
// for gopaw :
|
||||
@@ -38,8 +40,8 @@ public:
|
||||
public:
|
||||
virtual const desc_fields& node_desc_fields() const {
|
||||
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::plots)
|
||||
static const desc_fields s_v(parent::node_desc_fields(),16, //WARNING : take care of count.
|
||||
TOOLS_ARG_FIELD_DESC(width),
|
||||
static const desc_fields s_v(parent::node_desc_fields(),18, //WARNING : take care of count.
|
||||
TOOLS_ARG_FIELD_DESC(width), //1
|
||||
TOOLS_ARG_FIELD_DESC(height),
|
||||
TOOLS_ARG_FIELD_DESC(cols),
|
||||
TOOLS_ARG_FIELD_DESC(rows),
|
||||
@@ -48,6 +50,8 @@ public:
|
||||
TOOLS_ARG_FIELD_DESC(border_visible),
|
||||
TOOLS_ARG_FIELD_DESC(border_width),
|
||||
TOOLS_ARG_FIELD_DESC(border_height),
|
||||
TOOLS_ARG_FIELD_DESC(border_z), //10
|
||||
TOOLS_ARG_FIELD_DESC(border_scale),
|
||||
TOOLS_ARG_FIELD_DESC(border_color),
|
||||
TOOLS_ARG_FIELD_DESC(left_margin),
|
||||
TOOLS_ARG_FIELD_DESC(right_margin),
|
||||
@@ -84,6 +88,8 @@ private:
|
||||
add_field(&border_visible);
|
||||
add_field(&border_width);
|
||||
add_field(&border_height);
|
||||
add_field(&border_z);
|
||||
add_field(&border_scale);
|
||||
add_field(&border_color);
|
||||
add_field(&left_margin);
|
||||
add_field(&right_margin);
|
||||
@@ -157,6 +163,8 @@ public:
|
||||
,border_visible(false)
|
||||
,border_width(0)
|
||||
,border_height(0)
|
||||
,border_z(0)
|
||||
,border_scale(1)
|
||||
,border_color(colorf_grey())
|
||||
,left_margin(0)
|
||||
,right_margin(0)
|
||||
@@ -190,6 +198,8 @@ public:
|
||||
,border_visible(a_from.border_visible)
|
||||
,border_width(a_from.border_width)
|
||||
,border_height(a_from.border_height)
|
||||
,border_z(a_from.border_z)
|
||||
,border_scale(a_from.border_scale)
|
||||
,border_color(a_from.border_color)
|
||||
,left_margin(a_from.left_margin)
|
||||
,right_margin(a_from.right_margin)
|
||||
@@ -229,6 +239,8 @@ public:
|
||||
border_visible = a_from.border_visible;
|
||||
border_width = a_from.border_width;
|
||||
border_height = a_from.border_height;
|
||||
border_z = a_from.border_z;
|
||||
border_scale = a_from.border_scale;
|
||||
border_color = a_from.border_color;
|
||||
|
||||
left_margin = a_from.left_margin;
|
||||
@@ -1070,12 +1082,21 @@ protected:
|
||||
if(border_width.value()<=0) return;
|
||||
if(border_height.value()<=0) return;
|
||||
|
||||
// border_scale could be used as an offscreen (inzb_[ps,png,jpeg], gl2s_pdf)
|
||||
// cooking to avoid seeing a one pixel line at some side (in general left)
|
||||
// coming from the border.
|
||||
if(border_scale.value()!=1) {
|
||||
matrix* _m = new matrix;
|
||||
_m->set_scale(border_scale.value(),border_scale.value(),1);
|
||||
m_border_sep.add(_m);
|
||||
}
|
||||
|
||||
float bw = border_width;
|
||||
float bh = border_height;
|
||||
|
||||
// do it with four externals back_area.
|
||||
|
||||
float zz = 0;
|
||||
float zz = border_z.value();
|
||||
|
||||
// top :
|
||||
{separator* sep = new separator;
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
public:
|
||||
virtual ~bins1D(){}
|
||||
public:
|
||||
virtual void bins_Sw_range(float&,float&) const = 0;
|
||||
virtual void bins_Sw_range(float&,float&,bool) const = 0;
|
||||
public:
|
||||
// axis :
|
||||
virtual unsigned int bins() const = 0;
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
virtual float bin_lower_edge(int) const = 0;
|
||||
virtual float bin_upper_edge(int) const = 0;
|
||||
// bins :
|
||||
virtual bool has_entries_per_bin() const = 0;
|
||||
virtual unsigned int bin_entries(int) const = 0;
|
||||
virtual float bin_Sw(int) const = 0;
|
||||
virtual float bin_error(int) const = 0;
|
||||
public:
|
||||
@@ -48,7 +50,7 @@ public:
|
||||
public:
|
||||
virtual ~bins2D(){}
|
||||
public:
|
||||
virtual void bins_Sw_range(float&,float&) const = 0;
|
||||
virtual void bins_Sw_range(float&,float&,bool) const = 0;
|
||||
public:
|
||||
// x axis :
|
||||
virtual unsigned int x_bins() const = 0;
|
||||
|
||||
@@ -103,6 +103,8 @@ public:
|
||||
sf<bool> z_axis_is_log;
|
||||
|
||||
sf<float> value_top_margin;
|
||||
sf<float> value_bottom_margin;
|
||||
sf<bool> value_bins_with_entries;
|
||||
|
||||
sf<float> infos_width; //in percent of width.
|
||||
sf<float> infos_x_margin; //in percent of width. From right.
|
||||
@@ -178,7 +180,7 @@ public:
|
||||
public:
|
||||
virtual const desc_fields& node_desc_fields() const {
|
||||
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::plotter)
|
||||
static const desc_fields s_v(parent::node_desc_fields(),61, //WARNING : take care of count.
|
||||
static const desc_fields s_v(parent::node_desc_fields(),63, //WARNING : take care of count.
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(width),
|
||||
TOOLS_ARG_FIELD_DESC(height),
|
||||
@@ -231,13 +233,15 @@ public:
|
||||
TOOLS_ARG_FIELD_DESC(z_axis_is_log),
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(value_top_margin),
|
||||
TOOLS_ARG_FIELD_DESC(value_bottom_margin),
|
||||
TOOLS_ARG_FIELD_DESC(value_bins_with_entries),
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(infos_width),
|
||||
TOOLS_ARG_FIELD_DESC(infos_x_margin),
|
||||
TOOLS_ARG_FIELD_DESC(infos_y_margin),
|
||||
TOOLS_ARG_FIELD_DESC(infos_y_margin), //40
|
||||
TOOLS_ARG_FIELD_DESC(infos_what),
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(func2D_borders_visible), //40
|
||||
TOOLS_ARG_FIELD_DESC(func2D_borders_visible),
|
||||
TOOLS_ARG_FIELD_DESC(theta),
|
||||
TOOLS_ARG_FIELD_DESC(phi),
|
||||
TOOLS_ARG_FIELD_DESC(tau),
|
||||
@@ -251,11 +255,11 @@ public:
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(legends_origin_unit),
|
||||
TOOLS_ARG_FIELD_DESC(legends_size),
|
||||
TOOLS_ARG_FIELD_DESC(legends_string),
|
||||
TOOLS_ARG_FIELD_DESC(legends_string), //50
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(shape_automated),
|
||||
|
||||
TOOLS_ARG_FIELD_DESC_ENUMS_BEG(shape,2) //50
|
||||
TOOLS_ARG_FIELD_DESC_ENUMS_BEG(shape,2)
|
||||
"xy",xy,
|
||||
"xyz",xyz
|
||||
TOOLS_ARG_FIELD_DESC_ENUMS_END,
|
||||
@@ -271,10 +275,10 @@ public:
|
||||
TOOLS_ARG_FIELD_DESC(primitives_enforced),
|
||||
TOOLS_ARG_FIELD_DESC(inner_frame_enforced),
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(title_box_width),
|
||||
TOOLS_ARG_FIELD_DESC(title_box_width), //60
|
||||
TOOLS_ARG_FIELD_DESC(title_box_height),
|
||||
TOOLS_ARG_FIELD_DESC(title_box_x_margin),
|
||||
TOOLS_ARG_FIELD_DESC(title_box_y_margin)
|
||||
TOOLS_ARG_FIELD_DESC(title_box_y_margin) //63
|
||||
|
||||
);
|
||||
return s_v;
|
||||
@@ -359,6 +363,8 @@ private:
|
||||
add_field(&z_axis_is_log);
|
||||
|
||||
add_field(&value_top_margin);
|
||||
add_field(&value_bottom_margin);
|
||||
add_field(&value_bins_with_entries);
|
||||
|
||||
add_field(&infos_width);
|
||||
add_field(&infos_x_margin);
|
||||
@@ -403,6 +409,8 @@ public: //style
|
||||
xy_depth = a_from.xy_depth;
|
||||
curve_number_of_points = a_from.curve_number_of_points;
|
||||
value_top_margin = a_from.value_top_margin;
|
||||
value_bottom_margin = a_from.value_bottom_margin;
|
||||
value_bins_with_entries = a_from.value_bins_with_entries;
|
||||
infos_what = a_from.infos_what;
|
||||
infos_width = a_from.infos_width;
|
||||
//infos height is automatic.
|
||||
@@ -491,9 +499,10 @@ public: //style
|
||||
xy_depth = 0.01f;
|
||||
curve_number_of_points = 100;
|
||||
////////////////////////////////////////////
|
||||
// CERN-PAW seems to have 0.1F and CERN-ROOT 0.05F.
|
||||
value_top_margin = 0.1f; //percent.
|
||||
|
||||
value_top_margin = 0.1f; //percent. // CERN-PAW seems to have 0.1F and CERN-ROOT 0.05F.
|
||||
value_bottom_margin = 0.0f; //percent.
|
||||
value_bins_with_entries = true; //gopaw uses false.
|
||||
|
||||
infos_what = s_infos_what_def();
|
||||
infos_width = 0.3f;
|
||||
//infos height is automatic.
|
||||
@@ -871,6 +880,14 @@ public: //style
|
||||
float v;
|
||||
if(!to<float>(sv,v)) {style_failed(a_out,key,sv);return false;}
|
||||
value_top_margin = v;
|
||||
} else if(key=="value_bottom_margin") {
|
||||
float v;
|
||||
if(!to<float>(sv,v)) {style_failed(a_out,key,sv);return false;}
|
||||
value_bottom_margin = v;
|
||||
} else if(key=="value_bins_with_entries") {
|
||||
float v;
|
||||
if(!to<float>(sv,v)) {style_failed(a_out,key,sv);return false;}
|
||||
value_bins_with_entries = v;
|
||||
} else if(key=="infos_width") {
|
||||
float v;
|
||||
if(!to<float>(sv,v)) {style_failed(a_out,key,sv);return false;}
|
||||
@@ -1243,8 +1260,9 @@ public:
|
||||
,z_axis_max(1)
|
||||
,z_axis_is_log(false)
|
||||
|
||||
// CERN-PAW seems to have 0.1F and CERN-ROOT 0.05F.
|
||||
,value_top_margin(0.1f) //percent.
|
||||
,value_top_margin(0.1f) //percent. // CERN-PAW seems to have 0.1F and CERN-ROOT 0.05F.
|
||||
,value_bottom_margin(0.0f) //percent.
|
||||
,value_bins_with_entries(true)
|
||||
|
||||
,infos_width(0.3f) //percent of width
|
||||
,infos_x_margin(default_infos_margin()) //percent of width
|
||||
@@ -1346,6 +1364,8 @@ public:
|
||||
,z_axis_max(a_from.z_axis_max)
|
||||
,z_axis_is_log(a_from.z_axis_is_log)
|
||||
,value_top_margin(a_from.value_top_margin)
|
||||
,value_bottom_margin(a_from.value_bottom_margin)
|
||||
,value_bins_with_entries(a_from.value_bins_with_entries)
|
||||
|
||||
,infos_width(a_from.infos_width)
|
||||
,infos_x_margin(a_from.infos_x_margin)
|
||||
@@ -1465,6 +1485,8 @@ public:
|
||||
z_axis_max = a_from.z_axis_max;
|
||||
z_axis_is_log = a_from.z_axis_is_log;
|
||||
value_top_margin = a_from.value_top_margin;
|
||||
value_bottom_margin = a_from.value_bottom_margin;
|
||||
value_bins_with_entries = a_from.value_bins_with_entries;
|
||||
|
||||
infos_width = a_from.infos_width;
|
||||
infos_x_margin = a_from.infos_x_margin;
|
||||
@@ -1947,7 +1969,7 @@ public: //public
|
||||
|
||||
bool axis_2_data_frame(const vec3f& a_pos,vec3f& aDF) const {
|
||||
// a_pos is in axes coordinates.
|
||||
// aDF in data area coodinate. In [0,1][0,1][0,1].
|
||||
// aDF in data area coordinate. In [0,1][0,1][0,1].
|
||||
|
||||
// Assume that axes min,max,logScale are up to date.
|
||||
|
||||
@@ -2029,7 +2051,7 @@ public: //public
|
||||
bool axis_2_vp(const vec3f& a_pos,vec3f& a_vp) const {
|
||||
// a_pos is in axes coordinates.
|
||||
// a_vp is in viewport/screen coordinates (in [0,1]).
|
||||
vec3f d; // In data area coodinate. In [0,1][0,1][0,1].
|
||||
vec3f d; // In data area coordinate. In [0,1][0,1][0,1].
|
||||
if(!axis_2_data_frame(a_pos,d)) return false;
|
||||
return data_frame_2_vp(d,a_vp);
|
||||
}
|
||||
@@ -2037,7 +2059,7 @@ public: //public
|
||||
bool vp_2_axis(const vec3f& a_vp,vec3f& a_pos) const {
|
||||
// a_vp is in viewport/screen coordinates (in [0,1]).
|
||||
// a_pos is in axes coordinates.
|
||||
vec3f d; // In data area coodinate. In [0,1][0,1][0,1].
|
||||
vec3f d; // In data area coordinate. In [0,1][0,1][0,1].
|
||||
if(!vp_2_data_frame(a_vp,d)) return false;
|
||||
return data_frame_2_axis(d,a_pos);
|
||||
}
|
||||
@@ -2911,32 +2933,95 @@ public:
|
||||
update_primitives(a_out);
|
||||
}
|
||||
|
||||
void get_value_axis_min_max(float a_Sw_mn,float a_Sw_mx,bool a_is_log,float& a_min,float& a_max,bool a_min_visible) {
|
||||
if(a_Sw_mn>a_Sw_mx) {
|
||||
a_min = 0;
|
||||
a_max = 0;
|
||||
return;
|
||||
}
|
||||
// a_Sw_mx >= a_Sw_mn.
|
||||
if(a_is_log && (a_Sw_mn<=0) ) { //let data_axis.adjust() do something.
|
||||
a_min = a_Sw_mn;
|
||||
a_max = a_Sw_mx;
|
||||
return;
|
||||
}
|
||||
float mn;
|
||||
if(a_is_log) {
|
||||
if(value_bottom_margin.value()!=0) {
|
||||
float log_Sw_mn = flog10(a_Sw_mn);
|
||||
float log_Sw_mx = flog10(a_Sw_mx);
|
||||
float log_mn = log_Sw_mn - (log_Sw_mx-log_Sw_mn)*value_bottom_margin;
|
||||
mn = fpow(10,log_mn);
|
||||
} else {
|
||||
mn = a_Sw_mn;
|
||||
if(a_min_visible) { // arrang so that the bin with a_Sw_mn be visible.
|
||||
float log_Sw_mn = flog10(a_Sw_mn);
|
||||
mn = fpow(10,log_Sw_mn)*(1.0f-0.4f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(value_bottom_margin.value()!=0) {
|
||||
mn = a_Sw_mn - (a_Sw_mx-a_Sw_mn)*value_bottom_margin;
|
||||
} else {
|
||||
if(a_min_visible) {
|
||||
// Arrange so that the bin with a_Sw_mn (if not 0) be visible. (If 0, it will be anyway on the x axis) :
|
||||
if(a_Sw_mn>0) {
|
||||
mn = 0; //PAW logic.
|
||||
} else if(a_Sw_mn==0) {
|
||||
mn = 0; //PAW logic. min bin will be anyway on x axis.
|
||||
} else {
|
||||
mn = a_Sw_mn; // min bin will be anyway on x axis.
|
||||
}
|
||||
} else {
|
||||
mn = a_Sw_mn; //min bin will be on x axis.
|
||||
}
|
||||
}
|
||||
}
|
||||
a_min = mn;
|
||||
|
||||
float mx;
|
||||
if(a_is_log) {
|
||||
if(value_top_margin.value()!=0) {
|
||||
float log_Sw_mn = flog10(a_Sw_mn);
|
||||
float log_Sw_mx = flog10(a_Sw_mx);
|
||||
float log_mx = log_Sw_mx + (log_Sw_mx-log_Sw_mn)*value_top_margin;
|
||||
mx = fpow(10,log_mx);
|
||||
} else {
|
||||
mx = a_Sw_mx; //max bin will be on top of frame (then not visible if same color).
|
||||
}
|
||||
} else {
|
||||
mx = a_Sw_mx + (a_Sw_mx-mn)*value_top_margin;
|
||||
//mx = a_Sw_mx + (a_Sw_mx-a_Sw_mn)*value_top_margin; //not compatible with gopaw.
|
||||
}
|
||||
a_max = mx;
|
||||
}
|
||||
|
||||
void update_axes_data(std::ostream& a_out){
|
||||
m_x_axis_data.min_value(0);
|
||||
m_x_axis_data.max_value(0);
|
||||
m_x_axis_data.is_log(x_axis_is_log);
|
||||
m_x_axis_data.set_min_value(0);
|
||||
m_x_axis_data.set_max_value(0);
|
||||
m_x_axis_data.set_is_log(x_axis_is_log);
|
||||
|
||||
m_y_axis_data.min_value(0);
|
||||
m_y_axis_data.max_value(0);
|
||||
m_y_axis_data.is_log(y_axis_is_log);
|
||||
m_y_axis_data.set_min_value(0);
|
||||
m_y_axis_data.set_max_value(0);
|
||||
m_y_axis_data.set_is_log(y_axis_is_log);
|
||||
|
||||
m_z_axis_data.min_value(0);
|
||||
m_z_axis_data.max_value(0);
|
||||
m_z_axis_data.is_log(z_axis_is_log);
|
||||
m_z_axis_data.set_min_value(0);
|
||||
m_z_axis_data.set_max_value(0);
|
||||
m_z_axis_data.set_is_log(z_axis_is_log);
|
||||
|
||||
if(!x_axis_automated) { //def = true
|
||||
m_x_axis_data.min_value(x_axis_min);
|
||||
m_x_axis_data.max_value(x_axis_max);
|
||||
m_x_axis_data.set_min_value(x_axis_min);
|
||||
m_x_axis_data.set_max_value(x_axis_max);
|
||||
}
|
||||
|
||||
if(!y_axis_automated) {
|
||||
m_y_axis_data.min_value(y_axis_min);
|
||||
m_y_axis_data.max_value(y_axis_max);
|
||||
m_y_axis_data.set_min_value(y_axis_min);
|
||||
m_y_axis_data.set_max_value(y_axis_max);
|
||||
}
|
||||
|
||||
if(!z_axis_automated) {
|
||||
m_z_axis_data.min_value(z_axis_min);
|
||||
m_z_axis_data.max_value(z_axis_max);
|
||||
m_z_axis_data.set_min_value(z_axis_min);
|
||||
m_z_axis_data.set_max_value(z_axis_max);
|
||||
}
|
||||
|
||||
bins1D* b1;
|
||||
@@ -2953,39 +3038,46 @@ public:
|
||||
if(b1) {
|
||||
|
||||
if(x_axis_automated) {
|
||||
m_x_axis_data.min_value(b1->axis_min());
|
||||
m_x_axis_data.max_value(b1->axis_max());
|
||||
m_x_axis_data.set_min_value(b1->axis_min());
|
||||
m_x_axis_data.set_max_value(b1->axis_max());
|
||||
}
|
||||
|
||||
if(y_axis_automated) {
|
||||
//::printf("debug : value %g %g %d : is log %d\n",
|
||||
// value_bottom_margin.value(),value_top_margin.value(),value_bins_with_entries.value(),
|
||||
// m_y_axis_data.is_log());
|
||||
float Sw_mn,Sw_mx;
|
||||
b1->bins_Sw_range(Sw_mn,Sw_mx,value_bins_with_entries.value());
|
||||
//::printf("debug : Sw %g %g\n",Sw_mn,Sw_mx);
|
||||
float mn,mx;
|
||||
b1->bins_Sw_range(mn,mx);
|
||||
//m_y_axis_data.min_value(mn);
|
||||
if(mn>=0) mn = 0; //PAW convention.
|
||||
m_y_axis_data.min_value(mn);
|
||||
mx = mx + (mx-mn)*value_top_margin;
|
||||
m_y_axis_data.max_value(mx);
|
||||
get_value_axis_min_max(Sw_mn,Sw_mx,m_y_axis_data.is_log(),mn,mx,true);
|
||||
//::printf("debug : mn mx %g %g\n",mn,mx);
|
||||
m_y_axis_data.set_min_value(mn);
|
||||
m_y_axis_data.set_max_value(mx);
|
||||
|
||||
m_y_axis_data.adjust();
|
||||
//::printf("debug : adjusted : mn mx %g %g\n",mn,mx);
|
||||
}
|
||||
|
||||
} if(b2) {
|
||||
if(x_axis_automated) {
|
||||
m_x_axis_data.min_value(b2->x_axis_min());
|
||||
m_x_axis_data.max_value(b2->x_axis_max());
|
||||
m_x_axis_data.set_min_value(b2->x_axis_min());
|
||||
m_x_axis_data.set_max_value(b2->x_axis_max());
|
||||
}
|
||||
|
||||
if(y_axis_automated) {
|
||||
m_y_axis_data.min_value(b2->y_axis_min());
|
||||
m_y_axis_data.max_value(b2->y_axis_max());
|
||||
m_y_axis_data.set_min_value(b2->y_axis_min());
|
||||
m_y_axis_data.set_max_value(b2->y_axis_max());
|
||||
}
|
||||
|
||||
if(z_axis_automated) {
|
||||
float Sw_mn,Sw_mx;
|
||||
b2->bins_Sw_range(Sw_mn,Sw_mx,value_bins_with_entries.value());
|
||||
float mn,mx;
|
||||
b2->bins_Sw_range(mn,mx);
|
||||
m_z_axis_data.min_value(mn);
|
||||
mx = mx + (mx-mn)*value_top_margin;
|
||||
m_z_axis_data.max_value(mx);
|
||||
get_value_axis_min_max(Sw_mn,Sw_mx,m_z_axis_data.is_log(),mn,mx,false);
|
||||
m_z_axis_data.set_min_value(mn);
|
||||
m_z_axis_data.set_max_value(mx);
|
||||
|
||||
m_z_axis_data.adjust();
|
||||
}
|
||||
} /*else if(f_binsList[0]->getDimension()==3) {
|
||||
@@ -2997,33 +3089,33 @@ public:
|
||||
} else if(first_points(p2,p3)) {
|
||||
if(p2) {
|
||||
if(x_axis_automated) {
|
||||
m_x_axis_data.min_value(p2->x_axis_min());
|
||||
m_x_axis_data.max_value(p2->x_axis_max());
|
||||
m_x_axis_data.set_min_value(p2->x_axis_min());
|
||||
m_x_axis_data.set_max_value(p2->x_axis_max());
|
||||
}
|
||||
if(y_axis_automated) {
|
||||
float ymn = p2->y_axis_min();
|
||||
float ymx = p2->y_axis_max();
|
||||
// For pawex22 ?
|
||||
//m_y_axis_data.min_value(ymn*1.1F);
|
||||
//m_y_axis_data.max_value(ymx*1.1F);
|
||||
m_y_axis_data.min_value(ymn);
|
||||
m_y_axis_data.max_value(ymx);
|
||||
//m_y_axis_data.set_min_value(ymn*1.1F);
|
||||
//m_y_axis_data.set_max_value(ymx*1.1F);
|
||||
m_y_axis_data.set_min_value(ymn);
|
||||
m_y_axis_data.set_max_value(ymx);
|
||||
}
|
||||
} else if(p3) {
|
||||
|
||||
if(x_axis_automated) {
|
||||
m_x_axis_data.min_value(p3->x_axis_min());
|
||||
m_x_axis_data.max_value(p3->x_axis_max());
|
||||
m_x_axis_data.set_min_value(p3->x_axis_min());
|
||||
m_x_axis_data.set_max_value(p3->x_axis_max());
|
||||
}
|
||||
|
||||
if(y_axis_automated) {
|
||||
m_y_axis_data.min_value(p3->y_axis_min());
|
||||
m_y_axis_data.max_value(p3->y_axis_max());
|
||||
m_y_axis_data.set_min_value(p3->y_axis_min());
|
||||
m_y_axis_data.set_max_value(p3->y_axis_max());
|
||||
}
|
||||
|
||||
if(z_axis_automated) {
|
||||
m_z_axis_data.min_value(p3->z_axis_min());
|
||||
m_z_axis_data.max_value(p3->z_axis_max());
|
||||
m_z_axis_data.set_min_value(p3->z_axis_min());
|
||||
m_z_axis_data.set_max_value(p3->z_axis_max());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3038,8 +3130,8 @@ public:
|
||||
xmn = -1;
|
||||
xmx = 1;
|
||||
}
|
||||
m_x_axis_data.min_value(xmn);
|
||||
m_x_axis_data.max_value(xmx);
|
||||
m_x_axis_data.set_min_value(xmn);
|
||||
m_x_axis_data.set_max_value(xmx);
|
||||
}
|
||||
|
||||
if(y_axis_automated) {
|
||||
@@ -3070,8 +3162,8 @@ public:
|
||||
<< " problem when getting some function value."
|
||||
<< std::endl;
|
||||
}
|
||||
m_y_axis_data.min_value(vmin);
|
||||
m_y_axis_data.max_value(vmax);
|
||||
m_y_axis_data.set_min_value(vmin);
|
||||
m_y_axis_data.set_max_value(vmax);
|
||||
m_y_axis_data.adjust();
|
||||
}
|
||||
|
||||
@@ -3083,8 +3175,8 @@ public:
|
||||
xmn = -1;
|
||||
xmx = 1;
|
||||
}
|
||||
m_x_axis_data.min_value(xmn);
|
||||
m_x_axis_data.max_value(xmx);
|
||||
m_x_axis_data.set_min_value(xmn);
|
||||
m_x_axis_data.set_max_value(xmx);
|
||||
}
|
||||
|
||||
if(y_axis_automated) {
|
||||
@@ -3094,8 +3186,8 @@ public:
|
||||
ymn = -1;
|
||||
ymx = 1;
|
||||
}
|
||||
m_y_axis_data.min_value(ymn);
|
||||
m_y_axis_data.max_value(ymx);
|
||||
m_y_axis_data.set_min_value(ymn);
|
||||
m_y_axis_data.set_max_value(ymx);
|
||||
}
|
||||
|
||||
if(z_axis_automated) {
|
||||
@@ -3141,8 +3233,8 @@ public:
|
||||
<< " problem when getting some function value."
|
||||
<< std::endl;
|
||||
}
|
||||
m_z_axis_data.min_value(vmin);
|
||||
m_z_axis_data.max_value(vmax);
|
||||
m_z_axis_data.set_min_value(vmin);
|
||||
m_z_axis_data.set_max_value(vmax);
|
||||
m_z_axis_data.adjust();
|
||||
}
|
||||
}
|
||||
@@ -3555,20 +3647,31 @@ protected: //vis bins
|
||||
//::sprintf(sid,"tools::sg::bins1D/0x%lx",
|
||||
// (unsigned long)const_cast<bins1D*>(&a_bins));
|
||||
|
||||
//bool hbe = a_bins.has_entries_per_bin();
|
||||
|
||||
float bmin = 0;
|
||||
float bmax = 0;
|
||||
|
||||
size_t xnbin = a_bins.bins();
|
||||
std::vector<rep_bin1D> bins(xnbin);
|
||||
{bool first = true;
|
||||
for(size_t ibin=0;ibin<xnbin;ibin++) {
|
||||
//if(hbe && (a_bins.bin_entries(size_t(ibin))<=0)) continue;
|
||||
float val = a_bins.bin_Sw(int(ibin));
|
||||
float xx = float(a_bins.bin_lower_edge(int(ibin)));
|
||||
float xe = float(a_bins.bin_upper_edge(int(ibin)));
|
||||
float vmin,vmax;
|
||||
//if(aSuperpose) {
|
||||
//uuugetHeight(aIndex1D,a_bins1DList,a_bins1DListSwMnMx,ibin,vmin,vmax);
|
||||
//} else {
|
||||
vmin = 0;
|
||||
vmax = a_bins.bin_Sw(int(ibin));
|
||||
//}
|
||||
bins[ibin] = rep_bin1D(xx,xe,vmin,vmax);
|
||||
}
|
||||
bins[ibin] = rep_bin1D(xx,xe,0,val);
|
||||
if(first) {
|
||||
first = false;
|
||||
bmin = val;
|
||||
bmax = val;
|
||||
} else {
|
||||
bmin = mn<float>(bmin,val);
|
||||
bmax = mx<float>(bmax,val);
|
||||
}
|
||||
}}
|
||||
|
||||
//a_bins.bins_Sw_range(bmin,bmax,false);
|
||||
|
||||
//modeling_profile could override errors_visible.
|
||||
bool errors_visible = a_errors_style.visible;
|
||||
@@ -3581,9 +3684,6 @@ protected: //vis bins
|
||||
} else if( (painting==painting_grey_scale) ||
|
||||
(painting==painting_grey_scale_inverse) ||
|
||||
(painting==painting_violet_to_red) ){
|
||||
float bmin;
|
||||
float bmax;
|
||||
a_bins.bins_Sw_range(bmin,bmax);
|
||||
{float dbins = bmax-bmin;
|
||||
if(dbins!=0.0F) {
|
||||
for(size_t index=0;index<xnbin;index++) bins[index].m_ratio = (a_bins.bin_Sw(int(index))-bmin)/dbins;
|
||||
@@ -3819,10 +3919,6 @@ protected: //vis bins
|
||||
unsigned int xnbin = a_bins.x_bins();
|
||||
unsigned int ynbin = a_bins.y_bins();
|
||||
|
||||
float bmin;
|
||||
float bmax;
|
||||
a_bins.bins_Sw_range(bmin,bmax);
|
||||
|
||||
const std::string& modeling = a_data_style.modeling;
|
||||
|
||||
if( (modeling==modeling_curve()) || (modeling==modeling_filled_curve()) ){
|
||||
@@ -3944,22 +4040,38 @@ protected: //vis bins
|
||||
|
||||
bool hbe = a_bins.has_entries_per_bin();
|
||||
|
||||
float bmin = 0;
|
||||
float bmax = 0;
|
||||
|
||||
std::vector<rep_bin2D> bins;
|
||||
{for(int jbin=ynbin-1;jbin>=0;jbin--) {
|
||||
{bool first = true;
|
||||
for(int jbin=ynbin-1;jbin>=0;jbin--) {
|
||||
for(int ibin=xnbin-1;ibin>=0;ibin--) {
|
||||
if(hbe && (a_bins.bin_entries(ibin,jbin)<=0)) continue;
|
||||
|
||||
float val = a_bins.bin_Sw(ibin,jbin);
|
||||
|
||||
float xx = a_bins.bin_lower_edge_x(ibin);
|
||||
float xe = a_bins.bin_upper_edge_x(ibin);
|
||||
float yy = a_bins.bin_lower_edge_y(jbin);
|
||||
float ye = a_bins.bin_upper_edge_y(jbin);
|
||||
|
||||
bins.push_back(rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
|
||||
|
||||
if(first) {
|
||||
first = false;
|
||||
bmin = val;
|
||||
bmax = val;
|
||||
} else {
|
||||
bmin = mn<float>(bmin,val);
|
||||
bmax = mx<float>(bmax,val);
|
||||
}
|
||||
}
|
||||
}}
|
||||
size_t number = bins.size();
|
||||
|
||||
//a_bins.bins_Sw_range(bmin,bmax,false);
|
||||
|
||||
painting_policy painting = a_data_style.painting;
|
||||
if(painting==painting_by_value) {
|
||||
m_bins_cmaps[a_index] = new by_value_colormap(a_out,m_cmaps,a_data_style.color_mapping);
|
||||
@@ -4497,8 +4609,12 @@ protected: //vis bins
|
||||
|
||||
bool hbe = a_bins.has_entries_per_bin();
|
||||
|
||||
float bmin = 0;
|
||||
float bmax = 0;
|
||||
|
||||
std::vector<rep_bin2D> bins;
|
||||
{for(int jbin=ynbin-1;jbin>=0;jbin--) {
|
||||
{bool first = true;
|
||||
for(int jbin=ynbin-1;jbin>=0;jbin--) {
|
||||
for(int ibin=xnbin-1;ibin>=0;ibin--) {
|
||||
if(hbe && (a_bins.bin_entries(ibin,jbin)<=0)) continue;
|
||||
|
||||
@@ -4510,13 +4626,20 @@ protected: //vis bins
|
||||
float ye = a_bins.bin_upper_edge_y(jbin);
|
||||
|
||||
bins.push_back(rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
|
||||
|
||||
if(first) {
|
||||
first = false;
|
||||
bmin = val;
|
||||
bmax = val;
|
||||
} else {
|
||||
bmin = mn<float>(bmin,val);
|
||||
bmax = mx<float>(bmax,val);
|
||||
}
|
||||
}
|
||||
}}
|
||||
size_t number = bins.size();
|
||||
|
||||
float bmin;
|
||||
float bmax;
|
||||
a_bins.bins_Sw_range(bmin,bmax);
|
||||
|
||||
//a_bins.bins_Sw_range(bmin,bmax,false);
|
||||
|
||||
painting_policy painting = a_style.painting;
|
||||
if(painting==painting_by_value) {
|
||||
@@ -4545,7 +4668,11 @@ protected: //vis bins
|
||||
|
||||
} else if(modeling==modeling_curve()){ //gopaw
|
||||
|
||||
float bmin = 0;
|
||||
float bmax = 0;
|
||||
|
||||
std::vector<rep_top_face2D> faces((xnbin-1)*(ynbin-1));
|
||||
{bool first = true;
|
||||
size_t facei = 0;
|
||||
unsigned int xnbin_1 = xnbin-1;
|
||||
unsigned int ynbin_1 = ynbin-1;
|
||||
@@ -4572,10 +4699,22 @@ protected: //vis bins
|
||||
float val3 = a_bins.bin_Sw(ibin+1,jbin+1);
|
||||
float val4 = a_bins.bin_Sw(ibin,jbin+1);
|
||||
|
||||
faces[facei] = rep_top_face2D(xx,xe,yy,ye,val1,val2,val3,val4);
|
||||
faces[facei] = rep_top_face2D(xx,xe,yy,ye,val1,val2,val3,val4);
|
||||
|
||||
if(first) {
|
||||
first = false;
|
||||
bmin = val1;
|
||||
bmax = val1;
|
||||
} else {
|
||||
bmin = mn<float>(bmin,val1);
|
||||
bmax = mx<float>(bmax,val1);
|
||||
}
|
||||
|
||||
facei++;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
//a_bins.bins_Sw_range(bmin,bmax,false);
|
||||
|
||||
painting_policy painting = a_style.painting;
|
||||
if((painting==painting_by_value)||(painting==painting_by_level)) {
|
||||
@@ -4585,9 +4724,6 @@ protected: //vis bins
|
||||
}
|
||||
|
||||
if(painting==painting_by_level) { //gopaw
|
||||
float bmin;
|
||||
float bmax;
|
||||
a_bins.bins_Sw_range(bmin,bmax);
|
||||
rep_top_face2D_xyz_by_level(a_style,painting,*(m_bins_cmaps[a_index]),
|
||||
faces,a_box_x,a_box_y,a_box_z,
|
||||
bmin,bmax/*,SbString(sid.c_str())*/);
|
||||
@@ -8885,14 +9021,14 @@ protected: //etc
|
||||
|
||||
float _zoffset() const {
|
||||
// first data plane is at _zoffset.
|
||||
// last one at m_plottables.size()*_zoffset = xy_depth-_zoffset().
|
||||
return xy_depth.value()/(m_plottables.size()+1);
|
||||
// last one at m_plottables.size()*_zoffset = xy_depth.value()-_zoffset().
|
||||
return xy_depth.value()/(float(m_plottables.size())+1.0f);
|
||||
}
|
||||
float _zaxis() const {return _zoffset();}
|
||||
float _zgrid() const {return xy_depth-_zoffset()*0.5f;}
|
||||
float _zgrid() const {return xy_depth.value()-_zoffset()*0.5f;}
|
||||
float _ztext() const {return 0.01f;} //if text back is visible else 0. (sf<float> zfront ?)
|
||||
float _zscale_text() const {return _zoffset()*0.4f/_ztext();} //title and infos boxes thickness.
|
||||
float _zinfos() const {return xy_depth-_zoffset()*0.4f;} //in front _zgrid
|
||||
float _zinfos() const {return xy_depth.value()-_zoffset()*0.4f;} //in front _zgrid
|
||||
float _zhatch() const {return _zoffset()*0.25f;}
|
||||
float _zerrors() const {return _zoffset()*0.5f;}
|
||||
|
||||
@@ -8906,28 +9042,28 @@ protected: //etc
|
||||
}
|
||||
}
|
||||
|
||||
static float verify_log(float aVal,float aMin,float aDx,bool aLog){
|
||||
if(aLog) {
|
||||
if(aVal>0.0F) {
|
||||
return (flog10(aVal) - aMin)/aDx;
|
||||
static float verify_log(float a_val,float a_min,float a_dx,bool a_log){
|
||||
if(a_log) {
|
||||
if(a_val>0.0F) {
|
||||
return (flog10(a_val) - a_min)/a_dx;
|
||||
} else { // Return a negative large number :
|
||||
//return -FLT_MAX;
|
||||
return -100;
|
||||
}
|
||||
} else {
|
||||
// Simple protection against value that could exceed a float :
|
||||
if(aVal>(aMin+100.0F * aDx)) return 100;
|
||||
if(aVal<aMin-100.0F * aDx) return -100;
|
||||
if(a_val>(a_min+100.0F * a_dx)) return 100;
|
||||
if(a_val<(a_min-100.0F * a_dx)) return -100;
|
||||
// Rescale :
|
||||
return (aVal - aMin)/aDx;
|
||||
return (a_val - a_min)/a_dx;
|
||||
}
|
||||
}
|
||||
|
||||
static float verify_log_inv(float aVal,float aMin,float aDx,bool aLog){
|
||||
if(aLog) {
|
||||
return fpow(10,aVal*aDx+aMin);
|
||||
static float verify_log_inv(float a_val,float a_min,float a_dx,bool a_log){
|
||||
if(a_log) {
|
||||
return fpow(10,a_val*a_dx+a_min);
|
||||
} else {
|
||||
return aVal*aDx+aMin;
|
||||
return a_val*a_dx+a_min;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public:
|
||||
|
||||
typedef std::vector<path_t> paths_t;
|
||||
const paths_t& paths() const {return m_paths;}
|
||||
|
||||
protected:
|
||||
search_what m_what;
|
||||
bool m_stop_at_first;
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#include "../io/iwbuf"
|
||||
#include "../io/irbuf"
|
||||
#include "../stype"
|
||||
|
||||
#include <sstream>
|
||||
#include <istream>
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -48,6 +50,14 @@ public:
|
||||
a_s = strm.str();
|
||||
return true;
|
||||
}
|
||||
virtual bool s2value(const std::string& a_s) {
|
||||
std::istringstream strm(a_s.c_str());
|
||||
T v;
|
||||
strm >> v;
|
||||
if(strm.fail()) return false;
|
||||
parent::value(v);
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
sf(){}
|
||||
sf(const T& a_value):parent(a_value){}
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
//a_out << parent::m_value << std::endl;
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
virtual void set_value(int a_value) {parent::value(T(a_value));}
|
||||
public:
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
//a_out << parent::m_value << std::endl;
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
sf_img():parent(){}
|
||||
sf_img(const img<T>& a_value):parent(a_value){}
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
//a_out << parent::m_value << std::endl;
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
|
||||
virtual bool s2value(const std::string&) {return false;}
|
||||
public:
|
||||
sf_rotf():parent(){}
|
||||
sf_rotf(const rotf& a_value):parent(a_value){}
|
||||
|
||||
@@ -25,8 +25,16 @@ public:
|
||||
str_del(cstr);
|
||||
return true;
|
||||
}
|
||||
virtual bool dump(std::ostream&) {
|
||||
//a_out << parent::m_value << std::endl;
|
||||
virtual bool dump(std::ostream& a_out) {
|
||||
a_out << m_value << std::endl;
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {
|
||||
a_s = m_value;
|
||||
return true;
|
||||
}
|
||||
virtual bool s2value(const std::string& a_s) {
|
||||
value(a_s);
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "sf"
|
||||
|
||||
#include "../words"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
@@ -56,6 +58,36 @@ public:
|
||||
a_out << parent::m_value << std::endl;
|
||||
return true;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {
|
||||
a_s.clear();
|
||||
const T& vec = parent::m_value;
|
||||
for(size_t index=0;index<vec.size();index++) {
|
||||
if(index) a_s += ' ';
|
||||
std::ostringstream strm;
|
||||
strm << vec[index];
|
||||
a_s += strm.str();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool s2value(const std::string& a_s) {
|
||||
std::vector<std::string> ws;
|
||||
words(a_s," ",false,ws);
|
||||
T& vec = parent::m_value;
|
||||
if(ws.size()!=vec.size()) return false;
|
||||
T old_vec = vec;
|
||||
for(size_t index=0;index<vec.size();index++) {
|
||||
std::istringstream strm(ws[index].c_str());
|
||||
TT v;
|
||||
strm >> v;
|
||||
if(strm.fail()) {
|
||||
vec = old_vec;
|
||||
return false;
|
||||
}
|
||||
if(vec[index]!=v) parent::m_touched = true;
|
||||
vec[index] = v;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
sf_vec():parent(){}
|
||||
sf_vec(const T& a_value):parent(a_value){}
|
||||
@@ -76,17 +108,6 @@ public:
|
||||
parent::value(parent::value()+a_value);
|
||||
return *this;
|
||||
}
|
||||
virtual bool s_value(std::string& a_s) const {
|
||||
const T& vec = parent::m_value;
|
||||
typename T::size_type sz = vec.size();
|
||||
std::ostringstream strm;
|
||||
for(typename T::size_type index=0;index<sz;index++) {
|
||||
if(index) strm << " ";
|
||||
strm << vec[index];
|
||||
}
|
||||
a_s = strm.str();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -61,13 +61,12 @@ public:
|
||||
sf<bool> enforced;
|
||||
sf_vec3f translation;
|
||||
sf_string coloring;
|
||||
sf_string filling;
|
||||
sf_string title;
|
||||
public:
|
||||
virtual const desc_fields& node_desc_fields() const {
|
||||
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::style)
|
||||
static const desc_fields s_v(parent::node_desc_fields(),44, //WARNING : take care of count.
|
||||
TOOLS_ARG_FIELD_DESC(color),
|
||||
static const desc_fields s_v(parent::node_desc_fields(),43, //WARNING : take care of count.
|
||||
TOOLS_ARG_FIELD_DESC(color), //1
|
||||
TOOLS_ARG_FIELD_DESC(highlight_color),
|
||||
TOOLS_ARG_FIELD_DESC(back_color),
|
||||
TOOLS_ARG_FIELD_DESC(line_width),
|
||||
@@ -113,7 +112,6 @@ public:
|
||||
|
||||
TOOLS_ARG_FIELD_DESC(translation),
|
||||
TOOLS_ARG_FIELD_DESC(coloring),
|
||||
TOOLS_ARG_FIELD_DESC(filling),
|
||||
TOOLS_ARG_FIELD_DESC(title)
|
||||
);
|
||||
return s_v;
|
||||
@@ -162,7 +160,6 @@ private:
|
||||
add_field(&enforced);
|
||||
add_field(&translation);
|
||||
add_field(&coloring);
|
||||
add_field(&filling);
|
||||
add_field(&title);
|
||||
}
|
||||
public:
|
||||
@@ -210,7 +207,6 @@ public:
|
||||
,enforced(false)
|
||||
,translation(vec3f(0,0,0))
|
||||
,coloring()
|
||||
,filling()
|
||||
,title()
|
||||
{
|
||||
add_fields();
|
||||
@@ -261,7 +257,6 @@ public:
|
||||
,enforced(a_from.enforced)
|
||||
,translation(a_from.translation)
|
||||
,coloring(a_from.coloring)
|
||||
,filling(a_from.filling)
|
||||
,title(a_from.title)
|
||||
{
|
||||
add_fields();
|
||||
@@ -311,7 +306,6 @@ public:
|
||||
enforced = a_from.enforced;
|
||||
translation = a_from.translation;
|
||||
coloring = a_from.coloring;
|
||||
filling = a_from.filling;
|
||||
title = a_from.title;
|
||||
|
||||
return *this;
|
||||
@@ -360,7 +354,6 @@ public:
|
||||
enforced = false;
|
||||
translation = vec3f(0,0,0);
|
||||
coloring = "";
|
||||
filling = "";
|
||||
title = "";
|
||||
}
|
||||
|
||||
@@ -411,7 +404,6 @@ public:
|
||||
sp.enforced(enforced.value());
|
||||
sp.translation(translation.value());
|
||||
sp.coloring(coloring.value());
|
||||
sp.filling(filling.value());
|
||||
sp.title(title.value());
|
||||
|
||||
//if(!sp.parse(a_s,style_parser::def_error_func))
|
||||
@@ -468,7 +460,6 @@ public:
|
||||
enforced.value(sp.enforced());
|
||||
translation.value(sp.translation());
|
||||
coloring.value(sp.coloring());
|
||||
filling.value(sp.filling());
|
||||
title.value(sp.title());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -69,7 +69,6 @@ public:
|
||||
,m_hjust(left)
|
||||
,m_vjust(bottom)
|
||||
,m_coloring()
|
||||
,m_filling()
|
||||
,m_title()
|
||||
,m_pickable(false)
|
||||
{
|
||||
@@ -131,7 +130,6 @@ public:
|
||||
,m_hjust(a_from.m_hjust)
|
||||
,m_vjust(a_from.m_vjust)
|
||||
,m_coloring(a_from.m_coloring)
|
||||
,m_filling(a_from.m_filling)
|
||||
,m_title(a_from.m_title)
|
||||
,m_pickable(a_from.m_pickable)
|
||||
{
|
||||
@@ -194,7 +192,6 @@ public:
|
||||
m_hjust = a_from.m_hjust;
|
||||
m_vjust = a_from.m_vjust;
|
||||
m_coloring = a_from.m_coloring;
|
||||
m_filling = a_from.m_filling;
|
||||
m_title = a_from.m_title;
|
||||
m_pickable = a_from.m_pickable;
|
||||
}
|
||||
@@ -254,7 +251,6 @@ public:
|
||||
if(m_vjust!=a_from.m_vjust) return false;
|
||||
|
||||
if(m_coloring!=a_from.m_coloring) return false;
|
||||
if(m_filling!=a_from.m_filling) return false;
|
||||
if(m_title!=a_from.m_title) return false;
|
||||
if(m_pickable!=a_from.m_pickable) return false;
|
||||
|
||||
@@ -308,7 +304,6 @@ public:
|
||||
m_hjust = left;
|
||||
m_vjust = bottom;
|
||||
m_coloring = "";
|
||||
m_filling = "";
|
||||
m_title = "";
|
||||
m_pickable = false;
|
||||
}
|
||||
@@ -408,10 +403,6 @@ translation %g %g %g"
|
||||
s += "coloring ";
|
||||
s += m_coloring;
|
||||
|
||||
s += lf;
|
||||
s += "filling ";
|
||||
s += m_filling;
|
||||
|
||||
s += lf;
|
||||
s += "title ";
|
||||
s += m_title;
|
||||
@@ -623,9 +614,6 @@ translation %g %g %g"
|
||||
void coloring(const std::string& a_v){m_coloring = a_v;}
|
||||
const std::string& coloring() const {return m_coloring;}
|
||||
|
||||
void filling(const std::string& a_v){m_filling = a_v;}
|
||||
const std::string& filling() const {return m_filling;}
|
||||
|
||||
void title(const std::string& a_v){m_title = a_v;}
|
||||
const std::string& title() const {return m_title;}
|
||||
|
||||
@@ -1277,10 +1265,6 @@ public:
|
||||
if(!check_2(wordn,a_s,line,a_out)) return false;
|
||||
m_coloring = ws[1];
|
||||
|
||||
} else if(word0=="filling") {
|
||||
if(!check_2(wordn,a_s,line,a_out)) return false;
|
||||
m_filling = ws[1];
|
||||
|
||||
} else if(word0=="title") {
|
||||
if(!check_2(wordn,a_s,line,a_out)) return false;
|
||||
m_title = ws[1];
|
||||
@@ -1411,7 +1395,6 @@ protected:
|
||||
sg::hjust m_hjust;
|
||||
sg::vjust m_vjust;
|
||||
std::string m_coloring;
|
||||
std::string m_filling;
|
||||
std::string m_title;
|
||||
bool m_pickable;
|
||||
};
|
||||
|
||||
@@ -48,6 +48,7 @@ protected: //gstos
|
||||
|
||||
public:
|
||||
virtual void render(render_action& a_action) {
|
||||
if(touched()) {clean_gstos();reset_touched();}
|
||||
if(xyzs.empty()) return;
|
||||
|
||||
const state& state = a_action.state();
|
||||
@@ -101,13 +102,16 @@ public:
|
||||
#endif
|
||||
}
|
||||
virtual void pick(pick_action& a_action) {
|
||||
if(touched()) {clean_gstos();reset_touched();}
|
||||
a_action.add__primitive(*this,mode.value(),xyzs.values(),true);
|
||||
}
|
||||
|
||||
virtual void bbox(bbox_action& a_action) {
|
||||
if(touched()) {clean_gstos();reset_touched();}
|
||||
a_action.add_points(xyzs.values());
|
||||
}
|
||||
virtual void is_visible(visible_action& a_action) {
|
||||
if(touched()) {clean_gstos();reset_touched();}
|
||||
if(_is_visible(a_action)) a_action.increment();
|
||||
}
|
||||
|
||||
|
||||
@@ -936,10 +936,14 @@ inline bool value::subtract(value& aThis,const value& aV,std::string& aError){
|
||||
break;
|
||||
case value::UNSIGNED_INT:
|
||||
switch(aV.m_type) {
|
||||
//uuu
|
||||
//case value::UNSIGNED_INT:
|
||||
// aThis.u.m_unsigned_int -= aV.u.m_unsigned_int;
|
||||
// return true;
|
||||
case value::UNSIGNED_INT:
|
||||
if(aThis.u.m_unsigned_int>=aV.u.m_unsigned_int) {
|
||||
aThis.u.m_unsigned_int -= aV.u.m_unsigned_int;
|
||||
} else {
|
||||
int i = int(aThis.u.m_unsigned_int) - aV.u.m_unsigned_int;
|
||||
aThis.set(i);
|
||||
}
|
||||
return true;
|
||||
case value::DOUBLE:{
|
||||
double d = double(aThis.u.m_unsigned_int) - aV.u.m_double;
|
||||
aThis.set(d);
|
||||
@@ -968,7 +972,6 @@ inline bool value::subtract(value& aThis,const value& aV,std::string& aError){
|
||||
//case value::UNSIGNED_CHAR:
|
||||
//case value::CHAR:
|
||||
case value::UNSIGNED_SHORT :
|
||||
case value::UNSIGNED_INT:
|
||||
case value::UNSIGNED_INT64 :
|
||||
case value::DOUBLE_STAR:
|
||||
case value::FLOAT_STAR:
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#define tools_version
|
||||
|
||||
#define TOOLS_MAJOR_VERSION 5
|
||||
#define TOOLS_MINOR_VERSION 0
|
||||
#define TOOLS_PATCH_VERSION 3
|
||||
#define TOOLS_VERSION "5.0.3"
|
||||
#define TOOLS_VERSION_VRP "v5r0p3"
|
||||
#define TOOLS_MINOR_VERSION 1
|
||||
#define TOOLS_PATCH_VERSION 0
|
||||
#define TOOLS_VERSION "5.1.0"
|
||||
#define TOOLS_VERSION_VRP "v5r1p0"
|
||||
|
||||
namespace tools {
|
||||
inline unsigned int version() {return 50003;}
|
||||
inline unsigned int version() {return 50100;}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,8 +87,7 @@ inline void append(std::vector<T>& a_vec,typename std::vector<T>::size_type a_nu
|
||||
template <class T>
|
||||
inline void removep(std::vector<T*>& a_vec,const T* a_elem) {
|
||||
typedef typename std::vector<T*>::iterator it_t;
|
||||
it_t it;
|
||||
for(it=a_vec.begin();it!=a_vec.end();) {
|
||||
for(it_t it=a_vec.begin();it!=a_vec.end();) {
|
||||
if(*it==a_elem) {
|
||||
it = a_vec.erase(it);
|
||||
} else {
|
||||
@@ -100,8 +99,7 @@ inline void removep(std::vector<T*>& a_vec,const T* a_elem) {
|
||||
template <class T>
|
||||
inline bool is_inp(const std::vector<T*>& a_vec,const T* a_item){
|
||||
typedef typename std::vector<T*>::const_iterator it_t;
|
||||
it_t it;
|
||||
for(it=a_vec.begin();it!=a_vec.end();++it) {
|
||||
for(it_t it=a_vec.begin();it!=a_vec.end();++it) {
|
||||
if(*it==a_item) return true;
|
||||
}
|
||||
return false;
|
||||
@@ -160,7 +158,7 @@ inline void unique(std::vector<T>& a_vec) {
|
||||
for(it=a_vec.begin();it!=a_vec.end();++it) {
|
||||
it2 = it;it2++; //TOOLS_STL : it2=it+1 does not compile.
|
||||
for(;it2!=a_vec.end();) {
|
||||
if(*it2==*it) {
|
||||
if((*it2)==(*it)) {
|
||||
it2 = a_vec.erase(it2);
|
||||
} else {
|
||||
++it2;
|
||||
|
||||
@@ -37,23 +37,27 @@ inline void annotations_to(std::ostream& a_writer,const ANNOTATION& a_ans,char a
|
||||
}
|
||||
}
|
||||
|
||||
template <class HIST>
|
||||
inline void h_header(std::ostream& a_writer,const std::string& a_class,const HIST& a_h,char a_hc = '#') {
|
||||
a_writer << a_hc << "class " << a_class << std::endl;
|
||||
a_writer << a_hc << "title " << a_h.title() << std::endl;
|
||||
a_writer << a_hc << "dimension " << a_h.dimension() << std::endl;
|
||||
for(unsigned int iaxis=0;iaxis<a_h.dimension();iaxis++) axis_to(a_writer,a_h.get_axis(iaxis),a_hc);
|
||||
{const std::vector<typename HIST::coordinate_t>& planes = a_h.in_range_planes_xyw();
|
||||
if(planes.size()) {
|
||||
a_writer << a_hc << "planes_Sxyw";
|
||||
for(unsigned int iplane=0;iplane<planes.size();iplane++) a_writer << " " << planes[iplane];
|
||||
a_writer << std::endl;
|
||||
}}
|
||||
annotations_to(a_writer,a_h.annotations(),a_hc);
|
||||
a_writer << a_hc << "bin_number " << a_h.get_bins() << std::endl;
|
||||
}
|
||||
|
||||
template <class HIST>
|
||||
inline bool hto(std::ostream& a_writer,const std::string& a_class,const HIST& a_h,
|
||||
char a_sep = ',',char a_hc = '#',bool a_header = true) {
|
||||
if(a_header) {
|
||||
a_writer << a_hc << "class " << a_class << std::endl;
|
||||
a_writer << a_hc << "title " << a_h.title() << std::endl;
|
||||
a_writer << a_hc << "dimension " << a_h.dimension() << std::endl;
|
||||
for(unsigned int iaxis=0;iaxis<a_h.dimension();iaxis++) axis_to(a_writer,a_h.get_axis(iaxis),a_hc);
|
||||
{const std::vector<typename HIST::coordinate_t>& planes = a_h.in_range_planes_xyw();
|
||||
if(planes.size()) {
|
||||
a_writer << a_hc << "planes_Sxyw";
|
||||
for(unsigned int iplane=0;iplane<planes.size();iplane++) a_writer << " " << planes[iplane];
|
||||
a_writer << std::endl;
|
||||
}}
|
||||
annotations_to(a_writer,a_h.annotations(),a_hc);
|
||||
a_writer << a_hc << "bin_number " << a_h.get_bins() << std::endl;
|
||||
}
|
||||
if(a_header) h_header(a_writer,a_class,a_h,a_hc);
|
||||
|
||||
{a_writer << "entries" << a_sep << "Sw" << a_sep << "Sw2";
|
||||
for(unsigned int iaxis=0;iaxis<a_h.dimension();iaxis++) {
|
||||
a_writer << a_sep << "Sxw" << iaxis << a_sep << "Sx2w" << iaxis;
|
||||
@@ -88,26 +92,30 @@ inline bool hto(std::ostream& a_writer,const std::string& a_class,const HIST& a_
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class PROF>
|
||||
inline void p_header(std::ostream& a_writer,const std::string& a_class,const PROF& a_prof,char a_hc = '#') {
|
||||
a_writer << a_hc << "class " << a_class << std::endl;
|
||||
a_writer << a_hc << "title " << a_prof.title() << std::endl;
|
||||
a_writer << a_hc << "dimension " << a_prof.dimension() << std::endl;
|
||||
for(unsigned int iaxis=0;iaxis<a_prof.dimension();iaxis++) axis_to(a_writer,a_prof.get_axis(iaxis),a_hc);
|
||||
{const std::vector<typename PROF::coordinate_t>& planes = a_prof.in_range_planes_xyw();
|
||||
if(planes.size()) {
|
||||
a_writer << a_hc << "planes_Sxyw";
|
||||
for(unsigned int iplane=0;iplane<planes.size();iplane++) a_writer << " " << planes[iplane];
|
||||
a_writer << std::endl;
|
||||
}}
|
||||
annotations_to(a_writer,a_prof.annotations(),a_hc);
|
||||
a_writer << a_hc << "cut_v " << (a_prof.cut_v()?"true":"false") << std::endl;
|
||||
a_writer << a_hc << "min_v " << a_prof.min_v() << std::endl;
|
||||
a_writer << a_hc << "max_v " << a_prof.max_v() << std::endl;
|
||||
a_writer << a_hc << "bin_number " << a_prof.get_bins() << std::endl;
|
||||
}
|
||||
|
||||
template <class PROF>
|
||||
inline bool pto(std::ostream& a_writer,const std::string& a_class,const PROF& a_prof,
|
||||
char a_sep = ',',char a_hc = '#',bool a_header = true) {
|
||||
if(a_header) {
|
||||
a_writer << a_hc << "class " << a_class << std::endl;
|
||||
a_writer << a_hc << "title " << a_prof.title() << std::endl;
|
||||
a_writer << a_hc << "dimension " << a_prof.dimension() << std::endl;
|
||||
for(unsigned int iaxis=0;iaxis<a_prof.dimension();iaxis++) axis_to(a_writer,a_prof.get_axis(iaxis),a_hc);
|
||||
{const std::vector<typename PROF::coordinate_t>& planes = a_prof.in_range_planes_xyw();
|
||||
if(planes.size()) {
|
||||
a_writer << a_hc << "planes_Sxyw";
|
||||
for(unsigned int iplane=0;iplane<planes.size();iplane++) a_writer << " " << planes[iplane];
|
||||
a_writer << std::endl;
|
||||
}}
|
||||
annotations_to(a_writer,a_prof.annotations(),a_hc);
|
||||
a_writer << a_hc << "cut_v " << (a_prof.cut_v()?"true":"false") << std::endl;
|
||||
a_writer << a_hc << "min_v " << a_prof.min_v() << std::endl;
|
||||
a_writer << a_hc << "max_v " << a_prof.max_v() << std::endl;
|
||||
a_writer << a_hc << "bin_number " << a_prof.get_bins() << std::endl;
|
||||
}
|
||||
if(a_header) p_header(a_writer,a_class,a_prof,a_hc);
|
||||
|
||||
{a_writer << "entries" << a_sep << "Sw" << a_sep << "Sw2" << a_sep << "Svw" << a_sep << "Sv2w";
|
||||
for(unsigned int iaxis=0;iaxis<a_prof.dimension();iaxis++) {
|
||||
a_writer << a_sep << "Sxw" << iaxis << a_sep << "Sx2w" << iaxis;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#define tools_wroot_streamers
|
||||
|
||||
#include "named"
|
||||
#include "date"
|
||||
#include "directory"
|
||||
#include "file"
|
||||
#include "../vmanip" //convert
|
||||
|
||||
Reference in New Issue
Block a user