mvdApplication.cxx 3.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

#include "mvdApplication.h"


/*****************************************************************************/
/* INCLUDE SECTION                                                           */

//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.

//
// System includes (sorted by alphabetic order)

//
// OTB includes (sorted by alphabetic order)

//
// Monteverdi includes (sorted by alphabetic order)
39
#include "mvdMainWindow.h"
40
#include "mvdStackedLayerModel.h"
41 42

//
43
#ifdef OTB_USE_QT
44
#  include "mvdOTBApplicationsModel.h"
45 46
#endif

47 48 49 50
#if USE_OTB_APPS
#include "otbWrapperApplicationRegistry.h"
#endif

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
//
// Class implementation.
namespace mvd
{

/*
  TRANSLATOR mvd::Application

  Necessary for lupdate to be aware of C++ namespaces.

  Context comment for translator.
*/

/*****************************************************************************/
/* CONSTANTS                                                                 */

/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION                                             */


/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION                                              */

/*******************************************************************************/
Application
::Application( QApplication* qtApp ) :
  I18nApplication( qtApp ),
  m_OTBApplicationsModel( NULL )
{
}

/*******************************************************************************/
Application
::~Application()
{
86 87 88
#if USE_OTB_APPS
  otb::Wrapper::ApplicationRegistry::CleanRegistry();
#endif
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
}

/*******************************************************************************/
/*
CountType
Application
::OpenDatabase()
{
  DatabaseModel* databaseModel = new DatabaseModel( this );

  DatabaseModel::BuildContext context;
  databaseModel->BuildModel( &context );

  SetModel( databaseModel );

  return context.m_NbOutdatedDatasetModels;
}
*/

/*******************************************************************************/
/*
void
Application
::CloseDatabase()
{
  // Delete model and release resources.
  SetModel( NULL );
}
*/

/*******************************************************************************/
void
Application
::OpenApplicationsBrowser()
{
124
#ifdef OTB_USE_QT
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
  m_OTBApplicationsModel = new OTBApplicationsModel( this );

  m_OTBApplicationsModel->BuildModel();
#endif
}

/*******************************************************************************/
void
Application
::virtual_InitializeCore()
{
  I18nApplication::virtual_InitializeCore();

  setObjectName( "Application" );

  InitializeCore(
141
    PROJECT_NAME, QString( "OTB %1" ).arg(  OTB_VERSION_STRING ),
142 143 144 145
    "OrfeoToolBox", "orfeo-toolbox.org"
  );

  //
146
  // Create the OTBApplications model
147 148 149 150 151 152 153
  OpenApplicationsBrowser();
}

/*******************************************************************************/
/* SLOTS                                                                       */

} // end namespace 'mvd'