Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -86,14 +86,12 @@ public:
|
||||
sf_string encoding;
|
||||
sf_enum<font_type> font;
|
||||
public:
|
||||
virtual const std::vector<field_desc>& node_fields() const {
|
||||
virtual const desc_fields& node_desc_fields() const {
|
||||
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::text_hershey)
|
||||
static std::vector<field_desc> s_v;
|
||||
if(s_v.empty()) {
|
||||
s_v = parent::node_fields();
|
||||
TOOLS_ADD_FIELD_DESC(encoding)
|
||||
TOOLS_ADD_FIELD_DESC(font)
|
||||
}
|
||||
static const desc_fields s_v(parent::node_desc_fields(),2, //WARNING : take care of count.
|
||||
TOOLS_ARG_FIELD_DESC(encoding),
|
||||
TOOLS_ARG_FIELD_DESC(font)
|
||||
);
|
||||
return s_v;
|
||||
}
|
||||
private:
|
||||
@@ -102,7 +100,7 @@ private:
|
||||
add_field(&font);
|
||||
}
|
||||
protected: //gstos
|
||||
virtual unsigned int create_gsto(std::ostream&,sg::gl_manager& a_mgr) {
|
||||
virtual unsigned int create_gsto(std::ostream&,sg::render_manager& a_mgr) {
|
||||
std::vector<float> gsto_data;
|
||||
|
||||
{size_t npts = m_segs.size()/2; //2 coords
|
||||
@@ -127,7 +125,7 @@ public:
|
||||
}
|
||||
const state& state = a_action.state();
|
||||
if(state.m_use_gsto) {
|
||||
unsigned int _id = get_gsto_id(a_action.out(),a_action.gl_manager());
|
||||
unsigned int _id = get_gsto_id(a_action.out(),a_action.render_manager());
|
||||
if(_id) {
|
||||
a_action.begin_gsto(_id);
|
||||
a_action.draw_gsto_v(gl::lines(),m_gsto_sz/3,0);
|
||||
@@ -139,7 +137,7 @@ public:
|
||||
}
|
||||
|
||||
} else {
|
||||
clean_gstos(&a_action.gl_manager());
|
||||
clean_gstos(&a_action.render_manager());
|
||||
}
|
||||
|
||||
// immediate rendering :
|
||||
@@ -437,7 +435,7 @@ protected:
|
||||
|
||||
static void string_segs(
|
||||
bool aGEN_POINTS // false = advance only.
|
||||
,const std::string& aString
|
||||
,const std::string& a_string
|
||||
,float a_height
|
||||
,const std::string& a_encoding
|
||||
,font_type a_font
|
||||
@@ -451,7 +449,9 @@ protected:
|
||||
|
||||
bool encod_PAW = (a_encoding==encoding_PAW()?true:false);
|
||||
|
||||
sencoded sed = encod_PAW ? decode_PAW(aString) : decode_plain(aString);
|
||||
sencoded sed;
|
||||
if(encod_PAW) decode_PAW(a_string,sed);
|
||||
else decode_plain(a_string,sed);
|
||||
|
||||
tools_vforcit(hchar,sed,it) {
|
||||
const hchar& hc = *it;
|
||||
@@ -556,15 +556,14 @@ protected:
|
||||
|
||||
typedef std::vector<hchar> sencoded;
|
||||
|
||||
static sencoded decode_plain(const std::string& a_s){
|
||||
sencoded sed;
|
||||
static void decode_plain(const std::string& a_s,sencoded& a_sed){
|
||||
a_sed.clear();
|
||||
tools_sforcit(a_s,it) {
|
||||
hchar hc;
|
||||
hc.m_char = *it;
|
||||
sed.push_back(hc);
|
||||
a_sed.push_back(hc);
|
||||
}
|
||||
if(sed.size()) sed[sed.size()-1].m_cr = true;
|
||||
return sed;
|
||||
if(a_sed.size()) a_sed[a_sed.size()-1].m_cr = true;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// PAW encoding //////////////////////////////////////////////////////////
|
||||
@@ -578,16 +577,20 @@ protected:
|
||||
// ^ go to superscript
|
||||
// ? go to subscript
|
||||
// & backscpace one charachter
|
||||
// < go to lower case
|
||||
// > go to upper case (default)
|
||||
// Extension :
|
||||
// | draw a bar over one character
|
||||
// Found in PAW manual Version 1.14 (July 1992), page 178, 180.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
static sencoded decode_PAW(const std::string& a_s){
|
||||
sencoded sed;
|
||||
static void decode_PAW(const std::string& a_s,sencoded& a_sed){
|
||||
a_sed.clear();
|
||||
|
||||
font_type font = sg::latin;
|
||||
hchar::e_move move = hchar::none;
|
||||
bool back = false;
|
||||
bool bar = false;
|
||||
//bool upper = true; //to be done.
|
||||
|
||||
tools_sforcit(a_s,it) {
|
||||
char c = *it;
|
||||
@@ -616,8 +619,11 @@ protected:
|
||||
} else if(c=='&') {
|
||||
back = true;
|
||||
continue;
|
||||
} else if(c=='|') {
|
||||
bar = true;
|
||||
} else if(c=='<') {
|
||||
//upper = false;
|
||||
continue;
|
||||
} else if(c=='>') {
|
||||
//upper = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -625,62 +631,16 @@ protected:
|
||||
hc.m_y_move = move;
|
||||
hc.m_back = back;
|
||||
hc.m_bar = bar;
|
||||
hc.m_font = font;
|
||||
hc.m_char = c;
|
||||
|
||||
if(font==sg::special) {
|
||||
hc.m_font = sg::latin;
|
||||
//if(c=='A') {
|
||||
// hc.m_char = '';
|
||||
//} else
|
||||
if(c=='B') {
|
||||
hc.m_char = '|';
|
||||
//} else if(c=='C') {
|
||||
// hc.m_char = '';
|
||||
} else if(c=='D') {
|
||||
hc.m_char = '$';
|
||||
} else if(c=='E') {
|
||||
hc.m_char = '!';
|
||||
} else if(c=='F') {
|
||||
hc.m_char = '#';
|
||||
} else if(c=='G') {
|
||||
hc.m_char = '>';
|
||||
} else if(c=='H') {
|
||||
hc.m_char = '?';
|
||||
//} else if(c=='I') {
|
||||
// hc.m_char = '';
|
||||
} else if(c=='J') {
|
||||
hc.m_char = ':';
|
||||
} else if(c=='K') {
|
||||
hc.m_char = ';';
|
||||
} else if(c=='L') {
|
||||
hc.m_char = '<';
|
||||
} else if(c=='M') {
|
||||
hc.m_char = '[';
|
||||
} else if(c=='N') {
|
||||
hc.m_char = ']';
|
||||
|
||||
} else if(c=='W') {
|
||||
hc.m_char = '&';
|
||||
} else if(c=='Y') {
|
||||
hc.m_char = '%';
|
||||
} else {
|
||||
//FIXME : handle other characters.
|
||||
hc.m_char = c;
|
||||
}
|
||||
|
||||
} else {
|
||||
hc.m_font = font;
|
||||
hc.m_char = c;
|
||||
}
|
||||
|
||||
|
||||
sed.push_back(hc);
|
||||
a_sed.push_back(hc);
|
||||
|
||||
back = false;
|
||||
bar = false;
|
||||
}
|
||||
|
||||
if(sed.size()) sed[sed.size()-1].m_cr = true;
|
||||
return sed;
|
||||
if(a_sed.size()) a_sed[a_sed.size()-1].m_cr = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user