Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user