Skip to content
Snippets Groups Projects
Commit bc3f186d authored by marco's avatar marco
Browse files

tell ColorBy to not throw in case of undefined properties

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2543 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent b7cdedc8
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,6 @@ aln.SetSequenceOffset(0, 1)
# First we set all properties to zero, then let alg.Conservation assign the
# conservation scores to the residues
#-------------------------------------------------------------------------------
for r in m.residues:
r.SetFloatProp('cons', 0)
alg.Conservation(aln)
#-------------------------------------------------------------------------------
......
......
......@@ -196,6 +196,9 @@ Entity API Reference
the built-in properties is identical to the properties available in
:doc:`query language <../mol/base/query>`.
In case a generic property is undefined for a certain element, the property
the value of min is used for that element.
:param prop: The name of the numeric property
:type prop: str
:param color1: Color corresponding to min value
......
......
......@@ -57,7 +57,7 @@ namespace ost { namespace gfx { namespace impl {
typedef enum {
DIRTY_VIEW =1,
DIRTY_VA =2,
DIRTY_VA =2
} DirtyFlag;
typedef char DirtyFlags;
......@@ -211,7 +211,7 @@ struct GradientLevelGetCol {
maxv_(op.GetMaxV()){}
Color ColorOfAtom(mol::AtomHandle& atom) const{
try{
float n=Normalize(epm_.Get(atom), minv_, maxv_);
float n=Normalize(epm_.Get(atom, minv_), minv_, maxv_);
return gradient_.GetColorAt(n);
}catch(std::exception&){
LOGN_DEBUG("property " << property_ << " not found");
......
......
......@@ -34,7 +34,9 @@ void set_node_entry_color(NodeEntry& e, ColorMask mask,
}
template <typename T1>
inline void apply_color_op(TraceRendererBase* rend, TraceSubset& trace_subset, T1 get_col, const ColorOp& op)
inline void apply_color_op(TraceRendererBase* rend,
TraceSubset& trace_subset, T1 get_col,
const ColorOp& op)
{
rend->UpdateViews();
ColorMask mask = op.GetMask();
......
......
......@@ -311,7 +311,8 @@ void Surface::Apply(const gfx::GradientLevelColorOp& op, bool store){
for(VMap::const_iterator it=vmap_.begin();it!=vmap_.end();++it) {
mol::AtomHandle ah = sh_.GetVertex(it->first).atom;
if(ah.IsValid()) {
va_.SetColor(it->second,gradient.GetColorAt(normalize(epm.Get(ah),minv,maxv)));
va_.SetColor(it->second,gradient.GetColorAt(normalize(epm.Get(ah, minv),
minv,maxv)));
}
}
FlagRefresh();
......
......
......@@ -688,9 +688,14 @@ std::pair<Real,Real> EntityView::GetMinMax(const String& prop,
Real min_v=std::numeric_limits<Real>::max();
Real max_v=-std::numeric_limits<Real>::max();
for(AtomViewIter it=AtomsBegin(); it!=this->AtomsEnd(); ++it) {
try {
Real v=epm.Get(*it);
max_v=std::max(v, max_v);
min_v=std::min(v, min_v);
} catch(...) {
// do nothing in case of missing property
continue;
}
}
return std::make_pair(min_v,max_v);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment