116 oss <<
" d" << labelNum;
122 bool isVisible =
false;
162 ChemicalGraph::MoleculeMap::const_iterator m, me =
object->graph->molecules.end();
164 if (m->second->IsProtein() || m->second->IsNucleotide())
178 if (!entity || !(
object || molecule || residue)) {
179 ERRORMSG(
"ShowHideManager::Show() - must be a StructureObject, Molecule, or Residue");
202 if (!entity || !
IsHidden(entity))
return;
223 if (molecule && hObj != h->first && !hMol)
226 if (entity == h->first ||
227 (
object && hObj ==
object) ||
228 (molecule && hMol == molecule))
230 EntitiesHidden::iterator d(h);
255 else if ((molecule =
dynamic_cast<const Molecule *
>(entity)) !=
NULL) {
261 else if ((residue =
dynamic_cast<const Residue *
>(entity)) !=
NULL) {
269 ERRORMSG(
"ShowHideManager::IsHidden() - must be a StructureObject, Molecule, or Residue");
276 int objectIndex, moleculeIndex;
278 StructureSet::ObjectList::const_iterator o, oe = structureSet->
objects.end();
279 for (o=structureSet->
objects.begin(); o!=oe; ++o) {
285 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
286 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
289 if (m->second->IsProtein() || m->second->IsNucleotide()) {
292 info->parentIndexes.push_back(objectIndex);
296 if (m->second->nDomains >= 1) {
297 StructureObject::DomainMap::const_iterator d, de = (*o)->domainMap.end();
298 for (d=(*o)->domainMap.begin(); d!=de; ++d) {
299 if (d->second == m->second) {
301 info->parentIndexes.push_back(objectIndex);
302 info->parentIndexes.push_back(moleculeIndex);
313 vector < string > *
names, vector < bool > *visibilities)
const
326 ERRORMSG(
"ShowHideManager::ShowHideCallbackFunction() - wrong size list");
330 for (
unsigned int i=0;
i<itemsEnabled.size(); ++
i)
336 const vector < bool >& original, vector < bool >& itemsEnabled)
339 unsigned int i, nChanges = 0, itemChanged = 0, nEnabled = 0, itemEnabled = 0;
340 for (
i=0;
i<itemsEnabled.size(); ++
i) {
341 if (itemsEnabled[
i] != original[
i]) {
345 if (itemsEnabled[
i]) {
352 bool anyChange =
false;
353 if (nChanges == 1 || nEnabled == 1) {
354 int item = (nChanges == 1) ? itemChanged : itemEnabled;
356 for (
unsigned int j=0; j<
structureInfo[
i]->parentIndexes.size(); ++j) {
358 if (itemsEnabled[
i] != itemsEnabled[item]) {
359 itemsEnabled[
i] = itemsEnabled[item];
368 for (
i=0;
i<itemsEnabled.size(); ++
i) {
369 if (itemsEnabled[
i]) {
370 for (
unsigned int j=0; j<
structureInfo[
i]->parentIndexes.size(); ++j) {
390 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
391 for (o=
set->objects.
begin(); o!=oe; ++o) {
392 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
393 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
395 if (m->second->IsNucleotide()) {
396 Show(m->second,
false);
400 if (!m->second->IsProtein())
continue;
402 if (!
set->alignmentManager->IsInAlignment(m->second->sequence)) {
403 Show(m->second,
false);
408 Molecule::ResidueMap::const_iterator
r, re = m->second->residues.end();
411 for (
r=m->second->residues.begin();
r!=re; ++
r)
412 if (
set->alignmentManager->IsAligned(m->second->sequence,
r->first - 1))
413 domains[m->second->residueDomains[
r->first - 1]] =
true;
416 for (
r=m->second->residues.begin();
r!=re; ++
r)
417 if (domains.
find(m->second->residueDomains[
r->first - 1]) == domains.
end())
418 Show(
r->second,
false);
426 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
427 for (o=
set->objects.
begin(); o!=oe; ++o) {
428 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
429 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
431 if (!(m->second->IsProtein() || m->second->IsNucleotide()))
434 if (!(
set->alignmentManager->IsInAlignment(m->second->sequence) ||
set->styleManager->MoleculeHasUserStyle(*o, m->second->id))) {
435 Show(m->second,
false);
440 Molecule::ResidueMap::const_iterator
r, re = m->second->residues.end();
443 for (
r=m->second->residues.begin();
r!=re; ++
r)
444 if (
set->alignmentManager->IsAligned(m->second->sequence,
r->first - 1) ||
set->styleManager->ResidueHasUserStyle(*o, m->second->id,
r->first))
445 domains[m->second->residueDomains[
r->first - 1]] =
true;
448 for (
r=m->second->residues.begin();
r!=re; ++
r)
449 if (domains.
find(m->second->residueDomains[
r->first - 1]) == domains.
end())
450 Show(
r->second,
false);
458 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
459 for (o=
set->objects.
begin(); o!=oe; ++o) {
460 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
461 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
464 if (m->second->IsNucleotide() ||
465 (m->second->IsProtein() && !
set->alignmentManager->IsInAlignment(m->second->sequence)))
467 Show(m->second,
false);
475 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
476 for (o=
set->objects.
begin(); o!=oe; ++o) {
477 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
478 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
480 if (m->second->IsNucleotide()) {
481 Show(m->second,
false);
484 if (!m->second->IsProtein())
continue;
486 if (!
set->alignmentManager->IsInAlignment(m->second->sequence)) {
487 if (showAligned)
Show(m->second,
false);
491 Molecule::ResidueMap::const_iterator
r, re = m->second->residues.end();
492 for (
r=m->second->residues.begin();
r!=re; ++
r) {
493 bool aligned =
set->alignmentManager->IsAligned(m->second->sequence,
r->first - 1);
494 if ((showAligned && !aligned) || (!showAligned && aligned))
495 Show(
r->second,
false);
518 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
519 for (o=
set->objects.
begin(); o!=oe; ++o) {
520 bool anyResidueInObjectVisible =
false;
521 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
522 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
523 Molecule::ResidueMap::const_iterator
r, re = m->second->residues.end();
524 bool anyResidueInMoleculeVisible =
false;
525 for (
r=m->second->residues.begin();
r!=re; ++
r) {
527 Show(
r->second,
false);
529 anyResidueInMoleculeVisible = anyResidueInObjectVisible =
true;
531 if (!anyResidueInMoleculeVisible) {
532 for (
r=m->second->residues.begin();
r!=re; ++
r)
533 Show(
r->second,
true);
534 Show(m->second,
false);
537 if (!anyResidueInObjectVisible) {
538 for (m=(*o)->graph->molecules.begin(); m!=me; ++m)
539 Show(m->second,
true);
553 StructureSet::ObjectList::const_iterator o, oe =
set->objects.
end();
554 for (o=
set->objects.
begin(); o!=oe; ++o) {
555 ChemicalGraph::MoleculeMap::const_iterator m, me = (*o)->graph->molecules.end();
556 for (m=(*o)->graph->molecules.begin(); m!=me; ++m) {
557 Molecule::ResidueMap::const_iterator
r, re = m->second->residues.end();
562 for (
r=m->second->residues.begin();
r!=re; ++
r) {
564 domain = m->second->residueDomains[
r->first - 1];
566 domains[domain] =
true;
571 for (
r=m->second->residues.begin();
r!=re; ++
r) {
572 domain = m->second->residueDomains[
r->first - 1];
574 Show(
r->second,
true);
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
void PostRedrawMolecule(const Molecule *molecule)
void PostRedrawAllSequenceViewers(void)
std::vector< int > residueDomains
static const int NO_DOMAIN_SET
const MoleculeIdentifier * identifier
unsigned int NResidues(void) const
virtual ~ShowHideDomain(void)
void Show(ShowHideManager *shm, bool isShown) const
bool IsVisible(const ShowHideManager *shm) const
const Molecule * molecule
ShowHideDomain(const Molecule *m, int d, int labelNum)
virtual void Show(ShowHideManager *shm, bool isShown) const =0
virtual bool IsVisible(const ShowHideManager *shm) const =0
void GetLabel(string *str) const
vector< int > parentIndexes
virtual ~ShowHideInfo(void)
void ShowDomainsWithHighlights(const StructureSet *set)
std::vector< const ShowHideInfo * > structureInfo
void ShowSelectedResidues(const StructureSet *set)
void ShowResidues(const StructureSet *set, bool showAligned)
void ShowHideCallbackFunction(const std::vector< bool > &itemsEnabled)
void ConstructShowHideArray(const StructureSet *structureSet)
void UnHideEntityAndChildren(const StructureBase *entity)
void Show(const StructureBase *entity, bool isShown)
bool IsHidden(const StructureBase *entity) const
EntitiesHidden entitiesHidden
void ShowAlignedDomains(const StructureSet *set)
void ShowAlignedOrAnnotatedDomains(const StructureSet *set)
void PrivateShowResidues(const StructureSet *set, bool showAligned)
virtual ~ShowHideManager()
bool SelectionChangedCallback(const std::vector< bool > &original, std::vector< bool > &itemsEnabled)
void MakeAllVisible(void)
void ShowAlignedChains(const StructureSet *set)
void ShowUnalignedResiduesInAlignedDomains(const StructureSet *set)
bool IsVisible(const StructureBase *entity) const
void GetShowHideInfo(std::vector< std::string > *names, std::vector< bool > *visibilities) const
ShowHideMolecule(const Molecule *m)
const Molecule * molecule
void Show(ShowHideManager *shm, bool isShown) const
bool IsVisible(const ShowHideManager *shm) const
virtual ~ShowHideMolecule(void)
void Show(ShowHideManager *shm, bool isShown) const
virtual ~ShowHideObject(void)
ShowHideObject(const StructureObject *o)
const StructureObject * object
bool IsVisible(const ShowHideManager *shm) const
bool GetParentOfType(const T **ptr, bool warnIfNotFound=true) const
std::string GetPDBID(char separator='_') const
const ChemicalGraph * graph
OpenGLRenderer * renderer
const_iterator end() const
const_iterator find(const key_type &key) const
const_iterator begin() const
const_iterator end() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const struct name_t names[]
static const char * str(char *buf, int n)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
static const char label[]
Messenger * GlobalMessenger(void)
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static void PostRedrawEntity(const StructureObject *object, const Molecule *molecule, const Residue *residue)