23 singlePrecision(
true) {
26 union {
long l;
char c[
sizeof (long)]; }
u;
32 if (
tags.size() <= 0) {
34 tags[
"heprep"] = 0x05;
35 tags[
"attdef"] = 0x06;
36 tags[
"attvalue"] = 0x07;
37 tags[
"instance"] = 0x08;
38 tags[
"treeid"] = 0x09;
39 tags[
"action"] = 0x0a;
40 tags[
"instancetree"] = 0x0b;
42 tags[
"typetree"] = 0x0d;
83 values[
"drawasoptions"] = 0x86;
84 values[
"visibility"] = 0x87;
89 values[
"fontstyle"] = 0x8a;
91 values[
"fontcolor"] = 0x8c;
92 values[
"fonthasframe"] = 0x8d;
93 values[
"fontframecolor"] = 0x8e;
94 values[
"fontframewidth"] = 0x8f;
95 values[
"fonthasbanner"] = 0x90;
96 values[
"fontbannercolor"] = 0x91;
99 values[
"framecolor"] = 0x93;
101 values[
"markname"] = 0x95;
102 values[
"marksize"] = 0x96;
103 values[
"marksizemultiplier"] = 0x97;
104 values[
"marktype"] = 0x98;
105 values[
"hasframe"] = 0x99;
106 values[
"framecolor"] = 0x9a;
107 values[
"framewidth"] = 0x9b;
109 values[
"linestyle"] = 0x9c;
110 values[
"linewidth"] = 0x9d;
111 values[
"linewidthmultiplier"] = 0x9e;
112 values[
"linehasarrow"] = 0x9f;
114 values[
"fillcolor"] = 0xa0;
115 values[
"filltype"] = 0xa1;
125 values[
"curvature"] = 0xaa;
126 values[
"flylength"] = 0xab;
135 values[
"ispickable"] = 0xb2;
136 values[
"showparentvalues"] = 0xb3;
137 values[
"pickparent"] = 0xb4;
150 values[
"ellipsoid"] = 0xd9;
152 values[
"cylinder"] = 0xdb;
153 values[
"ellipseprism"] = 0xdc;
161 values[
"uptriangle"] = 0xe2;
162 values[
"dntriangle"] = 0xe3;
181 values[
"sansserif"] = 0xf3;
182 values[
"monotype"] = 0xf4;
190 values[
"baseline"] = 0xfa;
215 version =
"BinaryHepRep/1.0";
245 std::string
s = tagName;
249 if (
tags.count(s) <= 0) {
250 std::cerr <<
"Cannot find tag '" << s <<
"' in tags table." << std::endl;
255 bool isPoint = (s ==
"point");
258 if (!hasAttributes && isPoint) {
273 std::string
name = i->first;
274 std::string
value = i->second;
280 if (
values.count(v) > 0) {
300 std::string
name = i->first;
301 std::vector<double>
value = i->second;
307 writeByte((
int)(value[0] * 0xff) & 0xff);
308 writeByte((
int)(value[1] * 0xff) & 0xff);
309 writeByte((
int)(value[2] * 0xff) & 0xff);
310 if (value.size() > 3)
writeByte((
int)(value[3] * 0xff) & 0xff);
316 std::string
name = i->first;
329 std::string
name = i->first;
330 int value = i->second;
342 std::string
name = i->first;
343 bool value = i->second;
353 std::string
name = i->first;
354 double value = i->second;
355 if (!isPoint && (name !=
"x") && (name !=
"y") && (name !=
"z")) {
378 if (isPoint && !hasContent) {
385 if (
points.size() <= 0)
return;
390 for (std::vector<double>::iterator i =
points.begin(); i !=
points.end(); ) {
405 if (name ==
"value") name = name.append(
"String");
409 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
417 if (name ==
"value") name = name.append(
"Color");
421 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
429 if (name ==
"value") name = name.append(
"Long");
433 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
441 if (name ==
"value") name = name.append(
"Int");
445 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
453 if (name ==
"value") name = name.append(
"Boolean");
457 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
465 if (name ==
"value") name = name.append(
"Double");
469 std::cerr <<
"Cannot find attribute name '" << name <<
"' in attributes table, skipped." << std::endl;
482 unsigned char buf[5];
486 buf[idx++] = (
unsigned char) (ui & 0x7f);
518 os.put((i >> 56) & 0xff);
519 os.put((i >> 48) & 0xff);
520 os.put((i >> 40) & 0xff);
521 os.put((i >> 32) & 0xff);
522 os.put((i >> 24) & 0xff);
523 os.put((i >> 16) & 0xff);
524 os.put((i >> 8) & 0xff);
530 os.put((i >> 24) & 0xff);
531 os.put((i >> 16) & 0xff);
532 os.put((i >> 8) & 0xff);