OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimViewController.cpp
Go to the documentation of this file.
7 #include <vector>
8 using namespace std;
9 
10 RTTI_DEF1(ossimViewController, "ossimViewController", ossimSource);
11 
13  :
14  ossimSource((ossimObject*)NULL, 0, 0, true, false)
15 {
16  theView = NULL;
17 }
18 
20  ossim_uint32 inputListSize,
21  ossim_uint32 outputListSize,
22  bool inputListFixedFlag,
23  bool outputListFixedFlag)
24  :
25  ossimSource(owner,
26  inputListSize,
27  outputListSize,
28  inputListFixedFlag,
29  outputListFixedFlag)
30 {
31  theView = NULL;
32 }
33 
35 {
36  theView = 0;
37 }
38 
40 {
41  return ossimString("View");
42 }
43 
45 {
46  return ossimString("View controller");
47 }
48 
50  const ossimConnectableObject*)const
51 {
52  return false;
53 }
54 
56 {
57  bool returnResult = true;
58  if(!theOwner)
59  {
60  ossimNotify(ossimNotifyLevel_FATAL) << "FATAL: " << getClassName() << "::propagateView(), has no owner! We must find all views to set.\n";
61  return false;
62  }
64  theOwner);
65  if(inter)
66  {
69  true);
70  if(result.size() > 0)
71  {
72  ossim_uint32 index = 0;
73 
74  // first set all views then update all outputs
75  //
76  for(index = 0; index < result.size(); ++index)
77  {
78  ossimViewInterface* viewInterface = PTR_CAST(ossimViewInterface, result[index].get());
79 
80  if(viewInterface)
81  {
82  if(!viewInterface->setView(theView.get()))
83  {
84  returnResult = false;
85  }
86  }
87  }
88 
89  for(index = 0; index < result.size(); ++index)
90  {
91  ossimPropertyEvent event(result[index].get());
92  result[index]->fireEvent(event);
93  result[index]->propagateEventToOutputs(event);
94  }
95  }
96  }
97 
98  return returnResult;
99 }
100 
102 {
103  theView = object;
104 
105  return true;
106 }
107 
109 {
110  return theView.get();
111 }
112 
114 {
115  return theView.get();
116 }
117 
119 {
121  theOwner);
122  if(inter)
123  {
124  RTTItypeid viewInterfaceType = STATIC_TYPE_INFO(ossimViewInterface);
126  true);
127  if(result.size() > 0)
128  {
129  ossim_uint32 index = 0;
130 
131  for(index = 0; index < result.size(); ++index)
132  {
133 
134  ossimViewInterface* viewInterface = PTR_CAST(ossimViewInterface, result[index].get());
135 
136  if(viewInterface)
137  {
138  if(viewInterface->getView())
139  {
140  if(typeId.can_cast(viewInterface->getView()->getType()))
141  {
142  return viewInterface->getView();
143  }
144  }
145  }
146  }
147  }
148  }
149 
150  return (ossimObject*)NULL;
151 }
ossimRefPtr< ossimObject > theView
virtual bool setView(ossimObject *object)
virtual ossimObject * getView()
virtual ossimString getLongName() const
virtual bool propagateView()
virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
int can_cast(RTTItypeid) const
Definition: ossimRtti.h:259
virtual const ossimObject * findFirstViewOfType(RTTItypeid typeId) const
virtual RTTItypeid getType() const
Definition: ossimObject.cpp:69
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
unsigned int ossim_uint32
#define STATIC_TYPE_INFO(T)
Definition: ossimRtti.h:319
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
RTTI_DEF1(ossimViewController, "ossimViewController", ossimSource)
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *obj) const
required to be overriden by derived classes
virtual ossimString getShortName() const
virtual bool setView(ossimObject *baseObject)=0
virtual ossimObject * getView()=0
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32