Orfeo Toolbox  3.16
otbViewerController.cxx
Go to the documentation of this file.
1 
2 /*=========================================================================
3 
4  Program: ORFEO Toolbox
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
8 
9 
10  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
11 See OTBCopyright.txt for details.
12 
13 
14  This software is distributed WITHOUT ANY WARRANTY; without even
15  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  PURPOSE, See the above copyright notices for more information.
17 
18 =========================================================================*/
19 #include "otbViewerController.h"
20 #include "otbMsgReporter.h"
21 
22 #include "otbSystem.h"
23 
24 namespace otb
25 {
26 
29 {
30 
32  // Build a "visu"controller
33  m_VisuController = VisuControllerType::New();
34  m_PreviewVisuController = VisuControllerType::New();
35 }
36 
39 {
40  MsgReporter::GetInstance()->Hide();
41 }
42 
43 
44 unsigned int
46 ::OpenInputImage(const char * filename, const unsigned int & id)
47 {
48  unsigned int numberOfOpenedImages = 0;
49 
50  // Try to distinguish a jpeg2000 file whith the resoltion: filename:resId
51  std::string realFile(filename);
52  unsigned int addNum(0);
53  System::ParseFileNameForAdditonalInfo( filename, realFile, addNum );
54 
55  if( filename != realFile )
56  {
57  if( m_Model->IsJPEG2000File( realFile ) || m_Model->IsHDFFile(realFile) )
58  {
59  try
60  {
61  numberOfOpenedImages = m_Model->OpenImage( realFile, addNum );
62  return numberOfOpenedImages;
63  }
64  catch (itk::ExceptionObject & err)
65  {
66  MsgReporter::GetInstance()->SendError(err.GetDescription());
67  }
68  }
69  }
70 
71  try
72  {
73  std::string strFilename = filename;
74  numberOfOpenedImages = m_Model->OpenImage( strFilename, id );
75  }
76  catch ( ... )
77  {
78  try
79  {
80  std::string strFilename = filename;
81  numberOfOpenedImages = m_Model->OpenImageList( strFilename );
82  }
83  catch (itk::ExceptionObject & err)
84  {
85  MsgReporter::GetInstance()->SendError(err.GetDescription());
86  }
87  }
88 
89  return numberOfOpenedImages;
90 }
91 
95 void
97 ::CloseImage(unsigned int selectedItem)
98 {
99  try
100  {
101  m_Model->CloseImage( selectedItem );
102  }
103  catch (itk::ExceptionObject & err)
104  {
105  MsgReporter::GetInstance()->SendError(err.GetDescription());
106  }
107 }
108 
109 void
111 ::UpdateRGBChannelOrder(int redChoice , int greenChoice, int BlueChoice, unsigned int selectedItem)
112 {
113  try
114  {
115 
116  m_Model->UpdateRGBChannelOrder(redChoice, greenChoice, BlueChoice, selectedItem);
117  }
118  catch (itk::ExceptionObject & err)
119  {
120  MsgReporter::GetInstance()->SendError(err.GetDescription());
121  }
122 }
123 
124 void
126 ::UpdateGrayScaleChannelOrder(int choice, unsigned int selectedItem)
127 {
128  try
129  {
130 
131  m_Model->UpdateGrayScaleChannelOrder(choice, selectedItem);
132  }
133  catch (itk::ExceptionObject & err)
134  {
135  MsgReporter::GetInstance()->SendError(err.GetDescription());
136  }
137 }
138 
139 void
141 ::UpdateAmplitudeChannelOrder(int realChoice, int imChoice, unsigned int selectedItem)
142 {
143  try
144  {
145  m_Model->UpdateAmplitudeChannelOrder(realChoice, imChoice, selectedItem);
146  }
147  catch (itk::ExceptionObject & err)
148  {
149  MsgReporter::GetInstance()->SendError(err.GetDescription());
150  }
151 }
152 
153 void
155 ::UpdatePhaseChannelOrder(int realChoice, int imChoice, unsigned int selectedItem)
156 {
157  try
158  {
159  m_Model->UpdatePhaseChannelOrder(realChoice, imChoice, selectedItem);
160  }
161  catch (itk::ExceptionObject & err)
162  {
163  MsgReporter::GetInstance()->SendError(err.GetDescription());
164  }
165 }
166 
167 void
169 ::Link(unsigned int leftChoice, unsigned int rightChoice, OffsetType offset)
170 {
171  try
172  {
173  m_Model->Link(leftChoice, rightChoice, offset);
174  }
175  catch (itk::ExceptionObject & err)
176  {
177  MsgReporter::GetInstance()->SendError(err.GetDescription());
178  }
179 }
180 
181 void
183 ::UpdateImageViewController(unsigned int selectedItem)
184 {
185  try
186  {
187  m_Model->InitializeImageViewController(selectedItem);
188  }
189  catch (itk::ExceptionObject & err)
190  {
191  MsgReporter::GetInstance()->SendError(err.GetDescription());
192  }
193 }
194 
195 } // end namespace otb

Generated at Sun Feb 3 2013 00:55:04 for Orfeo Toolbox with doxygen 1.8.1.1