// draw the geometry marker in the given Displayable's drawing list void GeometryBond::create_cmd_list() { char valbuf[32]; // get the transformed positions, and draw a line between them float pos1[3], pos2[3]; reset_disp_list(); if(!transformed_atom_coord(0, pos1)) return; if(!transformed_atom_coord(1, pos2)) return; append(DMATERIALOFF); DispCmdColorIndex cmdColor; cmdColor.putdata(my_color, cmdList); DispCmdLineType cmdLineType; DispCmdLineWidth cmdLineWidth; cmdLineType.putdata(DASHEDLINE, cmdList); cmdLineWidth.putdata(4, cmdList); // print value of distance at midpoint midpoint(valuePos, pos1, pos2); // left-align the value so that it doesn't appear to shift its position // when the label text size changes. Shift it to the right by a constant // amount so that it doesn't intersect the line. valuePos[0] += 0.05f; sprintf(valbuf, "%-7.2f", geomValue); display_string(valbuf, cmdList); // draw a line into the given Displayable display_line(pos1, pos2, cmdList); }
// draw the geometry marker in the given Displayable's drawing list void GeometryAtom::create_cmd_list() { reset_disp_list(); // get the molecule pointer and atom position Molecule *mol = transformed_atom_coord(0, valuePos); // do not draw if illegal molecule, or atom is not on if(!mol) return; append(DMATERIALOFF); DispCmdColorIndex cmdColor; cmdColor.putdata(my_color,cmdList); // everything is OK, draw text at atom position JString str; atom_formatted_name(str, mol, comIndex[0]); display_string((const char *)str, cmdList); }