1 /* $Id: show_hide_manager.hpp 411368 2013-08-28 11:25:58Z thiessen $ 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * Authors: Paul Thiessen 27 * 28 * File Description: 29 * manager object to track show/hide status of objects at various levels 30 * 31 * =========================================================================== 32 */ 33 34 #ifndef CN3D_SHOW_HIDE_MANAGER__HPP 35 #define CN3D_SHOW_HIDE_MANAGER__HPP 36 37 #include <corelib/ncbistl.hpp> 38 39 #include <vector> 40 #include <map> 41 42 #include "structure_base.hpp" 43 #include "show_hide_callback.hpp" 44 45 46 BEGIN_SCOPE(Cn3D) 47 48 class Residue; 49 class StructureSet; 50 class ShowHideInfo; 51 class StructureObject; 52 53 class ShowHideManager : public ShowHideCallbackObject 54 { 55 public: 56 virtual ~ShowHideManager(); 57 58 // eventually this will be tied to a GUI element or something... OverlayConfEnsembles(void) const59 bool OverlayConfEnsembles(void) const { return true; } 60 61 // set show/hide status of an entity - must be StructureObject, Molecule, or Residue. 62 void Show(const StructureBase *entity, bool isShown); 63 64 void MakeAllVisible(void); 65 66 // query whether an entity is visible 67 bool IsHidden(const StructureBase *entity) const; IsVisible(const StructureBase * entity) const68 bool IsVisible(const StructureBase *entity) const { return !IsHidden(entity); } 69 70 // used for show/hide dialog to get list of names and visibility status 71 void GetShowHideInfo(std::vector < std::string > *names, std::vector < bool > *visibilities) const; 72 void ShowHideCallbackFunction(const std::vector < bool >& itemsEnabled); 73 bool SelectionChangedCallback(const std::vector < bool >& original, std::vector < bool >& itemsEnabled); 74 void ConstructShowHideArray(const StructureSet *structureSet); 75 76 // functions to show/hide more complex groups of stuff 77 void ShowAlignedDomains(const StructureSet *set); 78 void ShowAlignedOrAnnotatedDomains(const StructureSet *set); 79 void ShowAlignedChains(const StructureSet *set); 80 void ShowResidues(const StructureSet *set, bool showAligned); 81 void ShowUnalignedResiduesInAlignedDomains(const StructureSet *set); 82 void ShowSelectedResidues(const StructureSet *set); 83 void ShowDomainsWithHighlights(const StructureSet *set); 84 85 private: 86 typedef std::map < const StructureBase *, bool > EntitiesHidden; 87 EntitiesHidden entitiesHidden; 88 89 // holds info on objects in this StructureSet 90 std::vector < const ShowHideInfo * > structureInfo; 91 92 void PrivateShowResidues(const StructureSet *set, bool showAligned); 93 void UnHideEntityAndChildren(const StructureBase *entity); 94 95 public: 96 }; 97 98 END_SCOPE(Cn3D) 99 100 #endif // CN3D_SHOW_HIDE_MANAGER__HPP 101