Skip to content

Commit 9e08284

Browse files
andyclaude
andcommitted
Merge origin/main into wip/win-merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFPK14wBcLD1s4dYUowpP4
2 parents 4f1b1c6 + b875118 commit 9e08284

17 files changed

Lines changed: 184 additions & 21 deletions

‎CMakeLists.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,14 @@ if(PYTHON3_EXECUTABLE)
18631863
${CMAKE_BINARY_DIR}/viewer-scenes)
18641864
set_tests_properties(look_offscreen_shading PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 300)
18651865

1866+
# Sticks are thinner while normal-mode arrows are shown, normal again
1867+
# when they are hidden (#227). Needs `ninja viewer-scenes` and Xvfb.
1868+
add_test(NAME look_nm_sticks
1869+
COMMAND ${PYTHON3_EXECUTABLE}
1870+
${CMAKE_CURRENT_SOURCE_DIR}/tests/look/nm_sticks.py
1871+
${CMAKE_BINARY_DIR}/viewer-scenes)
1872+
set_tests_properties(look_nm_sticks PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 300)
1873+
18661874
# tests/guivalues -- memory sizes saved before the GB-everywhere change
18671875
# (Megawords, Megabytes) are converted by GUIValues::load() before a
18681876
# dialog or a generator reads them. Needs g++ and libecceutil.a.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
type: rule
3+
title: "Ball And Stick is the default style; sticks are drawn at 0.25 radius while normal-mode arrows are shown (#227)"
4+
area: wx-viewer
5+
paths: [src/tdat/chemistry/DisplayDescriptor.C, src/tdat/chemistry/TAtm.C, src/tdat/chemistry/Fragment.C, src/tdat/chemistry/Residue.C, include/tdat/DisplayStyle.H, src/viz/sgcommands/SGContainer.C, src/wxviz/viztools/ViewerEvtHandler.C, src/wxviz/viewer/VizRender.C, tests/look/nm_sticks.py]
6+
issues: [227]
7+
---
8+
The default comes from several places that must agree: `DisplayDescriptor::DISPLAY`,
9+
the `TAtm`/`Fragment`/`Residue` constructors, `DisplayStyle`'s default argument,
10+
`SGContainer`'s initial style and fragment style, and the two `DefaultStyle`
11+
fallbacks in `ViewerEvtHandler` and `VizRender`. A style a user saved
12+
(`DefaultStyle` in the viewer's ini, written on exit) still wins; there is no
13+
way to tell a saved Ball And Wireframe from the old default, so existing users
14+
keep it.
15+
16+
An arrow along a bond lies inside the stick. While the normal-mode arrow switch
17+
(`getNMVecRoot()`) is not NONE and holds arrows, `SGContainer::applyNMStickScale`
18+
multiplies every `bondCylinderRadius` by `NM_STICK_FACTOR` (0.25) and divides it
19+
back when they are hidden; a field sensor on the switch's `whichChild` triggers
20+
it, so it runs from the event loop's delay queue (a scene script must call
21+
`processDelayQueue`, as `nmhide` does). At 0.15 the bond disappears, at 0.4 the
22+
shaft (0.035 A) is still half inside the stick. The normal-mode animation
23+
(`getNMRoot()`) shows no arrows and keeps normal sticks.

‎docs/claude/wx-viewer/wireframe-bonds-are-3-px-smoothed-and-scaled-by-the-canvas.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ area: wx-viewer
55
paths: [src/tdat/chemistry/DisplayDescriptor.C, src/viz/sgcommands/SGContainer.C, src/inv/moiv/ChemDisplayWireframe.C, src/inv/wxinv/SoWxRenderArea.C, include/inv/ChemKit/ChemDisplayParam.H]
66
issues: [227]
77
---
8-
At 1 px the default Ball And Wireframe bonds were unreadable on white.
8+
At 1 px the (then default) Ball And Wireframe bonds were unreadable on white; the default style is now Ball And Stick, see the entry on thin sticks.
99
`DisplayDescriptor::LINEWDTH` is 3 and `SGContainer::applyStyle` sets
1010
`bondWireframeAntiAlias` to WITH_DEPTH_COMPARISON. GL line width is in device
1111
pixels, so `SoWxRenderArea::OnSize` publishes `GetContentScaleFactor()` through

‎include/tdat/DisplayStyle.H‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DisplayStyle
1717
enum Style { STICK, BALLSTICK, BALLWIRE, WIRE, DNONE, CPK,
1818
CAWIRE, CYLINDER, LINE, FLAT, SOLID, CARTOON, INVALIDSTYLE };
1919

20-
DisplayStyle(DisplayStyle::Style style = DisplayStyle::BALLWIRE);
20+
DisplayStyle(DisplayStyle::Style style = DisplayStyle::BALLSTICK);
2121
virtual ~DisplayStyle();
2222

2323
void setName(const string& name);

‎include/viz/SGContainer.H‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class ChemColor;
55
class ChemRadii;
66
class SoSeparator;
7+
class SoFieldSensor;
78
class SoSwitch;
89
class ChemDisplay;
910
class ChemDisplayParam;
@@ -86,6 +87,8 @@ public:
8687
double displayedSphereRadius(int idx);
8788
// Re-seat the normal-mode arrows on the spheres now drawn.
8889
void updateNMVecStarts();
90+
// Bond cylinders are drawn thinner while normal-mode arrows are shown.
91+
void applyNMStickScale();
8992

