| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2000-2004 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: interactionmode.h 6741 2009-11-26 15:29:43Z Jan_Klimke $ 00019 // 00020 // $Log$ 00021 // Revision 1.3 2006/05/03 15:30:53 schmidt 00022 // added technique-dependent preserving of view direction 00023 // on corrections done by a constraintchecker 00024 // 00025 // Revision 1.2 2005/05/08 21:52:39 buchholz 00026 // comments changed: A Technique can be inserted in multiple nodes, but 00027 // only for one InteractionConcept 00028 // 00029 // Revision 1.1 2005/02/23 14:48:57 glander 00030 // *** empty log message *** 00031 // 00032 // Revision 1.1 2005/02/15 18:29:08 buchholz 00033 // first check-in 00034 // 00035 00036 #ifndef VRS_SG_INTERACTIONMODE_H 00037 #define VRS_SG_INTERACTIONMODE_H 00038 00039 #include <vrs/sharedobj.h> 00040 #include <vrs/sg/interactionconcept.h> 00041 #include <vector> 00042 00043 namespace VRS { 00044 00045 class OrientationConstraint; 00046 class Event; 00047 class InteractionTechnique; 00048 class PhysicalModelSettings; 00049 00080 class VRS_CORE_API InteractionMode : public SharedObj { 00081 00082 public: 00083 00084 InteractionMode(); 00085 00090 void addInteractionTechnique(SO<InteractionTechnique> technique); 00091 00093 void removeInteractionTechnique(SO<InteractionTechnique> technique); 00094 00096 SO<Iterator<SO<InteractionTechnique> > > interactionTechniqueIterator() const; 00097 00101 SO<OrientationConstraint> getTechniqueConstraint(SO<InteractionTechnique> technique) const; 00102 00107 void setTechniqueConstraint(SO<InteractionTechnique> technique, SO<OrientationConstraint> constraint); 00108 00111 void setActiveInteraction(SO<InteractionTechnique> technique); 00112 00114 SO<InteractionTechnique> getActiveInteraction() const; 00115 00117 void selectActiveInteraction(SO<Event> event); 00118 00125 void setDefaultActiveInteraction(SO<InteractionTechnique> technique); 00126 00132 void setPhysicalModelSettings(SO<InteractionTechnique> technique, SO<PhysicalModelSettings> settings); 00133 00136 SO<PhysicalModelSettings> getPhysicalModelSettings(SO<InteractionTechnique> technique) const; 00137 00139 SO<InteractionConcept> getParent() const; 00140 00144 bool preservingViewDirectionRequired() const; 00145 00147 virtual void handle(SO<Event> event); 00148 00149 VRS_TYPEINFO(InteractionMode, SharedObj); 00150 VRS_SERIALIZABLE(InteractionMode); 00151 00152 private: 00153 00154 // These arrays define (InteractionTechnique, OrientationConstraint, PhysicalModelSettings)-triples. 00155 std::vector<SO<InteractionTechnique> > interactionTechniques_; 00156 std::vector<SO<OrientationConstraint> > interactionConstraints_; 00157 std::vector<SO<PhysicalModelSettings> > physicalModelSettings_; 00158 int findTechnique(SO<InteractionTechnique> technique) const; 00159 // returns the array index of a technique or -1 for unregistered techniques. 00160 00161 friend class InteractionConcept; 00162 void setParent(SO<InteractionConcept> parent); 00163 void activate(); // called by the InteractionConcept once when the mode is activated 00164 // activate() selects the defaultActiveInteraction. 00165 00167 void deactivate(); 00168 00169 InteractionConcept* parent_; 00170 00171 SO<InteractionTechnique> activeTechnique_; 00172 SO<InteractionTechnique> defaultActiveTechnique_; 00173 }; 00174 00175 } // namespace VRS 00176 00177 #endif // VRS_SG_INTERACTIONMODE_H