Skip to content

Commit

Permalink
fix MAC build and merge errors
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Prat Masó <marc.prat.maso@estudiantat.upc.edu>
  • Loading branch information
serk12 committed Aug 10, 2021
1 parent 93c4b38 commit 2f86874
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
7 changes: 2 additions & 5 deletions avogadro/core/layermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <cassert>
#include <map>
#include <memory>
#include <string>
#include <vector>

namespace Avogadro {
Expand All @@ -30,11 +31,7 @@ struct LayerData
LayerData(std::string save = "") { deserialize(save); }

/** save custom data, base save should never be called */
virtual std::string serialize()
{
assert(true);
return "";
}
virtual std::string serialize() { return ""; }

/** load the saved @p save data and wait to know the class type to recreate it
*/
Expand Down
47 changes: 24 additions & 23 deletions avogadro/qtplugins/cartoons/cartoons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct LayerCartoon : Core::LayerData
{
return boolToString(showBackbone) + " " + boolToString(showTrace) + " " +
boolToString(showTube) + " " + boolToString(showRibbon) + " " +
boolToString(showSimpleCartoon) + " " +
boolToString(showCartoon) + " " + boolToString(showRope);
boolToString(showSimpleCartoon) + " " + boolToString(showCartoon) +
" " + boolToString(showRope);
}
void deserialize(std::string text) override final
{
Expand Down Expand Up @@ -100,10 +100,10 @@ struct LayerCartoon : Core::LayerData
<< QObject::tr("Simple Cartoon", "protein rendering style")
<< QObject::tr("Cartoon", "protein rendering style")
<< QObject::tr("Rope", "protein rendering style");
vector<reference_wrapper<bool>> boxesBools = { showBackbone, showTrace,
showTube, showRibbon,
showSimpleCartoon,
showCartoon, showRope };
vector<reference_wrapper<bool>> boxesBools = {
showBackbone, showTrace, showTube, showRibbon,
showSimpleCartoon, showCartoon, showRope
};
jumpTable[0] = &Cartoons::showBackbone;
jumpTable[1] = &Cartoons::showTrace;
jumpTable[2] = &Cartoons::showTube;
Expand Down Expand Up @@ -206,11 +206,9 @@ map<size_t, AtomsPairList> Cartoons::getBackboneByResidues(
if (!residue.isHeterogen()) {
Atom caAtom = residue.getAtomByName("CA");
Atom oAtom = residue.getAtomByName("O");
if (caAtom.isValid() && oAtom.isValid()) {
if (!m_layerManager.atomEnabled(layer, caAtom.index()) ||
!m_layerManager.atomEnabled(layer, oAtom.index())) {
continue;
}
if (caAtom.isValid() && oAtom.isValid() &&
m_layerManager.atomEnabled(layer, caAtom.index()) &&
m_layerManager.atomEnabled(layer, oAtom.index())) {
// get the group ID and check if it's initialized in the map
size_t group = graph.getConnectedID(caAtom.index());
addBackBone(result, previousCA, caAtom, residue.color(), group,
Expand All @@ -231,7 +229,8 @@ map<size_t, AtomsPairList> Cartoons::getBackboneManually(

for (size_t i = 0; i < molecule.atomCount(); ++i) {
const auto atom = molecule.atom(i);
if (atom.atomicNumber() == AtomicNumber::Carbon) {
if (atom.atomicNumber() == AtomicNumber::Carbon &&
m_layerManager.atomEnabled(layer, atom.index())) {
size_t group = graph.getConnectedID(atom.index());
addBackBone(result, previousCA, atom, atom.color(), group,
Residue::SecondaryStructure::undefined);
Expand Down Expand Up @@ -354,11 +353,12 @@ void renderCartoon(const AtomsPairList& backbone, const Molecule& molecule,

void Cartoons::process(const Molecule& molecule, Rendering::GroupNode& node)
{
m_group = &node;
for (size_t layer = 0; layer < m_layerManager.layerCount(); ++layer) {
LayerCartoon& interface = m_layerManager.getSetting<LayerCartoon>(layer);
m_group = &node;
if (interface.showBackbone || interface.showTrace || interface.showTube ||
interface.showRibbon || interface.showCartoon || interface.showRope) {
interface.showRibbon || interface.showSimpleCartoon ||
interface.showCartoon || interface.showRope) {
map<size_t, AtomsPairList> backbones;
if (molecule.residues().size() > 0) {
backbones = getBackboneByResidues(molecule, layer);
Expand All @@ -373,23 +373,23 @@ void Cartoons::process(const Molecule& molecule, Rendering::GroupNode& node)
renderBackbone(backbone, molecule, node, 0.1f);
}
if (interface.showTrace) {
renderTube(backbone, molecule, node, -0.15f, i);
renderTube(backbone, molecule, node, -0.15f);
}
if (interface.showTube) {
renderTube(backbone, molecule, node, 0.15f, i);
renderTube(backbone, molecule, node, 0.15f);
}
if (interface.showRibbon) {
renderCartoon(backbone, molecule, node, -1.0f * Cartoon::ELIPSE_RATIO,
i);
}
renderCartoon(backbone, molecule, node,
-1.0f * Cartoon::ELIPSE_RATIO);
}
if (interface.showSimpleCartoon) {
renderSimpleCartoon(backbone, molecule, node, 1.0f);
}
if (interface.showCartoon) {
renderCartoon(backbone, molecule, node, 1.0f, i);
renderCartoon(backbone, molecule, node, 1.0f);
}
if (interface.showRope) {
renderRope(backbone, molecule, node, 1.0f, i);
renderRope(backbone, molecule, node, 1.0f);
}
++i;
}
Expand Down Expand Up @@ -450,8 +450,9 @@ void Cartoons::showRibbon(bool show)

void Cartoons::showSimpleCartoon(bool show)
{
if (show != m_showSimpleCartoon) {
m_showSimpleCartoon = show;
LayerCartoon& interface = m_layerManager.getSetting<LayerCartoon>();
if (show != interface.showSimpleCartoon) {
interface.showSimpleCartoon = show;
emit drawablesChanged();
}
QSettings settings;
Expand Down
2 changes: 1 addition & 1 deletion avogadro/rendering/curvegeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class AVOGADRORENDERING_EXPORT CurveGeometry : public Drawable

void processShaderError(bool error);

Core::Array<Identifier> areaHits(const Frustrum& f) const;
Core::Array<Identifier> areaHits(const Frustrum& f) const override;
};

} // End namespace Rendering
Expand Down

0 comments on commit 2f86874

Please sign in to comment.