9093
DisplayStyle::Style toOurStyle(ChemDisplayParam::DisplayBinding style);
9194
ChemDisplayParam::DisplayBinding toChemkitStyle(DisplayStyle::Style style);
@@ -278,6 +281,8 @@ SoINTERNAL public:
278281
// ---------------------- Property Stuff ----------------------------
279282
SoSwitch* p_MOSwitch;
280283
SoSwitch* p_NMVecSwitch;
284+
float p_nmStickScale;
285+
SoFieldSensor* p_nmSwitchSensor;
281286
SoSwitch* p_NMSwitch;
282287

283288
// ---------------------- Grid Property Stuff ----------------------------

‎src/tdat/chemistry/DisplayDescriptor.C‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "tdat/DisplayDescriptor.H"
1818

1919
//Default values
20-
const string DisplayDescriptor::DISPLAY = "Ball And Wireframe";
20+
const string DisplayDescriptor::DISPLAY = "Ball And Stick";
2121
const string DisplayDescriptor::COLORSCHEME = "Element";
2222
const int DisplayDescriptor::LINEWDTH = 3;
2323
const bool DisplayDescriptor::ANTIALIAS = false;

‎src/tdat/chemistry/DisplayStyle.C‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DisplayStyle::DisplayStyle(DisplayStyle::Style style )
77
p_displayFlag = true;
88
if (style == DisplayStyle::DNONE) {
99
p_displayFlag = false;
10-
p_style = DisplayStyle::BALLWIRE;
10+
p_style = DisplayStyle::BALLSTICK;
1111
}
1212
p_style = style;
1313
}

‎src/tdat/chemistry/Fragment.C‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
* This fragment has no name, atoms, residues, or constraints.
7373
*
7474
*/
75-
Fragment::Fragment() : p_mainDisplayStyle(DisplayStyle::BALLWIRE)
75+
Fragment::Fragment() : p_mainDisplayStyle(DisplayStyle::BALLSTICK)
7676
{
7777
p_name = "";
7878
p_charge = 0;
@@ -99,7 +99,7 @@ Fragment::Fragment(const string& name,
9999
const double* coordinates,
100100
const int numBonds,
101101
const int *bonds)
102-
: p_mainDisplayStyle(DisplayStyle::BALLWIRE)
102+
: p_mainDisplayStyle(DisplayStyle::BALLSTICK)
103103
{
104104
p_name = name;
105105
p_charge = 0;
@@ -138,7 +138,7 @@ Fragment::Fragment(const string& name,
138138
const double* coordinates,
139139
const int numBonds,
140140
const int *bonds)
141-
: p_mainDisplayStyle(DisplayStyle::BALLWIRE)
141+
: p_mainDisplayStyle(DisplayStyle::BALLSTICK)
142142
{
143143
p_name = name;
144144
p_charge = 0;
@@ -164,7 +164,7 @@ Fragment::Fragment(const string& name,
164164

165165

166166
Fragment::Fragment( const string& name )
167-
: p_mainDisplayStyle(DisplayStyle::BALLWIRE)
167+
: p_mainDisplayStyle(DisplayStyle::BALLSTICK)
168168
{
169169
p_name = name;
170170
p_charge = 0;
@@ -188,7 +188,7 @@ Fragment::Fragment( const string& name )
188188
* Copy Constructor.
189189
*/
190190
Fragment::Fragment(const Fragment& frag)
191-
: p_mainDisplayStyle(DisplayStyle::BALLWIRE)
191+
: p_mainDisplayStyle(DisplayStyle::BALLSTICK)
192192
{
193193
p_constraints = 0;
194194
p_potentials = 0;

‎src/tdat/chemistry/Residue.C‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static int vnumStatus = sizeof(vstatusMap)/sizeof(char*);
3737
//
3838
///////////////////////////////////////////////////////////////////////////////
3939
Residue::Residue(const char *cname, const int& number)
40-
: p_displayStyle(DisplayStyle::BALLWIRE)
40+
: p_displayStyle(DisplayStyle::BALLSTICK)
4141
{
4242

4343
name(cname);

‎src/tdat/chemistry/TAtm.C‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ using std::find;
5252
//
5353
///////////////////////////////////////////////////////////////////////////////
5454
TAtm::TAtm()
55-
: p_displayStyle(DisplayStyle::BALLWIRE)
55+
: p_displayStyle(DisplayStyle::BALLSTICK)
5656
{
5757
TPerTab tpt;
5858
strcpy(p_atomName,"");
@@ -97,7 +97,7 @@ TAtm::TAtm()
9797
//
9898
///////////////////////////////////////////////////////////////////////////////
9999
TAtm::TAtm(const char *tagString, const double* coord, const string& suffix)
100-
: p_displayStyle(DisplayStyle::BALLWIRE)
100+
: p_displayStyle(DisplayStyle::BALLSTICK)
101101
{
102102
TPerTab tpt;
103103
p_atomicNumber = tpt.atomicNumber(tagString);
@@ -142,7 +142,7 @@ TAtm::TAtm(const char *tagString, const double* coord, const string& suffix)
142142
//
143143
///////////////////////////////////////////////////////////////////////////////
144144
TAtm::TAtm(short atomicNumber, const double* coord, const string& suffix)
145-
: p_displayStyle(DisplayStyle::BALLWIRE)
145+
: p_displayStyle(DisplayStyle::BALLSTICK)
146146
{
147147
TPerTab tpt;
148148
string tagString = tpt.atomicSymbol(atomicNumber);
@@ -182,7 +182,7 @@ TAtm::TAtm(short atomicNumber, const double* coord, const string& suffix)
182182
* Copy constructor.
183183
*/
184184
TAtm::TAtm(const TAtm& atom)
185-
: p_displayStyle(DisplayStyle::BALLWIRE)
185+
: p_displayStyle(DisplayStyle::BALLSTICK)
186186
{
187187
*this = atom;
188188
}

0 commit comments

Comments
 (0)