📄 messenger.cpp
字号:
ToggleHighlights(molecule->identifier, residueID - 1, residueID - 1, molecule->parentSet); if (scrollViewersTo) { // make selected residue visible in sequence viewers if residue is in displayed sequence SequenceViewerList::iterator t, te = sequenceViewers.end(); for (t=sequenceViewers.begin(); t!=te; ++t) (*t)->MakeResidueVisible(molecule, residueID - 1); }}bool Messenger::RemoveAllHighlights(bool postRedraws){ bool anyRemoved = highlights.size() > 0; if (postRedraws) { if (anyRemoved) PostRedrawAllSequenceViewers(); if (structureWindow) { MoleculeHighlightMap::const_iterator h, he = highlights.end(); for (h=highlights.begin(); h!=he; ++h) RedrawMoleculesWithIdentifier(h->first, structureWindow->glCanvas->structureSet); } } highlights.clear(); return anyRemoved;}void Messenger::SetHighlights(const MoleculeHighlightMap& newHighlights){ RemoveAllHighlights(true); highlights = newHighlights; PostRedrawAllSequenceViewers(); if (structureWindow) { MoleculeHighlightMap::const_iterator h, he = highlights.end(); for (h=highlights.begin(); h!=he; ++h) RedrawMoleculesWithIdentifier(h->first, structureWindow->glCanvas->structureSet); }}void Messenger::SuspendHighlighting(bool suspend){ if (highlightingSuspended != suspend) { highlightingSuspended = suspend; if (IsAnythingHighlighted()) { PostRedrawAllStructures(); PostRedrawAllSequenceViewers(); } }}bool Messenger::GetHighlightedResiduesWithStructure(MoleculeHighlightMap *residues) const{ residues->clear(); if (!IsAnythingHighlighted()) return false; MoleculeHighlightMap::const_iterator h, he = highlights.end(); for (h=highlights.begin(); h!=he; ++h) { if (h->first->HasStructure()) (*residues)[h->first] = h->second; } return (residues->size() > 0);}CBiostruc_annot_set * Messenger::CreateBiostrucAnnotSetForHighlightsOnSingleObject(void) const{ if (!IsAnythingHighlighted()) { ERRORMSG("Nothing highlighted"); return NULL; } // check to see that all highlights are on a single structure object int mmdbID; MoleculeHighlightMap::const_iterator h, he = highlights.end(); for (h=highlights.begin(); h!=he; ++h) { if (h == highlights.begin()) mmdbID = h->first->mmdbID; if (h->first->mmdbID == MoleculeIdentifier::VALUE_NOT_SET || h->first->mmdbID != mmdbID) { ERRORMSG("All highlights must be on a single PDB structure"); return NULL; } if (h->first->moleculeID == MoleculeIdentifier::VALUE_NOT_SET) { ERRORMSG("internal error - MoleculeIdentifier has no moleculeID"); return NULL; } } // create the Biostruc-annot-set CRef < CBiostruc_annot_set > bas(new CBiostruc_annot_set()); // set id CRef < CBiostruc_id > bid(new CBiostruc_id()); bas->SetId().push_back(bid); bid->SetMmdb_id().Set(mmdbID); // create feature set and feature CRef < CBiostruc_feature_set > bfs(new CBiostruc_feature_set()); bas->SetFeatures().push_back(bfs); bfs->SetId().Set(1); CRef < CBiostruc_feature > bf(new CBiostruc_feature()); bfs->SetFeatures().push_back(bf); // create Chem-graph-pntrs with residues CChem_graph_pntrs *cgp = new CChem_graph_pntrs(); bf->SetLocation().SetSubgraph(*cgp); CResidue_pntrs *rp = new CResidue_pntrs(); cgp->SetResidues(*rp); // add all residue intervals for (h=highlights.begin(); h!=he; ++h) { int first = 0, last = 0; while (first < h->second.size()) { // find first highlighted residue while (first < h->second.size() && !h->second[first]) ++first; if (first >= h->second.size()) break; // find last in contiguous stretch of highlighted residues last = first; while (last + 1 < h->second.size() && h->second[last + 1]) ++last; // add new interval to list CRef < CResidue_interval_pntr > rip(new CResidue_interval_pntr()); rip->SetMolecule_id().Set(h->first->moleculeID); rip->SetFrom().Set(first + 1); // assume residueID == index + 1 rip->SetTo().Set(last + 1); rp->SetInterval().push_back(rip); first = last + 2; } } return bas.Release();}bool Messenger::GetHighlightsForSelectionMessage(string *data) const{ data->erase(); if (!IsAnythingHighlighted()) return false; CNcbiOstrstream oss; MoleculeHighlightMap::const_iterator h, he = highlights.end(); for (h=highlights.begin(); h!=he; ++h) { // add identifier if (h->first->pdbID.size() > 0) { oss << "pdb " << h->first->pdbID; if (h->first->pdbChain != ' ') oss << '_' << (char) h->first->pdbChain; } else if (h->first->gi != MoleculeIdentifier::VALUE_NOT_SET) { oss << "gi " << h->first->gi; } else if (h->first->accession.size() > 0) { oss << "acc " << h->first->accession; } else { WARNINGMSG("Messenger::GetHighlightsForSelectionMessage() - unimplemented identifier type"); continue; } // add range(s) int first = 0, last = 0; while (first < h->second.size()) { // find first highlighted residue while (first < h->second.size() && !h->second[first]) ++first; if (first >= h->second.size()) break; // find last in contiguous stretch of highlighted residues last = first; while (last + 1 < h->second.size() && h->second[last + 1]) ++last; // add new interval to list oss << ' ' << first; if (last > first) oss << '-' << last; first = last + 2; } oss << '\n'; } oss << '\0'; auto_ptr<char> d(oss.str()); *data = d.get(); return true;}void Messenger::SetAllWindowTitles(void) const{ SequenceViewerList::const_iterator q, qe = sequenceViewers.end(); for (q=sequenceViewers.begin(); q!=qe; ++q) (*q)->SetWindowTitle(); if (structureWindow) structureWindow->SetWindowTitle();}bool Messenger::IsFileMessengerActive(void) const{ return (structureWindow && structureWindow->IsFileMessengerActive());}void Messenger::FileMessengerSend(const std::string& toApp, const std::string& command, const std::string& data){ if (structureWindow) structureWindow->SendCommand(toApp, command, data);}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: messenger.cpp,v $* Revision 1000.3 2004/06/01 18:28:39 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.42** Revision 1.42 2004/05/21 21:41:39 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.41 2004/03/15 18:25:36 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.40 2004/02/19 17:04:56 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.39 2004/01/08 15:31:02 thiessen* remove hard-coded CDTree references in messaging; add Cn3DTerminated message upon exit** Revision 1.38 2003/11/15 16:08:36 thiessen* add stereo** Revision 1.37 2003/07/10 18:47:29 thiessen* add CDTree->Select command** Revision 1.36 2003/03/13 14:26:18 thiessen* add file_messaging module; split cn3d_main_wxwin into cn3d_app, cn3d_glcanvas, structure_window, cn3d_tools** Revision 1.35 2003/02/03 19:20:04 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.34 2002/10/11 17:21:39 thiessen* initial Mac OSX build** Revision 1.33 2002/10/07 13:29:31 thiessen* add double-click -> show row to taxonomy tree** Revision 1.32 2002/09/09 13:38:23 thiessen* separate save and save-as** Revision 1.31 2002/09/05 18:38:57 thiessen* add sort by highlights** Revision 1.30 2002/08/15 22:13:14 thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.29 2002/07/02 16:13:49 thiessen* allow for NULL structureWindow** Revision 1.28 2002/06/05 14:28:39 thiessen* reorganize handling of window titles** Revision 1.27 2002/03/04 15:52:13 thiessen* hide sequence windows instead of destroying ; add perspective/orthographic projection choice** Revision 1.26 2002/02/05 18:53:24 thiessen* scroll to residue in sequence windows when selected in structure window** Revision 1.25 2002/01/19 02:34:42 thiessen* fixes for changes in asn serialization API** Revision 1.24 2001/12/12 14:04:13 thiessen* add missing object headers after object loader change** Revision 1.23 2001/10/23 20:10:23 thiessen* fix scaling of fonts in high-res PNG output** Revision 1.22 2001/10/01 16:04:24 thiessen* make CDD annotation window non-modal; add SetWindowTitle to viewers** Revision 1.21 2001/08/27 00:06:23 thiessen* add structure evidence to CDD annotation** Revision 1.20 2001/08/14 17:18:22 thiessen* add user font selection, store in registry** Revision 1.19 2001/07/04 19:39:17 thiessen* finish user annotation system** Revision 1.18 2001/06/29 18:13:57 thiessen* initial (incomplete) user annotation system** Revision 1.17 2001/06/21 02:02:33 thiessen* major update to molecule identification and highlighting ; add toggle highlight (via alt)** Revision 1.16 2001/05/11 02:10:42 thiessen* add better merge fail indicators; tweaks to windowing/taskbar** Revision 1.15 2001/03/30 14:43:41 thiessen* show threader scores in status line; misc UI tweaks** Revision 1.14 2001/03/22 00:33:17 thiessen* initial threading working (PSSM only); free color storage in undo stack** Revision 1.13 2001/03/01 20:15:51 thiessen* major rearrangement of sequence viewer code into base and derived classes** Revision 1.12 2001/02/22 00:30:06 thiessen* make directories global ; allow only one Sequence per StructureObject** Revision 1.11 2000/12/15 15:51:47 thiessen* show/hide system installed** Revision 1.10 2000/11/30 15:49:38 thiessen* add show/hide rows; unpack sec. struc. and domain features** Revision 1.9 2000/11/02 16:56:02 thiessen* working editor undo; dynamic slave transforms** Revision 1.8 2000/10/19 12:40:54 thiessen* avoid multiple sequence redraws with scroll set** Revision 1.7 2000/10/12 02:14:56 thiessen* working block boundary editing** Revision 1.6 2000/10/02 23:25:21 thiessen* working sequence identifier window in sequence viewer** Revision 1.5 2000/09/15 19:24:22 thiessen* allow repeated structures w/o different local id** Revision 1.4 2000/09/14 14:55:34 thiessen* add row reordering; misc fixes** Revision 1.3 2000/09/11 22:57:32 thiessen* working highlighting** Revision 1.2 2000/09/11 14:06:28 thiessen* working alignment coloring** Revision 1.1 2000/09/11 01:46:14 thiessen* working messenger for sequence<->structure window communication**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -