Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
4b3c0e5c
Commit
4b3c0e5c
authored
14 years ago
by
Ansgar Philippsen
Browse files
Options
Downloads
Patches
Plain Diff
fixed strand continuity in mode 0; added helix & strand mode to hsc widget
parent
7a6314a9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gfx/src/impl/cartoon_renderer.cc
+75
-75
75 additions, 75 deletions
modules/gfx/src/impl/cartoon_renderer.cc
modules/gui/pymod/scene/hsc_widget.py
+29
-4
29 additions, 4 deletions
modules/gui/pymod/scene/hsc_widget.py
with
104 additions
and
79 deletions
modules/gfx/src/impl/cartoon_renderer.cc
+
75
−
75
View file @
4b3c0e5c
...
...
@@ -79,13 +79,13 @@ void CartoonRenderer::PrepareRendering(const BackboneTrace& subset,
int
type
=
0
;
const
NodeEntry
&
entry
=
nl
[
i
];
if
(
!
force_tube_
)
{
mol
::
ResidueHandle
resh
=
entry
.
atom
.
GetResidue
();
mol
::
SecStructure
sst
=
resh
.
GetSecStructure
();
if
(
sst
.
IsHelical
())
{
type
=
1
;
}
else
if
(
sst
.
IsExtended
())
{
type
=
2
;
}
mol
::
ResidueHandle
resh
=
entry
.
atom
.
GetResidue
();
mol
::
SecStructure
sst
=
resh
.
GetSecStructure
();
if
(
sst
.
IsHelical
())
{
type
=
1
;
}
else
if
(
sst
.
IsExtended
())
{
type
=
2
;
}
}
SplineEntry
ee
(
entry
.
atom
.
GetPos
(),
entry
.
direction
,
entry
.
normal
,
entry
.
rad
,
...
...
@@ -137,7 +137,7 @@ void CartoonRenderer::PrepareRendering()
for
(
int
nlc
=
0
;
nlc
<
sel_subset_
.
GetListCount
();
++
nlc
)
{
const
NodeEntryList
&
nelist
=
sel_subset_
.
GetList
(
nlc
);
for
(
NodeEntryList
::
const_iterator
nit
=
nelist
.
begin
();
nit
!=
nelist
.
end
();
++
nit
)
{
id_set
.
insert
(
nit
->
id
);
id_set
.
insert
(
nit
->
id
);
}
}
// now find all matching spline segments
...
...
@@ -147,28 +147,28 @@ void CartoonRenderer::PrepareRendering()
SplineEntryList
nlist
;
unsigned
int
sc
=
0
;
while
(
sc
<
slist
.
size
())
{
int
curr_id
=
slist
.
at
(
sc
).
id
;
if
(
id_set
.
count
(
curr_id
)
>
0
)
{
// if a match is found, add all until a new id is found
while
(
sc
<
slist
.
size
()
&&
slist
.
at
(
sc
).
id
==
curr_id
)
{
nlist
.
push_back
(
slist
[
sc
++
]);
// override with the selection color
nlist
.
back
().
color1
=
sel_color
;
nlist
.
back
().
color2
=
sel_color
;
}
}
else
{
// introduce break
if
(
!
nlist
.
empty
())
{
sel_spline_list_list_
.
push_back
(
nlist
);
nlist
.
clear
();
}
// and advance to the next id
while
(
sc
<
slist
.
size
()
&&
slist
.
at
(
sc
).
id
==
curr_id
)
++
sc
;
}
int
curr_id
=
slist
.
at
(
sc
).
id
;
if
(
id_set
.
count
(
curr_id
)
>
0
)
{
// if a match is found, add all until a new id is found
while
(
sc
<
slist
.
size
()
&&
slist
.
at
(
sc
).
id
==
curr_id
)
{
nlist
.
push_back
(
slist
[
sc
++
]);
// override with the selection color
nlist
.
back
().
color1
=
sel_color
;
nlist
.
back
().
color2
=
sel_color
;
}
}
else
{
// introduce break
if
(
!
nlist
.
empty
())
{
sel_spline_list_list_
.
push_back
(
nlist
);
nlist
.
clear
();
}
// and advance to the next id
while
(
sc
<
slist
.
size
()
&&
slist
.
at
(
sc
).
id
==
curr_id
)
++
sc
;
}
}
if
(
!
nlist
.
empty
())
{
sel_spline_list_list_
.
push_back
(
nlist
);
nlist
.
clear
();
sel_spline_list_list_
.
push_back
(
nlist
);
nlist
.
clear
();
}
}
RebuildSplineObj
(
sel_va_
,
sel_spline_list_list_
,
true
);
...
...
@@ -287,17 +287,17 @@ void CartoonRenderer::FudgeSplineObj(SplineEntryListList& olistlist)
nlistlist
.
push_back
(
nlist
);
nlist
.
clear
();
}
// make a two entry list with the cyl type
nlist
.
push_back
(
SplineEntry
(
cyl
.
first
,
geom
::
Vec3
(),
geom
::
Vec3
(),
0.0
,
olist
[
lstart
].
color1
,
olist
[
lstart
].
color1
,
6
,
olist
[
lstart
].
id
));
nlist
.
push_back
(
SplineEntry
(
cyl
.
second
,
geom
::
Vec3
(),
geom
::
Vec3
(),
0.0
,
olist
[
lend
].
color1
,
olist
[
lend
].
color1
,
6
,
olist
[
lend
].
id
));
nlistlist
.
push_back
(
nlist
);
nlist
.
clear
();
// make a two entry list with the cyl type
nlist
.
push_back
(
SplineEntry
(
cyl
.
first
,
geom
::
Vec3
(),
geom
::
Vec3
(),
0.0
,
olist
[
lstart
].
color1
,
olist
[
lstart
].
color1
,
6
,
olist
[
lstart
].
id
));
nlist
.
push_back
(
SplineEntry
(
cyl
.
second
,
geom
::
Vec3
(),
geom
::
Vec3
(),
0.0
,
olist
[
lend
].
color1
,
olist
[
lend
].
color1
,
6
,
olist
[
lend
].
id
));
nlistlist
.
push_back
(
nlist
);
nlist
.
clear
();
if
(
lend
+
1
<
olist
.
size
())
{
// and get going with an entry at the end of the cylinder
SplineEntry
tmp_start
(
olist
[
lend
]);
...
...
@@ -329,42 +329,42 @@ void CartoonRenderer::FudgeSplineObj(SplineEntryListList& olistlist)
for
(;
lc
<
olist
.
size
()
&&
olist
.
at
(
lc
).
type
==
2
;
++
lc
,
++
kend
)
{
nlist
.
push_back
(
olist
.
at
(
lc
));
}
if
(
kend
-
kstart
<
2
)
{
// dont bother with too short strands
for
(
unsigned
int
i
=
kstart
;
i
<
kend
;
++
i
)
{
nlist
.
at
(
i
).
type
=
0
;
}
}
else
{
kend
-=
1
;
// these magic numbers are used in RebuildSplineObj for proper arrow rendering
nlist
.
at
(
kend
-
1
).
type
=
3
;
nlist
.
at
(
kend
).
type
=
5
;
if
(
options_
->
GetStrandMode
()
==
1
)
{
// smooth the strands for mode 1
nlist
.
at
(
kstart
).
direction
=
geom
::
Normalize
(
nlist
.
at
(
kend
).
position
-
nlist
.
at
(
kstart
).
position
);
nlist
.
at
(
kend
).
direction
=
nlist
.
at
(
kstart
).
direction
;
float
invf
=
1.0
/
static_cast
<
float
>
(
kend
-
kstart
);
for
(
unsigned
int
k
=
kstart
;
k
<=
kend
;
++
k
)
{
float
f
=
static_cast
<
float
>
(
k
-
kstart
)
*
invf
;
nlist
.
at
(
k
).
position
=
nlist
.
at
(
kstart
).
position
+
f
*
(
nlist
.
at
(
kend
).
position
-
nlist
.
at
(
kstart
).
position
);
nlist
.
at
(
k
).
direction
=
nlist
.
at
(
kstart
).
direction
;
geom
::
Vec3
tmpn
=
geom
::
Normalize
(
nlist
.
at
(
kstart
).
normal
+
f
*
(
nlist
.
at
(
kend
).
normal
-
nlist
.
at
(
kstart
).
normal
));
geom
::
Vec3
tmpx
=
geom
::
Normalize
(
geom
::
Cross
(
nlist
.
at
(
kstart
).
direction
,
tmpn
));
nlist
.
at
(
k
).
normal
=
geom
::
Normalize
(
geom
::
Cross
(
tmpx
,
nlist
.
at
(
kstart
).
direction
));
}
}
// break nodelist, re-start at arrow tip for both modes
if
(
lc
+
1
<
olist
.
size
())
{
nlist
list
.
push_back
(
nlist
);
nlist
.
clear
(
);
nlist
.
push_back
(
nlist
list
.
back
().
back
())
;
nlist
.
back
().
type
=
0
;
nlist
.
back
().
color
1
=
olist
[
lc
+
1
].
color
1
;
nlist
.
back
().
color2
=
olist
[
lc
+
1
].
color2
;
}
}
if
(
kend
-
kstart
<
2
)
{
// dont bother with too short strands
for
(
unsigned
int
i
=
kstart
;
i
<
kend
;
++
i
)
{
nlist
.
at
(
i
).
type
=
0
;
}
}
else
{
kend
-=
1
;
// these magic numbers are used in RebuildSplineObj for proper arrow rendering
nlist
.
at
(
kend
-
1
).
type
=
3
;
nlist
.
at
(
kend
).
type
=
5
;
if
(
options_
->
GetStrandMode
()
==
1
)
{
// smooth the strands for mode 1
nlist
.
at
(
kstart
).
direction
=
geom
::
Normalize
(
nlist
.
at
(
kend
).
position
-
nlist
.
at
(
kstart
).
position
);
nlist
.
at
(
kend
).
direction
=
nlist
.
at
(
kstart
).
direction
;
float
invf
=
1.0
/
static_cast
<
float
>
(
kend
-
kstart
);
for
(
unsigned
int
k
=
kstart
;
k
<=
kend
;
++
k
)
{
float
f
=
static_cast
<
float
>
(
k
-
kstart
)
*
invf
;
nlist
.
at
(
k
).
position
=
nlist
.
at
(
kstart
).
position
+
f
*
(
nlist
.
at
(
kend
).
position
-
nlist
.
at
(
kstart
).
position
);
nlist
.
at
(
k
).
direction
=
nlist
.
at
(
kstart
).
direction
;
geom
::
Vec3
tmpn
=
geom
::
Normalize
(
nlist
.
at
(
kstart
).
normal
+
f
*
(
nlist
.
at
(
kend
).
normal
-
nlist
.
at
(
kstart
).
normal
));
geom
::
Vec3
tmpx
=
geom
::
Normalize
(
geom
::
Cross
(
nlist
.
at
(
kstart
).
direction
,
tmpn
));
nlist
.
at
(
k
).
normal
=
geom
::
Normalize
(
geom
::
Cross
(
tmpx
,
nlist
.
at
(
kstart
).
direction
));
}
// and break nodelist, re-starting at arrow tip, just for mode 1
if
(
lc
+
1
<
olist
.
size
())
{
nlistlist
.
push_back
(
nlist
);
nlist
.
clear
(
);
nlist
.
push_back
(
nlistlist
.
back
().
back
()
);
n
list
.
back
().
type
=
0
;
nlist
.
back
().
color1
=
olist
[
lc
+
1
].
color1
;
nlist
.
back
().
color
2
=
olist
[
lc
+
1
].
color
2
;
}
}
}
}
if
(
lc
<
olist
.
size
())
{
nlist
.
push_back
(
olist
.
at
(
lc
));
...
...
This diff is collapsed.
Click to expand it.
modules/gui/pymod/scene/hsc_widget.py
+
29
−
4
View file @
4b3c0e5c
...
...
@@ -132,7 +132,6 @@ class HSCWidget(RenderModeWidget):
self
.
width_helix_slider_
.
setTickPosition
(
QtGui
.
QSlider
.
NoTicks
)
self
.
width_helix_slider_
.
setTickInterval
(
1
)
#Helix Ratio
ratio_helix_label
=
QtGui
.
QLabel
(
"
Thickness
"
)
...
...
@@ -146,7 +145,6 @@ class HSCWidget(RenderModeWidget):
self
.
thickness_helix_slider_
.
setTickPosition
(
QtGui
.
QSlider
.
NoTicks
)
self
.
thickness_helix_slider_
.
setTickInterval
(
1
)
#Helix ECC
ecc_helix_label
=
QtGui
.
QLabel
(
"
ECC
"
)
...
...
@@ -165,6 +163,11 @@ class HSCWidget(RenderModeWidget):
self
.
helix_profile_spinbox_
=
QtGui
.
QSpinBox
()
self
.
helix_profile_spinbox_
.
setRange
(
min_profile
,
max_profile
)
# Helix Rendering Mode
helix_mode_label
=
QtGui
.
QLabel
(
"
Helix Render Mode
"
)
self
.
helix_mode_spinbox_
=
QtGui
.
QSpinBox
()
self
.
helix_mode_spinbox_
.
setRange
(
0
,
1
)
#Strand
strand_label
=
QtGui
.
QLabel
(
"
Strand
"
)
font
=
strand_label
.
font
()
...
...
@@ -183,7 +186,6 @@ class HSCWidget(RenderModeWidget):
self
.
width_strand_slider_
.
setTickPosition
(
QtGui
.
QSlider
.
NoTicks
)
self
.
width_strand_slider_
.
setTickInterval
(
1
)
#Strand Ratio
ratio_strand_label
=
QtGui
.
QLabel
(
"
Thickness
"
)
...
...
@@ -197,7 +199,6 @@ class HSCWidget(RenderModeWidget):
self
.
thickness_strand_slider_
.
setTickPosition
(
QtGui
.
QSlider
.
NoTicks
)
self
.
thickness_strand_slider_
.
setTickInterval
(
1
)
#Strand ECC
ecc_strand_label
=
QtGui
.
QLabel
(
"
ECC
"
)
...
...
@@ -216,6 +217,12 @@ class HSCWidget(RenderModeWidget):
self
.
strand_profile_spinbox_
=
QtGui
.
QSpinBox
()
self
.
strand_profile_spinbox_
.
setRange
(
min_profile
,
max_profile
)
# Strand Rendering Mode
strand_mode_label
=
QtGui
.
QLabel
(
"
Strand Render Mode
"
)
self
.
strand_mode_spinbox_
=
QtGui
.
QSpinBox
()
self
.
strand_mode_spinbox_
.
setRange
(
0
,
1
)
#
row
=
1
grid
=
QtGui
.
QGridLayout
()
grid
.
addWidget
(
poly_mode_label
,
row
,
0
,
1
,
1
)
...
...
@@ -257,6 +264,9 @@ class HSCWidget(RenderModeWidget):
grid
.
addWidget
(
helix_profile_label
,
row
,
0
,
1
,
3
)
grid
.
addWidget
(
self
.
helix_profile_spinbox_
,
row
,
4
,
1
,
1
)
row
+=
1
grid
.
addWidget
(
helix_mode_label
,
row
,
0
,
1
,
3
)
grid
.
addWidget
(
self
.
helix_mode_spinbox_
,
row
,
4
,
1
,
1
)
row
+=
1
grid
.
addWidget
(
strand_label
,
row
,
0
,
1
,
3
)
row
+=
1
grid
.
addWidget
(
radius_strand_label
,
row
,
0
,
1
,
1
)
...
...
@@ -273,6 +283,9 @@ class HSCWidget(RenderModeWidget):
row
+=
1
grid
.
addWidget
(
strand_profile_label
,
row
,
0
,
1
,
3
)
grid
.
addWidget
(
self
.
strand_profile_spinbox_
,
row
,
4
,
1
,
1
)
row
+=
1
grid
.
addWidget
(
strand_mode_label
,
row
,
0
,
1
,
3
)
grid
.
addWidget
(
self
.
strand_mode_spinbox_
,
row
,
4
,
1
,
1
)
grid
.
setRowStretch
(
row
+
1
,
1
)
self
.
setLayout
(
grid
)
...
...
@@ -294,6 +307,7 @@ class HSCWidget(RenderModeWidget):
QtCore
.
QObject
.
connect
(
self
.
ecc_helix_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(double)
"
),
self
.
UpdateHelixEcc
)
QtCore
.
QObject
.
connect
(
self
.
ecc_helix_slider_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateSliderHelixEcc
)
QtCore
.
QObject
.
connect
(
self
.
helix_profile_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateHelixProfileType
)
QtCore
.
QObject
.
connect
(
self
.
helix_mode_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateHelixMode
)
QtCore
.
QObject
.
connect
(
self
.
width_strand_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(double)
"
),
self
.
UpdateStrandWidth
)
QtCore
.
QObject
.
connect
(
self
.
width_strand_slider_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateSliderStrandWidth
)
...
...
@@ -302,6 +316,7 @@ class HSCWidget(RenderModeWidget):
QtCore
.
QObject
.
connect
(
self
.
ecc_strand_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(double)
"
),
self
.
UpdateStrandEcc
)
QtCore
.
QObject
.
connect
(
self
.
ecc_strand_slider_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateSliderStrandEcc
)
QtCore
.
QObject
.
connect
(
self
.
strand_profile_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateStrandProfileType
)
QtCore
.
QObject
.
connect
(
self
.
strand_mode_spinbox_
,
QtCore
.
SIGNAL
(
"
valueChanged(int)
"
),
self
.
UpdateStrandMode
)
self
.
setMinimumSize
(
250
,
420
)
#14*30
########/UI########
...
...
@@ -318,10 +333,12 @@ class HSCWidget(RenderModeWidget):
self
.
UpdateHelixThicknessGui
(
options
.
GetHelixThickness
())
self
.
UpdateHelixEccGui
(
options
.
GetHelixEcc
())
self
.
helix_profile_spinbox_
.
setValue
(
options
.
GetHelixProfileType
())
self
.
helix_mode_spinbox_
.
setValue
(
options
.
GetHelixMode
())
self
.
UpdateStrandWidthGui
(
options
.
GetStrandWidth
())
self
.
UpdateStrandThicknessGui
(
options
.
GetStrandThickness
())
self
.
UpdateStrandEccGui
(
options
.
GetStrandEcc
())
self
.
strand_profile_spinbox_
.
setValue
(
options
.
GetStrandProfileType
())
self
.
strand_mode_spinbox_
.
setValue
(
options
.
GetStrandMode
())
def
UpdatePolyMode
(
self
,
value
):
self
.
GetOptions
().
SetPolyMode
(
value
)
...
...
@@ -378,6 +395,10 @@ class HSCWidget(RenderModeWidget):
def
UpdateHelixProfileType
(
self
,
value
):
self
.
GetOptions
().
SetHelixProfileType
(
value
)
self
.
ApplyOptions
()
def
UpdateHelixMode
(
self
,
value
):
self
.
GetOptions
().
SetHelixMode
(
value
)
self
.
ApplyOptions
()
def
UpdateSliderHelixEcc
(
self
,
value
):
self
.
GetOptions
().
SetHelixEcc
(
value
/
10.0
)
...
...
@@ -411,6 +432,10 @@ class HSCWidget(RenderModeWidget):
self
.
GetOptions
().
SetStrandProfileType
(
value
)
self
.
ApplyOptions
()
def
UpdateStrandMode
(
self
,
value
):
self
.
GetOptions
().
SetStrandMode
(
value
)
self
.
ApplyOptions
()
def
UpdateTubeRadiusGui
(
self
,
value
):
if
(
abs
(
value
*
10.0
-
self
.
width_tube_slider_
.
value
())
>=
self
.
width_tube_spinbox_
.
singleStep
()):
self
.
width_tube_slider_
.
setValue
(
value
*
10.0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment