[ossim-gui] 01/02: Imported Upstream version 1.8.20.3+ds
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Jun 3 19:11:23 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository ossim-gui.
commit dfa4a5682cc65d6514a23cd454ec11220ebd30b2
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Jun 3 20:26:12 2016 +0200
Imported Upstream version 1.8.20.3+ds
---
ossimGui/CMakeLists.txt | 91 +
ossimGui/apps/ossim-geocell/ossim-geocell.cpp | 119 +
ossimGui/images/images.qrc | 26 +
ossimGui/images/logos/OSSIM.png | Bin 0 -> 41779 bytes
ossimGui/images/logos/RadiantBlue.png | Bin 0 -> 25354 bytes
ossimGui/images/logos/RadiantBlue2.png | Bin 0 -> 44771 bytes
ossimGui/images/splash/GeoCellSplash.png | Bin 0 -> 188260 bytes
ossimGui/images/splash/ImageLinkerSplash.png | Bin 0 -> 153629 bytes
ossimGui/images/splash/Splash.png | Bin 0 -> 64145 bytes
ossimGui/images/splash/iviewsplash.png | Bin 0 -> 131819 bytes
ossimGui/images/themes/default/mActionAddImage.png | Bin 0 -> 747 bytes
ossimGui/images/themes/default/mActionAddLayer.png | Bin 0 -> 1549 bytes
.../images/themes/default/mActionAddOgrLayer.png | Bin 0 -> 1996 bytes
.../themes/default/mActionAddRasterLayer.png | Bin 0 -> 1890 bytes
.../images/themes/default/mActionAddWmsLayer.png | Bin 0 -> 1987 bytes
.../images/themes/default/mActionZoomActual.png | Bin 0 -> 1312 bytes
.../themes/default/mActionZoomFullExtent.png | Bin 0 -> 1259 bytes
ossimGui/images/themes/default/mActionZoomIn.png | Bin 0 -> 975 bytes
ossimGui/images/themes/default/mActionZoomOut.png | Bin 0 -> 937 bytes
ossimGui/images/themes/default/mIconNoPyramid.png | Bin 0 -> 831 bytes
.../themes/default/mIconProjectionDisabled.png | Bin 0 -> 1077 bytes
.../themes/default/mIconProjectionEnabled.png | Bin 0 -> 1005 bytes
.../themes/default/mIconProjectionProblem.png | Bin 0 -> 775 bytes
ossimGui/images/themes/default/mIconPyramid.png | Bin 0 -> 854 bytes
ossimGui/images/themes/default/mIconWmsLayer.png | Bin 0 -> 2144 bytes
ossimGui/include/ossimGui/About.h | 17 +
.../include/ossimGui/AdjustableParameterEditor.h | 74 +
ossimGui/include/ossimGui/AnnotationItem.h | 50 +
ossimGui/include/ossimGui/AutoMeasurementDialog.h | 71 +
ossimGui/include/ossimGui/BandSelectorEditor.h | 50 +
.../include/ossimGui/BrightnessContrastEditor.h | 33 +
ossimGui/include/ossimGui/ChipperDialog.h | 156 +
ossimGui/include/ossimGui/Common.h | 32 +
.../include/ossimGui/ConnectableDisplayObject.h | 24 +
ossimGui/include/ossimGui/ConnectableImageObject.h | 28 +
ossimGui/include/ossimGui/ConnectableObject.h | 38 +
ossimGui/include/ossimGui/CopyChainVisitor.h | 26 +
ossimGui/include/ossimGui/DataManager.h | 193 +
.../include/ossimGui/DataManagerPropertyView.h | 108 +
ossimGui/include/ossimGui/DataManagerWidget.h | 774 ++++
ossimGui/include/ossimGui/DisplayTimerJobQueue.h | 48 +
ossimGui/include/ossimGui/Event.h | 147 +
ossimGui/include/ossimGui/Export.h | 52 +
ossimGui/include/ossimGui/ExportImageDialog.h | 35 +
.../ossimGui/GatherImageViewProjTransVisitor.h | 28 +
ossimGui/include/ossimGui/GlWidget.h | 119 +
.../include/ossimGui/HistogramRemapperEditor.h | 45 +
ossimGui/include/ossimGui/HistogramWidget.h | 61 +
ossimGui/include/ossimGui/HsiRemapperEditor.h | 64 +
ossimGui/include/ossimGui/Image.h | 27 +
ossimGui/include/ossimGui/ImageMdiSubWindow.h | 139 +
ossimGui/include/ossimGui/ImageScrollView.h | 374 ++
ossimGui/include/ossimGui/ImageViewManipulator.h | 104 +
ossimGui/include/ossimGui/ImageWidget.h | 390 ++
ossimGui/include/ossimGui/ImageWriterJob.h | 27 +
ossimGui/include/ossimGui/IvtGeomTransform.h | 40 +
ossimGui/include/ossimGui/MainWindow.h | 64 +
ossimGui/include/ossimGui/MarkPoint.h | 46 +
ossimGui/include/ossimGui/MdiSubWindowBase.h | 33 +
ossimGui/include/ossimGui/MetricOverlay.h | 53 +
ossimGui/include/ossimGui/MultiImageDialog.h | 88 +
ossimGui/include/ossimGui/OpenImageDialog.h | 71 +
ossimGui/include/ossimGui/OpenImageUrlJob.h | 34 +
ossimGui/include/ossimGui/OssimObjectFactory.h | 37 +
ossimGui/include/ossimGui/OverlayBase.h | 33 +
ossimGui/include/ossimGui/PlanetMdiSubWindow.h | 78 +
ossimGui/include/ossimGui/PolygonRemapperDialog.h | 78 +
.../include/ossimGui/PositionInformationDialog.h | 48 +
ossimGui/include/ossimGui/ProcessInterfaceJob.h | 39 +
ossimGui/include/ossimGui/ProgressDialog.h | 40 +
ossimGui/include/ossimGui/ProgressWidget.h | 38 +
ossimGui/include/ossimGui/PropertyEditorDialog.h | 42 +
ossimGui/include/ossimGui/RegPoint.h | 50 +
ossimGui/include/ossimGui/RegistrationOverlay.h | 66 +
ossimGui/include/ossimGui/RoiRectAnnotator.h | 148 +
ossimGui/include/ossimGui/RoiSelection.h | 51 +
ossimGui/include/ossimGui/SetViewVisitor.h | 42 +
ossimGui/include/ossimGui/StaticTileImageCache.h | 134 +
ossimGui/include/ossimGui/Util.h | 33 +
ossimGui/include/ossimGui/View.h | 116 +
ossimGui/include/ossimGui/ViewManipulator.h | 37 +
ossimGui/src/ossimGui/About.cpp | 10 +
.../src/ossimGui/AdjustableParameterEditor.cpp | 405 ++
ossimGui/src/ossimGui/AnnotationItem.cpp | 41 +
ossimGui/src/ossimGui/AutoMeasurementDialog.cpp | 436 +++
ossimGui/src/ossimGui/BandSelectorEditor.cpp | 288 ++
ossimGui/src/ossimGui/BrightnessContrastEditor.cpp | 97 +
ossimGui/src/ossimGui/ChipperDialog.cpp | 1242 ++++++
ossimGui/src/ossimGui/ConnectableDisplayObject.cpp | 46 +
ossimGui/src/ossimGui/ConnectableImageObject.cpp | 45 +
ossimGui/src/ossimGui/ConnectableObject.cpp | 29 +
ossimGui/src/ossimGui/CopyChainVisitor.cpp | 28 +
ossimGui/src/ossimGui/DataManager.cpp | 1432 +++++++
ossimGui/src/ossimGui/DataManagerPropertyView.cpp | 370 ++
ossimGui/src/ossimGui/DataManagerWidget.cpp | 4104 ++++++++++++++++++++
ossimGui/src/ossimGui/DisplayTimerJobQueue.cpp | 103 +
ossimGui/src/ossimGui/Event.cpp | 0
ossimGui/src/ossimGui/ExportImageDialog.cpp | 214 +
.../ossimGui/GatherImageViewProjTransVisitor.cpp | 40 +
ossimGui/src/ossimGui/GlWidget.cpp | 452 +++
ossimGui/src/ossimGui/HistogramRemapperEditor.cpp | 403 ++
ossimGui/src/ossimGui/HistogramWidget.cpp | 277 ++
ossimGui/src/ossimGui/HsiRemapperEditor.cpp | 500 +++
ossimGui/src/ossimGui/Image.cpp | 118 +
ossimGui/src/ossimGui/ImageMdiSubWindow.cpp | 1309 +++++++
ossimGui/src/ossimGui/ImageScrollView.cpp | 1115 ++++++
ossimGui/src/ossimGui/ImageViewManipulator.cpp | 627 +++
ossimGui/src/ossimGui/ImageWidget.cpp | 1013 +++++
ossimGui/src/ossimGui/ImageWriterJob.cpp | 31 +
ossimGui/src/ossimGui/IvtGeomTransform.cpp | 60 +
ossimGui/src/ossimGui/MainWindow.cpp | 519 +++
ossimGui/src/ossimGui/MarkPoint.cpp | 72 +
ossimGui/src/ossimGui/MdiSubWindowBase.cpp | 41 +
ossimGui/src/ossimGui/MetricOverlay.cpp | 147 +
ossimGui/src/ossimGui/MultiImageDialog.cpp | 720 ++++
ossimGui/src/ossimGui/OpenImageDialog.cpp | 175 +
ossimGui/src/ossimGui/OpenImageUrlJob.cpp | 38 +
ossimGui/src/ossimGui/OssimObjectFactory.cpp | 54 +
ossimGui/src/ossimGui/OverlayBase.cpp | 31 +
ossimGui/src/ossimGui/PlanetMdiSubWindow.cpp | 908 +++++
ossimGui/src/ossimGui/PolygonRemapperDialog.cpp | 375 ++
.../src/ossimGui/PositionInformationDialog.cpp | 235 ++
ossimGui/src/ossimGui/ProcessInterfaceJob.cpp | 59 +
ossimGui/src/ossimGui/ProgressDialog.cpp | 55 +
ossimGui/src/ossimGui/ProgressWidget.cpp | 78 +
ossimGui/src/ossimGui/PropertyEditorDialog.cpp | 64 +
ossimGui/src/ossimGui/RegPoint.cpp | 86 +
ossimGui/src/ossimGui/RegistrationOverlay.cpp | 228 ++
ossimGui/src/ossimGui/RoiRectAnnotator.cpp | 322 ++
ossimGui/src/ossimGui/RoiSelection.cpp | 131 +
ossimGui/src/ossimGui/SetViewVisitor.cpp | 66 +
ossimGui/src/ossimGui/StaticTileImageCache.cpp | 486 +++
ossimGui/src/ossimGui/Util.cpp | 24 +
ossimGui/src/ossimGui/View.cpp | 0
ossimGui/src/ossimGui/ViewManipulator.cpp | 217 ++
ossimGui/src/ossimGui/ui/About.ui | 135 +
.../src/ossimGui/ui/AdjustableParameterEditor.ui | 171 +
ossimGui/src/ossimGui/ui/AutoMeasurementDialog.ui | 633 +++
ossimGui/src/ossimGui/ui/BandSelectorEditor.ui | 123 +
.../src/ossimGui/ui/BrightnessContrastEditor.ui | 163 +
ossimGui/src/ossimGui/ui/ExportImageDialog.ui | 230 ++
.../src/ossimGui/ui/HistogramRemapperEditor.ui | 533 +++
ossimGui/src/ossimGui/ui/HsiRemapperEditor.ui | 780 ++++
ossimGui/src/ossimGui/ui/MainWindow.ui | 131 +
ossimGui/src/ossimGui/ui/MultiImageDialog.ui | 515 +++
145 files changed, 28489 insertions(+)
diff --git a/ossimGui/CMakeLists.txt b/ossimGui/CMakeLists.txt
new file mode 100644
index 0000000..4e3faf9
--- /dev/null
+++ b/ossimGui/CMakeLists.txt
@@ -0,0 +1,91 @@
+PROJECT(ossimGui)
+MESSAGE("**********************Setting up ossimGui********************")
+INCLUDE(OssimVersion)
+INCLUDE(OssimUtilities)
+INCLUDE(OssimCommonVariables)
+INCLUDE(OssimQt4Macros)
+
+SET (QT_MIN_VERSION "4.2.2")
+
+FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
+INCLUDE(${QT_USE_FILE})
+SET(QT_USE_QTOPENGL ON)
+find_package(Qt4)
+
+find_package(OpenThreads)
+find_package(ossim)
+find_package(TIFF)
+IF(BUILD_OSSIMPLANET)
+ find_package(ossimPlanet)
+ find_package(OpenGL)
+ find_package(OSG)
+ENDIF(BUILD_OSSIMPLANET)
+
+ADD_DEFINITIONS(${QT_DEFINITIONS}
+ -DQT_CORE_LIB
+ -DQT_GUI_LIB
+ -DQT_THREAD_SUPPORT
+)
+INCLUDE_DIRECTORIES(${${PROJECT_NAME}_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${OSSIM_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(${QT_INCLUDES})
+INCLUDE_DIRECTORIES(${OPENTHREADS_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
+
+#MESSAGE(STATUS "QT_INCLUDES = ${QT_INCLUDES}")
+
+############################################## BUILD THE LIBRARY ############################################
+SET(LIB_NAME ossimGui)
+FILE(GLOB OSSIMGUI_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include/ossimGui/*.h")
+FILE(GLOB OSSIMGUI_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimGui/*.cpp" )
+FILE(GLOB OSSIMGUI_UIS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimGui/ui/*.ui")
+
+SET(ADDITIONAL_LIBRARIES "")
+IF(BUILD_OSSIMPLANET)
+# LIST(APPEND ADDITIONAL_INCLUDES ${OSSIMPLANET_INCLUDE_DIR})
+# LIST(APPEND ADDITIONAL_INCLUDES ${OSG_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${OSSIMPLANET_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})
+
+ LIST(APPEND ADDITIONAL_LIBRARIES ${OSSIMPLANET_LIBRARY})
+ LIST(APPEND ADDITIONAL_LIBRARIES ${QT_QTOPENGL_LIBRARY})
+
+ ADD_DEFINITIONS(-DOSSIM_PLANET_ENABLED)
+ELSE()
+
+ LIST(REMOVE_ITEM OSSIMGUI_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimGui/PlanetMdiSubWindow.cpp")
+ LIST(REMOVE_ITEM OSSIMGUI_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimGui/GlWidget.cpp")
+ LIST(REMOVE_ITEM OSSIMGUI_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include/ossimGui/PlanetMdiSubWindow.h")
+ LIST(REMOVE_ITEM OSSIMGUI_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include/ossimGui/GlWidget.h")
+
+ENDIF()
+
+MESSAGE("QT4_LIBRARIES === ${QT_LIBRARIES}")
+QT4_WRAP_CPP(OSSIMGUI_MOC_SRCS ${OSSIMGUI_INCLUDES} )
+
+MESSAGE("UI_DESTINATION_DIR ${${PROJECT_NAME}_SOURCE_DIR}/include/ossimGui")
+SET(UI_DESTINATION_DIR ${${PROJECT_NAME}_SOURCE_DIR}/include/ossimGui)
+OSSIM_QT4_WRAP_UI(OSSIMGUI_UI_SRC ${OSSIMGUI_UIS} )
+
+SET(INCLUDE_DIR "include/ossimGui")
+
+#---
+# NOTE: INSTALL_HEADERS removed from last argument line for rpms as they were
+# not prefixed and not needed for development purposes at this time.
+#---
+OSSIM_LINK_LIBRARY(${LIB_NAME} COMPONENT_NAME ossim
+ TYPE "${OSSIM_USER_DEFINED_DYNAMIC_OR_STATIC}" HEADERS ${OSSIMGUI_INCLUDES} ${OSSIMGUI_UI_SRC} SOURCE_FILES ${OSSIMGUI_SRCS} ${OSSIMGUI_MOC_SRCS}
+ LIBRARIES ${OSSIM_LIBRARY} ${OSG_LIBRARY} ${OPENTHREADS_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARY} ${QT_LIBRARIES} ${TIFF_LIBRARIES} ${ADDITIONAL_LIBRARIES}
+ INSTALL_LIB VERSION_SYMLINKS ADDITIONAL_COMPILE_FLAGS "-DOSSIMGUI_LIBRARY")
+
+############################################# BUILD THE APPLICATIONS #################################################
+
+QT4_ADD_RESOURCES(OSSIMGUI_RC "${PROJECT_SOURCE_DIR}/images/images.qrc")
+set(TARGET_COMMON_LIBRARIES ossimGui)
+FILE(GLOB SOURCE_FILES "${PROJECT_SOURCE_DIR}/apps/ossim-geocell/ossim-geocell.cpp")
+SET(OSSIM_BUILD_APPLICATION_BUNDLES ON)
+MESSAGE(STATUS "IMAGELINKER SOURCE FILES = ${SOURCE_FILES}")
+OSSIM_SETUP_APPLICATION(ossim-geocell INSTALL REQUIRE_WINMAIN_FLAG COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES} ${OSSIMGUI_RC})
+
+########################### SETUP UNINSTALL ############################
+OSSIM_ADD_COMMON_MAKE_UNINSTALL()
diff --git a/ossimGui/apps/ossim-geocell/ossim-geocell.cpp b/ossimGui/apps/ossim-geocell/ossim-geocell.cpp
new file mode 100644
index 0000000..dda6abb
--- /dev/null
+++ b/ossimGui/apps/ossim-geocell/ossim-geocell.cpp
@@ -0,0 +1,119 @@
+// $Id$
+
+#include <iostream>
+#include <QtGui/QApplication>
+#include <QtGui/QSplashScreen>
+#include <QtCore/QThread>
+#include <ossimGui/MainWindow.h>
+#include <ossimGui/OssimObjectFactory.h>
+#include <ossim/base/ossimArgumentParser.h>
+#include <ossim/base/ossimApplicationUsage.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/init/ossimInit.h>
+#include <OpenThreads/Thread>
+#ifdef OSSIMQT_USE_WINDOWS_STYLE
+#include <QtGui/QWindowsStyle>
+#endif
+#include <ossim/base/ossimEnvironmentUtility.h>
+
+#ifdef WIN32
+int main(int argc, char *argv[]);
+#include <windows.h>
+#include <shellapi.h>
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ PSTR lpCmdLine, int nCmdShow)
+{
+ typedef int (__cdecl *GETMAINARGS)(int*, char***, char***, int, int*);
+
+ int argc;
+ char** argv;
+ char** env;
+ int new_mode = 0;
+ GETMAINARGS getmainargs;
+
+ getmainargs = (GETMAINARGS) GetProcAddress(LoadLibrary("msvcrt"),"__getmainargs");
+ getmainargs(&argc,&argv,&env,0,&new_mode);
+ int ret = main(argc,argv);
+
+ return ret;
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+ ossimArgumentParser argumentParser(&argc, argv);
+ ossimInit::instance()->addOptions(argumentParser);
+ ossimInit::instance()->initialize(argumentParser);
+ argumentParser.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
+ argumentParser.getApplicationUsage()->setApplicationName(argumentParser.getApplicationName());
+ argumentParser.getApplicationUsage()->setDescription(argumentParser.getApplicationName()+" GUI application for the ossim core library");
+ argumentParser.getApplicationUsage()->setCommandLineUsage(argumentParser.getApplicationName()+" [options]");
+ argumentParser.getApplicationUsage()->addCommandLineOption("-project","OPTIONAL: project file");
+ argumentParser.getApplicationUsage()->addCommandLineOption("No '-','*.gcl' file","untagged project file with 'gcl' extension");
+
+ if (argumentParser.read("-h") || argumentParser.read("--help"))
+ {
+ argumentParser.getApplicationUsage()->write(std::cout);
+ exit(0);
+ }
+
+ // project file
+ std::string tempString;
+ ossimArgumentParser::ossimParameter stringParam(tempString);
+ ossimString projFile;
+ while(argumentParser.read("-project", stringParam))
+ {
+ projFile = tempString;
+ }
+
+ // additional check for stand-alone ".gcl" project file
+ // or list of images
+ std::vector<ossimString> ilist;
+ if (argc > 1)
+ {
+ for (int k=1; k<argc; ++k)
+ {
+ tempString = argv[k];
+ if (tempString.find(".gcl") != std::string::npos)
+ {
+ projFile = tempString;
+ }
+ else
+ {
+ ilist.push_back(tempString);
+ }
+ }
+ }
+
+
+ argumentParser.reportRemainingOptionsAsUnrecognized();
+ QApplication app(argc, argv);
+ QSplashScreen splash(QPixmap(":/splash/GeoCellSplash.png"));
+ splash.setWindowFlags(splash.windowFlags()|Qt::WindowStaysOnTopHint);
+ splash.show();
+#ifdef OSSIMQT_USE_WINDOWS_STYLE
+ QWindowsStyle *style = new QWindowsStyle();
+ app.setStyle(style);
+#endif
+ ossimObjectFactoryRegistry::instance()->registerFactory(ossimGui::OssimObjectFactory::instance());
+ ossimGui::MainWindow* mainWindow = new ossimGui::MainWindow();
+
+ // Load command line project file or image files if present
+ if (projFile.size()>0)
+ {
+ mainWindow->loadProjectFile(projFile);
+ }
+ else if (ilist.size()>0)
+ {
+ mainWindow->loadImageFileList(ilist);
+ }
+ mainWindow->show();
+
+ OpenThreads::Thread::microSleep((1000*1000));
+ //splash.finish(mainWindow);
+ splash.close();
+ int result = app.exec();
+ ossimInit::instance()->finalize();
+
+ return result;
+}
diff --git a/ossimGui/images/images.qrc b/ossimGui/images/images.qrc
new file mode 100644
index 0000000..d184828
--- /dev/null
+++ b/ossimGui/images/images.qrc
@@ -0,0 +1,26 @@
+<RCC>
+ <qresource prefix="/">
+ <file>splash/ImageLinkerSplash.png</file>
+ <file>splash/iviewsplash.png</file>
+ <file>splash/Splash.png</file>
+ <file>themes/default/mActionZoomFullExtent.png</file>
+ <file>themes/default/mActionZoomIn.png</file>
+ <file>themes/default/mIconNoPyramid.png</file>
+ <file>themes/default/mIconPyramid.png</file>
+ <file>themes/default/mActionZoomActual.png</file>
+ <file>themes/default/mActionZoomOut.png</file>
+ <file>themes/default/mActionAddImage.png</file>
+ <file>themes/default/mActionAddLayer.png</file>
+ <file>themes/default/mActionAddRasterLayer.png</file>
+ <file>themes/default/mActionAddWmsLayer.png</file>
+ <file>themes/default/mIconProjectionDisabled.png</file>
+ <file>themes/default/mIconProjectionEnabled.png</file>
+ <file>themes/default/mIconProjectionProblem.png</file>
+ <file>themes/default/mIconWmsLayer.png</file>
+ <file>themes/default/mActionAddOgrLayer.png</file>
+ <file>splash/GeoCellSplash.png</file>
+ <file>logos/RadiantBlue2.png</file>
+ <file>logos/RadiantBlue.png</file>
+ <file>logos/OSSIM.png</file>
+ </qresource>
+</RCC>
diff --git a/ossimGui/images/logos/OSSIM.png b/ossimGui/images/logos/OSSIM.png
new file mode 100644
index 0000000..a3b4038
Binary files /dev/null and b/ossimGui/images/logos/OSSIM.png differ
diff --git a/ossimGui/images/logos/RadiantBlue.png b/ossimGui/images/logos/RadiantBlue.png
new file mode 100644
index 0000000..f85983b
Binary files /dev/null and b/ossimGui/images/logos/RadiantBlue.png differ
diff --git a/ossimGui/images/logos/RadiantBlue2.png b/ossimGui/images/logos/RadiantBlue2.png
new file mode 100644
index 0000000..f027aaf
Binary files /dev/null and b/ossimGui/images/logos/RadiantBlue2.png differ
diff --git a/ossimGui/images/splash/GeoCellSplash.png b/ossimGui/images/splash/GeoCellSplash.png
new file mode 100644
index 0000000..3eeda86
Binary files /dev/null and b/ossimGui/images/splash/GeoCellSplash.png differ
diff --git a/ossimGui/images/splash/ImageLinkerSplash.png b/ossimGui/images/splash/ImageLinkerSplash.png
new file mode 100644
index 0000000..5721c17
Binary files /dev/null and b/ossimGui/images/splash/ImageLinkerSplash.png differ
diff --git a/ossimGui/images/splash/Splash.png b/ossimGui/images/splash/Splash.png
new file mode 100644
index 0000000..527aecd
Binary files /dev/null and b/ossimGui/images/splash/Splash.png differ
diff --git a/ossimGui/images/splash/iviewsplash.png b/ossimGui/images/splash/iviewsplash.png
new file mode 100644
index 0000000..7759e21
Binary files /dev/null and b/ossimGui/images/splash/iviewsplash.png differ
diff --git a/ossimGui/images/themes/default/mActionAddImage.png b/ossimGui/images/themes/default/mActionAddImage.png
new file mode 100644
index 0000000..364167f
Binary files /dev/null and b/ossimGui/images/themes/default/mActionAddImage.png differ
diff --git a/ossimGui/images/themes/default/mActionAddLayer.png b/ossimGui/images/themes/default/mActionAddLayer.png
new file mode 100644
index 0000000..fd46e2b
Binary files /dev/null and b/ossimGui/images/themes/default/mActionAddLayer.png differ
diff --git a/ossimGui/images/themes/default/mActionAddOgrLayer.png b/ossimGui/images/themes/default/mActionAddOgrLayer.png
new file mode 100644
index 0000000..d5dd2c1
Binary files /dev/null and b/ossimGui/images/themes/default/mActionAddOgrLayer.png differ
diff --git a/ossimGui/images/themes/default/mActionAddRasterLayer.png b/ossimGui/images/themes/default/mActionAddRasterLayer.png
new file mode 100644
index 0000000..d579199
Binary files /dev/null and b/ossimGui/images/themes/default/mActionAddRasterLayer.png differ
diff --git a/ossimGui/images/themes/default/mActionAddWmsLayer.png b/ossimGui/images/themes/default/mActionAddWmsLayer.png
new file mode 100644
index 0000000..4965641
Binary files /dev/null and b/ossimGui/images/themes/default/mActionAddWmsLayer.png differ
diff --git a/ossimGui/images/themes/default/mActionZoomActual.png b/ossimGui/images/themes/default/mActionZoomActual.png
new file mode 100644
index 0000000..2b5c56f
Binary files /dev/null and b/ossimGui/images/themes/default/mActionZoomActual.png differ
diff --git a/ossimGui/images/themes/default/mActionZoomFullExtent.png b/ossimGui/images/themes/default/mActionZoomFullExtent.png
new file mode 100644
index 0000000..e53755d
Binary files /dev/null and b/ossimGui/images/themes/default/mActionZoomFullExtent.png differ
diff --git a/ossimGui/images/themes/default/mActionZoomIn.png b/ossimGui/images/themes/default/mActionZoomIn.png
new file mode 100644
index 0000000..76f4631
Binary files /dev/null and b/ossimGui/images/themes/default/mActionZoomIn.png differ
diff --git a/ossimGui/images/themes/default/mActionZoomOut.png b/ossimGui/images/themes/default/mActionZoomOut.png
new file mode 100644
index 0000000..a1a1cd1
Binary files /dev/null and b/ossimGui/images/themes/default/mActionZoomOut.png differ
diff --git a/ossimGui/images/themes/default/mIconNoPyramid.png b/ossimGui/images/themes/default/mIconNoPyramid.png
new file mode 100644
index 0000000..d634bfc
Binary files /dev/null and b/ossimGui/images/themes/default/mIconNoPyramid.png differ
diff --git a/ossimGui/images/themes/default/mIconProjectionDisabled.png b/ossimGui/images/themes/default/mIconProjectionDisabled.png
new file mode 100644
index 0000000..8c46acd
Binary files /dev/null and b/ossimGui/images/themes/default/mIconProjectionDisabled.png differ
diff --git a/ossimGui/images/themes/default/mIconProjectionEnabled.png b/ossimGui/images/themes/default/mIconProjectionEnabled.png
new file mode 100644
index 0000000..30e3d0b
Binary files /dev/null and b/ossimGui/images/themes/default/mIconProjectionEnabled.png differ
diff --git a/ossimGui/images/themes/default/mIconProjectionProblem.png b/ossimGui/images/themes/default/mIconProjectionProblem.png
new file mode 100644
index 0000000..a603c99
Binary files /dev/null and b/ossimGui/images/themes/default/mIconProjectionProblem.png differ
diff --git a/ossimGui/images/themes/default/mIconPyramid.png b/ossimGui/images/themes/default/mIconPyramid.png
new file mode 100644
index 0000000..de810a0
Binary files /dev/null and b/ossimGui/images/themes/default/mIconPyramid.png differ
diff --git a/ossimGui/images/themes/default/mIconWmsLayer.png b/ossimGui/images/themes/default/mIconWmsLayer.png
new file mode 100644
index 0000000..82325d4
Binary files /dev/null and b/ossimGui/images/themes/default/mIconWmsLayer.png differ
diff --git a/ossimGui/include/ossimGui/About.h b/ossimGui/include/ossimGui/About.h
new file mode 100644
index 0000000..a05b0fc
--- /dev/null
+++ b/ossimGui/include/ossimGui/About.h
@@ -0,0 +1,17 @@
+#ifndef ossimGuiAbout_HEADER
+#define ossimGuiAbout_HEADER
+#include <ossimGui/ui_About.h>
+#include <QtGui/QDialog>
+#include <ossimGui/Export.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL About : public QDialog, public Ui::About
+ {
+ Q_OBJECT
+ public:
+ About(QWidget* parent);
+
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/AdjustableParameterEditor.h b/ossimGui/include/ossimGui/AdjustableParameterEditor.h
new file mode 100644
index 0000000..4f0cd0a
--- /dev/null
+++ b/ossimGui/include/ossimGui/AdjustableParameterEditor.h
@@ -0,0 +1,74 @@
+#ifndef ossimGuiAdjustableParameterEditor_HEADER
+#define ossimGuiAdjustableParameterEditor_HEADER
+#include <ossimGui/ui_AdjustableParameterEditor.h>
+#include <QtGui/QDialog>
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimAdjustableParameterInterface.h>
+#include <ossim/base/ossimFilename.h>
+namespace ossimGui
+{
+ class AdjustableParameterSlider : public QSlider
+ {
+ Q_OBJECT
+ public:
+ AdjustableParameterSlider(int row, int col)
+ :QSlider(Qt::Horizontal),
+ m_row(row),
+ m_col(col)
+ {
+ connect(this, SIGNAL(valueChanged(int)), SLOT(valueChanged(int)));
+ }
+
+ signals:
+ void parameterChanged(int rowIdx, int colIdx);
+
+
+ public slots:
+ void valueChanged(int /* value */)
+ {
+ emit parameterChanged(m_row, m_col);
+ }
+ protected:
+ int m_row;
+ int m_col;
+ };
+
+ class OSSIMGUI_DLL AdjustableParameterEditor : public QDialog, public Ui::AdjustableParameterEditor
+ {
+ Q_OBJECT
+ public:
+ AdjustableParameterEditor(QWidget* parent=0, Qt::WindowFlags f = 0 );
+
+ void setObject(ossimObject* obj);
+ void setImageSource();
+
+ signals:
+ void sourceChanged(const QString&);
+
+ public slots:
+ void valueChanged(int row, int col);
+ void resetTable();
+ void keepAdjustment();
+ void saveAdjustment();
+ void copyAdjustment();
+ void deleteAdjustment();
+ void selectionListChanged();
+ void adjustmentDescriptionChanged(const QString&);
+ void setSource(const QString&);
+
+ protected:
+ ossimFilename findDefaultFilename();
+ void transferToDialog();
+ void transferToTable();
+ void transferToList();
+ void fireRefreshEvent();
+
+
+ ossimRefPtr<ossimObject> m_object;
+ ossimAdjustableParameterInterface* m_interface;
+ ossimFilename m_filename;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/AnnotationItem.h b/ossimGui/include/ossimGui/AnnotationItem.h
new file mode 100644
index 0000000..b05ef7d
--- /dev/null
+++ b/ossimGui/include/ossimGui/AnnotationItem.h
@@ -0,0 +1,50 @@
+#ifndef ossimGuiAnnotationItem_HEADER
+#define ossimGuiAnnotationItem_HEADER
+
+#include <QtGui/QWidget>
+#include <QtGui/QGraphicsItem>
+#include <QtGui/QGraphicsTextItem>
+#include <QtGui/QGraphicsLineItem>
+#include <QtGui/QGraphicsRectItem>
+#include <QtGui/QPen>
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL AnnotationItem : public QGraphicsItem
+ {
+
+ public:
+ enum ItemDataType
+ {
+ DATA_ITEM_ID=0,
+ DATA_OVERLAY_ID
+ };
+
+ AnnotationItem(const ossimString& overlayId, const ossimString& id = "");
+ virtual ossimString getID()const {return m_id;}
+ virtual ossimString getOverlayId()const {return m_overlayId;}
+ virtual bool isUsable()const {return m_isEnabled;}
+
+ virtual void setID(const ossimString& id);
+ virtual void setUsable(const bool& enable);
+
+ protected:
+ virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) = 0;
+ virtual QRectF boundingRect() const = 0;
+
+ QPen m_annPen;
+
+ ossimString m_id;
+ bool m_isEnabled;
+ ossimString m_overlayId;
+ };
+
+}
+
+#endif // ossimGuiAnnotationItem_HEADER
diff --git a/ossimGui/include/ossimGui/AutoMeasurementDialog.h b/ossimGui/include/ossimGui/AutoMeasurementDialog.h
new file mode 100644
index 0000000..eb29b9c
--- /dev/null
+++ b/ossimGui/include/ossimGui/AutoMeasurementDialog.h
@@ -0,0 +1,71 @@
+#ifndef ossimGuiAutoMeasurementDialog_HEADER
+#define ossimGuiAutoMeasurementDialog_HEADER
+#include <ossimGui/DataManager.h>
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_AutoMeasurementDialog.h>
+#include <QtGui/QDialog>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimProcessListener.h>
+#include <ossim/base/ossimTieMeasurementGeneratorInterface.h>
+
+
+
+namespace ossimGui
+{
+ class RegPoint;
+ class ImageScrollView;
+
+ class OSSIMGUI_DLL AutoMeasurementDialog : public QDialog, public Ui::AutoMeasurementDialog
+ {
+ Q_OBJECT
+
+ public:
+ AutoMeasurementDialog(QWidget* widget,
+ DataManager::NodeListType& nodeList,
+ ossimTieMeasurementGeneratorInterface* tGen);
+
+ public slots:
+ void setMeasurementReportContent(const ossimString&);
+
+ // Button click slots
+ void execMeas();
+ void acceptMeas();
+ void dismissMeas();
+ void resetMeas();
+
+ // Combo box slots
+ void selectDetector(QString);
+ void selectExtractor(QString);
+ void selectMatcher(QString);
+
+ // Grid definition slots
+ void setUseGridChecked(bool);
+ void setGridSizeX(int);
+ void setGridSizeY(int);
+ void setMaxMatches(int);
+
+ // Initial bounding box slot
+ void setBox(ImageScrollView*, const ossimDpt&, const ossimDpt&);
+
+
+ void displayClosing(QObject* obj);
+
+ signals:
+ void acceptMeasExecuted(DataManager::NodeListType&);
+ void dismissMeasExecuted();
+
+ protected:
+ DataManager::NodeListType m_nodeList;
+ std::vector<ossimGui::ImageScrollView*> m_scrollViews;
+ std::vector<ossimIrect> m_roiRects;
+
+ ossimTieMeasurementGeneratorInterface* m_tGen;
+
+ ostringstream m_report;
+
+ void initDialog();
+ void initContent();
+ void updateCurrentAlgorithmFields();
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/BandSelectorEditor.h b/ossimGui/include/ossimGui/BandSelectorEditor.h
new file mode 100644
index 0000000..f82da24
--- /dev/null
+++ b/ossimGui/include/ossimGui/BandSelectorEditor.h
@@ -0,0 +1,50 @@
+#ifndef ossimGuiBandSelectorEditor_HEADER
+#define ossimGuiBandSelectorEditor_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_BandSelectorEditor.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <QtGui/QDialog>
+
+namespace ossimGui {
+
+ class OSSIMGUI_DLL BandSelectorEditor: public QDialog, public Ui::BandSelectorEditor
+ {
+ Q_OBJECT
+ public:
+ enum SelectionType
+ {
+ SINGLE_BAND = 0,
+ THREE_BAND = 1,
+ N_BAND = 2
+ };
+ BandSelectorEditor(QWidget* parent=0, Qt::WindowFlags f = 0 );
+ void setObject(ossimObject* obj);
+
+ protected slots:
+ void oneBandButtonClicked(bool checked=false);
+ void threeBandButtonClicked(bool checked=false);
+ void nBandButtonClicked(bool checked=false);
+ void clearBandInputButtonClicked(bool checked=false);
+ void inputBandListClicked(const QModelIndex & index);
+ void enableButtonClicked(bool checked=false);
+ void resetButtonClicked(bool checked=false);
+ void okButtonClicked(bool checked=false);
+ void cancelButtonClicked(bool checked=false);
+
+ protected:
+ void initializeUiValues();
+ void setCurrentBandsToObject();
+ void fireRefreshEvent();
+ ossim_uint32 getNumberOfInputBands()const;
+ void setBandInput();
+
+ ossimRefPtr<ossimConnectableObject> m_object;
+ ossimKeywordlist m_cancelState;
+ SelectionType m_selectionType;
+ ossim_uint32 m_currentIndex;
+ std::vector<ossim_uint32> m_currentBandList;
+
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/BrightnessContrastEditor.h b/ossimGui/include/ossimGui/BrightnessContrastEditor.h
new file mode 100644
index 0000000..cbbad4d
--- /dev/null
+++ b/ossimGui/include/ossimGui/BrightnessContrastEditor.h
@@ -0,0 +1,33 @@
+#ifndef ossimGuiBrightnessContrastEditor_HEADER
+#define ossimGuiBrightnessContrastEditor_HEADER
+#include <ossimGui/ui_BrightnessContrastEditor.h>
+#include <ossimGui/Export.h>
+#include <QtGui/QDialog>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimRefPtr.h>
+namespace ossimGui
+{
+
+ class OSSIMGUI_DLL BrightnessContrastEditor : public QDialog, public Ui::BrightnessContrastEditor
+ {
+ Q_OBJECT
+ public:
+ BrightnessContrastEditor(QWidget* parent=0, Qt::WindowFlags f = 0 );
+
+ void setObject(ossimObject* obj);
+
+ public slots:
+ void ok();
+ void cancel();
+ void brightnessSliderChanged();
+ void contrastSliderChanged();
+ void enabledChanged();
+
+ protected:
+ ossimRefPtr<ossimConnectableObject> m_brightnessContrast;
+ ossim_float64 m_savedBrightness;
+ ossim_float64 m_savedContrast;
+
+ };
+}
+#endif
\ No newline at end of file
diff --git a/ossimGui/include/ossimGui/ChipperDialog.h b/ossimGui/include/ossimGui/ChipperDialog.h
new file mode 100644
index 0000000..24b5c17
--- /dev/null
+++ b/ossimGui/include/ossimGui/ChipperDialog.h
@@ -0,0 +1,156 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for chipping/exporting images.
+//
+//---
+// $Id$
+
+#ifndef ossimGuiChipperDialog_HEADER
+#define ossimGuiChipperDialog_HEADER 1
+
+#include <ossimGui/RoiRectAnnotator.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimROIEvent.h>
+#include <ossim/base/ossimROIEventListener.h>
+#include <ossim/imaging/ossimImageFileWriter.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <QDialog>
+
+class ossimDpt;
+class ossimMapProjection;
+class ossimProjection;
+class ossimROIEvent;
+class QComboBox;
+class QLineEdit;
+class QMouseEvent;
+class QPushButton;
+class QRubberBand;
+class QTextEdit;
+
+namespace ossimGui
+{
+ class ImageScrollView;
+ class View;
+
+ class ChipperDialog : public QDialog,
+ public ossimConnectableObjectListener,
+ public ossimROIEventListener
+ {
+ Q_OBJECT
+
+ public:
+
+ enum ErrorStatus
+ {
+ OK = 0,
+ ERROR = 1
+ };
+
+ /** @brief default constructor */
+ ChipperDialog( QWidget* parent=0, Qt::WFlags f = 0 );
+
+ virtual ~ChipperDialog();
+
+ ossimGui::ChipperDialog::ErrorStatus errorStatus() const;
+
+ virtual void objectDestructingEvent(ossimObjectDestructingEvent& event);
+ virtual void handleRectangleROIEvent( ossimROIEvent& event );
+
+ public slots:
+ void outputFilePushButtonClicked();
+ void saveSpecFilePushButtonClicked();
+ void runIgenPushButtonClicked();
+ void gsdLineEditReturnPressed();
+ void linesLineEditReturnPressed();
+ void samplesLineEditReturnPressed();
+ void outputFileLineEditReturnPressed();
+ void sceneRectPushButtonClicked();
+ void imageWidgetDestroyed();
+ void editWriterPushButtonClicked();
+ void outputTypeComboBoxActivated( const QString & type );
+ void syncView();
+
+ protected:
+
+ private:
+
+ void buildOutputTypeComboBox();
+ QString getWriterString() const;
+ void createWriter(const QString& type);
+
+ /**
+ * This will set theOutputImageField to that of the writer output filename
+ * provided it is not empty and not the same as the source file.
+ */
+ void updateOutputFilenameFromWriter();
+
+ void updateOutputTypeFromWriter();
+
+ void buildDialog();
+
+ void setView();
+
+ void setContainerView(ossimConnectableObject* container);
+
+ void setSceneBoundingRect();
+ void setWidgetRect(const ossimIrect& rect);
+ void updateOutputGrect();
+ void updateRoiRect();
+ void recalculateRect();
+ void updateDialog();
+
+ ossim_uint32 getLines() const;
+ ossim_uint32 getSamples() const;
+
+ /** @brief sets m_lines and m_samples */
+ void getBounds(ossim_uint32& lines, ossim_uint32& samples) const;
+
+ /** @brief Removes output file on failure detection. */
+ void removeFile() const;
+
+ /**
+ * @return true if outputFile is contained in the input's chain;
+ * false, if not.
+ */
+ bool isInChain(const ossimFilename& outputFile) const;
+
+ /**
+ * @brief Duplicates the input chain for writing output.
+ */
+ ossimRefPtr<ossimConnectableObject> duplicate(
+ const ossimConnectableObject* obj) const;
+
+ ossimGui::ImageScrollView* m_widget;
+ ossimRefPtr<ossimImageSource> m_input;
+
+ QLineEdit* m_outputFileLineEdit;
+ QPushButton* m_outputFilePushButton;
+ QComboBox* m_outputTypeComboBox;
+ QPushButton* m_editWriterPushButton;
+ QLineEdit* m_gsdLineEdit;
+ QLineEdit* m_linesLineEdit;
+ QLineEdit* m_samplesLineEdit;
+ QPushButton* m_sceneRectPushButton;
+ QPushButton* m_saveSpecFilePushButton;
+ QPushButton* m_saveImagePushButton;
+ QPushButton* m_closePushButton;
+
+ ossimFilename m_outputFile;
+ ossimRefPtr<ossimImageFileWriter> m_writer;
+ ossimRefPtr<ossimProjection> m_windowView;
+ ossimRefPtr<ossimMapProjection> m_outputView;
+ ossimDpt m_gsd;
+ ossim_uint32 m_lines;
+ ossim_uint32 m_samples;
+ ossimGeoPolygon m_outputGeoPolygon;
+ bool m_callBackDisabled;
+ RoiRectAnnotator m_annotator;
+ };
+}
+
+#endif /* #ifndef ossimGuiChipperDialog_HEADER */
diff --git a/ossimGui/include/ossimGui/Common.h b/ossimGui/include/ossimGui/Common.h
new file mode 100644
index 0000000..e4ffe36
--- /dev/null
+++ b/ossimGui/include/ossimGui/Common.h
@@ -0,0 +1,32 @@
+//----------------------------------------------------------------------------
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Author: David Burken
+//
+// Description: Place for common stuff.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimGuiCommon_HEADER
+#define ossimGuiCommon_HEADER 1
+
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/imaging/ossimImageHandler.h>
+
+#include <vector>
+
+// Forward class declarations:
+class QButtonGroup;
+
+namespace ossimGui
+{
+ typedef std::vector<ossimRefPtr<ossimImageHandler> > HandlerList;
+
+
+} // End: namespace ossimGui
+
+#endif /* #ifndef ossimGuiCommon_HEADER */
+
diff --git a/ossimGui/include/ossimGui/ConnectableDisplayObject.h b/ossimGui/include/ossimGui/ConnectableDisplayObject.h
new file mode 100644
index 0000000..29543a2
--- /dev/null
+++ b/ossimGui/include/ossimGui/ConnectableDisplayObject.h
@@ -0,0 +1,24 @@
+#ifndef ossimGuiConnectableDisplayObject_HEADER
+#define ossimGuiConnectableDisplayObject_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/ConnectableImageObject.h>
+
+namespace ossimGui {
+ class MdiSubWindowBase;
+ class OSSIMGUI_DLL ConnectableDisplayObject : public ConnectableImageObject
+ {
+ public:
+ ConnectableDisplayObject(MdiSubWindowBase* m_display=0);
+
+ void setDisplay(MdiSubWindowBase* d){m_display = d;}
+ MdiSubWindowBase* display(){return m_display;}
+ virtual void close();
+ virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
+ virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
+ protected:
+ MdiSubWindowBase* m_display;
+ TYPE_DATA;
+ };
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/ConnectableImageObject.h b/ossimGui/include/ossimGui/ConnectableImageObject.h
new file mode 100644
index 0000000..cc1642e
--- /dev/null
+++ b/ossimGui/include/ossimGui/ConnectableImageObject.h
@@ -0,0 +1,28 @@
+#ifndef ossimGuiConnectableImageObject_HEADER
+#define ossimGuiConnectableImageObject_HEADER
+#include <ossimGui/ConnectableObject.h>
+#include <ossim/base/ossimDrect.h>
+namespace ossimGui {
+ class OSSIMGUI_DLL ConnectableImageObject : public ConnectableObject
+ {
+ public:
+ /**
+ * required to be overriden by derived classes
+ */
+ virtual bool canConnectMyInputTo(ossim_int32 myInputIndex,
+ const ossimConnectableObject* object)const;
+ ossimDrect getBounds()const;
+ void getBounds(ossimDrect& result)const;
+ virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const
+ {
+ return ConnectableObject::saveState(kwl, prefix);
+ }
+ virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0)
+ {
+ return ConnectableObject::loadState(kwl, prefix);
+ }
+ TYPE_DATA;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/ConnectableObject.h b/ossimGui/include/ossimGui/ConnectableObject.h
new file mode 100644
index 0000000..4bcd86b
--- /dev/null
+++ b/ossimGui/include/ossimGui/ConnectableObject.h
@@ -0,0 +1,38 @@
+#ifndef ossimGuiConnection_HEADER
+#define ossimGuiConnection_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimConnectableObject.h>
+
+namespace ossimGui {
+ class OSSIMGUI_DLL ConnectableObject : public ossimConnectableObject
+ {
+ public:
+ ConnectableObject():ossimConnectableObject(0,0,false,false),m_autoDelete(true){}
+ ConnectableObject(ossimObject* owner,
+ ossim_int32 inputListSize,
+ ossim_int32 outputListSize,
+ bool inputListIsFixedFlag=true,
+ bool outputListIsFixedFlag=true):ossimConnectableObject(owner, inputListSize, outputListSize, inputListIsFixedFlag, outputListIsFixedFlag){}
+
+ virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
+ virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
+ /**
+ * Specifies if the connectable display auto deletes on disconnect
+ *
+ * Note, if the display attribute is not delete on close it
+ * will not delete but just hide and keep it alive in the datamanager
+ */
+ bool autoDelete()const{return m_autoDelete;}
+ /**
+ * Turns on and off the ability to auto delete when the node is disconnected
+ * from all inputs.
+ */
+ void setAutoDelete(bool flag){m_autoDelete = flag;}
+
+ protected:
+ bool m_autoDelete;
+ TYPE_DATA;
+ };
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/CopyChainVisitor.h b/ossimGui/include/ossimGui/CopyChainVisitor.h
new file mode 100644
index 0000000..4e74c1a
--- /dev/null
+++ b/ossimGui/include/ossimGui/CopyChainVisitor.h
@@ -0,0 +1,26 @@
+#ifndef ossimGuiCopyChainVisitor_HEADER
+#define ossimGuiCopyChainVisitor_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/base/ossimKeywordlist.h>
+
+namespace ossimGui
+{
+ class CopyChainVisitor : public ossimVisitor
+ {
+ public:
+ CopyChainVisitor():ossimVisitor(ossimVisitor::VISIT_INPUTS){reset();}
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new CopyChainVisitor(*this);}
+ virtual void reset();
+ virtual void visit(ossimObject* obj);
+
+ ossimObject* newContainer()const;
+ const ossimKeywordlist& kwl()const{return m_kwl;}
+
+ protected:
+ ossimKeywordlist m_kwl;
+ ossim_uint32 m_currentIndex;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/DataManager.h b/ossimGui/include/ossimGui/DataManager.h
new file mode 100644
index 0000000..f913998
--- /dev/null
+++ b/ossimGui/include/ossimGui/DataManager.h
@@ -0,0 +1,193 @@
+#ifndef ossimDataManager_HEADER
+#define ossimDataManager_HEADER
+#include <ossim/base/ossimReferenced.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimTieMeasurementGeneratorInterface.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossimGui/Export.h>
+#include <vector>
+#include <map>
+#include <QtCore/QString>
+#include <QtGui/QMdiArea>
+#include <ossim/projection/ossimSensorModelTuple.h>
+
+
+namespace ossimGui{
+
+ class RegistrationOverlay;
+ class MetricOverlay;
+ class MultiImageDialog;
+
+ class OSSIMGUI_DLL DataManager : public ossimObject
+ {
+ public:
+ class OSSIMGUI_DLL Node : public ossimObject
+ {
+ public:
+ Node(ossimRefPtr<ossimObject> source=0,
+ const ossimString& name=ossimString(), const ossimString& description=ossimString());
+ virtual ~Node()
+ {
+ m_object = 0;
+ }
+ ossimObject* getObject();
+ const ossimObject* getObject()const;
+ ossimConnectableObject* getObjectAsConnectable();
+ const ossimConnectableObject* getObjectAsConnectable()const;
+ const QString& name()const{return m_name;}
+ const QString& description()const{return m_description;}
+ void setName(const QString& name){m_name = name;}
+ void setDescription(const QString& value){m_description = value;}
+ void setObject(ossimObject* obj);
+ bool supportsInputs()const;
+ template <class T>
+ T* getObjectAs(){return dynamic_cast<T*>(m_object.get());}
+ template <class T>
+ const T* getObjectAs()const{return dynamic_cast<const T*>(m_object.get());}
+ virtual bool saveState(ossimKeywordlist& kwl, const ossimString& prefix)const;
+ virtual bool loadState(const ossimKeywordlist& kwl, const ossimString& prefix);
+ const ossimId& id()const{return m_id;}
+ virtual void accept(ossimVisitor& visitor)
+ {
+ if(!visitor.stopTraversal()&&!visitor.hasVisited(this))
+ {
+ visitor.visit(this);
+ if(m_object.valid())
+ {
+ m_object->accept(visitor);
+ }
+ }
+ }
+ protected:
+ void setId();
+ mutable OpenThreads::Mutex m_mutex;
+
+ QString m_name;
+ QString m_description;
+ mutable ossimId m_id;
+ ossimRefPtr<ossimObject> m_object;
+ };
+ typedef std::vector<ossimRefPtr<Node> > NodeListType;
+ typedef std::map<ossimObject*, ossimRefPtr<Node> > NodeMapType;
+ typedef std::map<ossimId, ossimRefPtr<Node> > NodeIdMapType;
+
+ class OSSIMGUI_DLL Callback : public ossimReferenced
+ {
+ public:
+ Callback():ossimReferenced(),m_enabled(true){}
+
+ virtual void nodeRemoved(ossimRefPtr<Node> node)
+ {
+ DataManager::NodeListType nodes;
+ nodes.push_back(node.get());
+ nodesRemoved(nodes);
+ }
+ virtual void nodeAdded(ossimRefPtr<Node> node)
+ {
+ DataManager:: NodeListType nodes;
+ nodes.push_back(node.get());
+ nodesAdded(nodes);
+ }
+ virtual void nodesRemoved(DataManager::NodeListType& /* nodes */){}
+ virtual void nodesAdded(DataManager::NodeListType& /* nodes */){}
+ void setEnabled(bool flag){m_enabled = flag;}
+ bool enabled()const{return m_enabled;}
+ protected:
+ bool m_enabled;
+ };
+
+
+ enum ExploitationModeType
+ {
+ NO_MODE=0,
+ REGISTRATION_MODE,
+ GEOPOSITIONING_MODE,
+ MENSURATION_MODE
+ };
+
+ DataManager();
+ ossimRefPtr<ossimGui::DataManager::Node> findNode(ossimObject* obj);
+ bool remove(ossimRefPtr<Node> obj, bool notifyFlag=true);
+ bool remove(NodeListType& nodes, bool notifyFlag=true);
+
+ ossimRefPtr<ossimGui::DataManager::Node> addSource(ossimRefPtr<ossimObject> obj, bool notifyFlag=true);
+ ossimRefPtr<ossimGui::DataManager::Node> createDefaultImageChain(ossimRefPtr<Node> obj, bool notifyFlag=true);
+ ossimRefPtr<ossimGui::DataManager::Node> createChainFromTemplate(const ossimString& templatChain,
+ ossimRefPtr<Node> input,
+ bool notifyFlag=true);
+ ossimRefPtr<ossimGui::DataManager::Node> createChainFromTemplate(const ossimKeywordlist& templatChain,
+ ossimRefPtr<Node> input,
+ bool notifyFlag=true);
+
+ ossimRefPtr<ossimGui::DataManager::Node> createDefaultCombinerChain(const ossimString& combinerType, NodeListType& nodeList, bool notifyFlag=true);
+ ossimRefPtr<ossimGui::DataManager::Node> createDefault2dImageDisplay(ossimRefPtr<Node> input=0, bool notifyFlag=true);
+ ossimRefPtr<ossimGui::DataManager::Node> node(ossimObject* obj);
+
+ ossimRefPtr<ossimGui::DataManager::Node> createDefault3dPlanetaryDisplay(bool notifyFlag=true);
+
+ virtual void accept(ossimVisitor& visitor);
+
+ void setCallback(ossimRefPtr<Callback> callback){m_callback = callback.get();}
+ void print();
+
+ bool saveState(ossimKeywordlist& kwl, const ossimString& prefix=ossimString())const;
+ bool loadState(const ossimKeywordlist& kwl, const ossimString& prefix = ossimString());
+ void clear(bool notifyFlag=true);
+ Node* findNode(const ossimId& id);
+ void setMdiArea(QMdiArea* mdi){m_mdiArea = mdi;}
+ QMdiArea* mdiArea(){return m_mdiArea;}
+
+ const ossimString& defaultReprojectionChain()const{return m_defaultReprojectionChainTemplate;}
+ const ossimString& defaultAffineChain()const{return m_defaultAffineChainTemplate;}
+
+ void setExploitationMode(int expMode);
+ void setAutoMeasActive(const bool state);
+ ossim_int32 exploitationMode()const{return m_exploitationMode;}
+ void syncImagesTo(const ossimDpt& sp, ossimRefPtr<DataManager::Node>);
+ void syncImagesTo(ossimRefPtr<DataManager::Node> node);
+ bool setAutoMeasureResults(NodeListType& nodes,
+ ossimTieMeasurementGeneratorInterface* tgen);
+ bool intersectRays(NodeListType& nodes);
+ bool registerImages(NodeListType& nodes);
+ bool loadImageGeometries(NodeListType& nodes);
+ bool saveImageGeometries(NodeListType& nodes);
+ bool resetMode(NodeListType& nodes);
+ bool resetAdj(NodeListType& nodes);
+ bool clearCurrentPoint(NodeListType& nodes);
+ RegistrationOverlay* regOverlayForNode(ossimRefPtr<Node> node);
+ MetricOverlay* metOverlayForNode(ossimRefPtr<Node> node);
+ void setDialog(MultiImageDialog* miDialog) {m_miDialog = miDialog;}
+
+ protected:
+ bool removeIndexMapping(Node* node);
+ void addIndexMapping(Node* node);
+ Node* findNodeNoMutex(const ossimId& id);
+
+ bool nodeExists(ossimObject* obj)const;
+ void findInputConnectionIds(std::vector<ossimId>& result,
+ const ossimKeywordlist& kwl,
+ const ossimString& prefix);
+ mutable OpenThreads::Mutex m_mutex;
+ ossimRefPtr<Callback> m_callback;
+
+ NodeListType m_sourceList;
+ NodeListType m_chainList;
+ NodeListType m_displayList;
+ mutable NodeMapType m_nodeMap;
+ mutable NodeIdMapType m_idMap;
+
+ ossimString m_defaultReprojectionChainTemplate;
+ ossimString m_defaultAffineChainTemplate;
+ QMdiArea* m_mdiArea;
+
+ ossimSensorModelTuple* m_imgSet;
+ ExploitationModeType m_exploitationMode;
+ MultiImageDialog* m_miDialog;
+ std::vector<ossimRefPtr<ossimImageGeometry> > m_imgGeoms;
+
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/DataManagerPropertyView.h b/ossimGui/include/ossimGui/DataManagerPropertyView.h
new file mode 100644
index 0000000..ca2c55f
--- /dev/null
+++ b/ossimGui/include/ossimGui/DataManagerPropertyView.h
@@ -0,0 +1,108 @@
+#ifndef ossimGuiDataManagerPropertyView_HEADER
+#define ossimGuiDataManagerPropertyView_HEADER
+
+#include <QtGui/QTreeView>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QStandardItemModel>
+#include <QtGui/QComboBox>
+#include <QtGui/QCheckBox>
+#include <QtGui/QItemDelegate>
+#include <ossimGui/DataManager.h>
+#include <ossim/base/ossimPropertyInterface.h>
+#include <ossim/base/ossimRefreshEvent.h>
+
+namespace ossimGui
+{
+ class DataManagerProperty;
+
+ class OSSIMGUI_DLL StringChoicePropertyWidget : public QComboBox
+ {
+ Q_OBJECT
+ public:
+ StringChoicePropertyWidget(QWidget* parent);
+ void setDelegateInformation(DataManagerProperty* prop, const QAbstractItemDelegate* delegate);
+ public slots:
+ void valueChanged();
+
+ protected:
+ DataManagerProperty* m_property;
+ const QAbstractItemDelegate* m_delegate;
+
+ };
+
+ class OSSIMGUI_DLL BooleanPropertyWidget : public QCheckBox
+ {
+ Q_OBJECT
+ public:
+ BooleanPropertyWidget(QWidget* parent=0);
+ void setDelegateInformation(DataManagerProperty* prop, const QAbstractItemDelegate* delegate);
+
+ public slots:
+ void valueChanged();
+
+ protected:
+ DataManagerProperty* m_property;
+ const QAbstractItemDelegate* m_delegate;
+ };
+
+ class OSSIMGUI_DLL DataManagerPropertyDelegate : public QItemDelegate
+ {
+ public:
+ DataManagerPropertyDelegate(QObject *parent):QItemDelegate(parent){};
+ virtual QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
+ virtual void setEditorData ( QWidget * editor, const QModelIndex & index ) const;
+ virtual void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const;
+ };
+
+ class OSSIMGUI_DLL DataManagerProperty : public QStandardItem
+ {
+ public:
+ DataManagerProperty():QStandardItem(){}
+ DataManagerProperty(const QString& value, ossimRefPtr<ossimProperty> property=ossimRefPtr<ossimProperty>()):QStandardItem(value){setProperty(property.get());}
+ virtual void setProperty(ossimRefPtr<ossimProperty> property);
+ virtual void populateChildren();
+ ossimProperty* property(){return m_property.get();}
+ const ossimProperty* property()const{return m_property.get();}
+ DataManagerProperty* rootProperty();
+ protected:
+ void addProperty(ossimRefPtr<ossimProperty> property);
+ ossimRefPtr<ossimProperty> m_property;
+ };
+
+ class OSSIMGUI_DLL DataManagerPropertyView : public QTreeView
+ {
+ Q_OBJECT
+ public:
+ DataManagerPropertyView(QWidget* parent=0);
+ virtual void setObject(ossimObject* obj)
+ {
+ m_node = obj;
+ DataManager::Node* node = dynamic_cast<DataManager::Node*>(obj);
+ if(node)
+ {
+ m_node = node->getObject();
+ }
+
+ populateChildren();
+ }
+
+ virtual void populateChildren();
+ void reloadProperties();
+ public slots:
+ void expanded ( const QModelIndex & idx );
+ void collapsed ( const QModelIndex & index );
+
+ protected:
+ virtual void mousePressEvent ( QMouseEvent * event );
+ virtual void dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
+ ossimPropertyInterface* propertyInterface()
+ {
+ return dynamic_cast<ossimPropertyInterface*> (m_node.get());
+ }
+ void fireRefresh(int type = ossimRefreshEvent::REFRESH_PIXELS);
+ QStandardItemModel* m_model;
+// ossimRefPtr<DataManager::Node> m_node;
+ ossimRefPtr<ossimObject> m_node;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/DataManagerWidget.h b/ossimGui/include/ossimGui/DataManagerWidget.h
new file mode 100644
index 0000000..e28d260
--- /dev/null
+++ b/ossimGui/include/ossimGui/DataManagerWidget.h
@@ -0,0 +1,774 @@
+#ifndef ossimGuiDataManagerWidget_HEADER
+#define ossimGuiDataManagerWidget_HEADER 1
+#include <ossimGui/DataManager.h>
+#include <QtGui/QTreeView>
+#include <QtGui/QItemDelegate>
+#include <QtGui/QTreeWidget>
+#include <QtGui/QTreeWidgetItem>
+#include <QtGui/QStandardItem>
+#include <QtGui/QMenu>
+#include <QtCore/QModelIndex>
+#include <QtGui/QCheckBox>
+#include <QtGui/QComboBox>
+//#include <QtGui/QProgressBar>
+#include <ossimGui/Export.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/DataManagerPropertyView.h>
+#include <ossimGui/DisplayTimerJobQueue.h>
+#include <ossimGui/ProgressWidget.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/base/ossimTieMeasurementGeneratorInterface.h>
+#include <ossim/parallel/ossimJob.h>
+#include <ossim/parallel/ossimJobQueue.h>
+#include <QtGui/QApplication>
+class QMainWindow;
+
+class ossimSensorModelTuple;
+
+namespace ossimGui{
+
+ class DataManagerWidget;
+ class MultiImageDialog;
+ class AutoMeasurementDialog;
+ class RegPoint;
+
+ class OSSIMGUI_DLL DataManagerItem : public QTreeWidgetItem
+ {
+ public:
+ DataManagerItem(QTreeWidget* parent):QTreeWidgetItem(parent),m_markedForDeletion(false){}
+ DataManagerItem(QTreeWidgetItem* parent):QTreeWidgetItem(parent),m_markedForDeletion(false){}
+ DataManagerItem():QTreeWidgetItem(),m_markedForDeletion(false){}
+ virtual ~DataManagerItem()
+ {
+ m_object = 0;
+ }
+ DataManager* dataManager();
+ DataManagerWidget* dataManagerWidget();
+ template<class T>
+ bool isAnyParentSelectedOfType()const
+ {
+ bool result = false;
+ T* parentItem = dynamic_cast<T*>(parent());
+ while(parentItem&&!result)
+ {
+ result = parentItem->isSelected();
+ parentItem = dynamic_cast<T*>(parentItem->parent());
+ }
+
+ return result;
+ }
+ template<class T>
+ T* itemAs(){return dynamic_cast<T*>(this);}
+ template<class T>
+ const T* itemAs()const{return dynamic_cast<T*>(this);}
+ template<class T>
+ T* parentItemAs(){return dynamic_cast<T*>(parent());}
+ template<class T>
+ const T* parentItemAs()const{return dynamic_cast<T*>(parent());}
+ template<class T>
+ T* findParentItemAs()
+ {
+ T* result = 0;
+ QTreeWidgetItem* currentItem = this;
+ while(!result&¤tItem)
+ {
+ result = dynamic_cast<T*> (currentItem);
+ currentItem = currentItem->parent();
+ }
+ return result;
+ }
+ template<class T>
+ const T* findParentItemAs()const
+ {
+ const T* result = 0;
+ const QTreeWidgetItem* currentItem = this;
+ while(!result&¤tItem)
+ {
+ result = dynamic_cast<const T*> (currentItem);
+ currentItem = currentItem->parent();
+ }
+ return result;
+ }
+
+ virtual void setMarkForDeletion(bool flag)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+ m_markedForDeletion = flag;
+ }
+ bool markedForDeletion()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+ return m_markedForDeletion;
+ }
+ virtual void setObject(ossimObject* obj)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+ m_object = obj;
+ }
+ virtual DataManager::Node* objectAsNode(){return dynamic_cast<DataManager::Node*> (object());}
+ virtual const DataManager::Node* objectAsNode()const{return dynamic_cast<const DataManager::Node*> (object());}
+ virtual ossimObject* object()
+ {
+ return m_object.get();
+ }
+ virtual const ossimObject* object()const
+ {
+ return m_object.get();
+ }
+
+ virtual void populateChildren(){}
+ virtual void clearChildren();
+ virtual void setNodeListenerEnabled(bool /* flag */){}
+ virtual void reset(){}
+ protected:
+ mutable OpenThreads::Mutex m_itemMutex;
+ bool m_markedForDeletion;
+ ossimRefPtr<ossimObject> m_object;
+ };
+
+ class DataManagerNodeItem;
+ class OSSIMGUI_DLL DataManagerNodeItemListener : public ossimConnectableObjectListener
+ {
+ public:
+ DataManagerNodeItemListener(DataManagerNodeItem* item):m_nodeItem(item){}
+ virtual void disconnectInputEvent(ossimConnectionEvent& /* event */);
+ virtual void connectInputEvent(ossimConnectionEvent& /* event */);
+
+ void setNodeItem(DataManagerNodeItem* item){m_nodeItem = item;}
+ DataManagerNodeItem* nodeItem(){return m_nodeItem;}
+ protected:
+ DataManagerNodeItem* m_nodeItem;
+ };
+
+ class DataManagerInputConnectionFolder;
+ class DataManagerPropertyFolder;
+ class OSSIMGUI_DLL DataManagerNodeItem : public DataManagerItem, public ossimConnectableObjectListener
+ {
+ public:
+ friend class DataManagerNodeItemListener;
+ DataManagerNodeItem(DataManager::Node* node=0);
+ virtual ~DataManagerNodeItem();
+ virtual void setObject(ossimObject* obj);
+ void getInputs(DataManager::NodeListType& result);
+ virtual ossimObject* object(){return m_node.get();}
+ virtual const ossimObject* object()const{return m_node.get();}
+ // virtual void removeChildItem(DataManagerNodeItem* item);
+
+ template<class T>
+ T* parentAs(){return dynamic_cast<T*> (parent());}
+ template<class T>
+ const T* parentAs()const{return dynamic_cast<const T*> (parent());}
+
+ virtual bool autoDelete()const;
+ virtual void setAutoDelete(bool flag);
+ virtual bool isCombiner()const;
+ virtual bool isParentCombiner()const;
+ virtual void refreshChildConnections();
+ virtual void refreshChildProperties();
+ virtual void populateChildren();
+ virtual void initializePropertiesFromNode();
+ virtual void setMarkForDeletion(bool flag);
+
+ virtual void setNodeListenerEnabled(bool flag);
+ virtual void reset();
+ protected:
+ // virtual void disconnectInputEvent(ossimConnectionEvent& /* event */);
+ // virtual void connectInputEvent(ossimConnectionEvent& /* event */);
+ ossimRefPtr<DataManager::Node> m_node;
+ DataManagerNodeItemListener* m_listener;
+ bool m_combinerFlag;
+ bool m_autoDelete;
+ DataManagerInputConnectionFolder* m_inputConnectionFolder;
+ DataManagerPropertyFolder* m_propertyFolder;
+ };
+
+
+ class OSSIMGUI_DLL DataManagerRawImageSourceItem : public DataManagerNodeItem
+ {
+ public:
+ DataManagerRawImageSourceItem(DataManager::Node* node=0):DataManagerNodeItem(node){}
+ virtual void reset();
+ protected:
+ };
+
+ class OSSIMGUI_DLL DataManagerFolder : public DataManagerItem
+ {
+ public:
+ DataManagerFolder():DataManagerItem(){}
+ DataManagerFolder(QTreeWidget* parent):DataManagerItem(parent){}
+ DataManagerFolder(QTreeWidgetItem* parent):DataManagerItem(parent){}
+ virtual void dropItems(QList<DataManagerItem*>& /*chainItemList*/){}
+ virtual void setMarkForDeletion(bool flag);
+ virtual void setNodeListenerEnabled(bool flag);
+
+ protected:
+ };
+ class DataManagerImageFilterFolder;
+ class OSSIMGUI_DLL DataManagerImageFilterItem : public DataManagerItem
+ {
+ public:
+ DataManagerImageFilterItem();
+ virtual ~DataManagerImageFilterItem();
+ virtual void populateChildren();
+ DataManagerImageFilterFolder* folder();
+ virtual void setObject(ossimObject* obj);
+
+ protected:
+ DataManagerPropertyFolder* m_properties;
+ };
+
+ class OSSIMGUI_DLL DataManagerImageFilterFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerImageFilterFolder();
+ virtual void populateChildren();
+ virtual void setObject(ossimObject* obj);
+
+ /**
+ * This will remove all filters from the managed object.
+ */
+ void removeFilters();
+ void removeFilter(ossimObject* obj);
+ void addFilterToFront(ossimObject* obj);
+ void addFilterToEnd(ossimObject* obj);
+ void insertFilterBefore(ossimObject* newObj, ossimObject* before);
+ void insertFilterAfter(ossimObject* newObj, ossimObject* after);
+
+ protected:
+ // void printChain();
+ };
+
+ class OSSIMGUI_DLL DataManagerImageFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerImageFolder():DataManagerFolder(){}
+ DataManagerImageFolder(QTreeWidget* parent):DataManagerFolder(parent){}
+ DataManagerImageFolder(QTreeWidgetItem* parent):DataManagerFolder(parent){}
+ protected:
+ };
+
+ class OSSIMGUI_DLL DataManagerRawImageSourceFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerRawImageSourceFolder():DataManagerFolder(){}
+ protected:
+ };
+
+ class OSSIMGUI_DLL DataManagerImageChainFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerImageChainFolder():DataManagerFolder(){}
+ protected:
+
+ };
+ class DataManagerPropertyItem;
+ class OSSIMGUI_DLL DataManagerPropertyFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerPropertyFolder();
+ virtual ~DataManagerPropertyFolder();
+
+ virtual void populateChildren();
+
+ protected:
+ };
+ class OSSIMGUI_DLL DataManagerPropertyItem : public DataManagerItem
+ {
+ public:
+ DataManagerPropertyItem(QTreeWidget* parent):DataManagerItem(parent){}
+ DataManagerPropertyItem(QTreeWidgetItem* parent):DataManagerItem(parent){}
+ DataManagerPropertyItem():DataManagerItem(){}
+ DataManagerPropertyFolder* propertyFolder();
+ void setProperty(ossimProperty* prop);
+
+ protected:
+ ossimRefPtr<ossimProperty> m_property;
+ };
+ class OSSIMGUI_DLL DataManagerImageChainItem : public DataManagerNodeItem
+ {
+ public:
+ DataManagerImageChainItem(DataManager::Node* node=0);
+ virtual void dropItems(QList<DataManagerImageChainItem*>& chainItemList,
+ DataManagerNodeItem* targetItem=0,
+ bool insertBefore=true);
+ virtual void populateChildren();
+ virtual void clearChildren();
+
+ protected:
+ DataManagerImageFilterFolder* m_filters;
+ };
+
+ class OSSIMGUI_DLL DataManagerInputConnectionItem : public DataManagerItem
+ {
+ public:
+ DataManagerInputConnectionItem(DataManager::Node* inputNode=0);
+ virtual ~DataManagerInputConnectionItem();
+ virtual void setObject(ossimObject* obj);
+ virtual ossimObject* object(){return m_node.get();}
+ virtual const ossimObject* object()const{return m_node.get();}
+
+ protected:
+ ossimRefPtr<DataManager::Node> m_node;
+ };
+
+ class OSSIMGUI_DLL DataManagerInputConnectionFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerInputConnectionFolder(DataManager::Node* node=0);
+ virtual ~DataManagerInputConnectionFolder();
+ virtual void setObject(ossimObject* node);
+ virtual ossimObject* object(){return m_node.get();}
+ virtual const ossimObject* object()const{return m_node.get();}
+
+ void getInputs(DataManager::NodeListType& result);
+ virtual void connect(QList<DataManagerItem*>& nodeItems, DataManagerInputConnectionItem* targetItem=0);
+ virtual void disconnectSelected();
+ virtual void populateChildren();
+ ossimConnectableObject* connectableObject();
+ const ossimConnectableObject* connectableObject()const;
+
+ protected:
+ ossimRefPtr<DataManager::Node> m_node;
+ };
+
+ class OSSIMGUI_DLL DataManagerDisplayItem : public DataManagerNodeItem
+ {
+ public:
+ DataManagerDisplayItem(DataManager::Node* node=0);
+ virtual ~DataManagerDisplayItem();
+ virtual void setObject(ossimObject* obj);
+
+ protected:
+ // DataManagerInputConnectionFolder* m_inputConnectionFolder;
+ };
+
+ class OSSIMGUI_DLL DataManagerDisplayFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerDisplayFolder();
+ };
+
+ class OSSIMGUI_DLL DataManagerImageWriterItem : public DataManagerNodeItem
+ {
+ public:
+ DataManagerImageWriterItem(DataManager::Node* node=0);
+ virtual ~DataManagerImageWriterItem();
+ // virtual void setNode(DataManager::Node*);
+ virtual void execute();
+
+ protected:
+
+ // std::vector<ossimRefPtr<ossimConnectableObject> > m_duplicatedInputs;
+
+ // DataManagerInputConnectionFolder* m_inputConnectionFolder;
+ };
+
+ class OSSIMGUI_DLL DataManagerImageFileWriterItem : public DataManagerImageWriterItem
+ {
+ public:
+ DataManagerImageFileWriterItem(DataManager::Node* node=0);
+ virtual ~DataManagerImageFileWriterItem();
+
+ protected:
+ DataManagerInputConnectionFolder* m_inputConnectionFolder;
+ };
+
+ class OSSIMGUI_DLL DataManagerImageWriterFolder : public DataManagerFolder
+ {
+ public:
+ DataManagerImageWriterFolder();
+ };
+
+
+ class OSSIMGUI_DLL DataManagerJobItem : public DataManagerItem
+ {
+ public:
+ DataManagerJobItem();
+ virtual ~DataManagerJobItem();
+ virtual void setJob(ossimJob* job);
+ virtual void cancel();
+ void setPercentComplete(double value)
+ {
+ if(m_progressBar)
+ {
+ m_progressBar->setValue(static_cast<int> (value));
+ }
+ }
+ protected:
+ class JobCallback : public ossimJobCallback
+ {
+ public:
+ JobCallback(DataManagerJobItem* item, ossimJobCallback* next):ossimJobCallback(next),m_jobItem(item){}
+ virtual void ready(ossimJob* job);
+ virtual void started(ossimJob* job);
+ virtual void finished(ossimJob* job);
+ virtual void canceled(ossimJob* job);
+
+ virtual void nameChanged(const ossimString& name, ossimJob* job);
+ virtual void descriptionChanged(const ossimString& description, ossimJob* job);
+ virtual void idChanged(const ossimString& id, ossimJob* job);
+
+ virtual void percentCompleteChanged(double percentValue, ossimJob* job);
+
+ DataManagerJobItem* m_jobItem;
+ };
+
+ ossimRefPtr<ossimJob> m_job;
+ ossimRefPtr<JobCallback> m_jobCallback;
+ QTreeWidgetItem* m_progressItem;
+ QProgressBar* m_progressBar;
+ };
+
+ class OSSIMGUI_DLL DataManagerJobsFolder : public DataManagerFolder
+ {
+ public:
+ typedef std::vector<ossimRefPtr<ossimJobQueue> > QueueListType;
+ typedef std::map<ossimRefPtr<ossimJob>, QTreeWidgetItem* > JobMapType;
+ DataManagerJobsFolder();
+ DataManagerJobsFolder(QTreeWidget* parent);
+ DataManagerJobsFolder(QTreeWidgetItem* parent);
+ virtual ~DataManagerJobsFolder();
+ void setQueue(ossimJobQueue* q);
+ void removeStoppedJobs();
+ void addJob(ossimJob* job)
+ {
+ m_jobsFolderMutex.lock();
+ if(m_jobItemMap.find(job)==m_jobItemMap.end())
+ {
+ DataManagerJobItem* item = new DataManagerJobItem();
+ addChild(item);
+ item->setJob(job);
+ m_jobItemMap.insert(make_pair(job, item));
+ }
+ m_jobsFolderMutex.unlock();
+ stateChanged(job);
+ }
+ void removeJob(ossimJob* job)
+ {
+ m_jobsFolderMutex.lock();
+ JobMapType::iterator iter = m_jobItemMap.find(job);
+
+ if(iter!=m_jobItemMap.end())
+ {
+ delete (*iter).second;
+ m_jobItemMap.erase(iter);
+ }
+ m_jobsFolderMutex.unlock();
+ }
+ void stateChanged(ossimJob* job)
+ {
+ m_jobsFolderMutex.lock();
+ JobMapType::iterator iter = m_jobItemMap.find(job);
+ if(iter!=m_jobItemMap.end())
+ {
+ if(job->isReady())
+ {
+ (*iter).second->setText(0, ("Ready: " + job->name()).c_str());
+ }
+ if(job->isCanceled())
+ {
+ if(!job->isStopped())
+ {
+ (*iter).second->setText(0, ("Request Cancel: " + job->name()).c_str());
+ }
+ else if(job->isStopped())
+ {
+ (*iter).second->setText(0, ("Canceled: " + job->name()).c_str());
+ }
+
+ }
+ else if(job->isRunning())
+ {
+
+ (*iter).second->setText(0, ("Running: " + job->name()).c_str());
+ }
+ if(job->isStopped())
+ {
+ delete (*iter).second;
+ m_jobItemMap.erase(iter);
+ }
+ }
+ m_jobsFolderMutex.unlock();
+ }
+ void propertyChanged(ossimJob* job)
+ {
+ m_jobsFolderMutex.lock();
+ JobMapType::iterator iter = m_jobItemMap.find(job);
+ if(iter!=m_jobItemMap.end())
+ {
+ (*iter).second->setText(0, job->name().c_str());
+ }
+ m_jobsFolderMutex.unlock();
+ }
+ void percentCompleteChanged(ossimJob* job, double percentComplete)
+ {
+ m_jobsFolderMutex.lock();
+ JobMapType::iterator iter = m_jobItemMap.find(job);
+ if(iter!=m_jobItemMap.end())
+ {
+ DataManagerJobItem* jobItem = dynamic_cast<DataManagerJobItem*>((*iter).second);
+ if(jobItem)
+ {
+ jobItem->setPercentComplete(percentComplete);
+ }
+ }
+ m_jobsFolderMutex.unlock();
+ }
+ protected:
+ class JobQueueCallback : public ossimJobQueue::Callback
+ {
+ public:
+ JobQueueCallback(DataManagerJobsFolder* f):m_folder(f){}
+ virtual void adding(ossimJobQueue* /* q */, ossimJob* job)
+ {
+ if(m_folder)
+ {
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_ADDED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(m_folder->treeWidget(), e);
+ }
+ }
+ virtual void removed(ossimJobQueue* /*q*/, ossimJob* /*job*/)
+ {
+ if(m_folder)
+ {
+ }
+ }
+
+ DataManagerJobsFolder* m_folder;
+ };
+
+ QueueListType m_queues;
+ ossimRefPtr<JobQueueCallback> m_jobQueueCallback;
+ mutable OpenThreads::Mutex m_jobsFolderMutex;
+ JobMapType m_jobItemMap;
+ };
+
+ class OSSIMGUI_DLL DataManagerWidget : public QTreeWidget
+ {
+ Q_OBJECT
+ public:
+ friend class DataManagerNodeItem;
+ DataManagerWidget(QWidget* parent=0);
+
+ //virtual void setDataManager(ossimRefPtr<DataManager> manager);
+ DataManager* dataManager(){return m_dataManager.get();}
+ const DataManager* dataManager()const{return m_dataManager.get();}
+
+ QMenu* createMenu(QList<DataManagerItem*>& selection, DataManagerItem* activeItem=0);
+ QMainWindow* mainWindow();
+ void setJobQueue(ossimJobQueue* que){m_jobQueue = que; m_rootJobsFolder->setQueue(que);}
+ ossimJobQueue* jobQueue(){return m_jobQueue.get();}
+ ossimJobQueue* displayQueue(){return m_displayQueue.get();}
+ void setDisplayQueue(ossimJobQueue* q){m_displayQueue = q;}
+ bool openDataManager(const ossimFilename& file);
+ void refresh();
+ QModelIndex indexFromDataManagerItem(DataManagerItem* item, int col=0);
+ virtual void unselectAll();
+
+ /** @return the last opened directory. */
+ const ossimFilename& getLastOpenedDirectory() const;
+
+ public slots:
+ virtual void buildOverviewsForSelected(QAction* action);
+ virtual void buildOverviewsForSelected(const QString& type);
+ virtual void buildOverviewsForSelected();
+ virtual void createFullHistogramsForSelected();
+ virtual void createFastHistogramsForSelected();
+
+
+ virtual void createDefaultChain();
+ virtual void createAffineChain();
+ virtual void createMapProjectedChain();
+ virtual void createImageNormalsChain();
+
+ virtual void registrationExploitationSelected();
+ virtual void geoPositioningExploitationSelected();
+ virtual void mensurationExploitationSelected();
+
+ virtual void miDialogDestroyed();
+
+ void aOverBMosaic();
+ void blendMosaic();
+ void featherMosaic();
+ void hillShadeCombiner();
+ void factoryCombiner();
+
+ void geographicView();
+ void scaledGeographicView();
+ void utmView();
+
+ void exportSelected();
+ void showSelected();
+ void swipeSelected();
+ void deleteSelected();
+
+ void cancelSelected();
+
+ virtual void openLocalImage();
+
+ /**
+ * @brief Opens local image(s).
+ *
+ * This method is like openLocalImage method but is interactive in that
+ * it will bring up a dialog box if needed to select entries or
+ * potentially different geometry options.
+ */
+ virtual void openLocalImageInteractive();
+
+ virtual void openJpipImage();
+
+ virtual void createTiffWriter();
+ virtual void createJpegWriter();
+ virtual void createWriterFromFactory();
+
+ virtual void executeSelected();
+
+ virtual void displayCropViewport();
+
+ virtual void removeAllFilters();
+ virtual void addFilterToFront();
+ virtual void addFilterToEnd();
+ virtual void insertFilterBefore();
+ virtual void insertFilterAfter();
+ virtual void removeFilter();
+
+ virtual void planetaryView();
+
+ // Multi-image dialog
+ virtual void miDialog(const int& mode);
+ virtual void miSync();
+ virtual void miSync(ossimGui::RegPoint*, ossimRefPtr<DataManager::Node>);
+ virtual bool miDrop(DataManager::NodeListType& nodes);
+ virtual bool miReg(DataManager::NodeListType& nodes);
+ virtual bool miResetMode(DataManager::NodeListType& nodes);
+ virtual bool miClearCurrentPoint(DataManager::NodeListType& nodes);
+ virtual bool miAcceptReg(DataManager::NodeListType& nodes);
+ virtual bool miResetReg(DataManager::NodeListType& nodes);
+ virtual bool miAutoMeas(DataManager::NodeListType& nodes);
+ virtual bool miAcceptMeas(DataManager::NodeListType& nodes);
+ virtual bool miDismissMeas();
+
+ // Auto-measurement dialog
+ virtual void amDialog(DataManager::NodeListType& nodes);
+ bool amDialogIsActive()const {return m_amDialogActive;}
+
+
+ void itemChanged( QTreeWidgetItem * item, int column );
+ void itemCollapsed ( QTreeWidgetItem * item );
+ void itemExpanded ( QTreeWidgetItem * item );
+
+ signals:
+ void resetMode();
+
+ protected:
+ /*************************** REFRESH VISITOR **************************/
+ class OSSIMGUI_DLL RefreshVisitor : public ossimVisitor
+ {
+ public:
+ RefreshVisitor(DataManagerWidget* widget):m_widget(widget){}
+ RefreshVisitor(const RefreshVisitor& src):m_widget(src.m_widget){}
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new RefreshVisitor(*this);}
+
+ virtual void visit(ossimObject* obj);
+
+ DataManagerWidget* m_widget;
+ };
+ friend class RefreshVisitor;
+ /**********************************************************************/
+
+ /*************************** DATAMANAGER CALLBACK **************************/
+ class DataManagerCallback : public DataManager::Callback
+ {
+ public:
+ DataManagerCallback(DataManagerWidget* widget);
+ virtual void nodesRemoved(DataManager::NodeListType& nodes);
+ virtual void nodesAdded(DataManager::NodeListType& nodes);
+ protected:
+ DataManagerWidget* m_dataManagerWidget;
+ };
+ friend class DataManagerCallback;
+ /***************************************************************************/
+ template<class T>
+ QList<T*> grabSelectedChildItemsOfType()
+ {
+ QList<T*> result;
+
+ QList<QTreeWidgetItem*> selectedNodes = selectedItems();
+ QList<QTreeWidgetItem*>::iterator iter = selectedNodes.begin();
+ while(iter!=selectedNodes.end())
+ {
+ T* node = dynamic_cast<T*> ((*iter));
+ if(node)
+ {
+ result.push_back(node);
+ }
+ ++iter;
+ }
+
+ return result;
+ }
+
+ void combineImagesWithType(const QString& classType);
+ void createWriterFromType(const QString& classType);
+ virtual void incrementScrollBars(const QPoint& pos);
+
+ /***************************** QT events **************************/
+
+ virtual void dragEnterEvent ( QDragEnterEvent * event );
+ virtual void dragLeaveEvent ( QDragLeaveEvent * event );
+ virtual void dragMoveEvent ( QDragMoveEvent * event );
+ virtual void dropEvent ( QDropEvent * event );
+ void keyPressEvent ( QKeyEvent * e);
+ void mousePressEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent * e);
+ /*******************************************************************/
+ virtual bool event ( QEvent * e );
+ virtual void deleteSelectedItems();
+ virtual void initialize();
+ void populateTreeWithNodes(DataManager::NodeListType& nodes);
+
+ ossimGui::DataManager::NodeListType getSelectedNodeList();
+
+ ossimRefPtr<DataManager> m_dataManager;
+ ossimRefPtr<DataManagerCallback> m_dataManagerCallback;
+ ossimRefPtr<ossimJobQueue> m_jobQueue;
+ ossimRefPtr<ossimJobQueue> m_displayQueue;
+
+ DataManagerImageFolder* m_rootImageFolder;
+ DataManagerJobsFolder* m_rootJobsFolder;
+ DataManagerRawImageSourceFolder* m_rawImageSources;
+ DataManagerImageChainFolder* m_imageChains;
+ // DataManagerImageOutputFolder* m_imageOutput;
+ DataManagerDisplayFolder* m_imageDisplays;
+ DataManagerImageWriterFolder* m_imageWriters;
+
+ QPoint m_dragStartPosition;
+
+ std::set<DataManagerItem*> m_activeItems;
+ mutable OpenThreads::Mutex m_activeItemsMutex;
+
+ // Registration-related members
+ MultiImageDialog* m_miDialog;
+ AutoMeasurementDialog* m_amDialog;
+ ossimTieMeasurementGeneratorInterface* m_tGen;
+ ossimRefPtr<ossimObject> m_tGenObj;
+ bool m_amDialogAvailable;
+ bool m_amDialogActive;
+
+ /**
+ * We will temporarily store the filter lists here from the factories
+ */
+ QStringList m_filterList;
+ QStringList m_combinerList;
+
+ ossimRefPtr<DataManager::Node> m_planetaryDisplayNode;
+
+ ossimFilename m_lastOpenedDirectory; // For QFileDialog::getOpenFileNames
+
+ }; // End: class DataManagerWidget
+
+} // End: namespace ossimGui{
+
+#endif /** #ifndef ossimGuiDataManagerWidget_HEADER */
diff --git a/ossimGui/include/ossimGui/DisplayTimerJobQueue.h b/ossimGui/include/ossimGui/DisplayTimerJobQueue.h
new file mode 100644
index 0000000..cdb5ab8
--- /dev/null
+++ b/ossimGui/include/ossimGui/DisplayTimerJobQueue.h
@@ -0,0 +1,48 @@
+#ifndef ossimGuiDipalyTimerJobQueue_HEADER
+#define ossimGuiDipalyTimerJobQueue_HEADER
+#include <QtCore/QObject>
+#include <ossim/parallel/ossimJobQueue.h>
+#include <ossimGui/Export.h>
+#include <QtCore/QTimerEvent>
+namespace ossimGui{
+
+
+ class OSSIMGUI_DLL DisplayTimerJobQueue : public ossimJobQueue
+ {
+ public:
+ DisplayTimerJobQueue();
+ virtual ~DisplayTimerJobQueue();
+ virtual void add(ossimJob* job, bool guaranteeUniqueFlag=true);
+ virtual ossimRefPtr<ossimJob> nextJob(bool blockIfEmptyFlag=true);
+
+
+ protected:
+
+ // this class is protected to the queue and manages the timer that processes jobs
+ //
+
+ class DisplayTimer : public QObject
+ {
+ public:
+ DisplayTimer(DisplayTimerJobQueue* q);
+ void startProcessingJobs();
+ void stopProcessingJobs();
+ virtual ~DisplayTimer();
+ void setJobQueue(DisplayTimerJobQueue* que);
+ virtual void timerEvent ( QTimerEvent * event );
+
+ protected:
+ DisplayTimerJobQueue* m_jobQueue;
+ int m_timerId;
+ int m_timerInterval;
+ };
+
+
+ mutable OpenThreads::Mutex m_timeJobQueueMutex;
+ DisplayTimer* m_displayTimer;
+
+ };
+
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/Event.h b/ossimGui/include/ossimGui/Event.h
new file mode 100644
index 0000000..8f1e7ab
--- /dev/null
+++ b/ossimGui/include/ossimGui/Event.h
@@ -0,0 +1,147 @@
+#ifndef ossimGuiEvent_HEADER
+#define ossimGuiEvent_HEADER
+#include <QtCore/QEvent>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/parallel/ossimJob.h>
+#include <ossimGui/DataManager.h>
+namespace ossimGui{
+ enum EventId
+ {
+ IMAGE_OPEN_EVENT_ID = QEvent::User,
+ DATA_MANAGER_EVENT_ID = (IMAGE_OPEN_EVENT_ID+1),
+ DATA_MANAGER_WIDGET_EVENT_ID = (DATA_MANAGER_EVENT_ID+1),
+ DATA_MANAGER_WIDGET_JOB_EVENT_ID = (DATA_MANAGER_WIDGET_EVENT_ID+1),
+ WINDOW_REFRESH_ACTIONS_EVENT_ID = (DATA_MANAGER_WIDGET_JOB_EVENT_ID+1),
+ PROGRESS_EVENT_ID = (WINDOW_REFRESH_ACTIONS_EVENT_ID+1),
+ DATA_MANGER_LAST_ID = (PROGRESS_EVENT_ID+1)
+ };
+
+ class OSSIMGUI_DLL ImageOpenEvent : public QEvent
+ {
+ public:
+ typedef std::vector<ossimRefPtr<ossimImageHandler> > HandlerList;
+
+ ImageOpenEvent():QEvent((QEvent::Type)IMAGE_OPEN_EVENT_ID)
+ {
+ }
+ ImageOpenEvent(ossimImageHandler* handler):QEvent((QEvent::Type)IMAGE_OPEN_EVENT_ID)
+ {
+ if(handler) m_handlerList.push_back(handler);
+ }
+ ImageOpenEvent(HandlerList& handlers):QEvent((QEvent::Type)IMAGE_OPEN_EVENT_ID)
+ {
+ m_handlerList = handlers;
+ }
+ HandlerList& handlerList(){return m_handlerList;}
+ const HandlerList& handlerList()const{return m_handlerList;}
+ protected:
+ HandlerList m_handlerList;
+ };
+
+ class OSSIMGUI_DLL DataManagerEvent : public QEvent
+ {
+ public:
+ enum CommandType
+ {
+ COMMAND_NONE = 0,
+ COMMAND_DISPLAY_NODE = 1,
+ COMMAND_NODE_ADDED = 2,
+ COMMAND_NODE_REMOVED = 3
+ };
+ DataManagerEvent(int commandType=COMMAND_DISPLAY_NODE):QEvent((QEvent::Type)DATA_MANAGER_EVENT_ID),
+ m_commandType(static_cast<CommandType>(commandType))
+ {
+ }
+
+ void setNodeList(DataManager::Node* node){m_nodeList.clear();if(node) m_nodeList.push_back(node);}
+ void setNodeList(const DataManager::NodeListType& nodes){m_nodeList = nodes;}
+ DataManager::NodeListType& nodeList(){return m_nodeList;}
+ const DataManager::NodeListType& nodeList()const{return m_nodeList;}
+ void setCommand(int commandType){m_commandType = static_cast<CommandType>(commandType);}
+ int command(){return m_commandType;}
+
+ protected:
+ DataManager::NodeListType m_nodeList;
+ CommandType m_commandType;
+ };
+
+ class DataManagerNodeItem;
+ class OSSIMGUI_DLL DataManagerWidgetEvent : public QEvent
+ {
+ public:
+ typedef std::vector<DataManagerNodeItem*> ItemListType;
+ enum CommandType
+ {
+ COMMAND_NONE = 0,
+ COMMAND_DELETE_NODE = 1,
+ COMMAND_REFRESH = 2,
+ COMMAND_DISCONNECT_INPUT = 3,
+ COMMAND_CONNECT_INPUT = 4,
+ COMMAND_RESET = 5
+ };
+ DataManagerWidgetEvent(int commandType=COMMAND_NONE)
+ :QEvent(static_cast<QEvent::Type>(DATA_MANAGER_WIDGET_EVENT_ID)),
+ m_commandType(static_cast<CommandType>(commandType))
+ {
+ }
+ void setCommand(int commandType){m_commandType = static_cast<CommandType>(commandType);}
+ int command(){return m_commandType;}
+ void setItemList(DataManagerNodeItem* item){m_itemList.clear();if(item) m_itemList.push_back(item);}
+ void setItemList(const ItemListType& items){m_itemList = items;}
+ ItemListType& itemList(){return m_itemList;}
+ const ItemListType& itemList()const{return m_itemList;}
+
+ protected:
+ ItemListType m_itemList;
+ CommandType m_commandType;
+ };
+ class OSSIMGUI_DLL DataManagerWidgetJobEvent : public QEvent
+ {
+ public:
+ typedef std::vector<ossimRefPtr<ossimJob> > JobListType;
+ enum CommandType
+ {
+ COMMAND_NONE = 0,
+ COMMAND_JOB_ADD,
+ COMMAND_JOB_ADDED,
+ COMMAND_JOB_STATE_CHANGED,
+ COMMAND_JOB_PROPERTY_CHANGED,
+ COMMAND_JOB_PERCENT_COMPLETE
+ };
+ DataManagerWidgetJobEvent(int commandType=COMMAND_NONE)
+ :QEvent(static_cast<QEvent::Type>(DATA_MANAGER_WIDGET_JOB_EVENT_ID)),
+ m_commandType(static_cast<CommandType>(commandType)),
+ m_percentComplete(0.0)
+ {}
+ void setCommand(int commandType){m_commandType = static_cast<CommandType>(commandType);}
+ int command(){return m_commandType;}
+ void setJobList(ossimJob* job){m_jobList.clear();if(job) m_jobList.push_back(job);}
+ void setJobList(const JobListType& jobs){m_jobList = jobs;}
+ JobListType& jobList(){return m_jobList;}
+ const JobListType& jobList()const{return m_jobList;}
+ void setJobList(ossim_float64 percentComplete, ossimJob* job){setJobList(job);m_percentComplete=percentComplete;}
+ ossim_float64 percentComplete()const{return m_percentComplete;}
+
+ protected:
+ JobListType m_jobList;
+ CommandType m_commandType;
+ ossim_float64 m_percentComplete;
+ };
+
+ class OSSIMGUI_DLL ProgressEvent : public QEvent
+ {
+ public:
+ ProgressEvent(double value=0.0)
+ :QEvent(static_cast<QEvent::Type>(PROGRESS_EVENT_ID)),
+ m_percentComplete(value)
+ {
+ }
+ void setPercentComplete(double value){m_percentComplete = value;}
+ double percentComplete()const{return m_percentComplete;}
+
+ protected:
+ double m_percentComplete;
+ };
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/Export.h b/ossimGui/include/ossimGui/Export.h
new file mode 100644
index 0000000..4834ec3
--- /dev/null
+++ b/ossimGui/include/ossimGui/Export.h
@@ -0,0 +1,52 @@
+/* -*-c++-*- libwms - Copyright (C) since 2004 Garrett Potts
+ *
+ * This library is open source and may be redistributed and/or modified under
+ * the terms of the libwms Public License (WMSGPL) version 0.0 or
+ * (at your option) any later version. The full license is in LICENSE file
+ * included with this distribution.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * libwms Public License for more details.
+*/
+#ifndef ossimGuiExport_HEADER
+#define ossimGuiExport_HEADER
+// define used to include in API which is being fazed out
+// if you can compile your apps with this turned off you are
+// well placed for compatablity with future versions.
+//#define USE_DEPRECATED_API
+
+#if defined(_MSC_VER)
+ #pragma warning( disable : 4244 )
+ #pragma warning( disable : 4251 )
+ #pragma warning( disable : 4267 )
+ #pragma warning( disable : 4275 )
+ #pragma warning( disable : 4290 )
+ #pragma warning( disable : 4786 )
+ #pragma warning( disable : 4305 )
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
+# ifdef OSSIMGUI_LIBRARY
+# define OSSIMGUI_EXPORT __declspec(dllexport)
+# define OSSIMGUI_DLL OSSIMGUI_EXPORT
+# else
+# define OSSIMGUI_EXPORT __declspec(dllimport)
+# define OSSIMGUI_DLL OSSIMGUI_EXPORT
+# endif /* OSSIMPLANETQT_LIBRARY */
+#else
+# define OSSIMGUI_EXPORT
+# define OSSIMGUI_DLL OSSIMGUI_EXPORT
+#endif
+
+// set up define for whether member templates are supported by VisualStudio compilers.
+#ifdef _MSC_VER
+# if (_MSC_VER >= 1300)
+# define __STL_MEMBER_TEMPLATES
+# endif
+#endif
+
+
+
+#endif
diff --git a/ossimGui/include/ossimGui/ExportImageDialog.h b/ossimGui/include/ossimGui/ExportImageDialog.h
new file mode 100644
index 0000000..ff8e35d
--- /dev/null
+++ b/ossimGui/include/ossimGui/ExportImageDialog.h
@@ -0,0 +1,35 @@
+#ifndef ossimGuiExportImageDialog_HEADER
+#define ossimGuiExportImageDialog_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_ExportImageDialog.h>
+#include <QtGui/QDialog>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/imaging/ossimImageFileWriter.h>
+#include <ossim/base/ossimProcessListener.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL ExportImageDialog :public QDialog, public Ui::ExportImageDialog
+ {
+ Q_OBJECT
+ public:
+ ExportImageDialog(QWidget* widget);
+
+ void setObject(ossimObject* obj);
+
+ public slots:
+ void exportAbortClicked(bool);
+ void closeClicked(bool);
+ void fileTypeActivated(int);
+ void openFileSaveDialog();
+
+ protected:
+ void populateFileTypes();
+ void populatePropertyView();
+ void populateGeneralInformation();
+ ossimRefPtr<ossimConnectableObject> m_connectable;
+ ossimRefPtr<ossimImageFileWriter> m_writer;
+ bool m_exportingFlag;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/GatherImageViewProjTransVisitor.h b/ossimGui/include/ossimGui/GatherImageViewProjTransVisitor.h
new file mode 100644
index 0000000..ecbbc2c
--- /dev/null
+++ b/ossimGui/include/ossimGui/GatherImageViewProjTransVisitor.h
@@ -0,0 +1,28 @@
+#ifndef ossimGuiGatherImageViewProjTransVisitor_HEADER
+#define ossimGuiGatherImageViewProjTransVisitor_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/IvtGeomTransform.h>
+#include <ossim/base/ossimVisitor.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL GatherImageViewProjTransVisitor : public ossimVisitor
+ {
+ public:
+ typedef std::vector<ossimRefPtr<IvtGeomTransform> > TransformList;
+
+ GatherImageViewProjTransVisitor(int visitorType =(VISIT_INPUTS|VISIT_CHILDREN))
+ :ossimVisitor(visitorType)
+ {
+ }
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new GatherImageViewProjTransVisitor(*this);}
+ virtual void visit(ossimObject* obj);
+
+ TransformList& getTransformList(){return m_transformList;}
+ const TransformList& getTransformList()const{return m_transformList;}
+ protected:
+ TransformList m_transformList;
+ };
+}
+
+#endif
\ No newline at end of file
diff --git a/ossimGui/include/ossimGui/GlWidget.h b/ossimGui/include/ossimGui/GlWidget.h
new file mode 100644
index 0000000..2fdf158
--- /dev/null
+++ b/ossimGui/include/ossimGui/GlWidget.h
@@ -0,0 +1,119 @@
+#ifndef ossimGuiQtGlWidget_HEADER
+#define ossimGuiQtGlWidget_HEADER
+#include <QtOpenGL/QGLWidget>
+#include <ossimGui/Export.h>
+#include <iostream>
+#include <osg/Node>
+#include <osg/Timer>
+#include <osg/Matrixd>
+#include <osg/Material>
+#include <osg/FrameStamp>
+#include <osgDB/DatabasePager>
+#include <osgGA/GUIEventHandler>
+#include <osgGA/EventQueue>
+#include <osgGA/EventVisitor>
+#include <osgDB/ReadFile>
+#include <osgUtil/SceneView>
+//#include "ossimPlanetQtActionAdapter.h"
+#include <ossimPlanet/ossimPlanet.h>
+#include <ossimPlanet/ossimPlanetSceneView.h>
+#include <ossimPlanet/ossimPlanetManipulator.h>
+#include <osgDB/DatabasePager>
+//#include <ossimPlanet/ossimPlanetDatabasePager.h>
+#include <ossimPlanet/ossimPlanetLookAt.h>
+#include <ossimPlanet/ossimPlanetViewer.h>
+//#include <osgGA/MatrixManipulator>
+#include <osgGA/CameraManipulator>
+#include <osgGA/StateSetManipulator>
+#include <ossimPlanet/ossimPlanetVisitors.h>
+/* #include <ossimPlanet/ossimPlanet.h> */
+#include <osgViewer/Viewer>
+#include <osgViewer/CompositeViewer>
+#include <osgViewer/ViewerEventHandlers>
+#include <OpenThreads/ReentrantMutex>
+//class ossimOsgMainFormController;
+namespace ossimGui
+{
+ class OSSIMGUI_DLL GlWidget : public QGLWidget
+ {
+ Q_OBJECT
+ public:
+ GlWidget( QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0 );
+ GlWidget( const QGLFormat & format, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0 );
+ virtual ~GlWidget();
+
+ osgViewer::GraphicsWindow* getGraphicsWindow() { return m_graphicsWindow.get(); }
+ const osgViewer::GraphicsWindow* getGraphicsWindow() const { return m_graphicsWindow.get(); }
+
+ void setMouseNavigationFlag(bool flag);
+ bool getMouseNavigationFlag()const;
+
+ protected slots:
+
+ void doIdleAnimationFrame();
+
+ signals:
+ void signalMouseMoveEvent(QMouseEvent* event);
+ void signalMousePressEvent(QMouseEvent* event);
+ void signalMouseReleaseEvent(QMouseEvent* event);
+ void signalMouseDoubleClickEvent(QMouseEvent* event);
+ void signalViewPositionChangedLatLonHgtHPR(double lat, double lon, double height,
+ double heading, double pitch, double roll);
+ // void signalDropEvent(QDropEvent * event);
+ // void signalDragEnterEvent(QDragEnterEvent *event);
+
+ protected:
+ void init();
+ virtual void frameIfNeeded()=0;
+ virtual void resizeGL( int width, int height );
+ virtual void keyPressEvent( QKeyEvent* event );
+ virtual void keyReleaseEvent( QKeyEvent* event );
+ virtual void mousePressEvent( QMouseEvent* event );
+ virtual void mouseReleaseEvent( QMouseEvent* event );
+ virtual void mouseMoveEvent( QMouseEvent* event );
+ virtual void mouseDoubleClickEvent ( QMouseEvent * event );
+ virtual void wheelEvent ( QWheelEvent * event );
+ osgGA::GUIEventAdapter::KeySymbol qtKeyToOsg(QKeyEvent * e)const;
+ void addModifiers(osg::ref_ptr<osgGA::EventQueue> eventQueue, Qt::KeyboardModifiers modifier);
+
+ osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_graphicsWindow;
+ bool m_mouseNavigationFlag;
+ bool m_passAllUnhandledEventsFlag;
+ };
+
+ class OSSIMGUI_DLL GlViewer : public GlWidget
+ {
+ public:
+ GlViewer(QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0);
+ GlViewer( const QGLFormat & format, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0 );
+ virtual ~GlViewer();
+ void setViewer(ossimPlanetViewer* viewer);
+ virtual void paintGL();
+
+ virtual void frameIfNeeded();
+ virtual void mouseMoveEvent( QMouseEvent* event );
+ ossimPlanetViewer* viewer();
+ void setCurrentSimulationTime(double simtime = USE_REFERENCE_TIME);
+ void setTargetFrameTimeInMilliseconds(float millisecondRate);
+ void setTargetFramesPerSecond(float framesPerSecond);
+ protected:
+ virtual void resizeGL( int width, int height );
+ void clearPointersInViewer();
+ QTimer *timer(); // Ensures that qtimer_ exists
+ void noRenderCycle();
+ OpenThreads::ReentrantMutex theDrawMutex;
+ // bool theRequestRedrawFlag;
+ // bool theRequestContinuousUpdateFlag;
+ int m_timerInterval;
+ osg::Matrixd m_currentViewMatrix;
+ osg::Matrixd m_currentViewMatrixInverse;
+ osg::Vec3d m_currentViewLlh;
+ osg::Vec3d m_currentViewHpr;
+ osg::ref_ptr<ossimPlanetViewer> m_viewer;
+ double m_currentSimulationTime;
+ float m_frameRateLimiter;
+ private:
+ QTimer *m_timer; // This should always be accessed via the timer() method
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/HistogramRemapperEditor.h b/ossimGui/include/ossimGui/HistogramRemapperEditor.h
new file mode 100644
index 0000000..4d745ab
--- /dev/null
+++ b/ossimGui/include/ossimGui/HistogramRemapperEditor.h
@@ -0,0 +1,45 @@
+#ifndef ossimGuiHistogramRemapperEditor_HEADER
+#define ossimGuiHistogramRemapperEditor_HEADER
+
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_HistogramRemapperEditor.h>
+#include <ossim/imaging/ossimHistogramRemapper.h>
+#include <ossim/base/ossimMultiResLevelHistogram.h>
+#include <ossim/base/ossimKeywordlist.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL HistogramRemapperEditor : public QDialog, public Ui::HistogramRemapperEditor
+ {
+ Q_OBJECT
+ public:
+ HistogramRemapperEditor(QWidget* parent=0, Qt::WindowFlags f = 0 );
+ void setObject(ossimObject* obj);
+ void setHistogram(const ossimFilename& file);
+
+ public slots:
+ void okButtonClicked(bool);
+ void resetButtonClicked(bool);
+ void cancelButtonClicked(bool);
+ void enableButtonClicked(bool);
+ void bandActivated ( int index );
+ void stretchModeActivated ( int index );
+ void openHistogramButton(bool);
+
+ void clipPenetrationsAdjusted(double minValue, double maxValue);
+ protected:
+ void initializeUiValues();
+ void populateClipPoints();
+ void calculateAverageHistogram();
+ void fireRefreshEvent();
+
+
+ ossimRefPtr<ossimHistogramRemapper> m_histogramRemapper;
+ ossimRefPtr<ossimMultiResLevelHistogram> m_multiResHistogram;
+ ossimRefPtr<ossimHistogram> m_averageHistogram;
+ ossimKeywordlist m_cancelState;
+
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/HistogramWidget.h b/ossimGui/include/ossimGui/HistogramWidget.h
new file mode 100644
index 0000000..6a9451b
--- /dev/null
+++ b/ossimGui/include/ossimGui/HistogramWidget.h
@@ -0,0 +1,61 @@
+#ifndef ossimQtHistogramWidget_HEADER
+#define ossimQtHistogramWidget_HEADER
+
+#include <QtGui/QGraphicsView>
+#include <ossim/base/ossimConstants.h>
+#include <ossim/base/ossimMultiBandHistogram.h>
+#include <ossim/base/ossimMultiResLevelHistogram.h>
+#include <ossimGui/Export.h>
+
+namespace ossimGui{
+
+ class OSSIMGUI_DLL HistogramWidget : public QGraphicsView
+ {
+ Q_OBJECT
+
+ public:
+ HistogramWidget(QWidget* parent = 0);//,
+ //Qt::WindowFlags f = 0);
+
+ virtual ~HistogramWidget();
+
+ /*!
+ * We need a pointer to the remapper as it's the only one who can map
+ * it's bands to the histogram file bands.
+ */
+ void setHistogram(ossimHistogram* histogram);
+
+ void setPenetration(double minValue, double maxValue);
+ void setClipPoints(double minValue, double maxValue);
+ void getClipPoints(double& minValue, double& maxValue);
+
+ void setReadOnly(bool flag){m_readOnly = flag;}
+ void setShowClipPointsFlag(bool flag);
+
+ virtual void paintEvent(QPaintEvent *event);
+ virtual void resizeEvent ( QResizeEvent * event );
+protected:
+
+ signals:
+ void clipPenetrationsAdjusted(double minValue, double maxValue);
+
+ private:
+ void mousePressEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e);
+ void adjustClips(const QPoint& point);
+ /*!
+ * A band of zero tells paintHistogram to paint average of all bands...
+ */
+ double getMaxBinCount();
+ void updateScaledHistogram();
+ ossimRefPtr<ossimHistogram> m_histogram;
+ ossimRefPtr<ossimHistogram> m_scaledHistogram;
+ ossim_float64 m_scaledNormalizer;
+ bool m_showClipPointsFlag;
+ double m_minFraction;
+ double m_maxFraction;
+ bool m_readOnly;
+ };
+}
+
+#endif /* #ifndef ossimQtHistogramWidget_HEADER */
diff --git a/ossimGui/include/ossimGui/HsiRemapperEditor.h b/ossimGui/include/ossimGui/HsiRemapperEditor.h
new file mode 100644
index 0000000..9af0227
--- /dev/null
+++ b/ossimGui/include/ossimGui/HsiRemapperEditor.h
@@ -0,0 +1,64 @@
+#ifndef ossimGuiHsiRemapperEditor_HEADER
+#define ossimGuiHsiRemapperEditor_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_HsiRemapperEditor.h>
+#include <QtGui/QDialog>
+#include <ossim/imaging/ossimHsiRemapper.h>
+namespace ossimGui{
+ class OSSIMGUI_DLL HsiRemapperEditor: public QDialog, public Ui::HsiRemapperEditor
+ {
+ Q_OBJECT
+ public:
+ HsiRemapperEditor(QWidget* parent=0, Qt::WindowFlags f = 0 );
+
+ void setObject(ossimObject* obj);
+
+ public slots:
+ void hueOffsetChanged(int value);
+ void hueLowChange(int value);
+ void hueHighChange(int value);
+ void hueBlendChange(int value);
+ void saturationOffsetChange(int value);
+ void intensityOffsetChange(int value);
+ void lowIntensityClipChange(int value);
+ void highIntensityClipChange(int value);
+ void whitObjectClipChange(int value);
+
+ void redButtonClicked();
+ void yellowButtonClicked();
+ void greenButtonClicked();
+ void cyanButtonClicked();
+ void blueButtonClicked();
+ void magentaButtonClicked();
+ void allButtonClicked();
+
+ void enableButtonClicked(bool checked);
+ void resetGroupButtonClicked();
+ void resetAllButtonClicked();
+ void okButtonClicked();
+ void cancelButtonClicked();
+
+ protected:
+ ossimRefPtr<ossimHsiRemapper> m_object;
+ int m_activeGroup;
+ double m_hueOffsetRange[2];
+ double m_hueLowRange[2];
+ double m_hueHighRange[2];
+ double m_hueBlendRange[2];
+ double m_saturationOffsetRange[2];
+ double m_intensityOffsetRange[2];
+ double m_lowIntensityClipRange[2];
+ double m_highIntensityClipRange[2];
+ double m_whiteObjectClipRange[2];
+ ossimKeywordlist m_cancelState;
+
+ ossimString getPropertyPrefix()const;
+ double roundForDisplay(double value, int precision=100)const;
+ void fireRefreshEvent();
+ void initializeUiValues();
+ void initializeUiRanges();
+ };
+
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/Image.h b/ossimGui/include/ossimGui/Image.h
new file mode 100644
index 0000000..9fc9a6f
--- /dev/null
+++ b/ossimGui/include/ossimGui/Image.h
@@ -0,0 +1,27 @@
+#ifndef ossimGuiImage_HEADER
+#define ossimGuiImage_HEADER
+#include <QtGui/QImage>
+#include <ossim/imaging/ossimImageData.h>
+#include <ossimGui/Export.h>
+namespace ossimGui{
+
+
+ class OSSIMGUI_DLL Image : public QImage
+ {
+ public:
+ Image()
+ :QImage()
+ {}
+ Image ( const QSize & size, Format format )
+ :QImage(size, format)
+ {}
+ Image ( const QImage & image )
+ :QImage(image){}
+ Image(ossimRefPtr<ossimImageData> data, bool includeOffset = false);
+
+ void setImage(ossimRefPtr<ossimImageData> data, bool includeOffset=false);
+ ossimRefPtr<ossimImageData> toOssimImage();
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/ImageMdiSubWindow.h b/ossimGui/include/ossimGui/ImageMdiSubWindow.h
new file mode 100644
index 0000000..a4d2003
--- /dev/null
+++ b/ossimGui/include/ossimGui/ImageMdiSubWindow.h
@@ -0,0 +1,139 @@
+#ifndef ImageMdiSubWindow_HEADER
+#define ImageMdiSubWindow_HEADER
+#include <ossimGui/MdiSubWindowBase.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/base/ossimVisitor.h>
+#include <QtGui/QMouseEvent>
+class QMenu;
+class QToolBar;
+class QMenuBar;
+class QMainWindow;
+class ossimConnectableObject;
+namespace ossimGui {
+ //class ImageScrollWidget;
+ class ImageScrollView;
+ class OSSIMGUI_DLL ImageActions : public QObject
+ {
+ Q_OBJECT
+ public:
+ class OSSIMGUI_DLL Visitor : public ossimVisitor
+ {
+ public:
+ Visitor();
+ virtual void reset();
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new Visitor(*this);}
+ virtual void visit(ossimConnectableObject* obj);
+
+ ossimVisitor::ListRef m_imageAdjustments;
+ bool m_isProjected;
+ bool m_isAffine;
+ ossimVisitor::ListRef m_imageHandlers;
+ ossimVisitor::ListRef m_bandSelectors;
+ ossimVisitor::ListRef m_histogramRemappers;
+ ossimVisitor::ListRef m_imageRenderers;
+ ossimVisitor::ListRef m_viewInterfaces;
+ ossimVisitor::ListRef m_scalarRemappers;
+ ossimVisitor::ListRef m_hsiRemappers;
+ ossimVisitor::ListRef m_brightnessContrastSources;
+ ossimVisitor::ListRef m_containers;
+ };
+
+ ImageActions();
+ void addActions(QMainWindow* mainWindow);
+ void removeActions(QMainWindow* mainWindow);
+ void setWidget(ossimGui::ImageScrollView* widget){m_widget = widget;}
+ void setupAndExecuteSyncing();
+ Visitor& visitor(){return m_visitor;}
+ const Visitor& visitor()const{return m_visitor;}
+ public slots:
+ void exportImage();
+ void saveAs();
+ void exportKeywordlist();
+ void editBandSelector();
+ void editHsiAdjustments();
+ void editBrightnessContrast();
+ void editHistogramRemapper();
+ void editGeometryAdjustments();
+ void editView();
+ void showPolygonRemapper();
+ void showPositionInformation();
+
+ void interpolationTypeChanged(const QString& value);
+ void fitToWindow();
+ void fullRes();
+ void zoomIn(double factor=2.0);
+ void zoomOut(double factor=2.0);
+ void syncingOptionsChanged(const QString& value);
+ void layerOptionsChanged(int index);
+// void mouseMove(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+// void mousePress(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+// void mouseRelease(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+// void mouseDoubleClick(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+// void wheel(QWheelEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+ void track(const ossimDpt& scenePoint);
+ signals:
+ void syncView(View&);
+ protected:
+ ossimImageGeometry* getView();
+
+ Visitor m_visitor;
+ ossimGui::ImageScrollView* m_widget;
+ ossim_uint32 m_syncType;
+ ossimDpt m_currentScenePoint;
+ QString m_resamplerType;
+ bool m_leftButtonPressed;
+ };
+
+ class OSSIMGUI_DLL ImageMdiSubWindow : public MdiSubWindowBase
+ {
+ Q_OBJECT
+ public:
+ ImageMdiSubWindow( QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ virtual ~ImageMdiSubWindow();
+
+ ossimGui::ImageScrollView* scrollWidget();
+ virtual void setJobQueue(ossimJobQueue* q);
+ virtual void sync(View& syncInfo);
+ virtual void setConnectableObject(ConnectableObject* connectable);
+ ImageActions* getImageActions()const {return m_actions;}
+
+ public slots:
+ void stateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
+ void syncView(View& view);
+
+ protected:
+ friend class ConnectionListener;
+ class ContainerListener : public ossimConnectableObjectListener
+ {
+ public:
+ ContainerListener(ImageMdiSubWindow* w)
+ :m_window(w)
+ {
+ }
+ ImageMdiSubWindow* window(){return m_window;}
+ void setWindow(ImageMdiSubWindow* w){m_window = w;}
+ virtual void containerEvent(ossimContainerEvent& /* event */);
+
+ protected:
+ ImageMdiSubWindow* m_window;
+ };
+ void addItems();
+ void removeItems();
+ void addOrSetupToolbar();
+ virtual void closeEvent ( QCloseEvent * event ) ;
+ void addListeners();
+ void removeListeners();
+ virtual bool event ( QEvent * event );
+ ossimImageGeometry* getView();
+
+ ossimGui::ImageScrollView* m_imageScrollView;
+
+ ImageActions* m_actions;
+ ContainerListener* m_containerListener;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/ImageScrollView.h b/ossimGui/include/ossimGui/ImageScrollView.h
new file mode 100644
index 0000000..0ba22cb
--- /dev/null
+++ b/ossimGui/include/ossimGui/ImageScrollView.h
@@ -0,0 +1,374 @@
+#ifndef ossimGuiImageScrollView_HEADER
+#define ossimGuiImageScrollView_HEADER 1
+#include <QtGui/QGraphicsView>
+#include <QtGui/QScrollArea>
+#include <QtGui/QResizeEvent>
+#include <QtGui/QScrollBar>
+#include <QtGui/QLabel>
+#include <QtGui/QBitmap>
+#include <QtGui/QRubberBand>
+#include <ossimGui/Export.h>
+#include <ossimGui/ConnectableImageObject.h>
+#include <ossimGui/Image.h>
+#include <ossimGui/StaticTileImageCache.h>
+#include <ossimGui/ImageViewManipulator.h>
+#include <ossimGui/DataManager.h>
+#include <ossim/imaging/ossimImageChain.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <ossim/imaging/ossimImageData.h>
+#include <ossim/imaging/ossimScalarRemapper.h>
+#include <ossim/imaging/ossimCacheTileSource.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/parallel/ossimJobQueue.h>
+#include <vector>
+
+namespace ossimGui
+{
+ class RegistrationOverlay;
+ class MetricOverlay;
+
+ class OSSIMGUI_DLL ImageViewJob : public ossimJob
+ {
+ public:
+ ImageViewJob();
+ virtual void start();
+ void setMaxProcessingTimeInMillis(ossim_float64 t)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_maxProcessingTime = t;
+ }
+ ossim_float64 maxProcessingTimeInMillis()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ return m_maxProcessingTime;
+ }
+ void setTileCache(StaticTileImageCache* cache)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_tileCache = cache;
+ }
+ StaticTileImageCache* tileCache()
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ return m_tileCache.get();
+ }
+ void setInputSource(ossimImageSource* input)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_inputSource = input;
+ }
+
+ protected:
+ ossim_float64 m_maxProcessingTime;
+ ossimRefPtr<StaticTileImageCache> m_tileCache;
+ ossimRefPtr<ossimImageSource> m_inputSource;
+ OpenThreads::Mutex m_imageViewJobMutex;
+ };
+
+ class OSSIMGUI_DLL ImageScrollView : public QGraphicsView
+ {
+ Q_OBJECT
+ public:
+ friend class ImageViewManipulator;
+ enum MultiLayerAlgorithmType
+ {
+ NO_ALGORITHM=0,
+ HORIZONTAL_SWIPE_ALGORITHM,
+ VERTICAL_SWIPE_ALGORITHM,
+ BOX_SWIPE_ALGORITHM,
+ CIRCLE_SWIPE_ALGORITHM,
+ ANIMATION_ALGORITHM
+ };
+
+ friend class ImageViewJob;
+ class ConnectionListener : public ossimConnectableObjectListener
+ {
+ public:
+ ConnectionListener(ImageScrollView* widget=0)
+ :m_widget(widget)
+ {
+ }
+ virtual void objectDestructingEvent(ossimObjectDestructingEvent& /*event*/)
+ {
+ }
+ virtual void disconnectInputEvent(ossimConnectionEvent& /* event */)
+ {
+ if(m_widget)
+ {
+ m_widget->inputDisconnected();
+ }
+
+ }
+ virtual void disconnectOutputEvent(ossimConnectionEvent& /* event */)
+ {
+ }
+ virtual void connectInputEvent(ossimConnectionEvent& /* event */)
+ {
+ if(m_widget)
+ {
+ m_widget->inputConnected();
+ }
+ }
+ virtual void connectOutputEvent(ossimConnectionEvent& /* event */)
+ {
+ }
+
+ virtual void propertyEvent(ossimPropertyEvent& /* event */)
+ {
+ m_widget->refreshDisplay();
+ }
+
+ /*!
+ * Typically isued by objects that contain children. If anyone is
+ * interested, can latch on to this event. Other objects within the
+ * system might be interest in this event even
+ */
+ virtual void addObjectEvent(ossimContainerEvent& /* event */)
+ {}
+
+ virtual void removeObjectEvent(ossimContainerEvent& /* event */)
+ {}
+
+ virtual void refreshEvent(ossimRefreshEvent& event)
+ {
+ int refreshType = event.getRefreshType();
+ if((refreshType & ossimRefreshEvent::REFRESH_PIXELS)||
+ (refreshType & ossimRefreshEvent::REFRESH_GEOMETRY))
+ {
+ m_widget->refreshDisplay();
+ }
+ if(refreshType & ossimRefreshEvent::REFRESH_POSITION)
+ {
+ m_widget->centerOn(event.getPosition().x, event.getPosition().y);
+ }
+ }
+ ImageScrollView* m_widget;
+ };
+ class Callback : public ossimJobCallback
+ {
+ public:
+ Callback(ImageScrollView* w):m_imageScrollWidget(w){}
+ virtual void started(ossimJob* job)
+ {
+ ImageViewJob* imageViewJob = dynamic_cast<ImageViewJob*>(job);
+ if(imageViewJob)
+ {
+ ossimRefPtr<Layer> layer = m_imageScrollWidget->m_layers->findFirstDirtyLayer();
+ if(layer.valid())
+ {
+ imageViewJob->setTileCache(layer->tileCache());
+ imageViewJob->setInputSource(layer->chain());
+ }
+ }
+ }
+ virtual void finished(ossimJob* job)
+ {
+ ImageViewJob* imageViewJob = dynamic_cast<ImageViewJob*>(job);
+ if(imageViewJob)
+ {
+ m_imageScrollWidget->viewport()->update();
+ if(m_imageScrollWidget)
+ {
+ ossimRefPtr<Layer> layer = m_imageScrollWidget->m_layers->findFirstDirtyLayer();
+ if(layer.valid())
+ {
+ imageViewJob->ready();
+ m_imageScrollWidget->m_jobQueue->add(job);
+ }
+ }
+ }
+ }
+
+ ImageScrollView* m_imageScrollWidget;
+ };
+ friend class Callback;
+
+ class OSSIMGUI_DLL Layer : public ossimReferenced
+ {
+ public:
+ Layer(ossimConnectableObject* obj=0);
+ virtual ~Layer();
+ void clear()
+ {
+ m_inputObject = 0;
+ m_tileCache = 0;
+ if(m_scalarRemapperChain.valid()) m_scalarRemapperChain->disconnect();
+ m_scalarRemapperChain = 0;
+ }
+ StaticTileImageCache* tileCache(){return m_tileCache.get();}
+ const StaticTileImageCache* tileCache()const{return m_tileCache.get();}
+
+ ossimConnectableObject* inputSource(){return m_inputObject.get();}
+ const ossimConnectableObject* inputSource()const{return m_inputObject.get();}
+
+ ossimImageSource* chain(){return m_scalarRemapperChain.get();}
+ const ossimImageSource* chain()const{return m_scalarRemapperChain.get();}
+
+ ossimRefPtr<ossimConnectableObject> m_inputObject;
+ ossimRefPtr<ossimImageChain> m_scalarRemapperChain;
+ ossimRefPtr<StaticTileImageCache> m_tileCache;
+ };
+ class Layers : public ossimReferenced
+ {
+ public:
+ typedef std::vector<ossimRefPtr<Layer> > LayerListType;
+ class OSSIMGUI_DLL FindConnectable
+ {
+ public:
+ FindConnectable(ossimConnectableObject* obj):m_connectable(obj){}
+ bool operator()(const ossimRefPtr<Layer>& layer)
+ {
+ return (layer->m_inputObject.get() == m_connectable);
+ }
+ ossimConnectableObject* m_connectable;
+ };
+
+ Layers();
+ virtual ~Layers();
+ Layer* layer(ossim_uint32 idx);
+ Layer* layer(ossimConnectableObject* input);
+ bool isEmpty()const;
+ void adjustLayers(ossimConnectableObject* connectable);
+ Layer* findFirstDirtyLayer();
+ void setCacheRect(const ossimDrect& rect);
+ void flushDisplayCaches();
+ ossim_uint32 numberOfLayers()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return m_layers.size();
+ }
+
+ protected:
+ Layer* layerNoMutex(ossim_uint32 idx);
+ Layer* layerNoMutex(ossimConnectableObject* input);
+ LayerListType m_layers;
+
+ mutable OpenThreads::Mutex m_mutex;
+ };
+
+ ImageScrollView ( QWidget * parent = 0 );
+ ImageScrollView ( QGraphicsScene * scene, QWidget * parent = 0 );
+ ~ImageScrollView ();
+ void setManipulator(ImageViewManipulator* manipulator);
+ ImageViewManipulator* manipulator();
+
+ void setConnectableObject(ConnectableImageObject* c);
+ ConnectableImageObject* connectableObject();
+
+ ossimImageGeometry* getGeometry();
+
+ /**
+ * @brief Gets rgb values from viewport.
+ */
+ void getRgb(const ossimIpt& location,
+ ossim_uint8& r,
+ ossim_uint8& g,
+ ossim_uint8& b);
+
+ /**
+ * @brief Gets the raw pixel values at the image handler level.
+ * Only works on single image chains. If the input fed from multiple
+ * inputs the call will do nothing.
+ */
+ void getRaw(const ossimIpt& location,
+ std::vector<ossim_float64>& values);
+
+ void setShowTrackCursor(bool flag){m_showTrackingCursorFlag=flag;}
+ bool showTrackCursor()const{return m_showTrackingCursorFlag;}
+ const ossimDpt& trackPoint()const;
+ void setTrackPoint(const ossimDpt& position);
+ void setJobQueue(ossimJobQueue* jobQueue);
+ void refreshDisplay();
+ void setMultiLayerAlgorithm(int algorithm){m_multiLayerAlgorithm = static_cast<MultiLayerAlgorithmType> (algorithm);}
+ ossim_int32 multiLayerAlgorithmType()const{return m_multiLayerAlgorithm;}
+ void setExploitationMode(int expMode);
+ void setAutoMeasActive(const bool state);
+ ossim_int32 exploitationMode()const{return m_exploitationMode;}
+ ossimDrect viewportBoundsInSceneSpace()const;
+ Layers* layers(){return m_layers.get();}
+ const ossimDrect& getInputBounds()const{return m_inputBounds;}
+ const ossimDpt& getLastClickedPoint()const{return m_lastClickedPoint;}
+ void setLastClickedPoint(const ossimDpt& position) {m_lastClickedPoint = position;}
+ void setPositionGivenView(const ossimDpt& position);
+ virtual void mouseDoubleClickEvent ( QMouseEvent * e );
+ virtual void mouseMoveEvent ( QMouseEvent * e );
+ virtual void mousePressEvent ( QMouseEvent * e );
+ virtual void mouseReleaseEvent ( QMouseEvent * e );
+ virtual void wheelEvent ( QWheelEvent * e );
+ virtual void enterEvent ( QEvent * event );
+ virtual void leaveEvent ( QEvent * event );
+ virtual void keyPressEvent ( QKeyEvent * event );
+ virtual void keyReleaseEvent ( QKeyEvent * event );
+
+ // Currently called by ImageViewManipulator zoom functions
+ void zoomAnnotation();
+
+ // Overlay access
+ ossimGui::RegistrationOverlay* regOverlay()const{return m_regOverlay;}
+ ossimGui::MetricOverlay* metOverlay()const{return m_metricOverlay;}
+
+ void emitViewChanged();
+
+ signals:
+
+ void wheel(QWheelEvent* event, const ossimDrect& viewSceneRect, const ossimDpt& scenePoint);
+ void mouseMove(QMouseEvent* event, const ossimDrect& viewSceneRect, const ossimDpt& scenePoint);
+ void mouseMove(QMouseEvent* event);
+ void mouseDoubleClick(QMouseEvent* event, const ossimDrect& viewSceneRect, const ossimDpt& scenePoint);
+ void mouseRelease(QMouseEvent* event, const ossimDrect& viewSceneRect, const ossimDpt& scenePoint);
+ void mouseRelease(QMouseEvent* event);
+ void track(const ossimDpt& scenePoint);
+ void mousePress(QMouseEvent* event, const ossimDrect& viewSceneRect, const ossimDpt& scenePoint);
+ void mousePress(QMouseEvent* event, const ossimDpt& scenePoint);
+ void mousePress(ImageScrollView* sptr, const ossimDpt& scenePoint);
+ void mousePress(QMouseEvent* event);
+ void mouseBox(ImageScrollView* sptr, const ossimDpt& startPoint, const ossimDpt& stopPoint);
+
+ void paintYourGraphics(QPainter* p, const QRectF& rect);
+
+ void viewChanged();
+
+ protected:
+
+ virtual void resizeEvent(QResizeEvent* event);
+ virtual void scrollContentsBy( int dx, int dy );
+ void setCacheRect();
+ void inputConnected(ossim_int32 idx = -1);
+ void inputDisconnected(ossim_int32 idx = -1);
+ virtual void drawBackground ( QPainter * painter, const QRectF & rect );
+ virtual void drawForeground ( QPainter * painter, const QRectF & rect );
+ void paintMultiLayer(QPainter& painter, const QRectF & rect);
+ void updateSceneRect();
+ void emitTracking(const ossimDpt& pt);
+
+ ossimDpt m_lastClickedPoint;
+ ossimDpt m_trackPoint;
+ ossimDpt m_oldTrackPoint;
+ bool m_trackingFlag;
+ bool m_mouseInsideFlag;
+ bool m_showTrackingCursorFlag;
+ bool m_amDialogActive;
+
+ QPoint m_mouseStartPoint;
+ QPointF m_activePointStart;
+ QPointF m_activePointEnd;
+ ossimRefPtr<ImageViewJob> m_imageViewJob;
+ ossimRefPtr<Layers> m_layers;
+ ConnectionListener* m_listener;
+ ossimRefPtr<ossimJobQueue> m_jobQueue;
+ ossimDrect m_inputBounds;
+ MultiLayerAlgorithmType m_multiLayerAlgorithm;
+ DataManager::ExploitationModeType m_exploitationMode;
+
+ ossimRefPtr<ImageViewManipulator> m_manipulator;
+ mutable ossimRefPtr<ConnectableImageObject> m_connectableObject;
+
+ RegistrationOverlay* m_regOverlay;
+ MetricOverlay* m_metricOverlay;
+ ossimString m_roiId;
+
+ }; // End: class ImageScrollView
+}
+
+#endif /* #ifndef ossimGuiImageScrollView_HEADER */
diff --git a/ossimGui/include/ossimGui/ImageViewManipulator.h b/ossimGui/include/ossimGui/ImageViewManipulator.h
new file mode 100644
index 0000000..f0e09e0
--- /dev/null
+++ b/ossimGui/include/ossimGui/ImageViewManipulator.h
@@ -0,0 +1,104 @@
+#ifndef ossimGuiImageViewManipulator_HEADER
+#define ossimGuiImageViewManipulator_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimReferenced.h>
+#include <ossim/base/ossimDrect.h>
+#include <ossim/base/ossimIrect.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QWheelEvent>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QResizeEvent>
+
+
+namespace ossimGui
+{
+ /*
+ class OSSIMGUI_DLL SceneItemUpdate : public QObject
+ {
+ Q_OBJECT
+ public:
+ SceneItemUpdate(){}
+
+ public slots:
+ void sceneRectChanged ( const QRectF & rect )
+ {
+ std::cout << "Iterating!!!!!\n";
+ }
+ };
+ */
+ class ImageScrollView;
+ class OSSIMGUI_DLL ImageViewManipulator : public ossimReferenced
+ {
+ public:
+ ImageViewManipulator(ImageScrollView*);
+
+ virtual void setImageScrollView(ImageScrollView*);
+ ImageScrollView* getImageScrollView();
+
+ void setObject(ossimObject* geom);
+ template<class T>
+ T* getObjectAs()
+ {
+ return dynamic_cast<T*>(m_obj.get());
+ }
+ template<class T>
+ const T* getObjectAs()const
+ {
+ return dynamic_cast<T*>(m_obj.get());
+ }
+ virtual void fit();
+ void setFullResScale(const ossimDpt& scale);
+ ossimDpt getFullResScale() {return m_fullResolutionScale;}
+ void fullRes();
+ virtual void zoomIn(double factor=2.0);
+ virtual void zoomOut(double factor=2.0);
+ virtual void initializeToCurrentView();
+ bool isAffine()const;
+
+ virtual void resizeEvent(QResizeEvent* event);
+ virtual void scrollContentsBy( int dx, int dy );
+ virtual void keyPressEvent ( QKeyEvent * event, bool& consumeEvent );
+ virtual void keyReleaseEvent ( QKeyEvent * event, bool& consumeEvent);
+ virtual void mouseDoubleClickEvent ( QMouseEvent * event, bool& consumeEvent );
+ virtual void mouseMoveEvent ( QMouseEvent * event, bool& consumeEvent );
+ virtual void mousePressEvent ( QMouseEvent * event, bool& consumeEvent );
+ virtual void mouseReleaseEvent ( QMouseEvent * event, bool& consumeEvent );
+ virtual void resizeEvent ( QResizeEvent * event, bool& consumeEvent );
+ virtual void wheelEvent ( QWheelEvent * event, bool& consumeEvent );
+ virtual void enterEvent ( QEvent * event, bool& consumeEvent );
+ virtual void leaveEvent ( QEvent * event, bool& consumeEvent );
+
+ protected:
+ struct Range
+ {
+ Range(ossim_float64 minValue=ossim::nan(), ossim_float64 maxValue=ossim::nan())
+ :m_min(minValue),
+ m_max(maxValue)
+ {
+ }
+ bool isValid()const{return (!ossim::isnan(m_min)&&!ossim::isnan(m_max));}
+ bool withinRange(ossim_float64 v){return (v>=m_min&&v<=m_max);}
+ ossim_float64 m_min;
+ ossim_float64 m_max;
+ };
+ void setViewToChains();
+ void setCommonCenter();
+ ossimDpt sceneToLocal(const ossimDpt& scenePoint);
+
+ virtual void fit(const ossimIrect& input, const ossimIrect& target);
+ ossimImageGeometry* asGeometry();
+
+ ImageScrollView* m_scrollView;
+ ossimDpt m_centerPoint;
+ ossimDpt m_fullResolutionScale;
+ ossimRefPtr<ossimObject> m_obj;
+ mutable bool m_leftButtonPressed;
+ Range m_scaleRange;
+ // SceneItemUpdate* m_sceneItemUpdate;
+
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/ImageWidget.h b/ossimGui/include/ossimGui/ImageWidget.h
new file mode 100644
index 0000000..2db23ba
--- /dev/null
+++ b/ossimGui/include/ossimGui/ImageWidget.h
@@ -0,0 +1,390 @@
+#ifndef ossimGuiImageWidget_HEADER
+#define ossimGuiImageWidget_HEADER
+#include <QtGui/QScrollArea>
+#include <QtGui/QResizeEvent>
+#include <QtGui/QScrollBar>
+#include <QtGui/QLabel>
+#include <QtGui/QBitmap>
+#include <ossim/imaging/ossimImageSource.h>
+#include <ossim/imaging/ossimImageData.h>
+#include <ossim/imaging/ossimScalarRemapper.h>
+#include <ossim/imaging/ossimCacheTileSource.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimDrect.h>
+#include <ossimGui/Export.h>
+#include <ossimGui/Image.h>
+#include <ossimGui/ConnectableImageObject.h>
+#include <ossimGui/StaticTileImageCache.h>
+#include <ossim/imaging/ossimImageChain.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/parallel/ossimJobQueue.h>
+
+class QGraphicsView;
+class QGraphicsScene;
+
+namespace ossimGui
+{
+ class ImageWidget;
+ class ImageScrollWidget;
+ class RegistrationOverlay;
+
+ class OSSIMGUI_DLL ImageWidgetJob : public ossimJob
+ {
+ public:
+ ImageWidgetJob();
+ virtual void start();
+ void setMaxProcessingTimeInMillis(ossim_float64 t)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_maxProcessingTime = t;
+ }
+ ossim_float64 maxProcessingTimeInMillis()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ return m_maxProcessingTime;
+ }
+ void setCacheToViewTransform(const QTransform& trans)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_cacheToView = trans;
+ }
+ void setViewToCacheTransform(const QTransform& trans)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_viewToCache = trans;
+ }
+ void setTileCache(StaticTileImageCache* cache)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_tileCache = cache;
+ }
+ StaticTileImageCache* tileCache()
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ return m_tileCache.get();
+ }
+ void setInputSource(ossimImageSource* input)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobMutex);
+ m_inputSource = input;
+ }
+
+ protected:
+ ossim_float64 m_maxProcessingTime;
+ QTransform m_cacheToView;
+ QTransform m_viewToCache;
+ ossimRefPtr<StaticTileImageCache> m_tileCache;
+ ossimRefPtr<ossimImageSource> m_inputSource;
+ OpenThreads::Mutex m_imageWidgetJobMutex;
+ };
+
+ class OSSIMGUI_DLL ImageScrollWidget : public QScrollArea
+ {
+ Q_OBJECT
+ public:
+ enum MultiLayerAlgorithmType
+ {
+ NO_ALGORITHM=0,
+ HORIZONTAL_SWIPE_ALGORITHM,
+ VERTICAL_SWIPE_ALGORITHM,
+ BOX_SWIPE_ALGORITHM,
+ CIRCLE_SWIPE_ALGORITHM,
+ ANIMATION_ALGORITHM
+ };
+
+ friend class ImageWidgetJob;
+
+ class OSSIMGUI_DLL ImageWidget : public QFrame
+ {
+ public:
+ ImageWidget(ImageScrollWidget* scrollWidget, QWidget* parent=0);
+
+ virtual void paintEvent(QPaintEvent *event);
+ protected:
+ ImageScrollWidget* m_scrollWidget;
+
+
+ // QGraphicsScene* m_scene;
+ // QGraphicsView* m_view;
+
+
+ };
+
+ class OSSIMGUI_DLL Layer : public ossimReferenced
+ {
+ public:
+ Layer(ossimConnectableObject* obj=0);
+ virtual ~Layer();
+ void clear()
+ {
+ m_inputObject = 0;
+ m_tileCache = 0;
+ if(m_scalarRemapperChain.valid()) m_scalarRemapperChain->disconnect();
+ m_scalarRemapperChain = 0;
+ }
+ StaticTileImageCache* tileCache(){return m_tileCache.get();}
+ const StaticTileImageCache* tileCache()const{return m_tileCache.get();}
+
+ ossimConnectableObject* inputSource(){return m_inputObject.get();}
+ const ossimConnectableObject* inputSource()const{return m_inputObject.get();}
+
+ ossimImageSource* chain(){return m_scalarRemapperChain.get();}
+ const ossimImageSource* chain()const{return m_scalarRemapperChain.get();}
+
+ ossimRefPtr<ossimConnectableObject> m_inputObject;
+ ossimRefPtr<ossimImageChain> m_scalarRemapperChain;
+ ossimRefPtr<StaticTileImageCache> m_tileCache;
+ };
+ class Layers : public ossimReferenced
+ {
+ public:
+ typedef std::vector<ossimRefPtr<Layer> > LayerListType;
+ class OSSIMGUI_DLL FindConnectable
+ {
+ public:
+ FindConnectable(ossimConnectableObject* obj):m_connectable(obj){}
+ bool operator()(const ossimRefPtr<Layer>& layer)
+ {
+ return (layer->m_inputObject.get() == m_connectable);
+ }
+ ossimConnectableObject* m_connectable;
+ };
+
+ Layers();
+ virtual ~Layers();
+ Layer* layer(ossim_uint32 idx);
+ Layer* layer(ossimConnectableObject* input);
+ bool isEmpty()const;
+ void adjustLayers(ossimConnectableObject* connectable);
+ Layer* findFirstDirtyLayer();
+ void setCacheRect(const ossimDrect& rect);
+ void flushDisplayCaches();
+ ossim_uint32 numberOfLayers()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return m_layers.size();
+ }
+ protected:
+ Layer* layerNoMutex(ossim_uint32 idx);
+ Layer* layerNoMutex(ossimConnectableObject* input);
+ LayerListType m_layers;
+
+ mutable OpenThreads::Mutex m_mutex;
+ };
+ ImageScrollWidget(QWidget* parent=0);
+ virtual ~ImageScrollWidget();
+ void setJobQueue(ossimJobQueue* jobQueue);
+ void refreshDisplay();
+ ossimIpt getViewportSize();
+ void inputConnected(ossim_int32 idx = -1);
+ void inputDisconnected(ossim_int32 idx = -1);
+ Layers* layers(){return m_layers.get();}
+ ImageWidget* imageWidget(){return m_widget;}
+ const ImageWidget* imageWidget()const{return m_widget;}
+ const ossimDrect& inputBounds()const{return m_inputBounds;}
+ const ossimDpt& scrollOrigin()const{return m_scrollOrigin;}
+ ossimDrect viewportBoundsInViewSpace()const;
+ // ossimDrect viewportBoundsInLocalSpace()const;
+ void setPositionGivenView(const ossimDpt& position);
+ void setPositionGivenLocal(const ossimDpt& position);
+ void setTrackPoint(const ossimDpt& viewPoint);
+
+
+ const QTransform& viewToScroll()const{return m_viewToScroll;}
+ const QTransform& scrollToView()const{return m_scrollToView;}
+ const QTransform& localToView()const{return m_localToView;}
+ const QTransform& viewToLocal()const{return m_viewToLocal;}
+
+ ossimImageGeometry* getGeometry();
+
+ void setConnectableObject(ConnectableImageObject* c);
+ ConnectableImageObject* connectableObject();
+
+ void setMultiLayerAlgorithm(int algorithm){m_multiLayerAlgorithm = static_cast<MultiLayerAlgorithmType> (algorithm);}
+ ossim_int32 multiLayerAlgorithmType()const{return m_multiLayerAlgorithm;}
+
+ // Temporay multi-image development
+ const ossimDpt& measPnt()const{return m_measPoint;}
+ void updateAnnotation();
+ void setMarkPointPosition(const ossimDpt& setViewPoint, const ossimDpt& setImagePoint);
+ void storeCurrentPosition(const ossimString& id);
+ bool getPoint(const ossimString& id, ossimDpt& imgPt);
+ // Temporay multi-image development
+
+ signals:
+ void wheel(QWheelEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+ void mouseMove(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+ void mousePress(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+ void mouseRelease(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+ void mouseDoubleClick(QMouseEvent* event, const ossimDrect& viewportRectInViewSpace, const ossimDpt& viewPoint);
+
+ protected:
+
+
+ class ConnectionListener : public ossimConnectableObjectListener
+ {
+ public:
+ ConnectionListener(ImageScrollWidget* widget=0)
+ :m_widget(widget)
+ {
+ }
+ virtual void objectDestructingEvent(ossimObjectDestructingEvent& /*event*/)
+ {
+ }
+ virtual void disconnectInputEvent(ossimConnectionEvent& /* event */)
+ {
+ if(m_widget)
+ {
+ m_widget->inputDisconnected();
+ }
+
+ }
+ virtual void disconnectOutputEvent(ossimConnectionEvent& /* event */)
+ {
+ }
+ virtual void connectInputEvent(ossimConnectionEvent& /* event */)
+ {
+ if(m_widget)
+ {
+ m_widget->inputConnected();
+ }
+ }
+ virtual void connectOutputEvent(ossimConnectionEvent& /* event */)
+ {
+ }
+
+ virtual void propertyEvent(ossimPropertyEvent& /* event */)
+ {
+ m_widget->refreshDisplay();
+ }
+
+ /*!
+ * Typically isued by objects that contain children. If anyone is
+ * interested, can latch on to this event. Other objects within the
+ * system might be interest in this event even
+ */
+ virtual void addObjectEvent(ossimContainerEvent& /* event */)
+ {}
+
+ virtual void removeObjectEvent(ossimContainerEvent& /* event */)
+ {}
+
+ virtual void refreshEvent(ossimRefreshEvent& event)
+ {
+ int refreshType = event.getRefreshType();
+ if((refreshType & ossimRefreshEvent::REFRESH_PIXELS)||
+ (refreshType & ossimRefreshEvent::REFRESH_GEOMETRY))
+ {
+ m_widget->refreshDisplay();
+ }
+ if(refreshType & ossimRefreshEvent::REFRESH_POSITION)
+ {
+ m_widget->setPositionGivenView(event.getPosition());
+ }
+ }
+ ImageScrollWidget* m_widget;
+ };
+
+ protected:
+ class Callback : public ossimJobCallback
+ {
+ public:
+ Callback(ImageScrollWidget* w):m_imageScrollWidget(w){}
+ virtual void started(ossimJob* job)
+ {
+ ImageWidgetJob* imageWidgetJob = dynamic_cast<ImageWidgetJob*>(job);
+ if(imageWidgetJob)
+ {
+ ossimRefPtr<Layer> layer = m_imageScrollWidget->m_layers->findFirstDirtyLayer();
+ if(layer.valid())
+ {
+ imageWidgetJob->setTileCache(layer->tileCache());
+ imageWidgetJob->setInputSource(layer->chain());
+ }
+ imageWidgetJob->setCacheToViewTransform(m_imageScrollWidget->scrollToView());
+ imageWidgetJob->setViewToCacheTransform(m_imageScrollWidget->viewToScroll());
+ }
+ }
+ virtual void finished(ossimJob* job)
+ {
+ ImageWidgetJob* imageWidgetJob = dynamic_cast<ImageWidgetJob*>(job);
+ if(imageWidgetJob)
+ {
+ m_imageScrollWidget->m_widget->update();
+ if(m_imageScrollWidget)
+ {
+ ossimRefPtr<Layer> layer = m_imageScrollWidget->m_layers->findFirstDirtyLayer();
+ if(layer.valid())
+ {
+ imageWidgetJob->ready();
+ m_imageScrollWidget->m_jobQueue->add(job);
+ }
+ }
+ }
+ }
+
+ ImageScrollWidget* m_imageScrollWidget;
+ };
+ friend class Callback;
+ //virtual void timerEvent(QTimerEvent* event);
+ virtual void resizeEvent(QResizeEvent* event);
+ virtual void scrollContentsBy ( int dx, int dy );
+ void updateScrollBars();
+ void setCacheRect();
+ virtual void mouseDoubleClickEvent ( QMouseEvent * e );
+ virtual void mouseMoveEvent ( QMouseEvent * e );
+ virtual void mousePressEvent ( QMouseEvent * e );
+ virtual void mouseReleaseEvent ( QMouseEvent * e );
+ virtual void wheelEvent ( QWheelEvent * e );
+ virtual void enterEvent ( QEvent * event );
+ virtual void leaveEvent ( QEvent * event );
+ virtual void paintWidget(QPainter& painter);
+ virtual void drawCursor(QPainter& painter);
+ virtual void paintMultiLayer(QPainter& painter);
+ virtual void updateTransforms();
+ mutable ossimRefPtr<ConnectableImageObject> m_connectableObject;
+
+ ConnectionListener* m_listener;
+ ossimDrect m_inputBounds;
+ ossimDpt m_scrollOrigin;
+ ImageWidget* m_widget;
+ ossimIpt m_tileSize;
+ ossim_int32 m_timerId;
+ ossimRefPtr<ossimJobQueue> m_jobQueue;
+ ossimRefPtr<ImageWidgetJob> m_imageWidgetJob;
+
+ ossimRefPtr<Layers> m_layers;
+
+ // ossimGui::RegistrationOverlay* m_regOverlay;
+
+ ossimDpt m_trackPoint;
+ ossimDpt m_oldTrackPoint;
+ bool m_trackingFlag;
+ bool m_mouseInsideFlag;
+
+ QPoint m_activePointStart;
+ QPoint m_activePointEnd;
+
+ MultiLayerAlgorithmType m_multiLayerAlgorithm;
+ ossim_int32 m_activeIndex;
+ QTransform m_viewToScroll;
+ QTransform m_scrollToView;
+ QTransform m_scrollToLocal;
+ QTransform m_localToScroll;
+
+ QTransform m_viewToLocal;
+ QTransform m_localToView;
+
+ ossimDpt m_measPoint;
+ ossimDpt m_measImgPoint;
+ ossimDpt m_markPoint;
+ ossimDpt m_markImgPoint;
+ bool m_drawPts;
+
+ // QGraphicsScene* m_scene;
+ // QGraphicsView* m_view;
+ };
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/ImageWriterJob.h b/ossimGui/include/ossimGui/ImageWriterJob.h
new file mode 100644
index 0000000..062b9cf
--- /dev/null
+++ b/ossimGui/include/ossimGui/ImageWriterJob.h
@@ -0,0 +1,27 @@
+#ifndef ossimGuiImageWriterJob_HEADER
+#define ossimGuiImageWriterJob_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/ProcessInterfaceJob.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <OpenThreads/Mutex>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL ImageWriterJob : public ProcessInterfaceJob
+ {
+ public:
+ ImageWriterJob(const ossimKeywordlist& kwl)
+ :ProcessInterfaceJob(),m_kwl(kwl)
+ {
+ m_processInterface = 0;
+ }
+
+ virtual void start();
+
+ protected:
+ ossimKeywordlist m_kwl;
+ ossimRefPtr<ossimObject> m_containerObj;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/IvtGeomTransform.h b/ossimGui/include/ossimGui/IvtGeomTransform.h
new file mode 100644
index 0000000..303c6ea
--- /dev/null
+++ b/ossimGui/include/ossimGui/IvtGeomTransform.h
@@ -0,0 +1,40 @@
+#ifndef ossimGuiIvtGeomTransform_HEADER
+#define ossimGuiIvtGeomTransform_HEADER
+#include <ossim/base/ossimReferenced.h>
+#include <ossim/base/ossimIpt.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimGpt.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <ossim/projection/ossimImageViewAffineTransform.h>
+#include <ossimGui/Export.h>
+
+namespace ossimGui{
+
+ class OSSIMGUI_DLL IvtGeomTransform : public ossimReferenced
+ {
+ public:
+ IvtGeomTransform(ossimImageViewTransform* trans,
+ ossimImageGeometry* geom)
+ :m_ivt(trans),
+ m_geom(geom){
+
+ }
+
+ void viewToImage(const ossimDpt& viewPt, ossimDpt& ipt);
+ void imageToView(const ossimDpt& ipt, ossimDpt& viewPt);
+ void imageToGround(const ossimDpt& ipt, ossimGpt& gpt);
+ void groundToImage(const ossimGpt& gpt, ossimDpt& ipt);
+ void viewToGround(const ossimDpt& viewPt, ossimGpt& gpt);
+ void groundToView(const ossimGpt& gpt, ossimDpt& viewPt);
+ ossimImageViewTransform* getIvt(){return m_ivt.get();}
+ const ossimImageViewTransform* getIvt()const {return m_ivt.get();}
+ ossimImageGeometry* getGeom(){return m_geom.get();}
+ const ossimImageGeometry* getGeom()const{return m_geom.get();}
+
+ protected:
+ ossimRefPtr<ossimImageViewTransform> m_ivt;
+ ossimRefPtr<ossimImageGeometry> m_geom;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/MainWindow.h b/ossimGui/include/ossimGui/MainWindow.h
new file mode 100644
index 0000000..7e84dba
--- /dev/null
+++ b/ossimGui/include/ossimGui/MainWindow.h
@@ -0,0 +1,64 @@
+#ifndef ossimGuiMainWindow_HEADER
+#define ossimGuiMainWindow_HEADER
+#include <ossimGui/ui_MainWindow.h>
+#include <QtGui/QMainWindow>
+#include <QtGui/QDropEvent>
+#include <QtGui/QDragEnterEvent>
+#include <ossimGui/Export.h>
+#include <ossimGui/DataManager.h>
+#include <ossim/parallel/ossimJobMultiThreadQueue.h>
+#include <ossimGui/DisplayTimerJobQueue.h>
+
+class QMdiArea;
+namespace ossimGui
+{
+ class ImageScrollWidget;
+ class ImageMdiSubWindow;
+ class OSSIMGUI_DLL MainWindow : public QMainWindow, public Ui::ossimGuiMainWindow
+ {
+ Q_OBJECT
+ public:
+ MainWindow(QWidget* parent=0);
+
+ /**
+ * This method will create and set a default menu bar. This will destroy the
+ * old menu bar and allocate a new one and set the new menu bar for the main window
+ *
+ */
+ QMenuBar* createAndSetMenuBar();
+ virtual void dropEvent ( QDropEvent * event );
+ virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual bool event ( QEvent * e );
+ virtual void showNode(DataManager::Node* node);
+
+ virtual bool loadProjectFile(const ossimString& projFile);
+ virtual bool loadImageFileList(std::vector<ossimString>& ilist);
+
+ public slots:
+ void saveProject(bool checked = false);
+ void saveProjectAs(bool checked = false);
+ void openProject(bool checked = false);
+ void openImage( bool checked = false );
+ void openJpip( bool checked = false );
+ void cascadeWindows( bool checked = false );
+ void tileWindows( bool checked= false );
+ void tabWindows(bool checked=false);
+ void closeAllWindows( bool checked=false );
+ void exploitationModeChanged(int index);
+ void resetExploitationMode();
+
+ void about(bool checked=false);
+ protected:
+ ImageMdiSubWindow* createImageWindow();
+ //QMdiArea *mdiArea;
+ ossimRefPtr<ossimJobMultiThreadQueue> m_stagerQueue;
+ ossimRefPtr<ossimGui::DisplayTimerJobQueue> m_displayQueue;
+
+ ossimRefPtr<DataManager> m_dataManager;
+
+ QComboBox* m_exploitationOptions;
+ void createModeSelector(QToolBar* bar);
+
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/MarkPoint.h b/ossimGui/include/ossimGui/MarkPoint.h
new file mode 100644
index 0000000..6d9cd14
--- /dev/null
+++ b/ossimGui/include/ossimGui/MarkPoint.h
@@ -0,0 +1,46 @@
+#ifndef ossimGuiMarkPoint_HEADER
+#define ossimGuiMarkPoint_HEADER
+
+#include <QtGui/QWidget>
+#include <QtGui/QGraphicsItem>
+#include <QtGui/QGraphicsTextItem>
+#include <QtGui/QGraphicsLineItem>
+#include <QtGui/QGraphicsRectItem>
+#include <QtGui/QPen>
+#include <ossimGui/Export.h>
+#include <ossimGui/AnnotationItem.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+
+
+namespace ossimGui {
+
+ class OSSIMGUI_DLL MarkPoint : public AnnotationItem
+ {
+
+ public:
+ MarkPoint(const ossimDpt& scenePos,
+ const ossimDpt& imgPos,
+ const ossimString& overlayId,
+ const ossimString& id = "");
+ virtual ossimDpt getImgPos()const {return m_imgPos;}
+
+ protected:
+ virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+
+ QRectF m_rect;
+ QLineF m_ver;
+ QLineF m_hor;
+ qreal m_len;
+ QPen m_pen;
+ QPen m_savedPen;
+
+ ossimDpt m_imgPos;
+ };
+
+}
+
+#endif // ossimMarkPoint_HEADER
diff --git a/ossimGui/include/ossimGui/MdiSubWindowBase.h b/ossimGui/include/ossimGui/MdiSubWindowBase.h
new file mode 100644
index 0000000..c63b576
--- /dev/null
+++ b/ossimGui/include/ossimGui/MdiSubWindowBase.h
@@ -0,0 +1,33 @@
+#ifndef ossimGuiMdiSubWindowBase_HEADER
+#define ossimGuiMdiSubWindowBase_HEADER
+#include <ossimGui/Export.h>
+#include <ossimGui/View.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <QtGui/QMdiSubWindow>
+#include <ossim/base/ossimGpt.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/parallel/ossimJobQueue.h>
+
+class QMainWindow;
+namespace ossimGui{
+
+ class OSSIMGUI_DLL MdiSubWindowBase : public QMdiSubWindow
+ {
+ public:
+ MdiSubWindowBase( QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ virtual ~MdiSubWindowBase();
+ QMainWindow* mainWindow();
+
+ virtual void sync(View& /* viewInfo */){}
+ virtual void setJobQueue(ossimJobQueue* /* q */){}
+ virtual ConnectableObject* connectableObject(){return m_connectableObject.get();}
+ virtual const ConnectableObject* connectableObject()const{return m_connectableObject.get();}
+ virtual void setConnectableObject(ConnectableObject* connectable);
+
+ protected:
+ ossimRefPtr<ConnectableObject> m_connectableObject;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/MetricOverlay.h b/ossimGui/include/ossimGui/MetricOverlay.h
new file mode 100644
index 0000000..8d4835d
--- /dev/null
+++ b/ossimGui/include/ossimGui/MetricOverlay.h
@@ -0,0 +1,53 @@
+#ifndef ossimGuiMetricOverlay_HEADER
+#define ossimGuiMetricOverlay_HEADER
+
+#include <ossimGui/OverlayBase.h>
+#include <ossimGui/Export.h>
+#include <ossimGui/MarkPoint.h>
+#include <ossim/base/ossimObject.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+#include <ossim/base/ossimDpt.h>
+#include <map>
+
+
+namespace ossimGui {
+
+ class IvtGeomTransform;
+
+ class OSSIMGUI_DLL MetricOverlay : public OverlayBase
+ {
+ Q_OBJECT
+
+ public:
+ MetricOverlay(const ossimString& overlayId, QGraphicsScene* scene);
+ virtual void reset();
+
+ virtual void addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id);
+ virtual void addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt);
+ virtual void removePoint(const ossimString& id);
+ virtual void togglePointActive(const ossimString& id);
+
+ virtual bool getImgPoint(const ossimString& id, ossimDpt& imgPt, bool& isActive);
+ virtual ossimGui::MarkPoint* getMarkPoint(const ossimString& id);
+ virtual ossimString getCurrentId()const {return m_currentId;}
+ virtual ossim_uint32 getNumPoints()const;
+
+ virtual void setVisible(const bool& visible);
+ virtual void setCurrentId(const ossimString& id) {m_currentId = id;}
+ virtual void setView(ossimRefPtr<IvtGeomTransform> ivtg);
+
+ signals:
+ void pointActivated(const ossimString&);
+ void pointDeactivated(const ossimString&);
+ void pointRemoved(const ossimString&);
+
+ protected:
+ ossimString m_currentId;
+
+ };
+
+}
+
+#endif // ossimGuiMetricOverlay_HEADER
diff --git a/ossimGui/include/ossimGui/MultiImageDialog.h b/ossimGui/include/ossimGui/MultiImageDialog.h
new file mode 100644
index 0000000..bc91010
--- /dev/null
+++ b/ossimGui/include/ossimGui/MultiImageDialog.h
@@ -0,0 +1,88 @@
+#ifndef ossimGuiMultiImageDialog_HEADER
+#define ossimGuiMultiImageDialog_HEADER
+#include <ossimGui/DataManager.h>
+#include <ossimGui/Export.h>
+#include <ossimGui/ui_MultiImageDialog.h>
+#include <QtGui/QDialog>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimProcessListener.h>
+
+namespace ossimGui
+{
+ class RegistrationOverlay;
+ class MetricOverlay;
+ class RegPoint;
+
+ class OSSIMGUI_DLL MultiImageDialog : public QDialog, public Ui::MultiImageDialog
+ {
+ Q_OBJECT
+
+ public:
+ MultiImageDialog(QWidget* widget);
+ void initDialog();
+ void initContent(DataManager::NodeListType& nodeList, const bool& amDialogAvailable);
+
+ void setImgList(const vector<ossimString>& ilist, const vector<ossimString>& tlist);
+ void setPtTable(const int& nPts);
+ ossimString getCurrentId()const {return ossimString::toString(m_currentIdCounter);}
+ ossim_uint32 getNumObs()const {return m_pointTable->columnCount();}
+ ossimString getIdByIndex(const ossim_uint32& index);
+ bool isActive()const {return m_isActive;}
+ void setMode(const int& expMode);
+ void updateCurrentIdField();
+
+ public slots:
+ void resetContent();
+ void setImagePointActive(const ossimString&);
+ void setImagePointInactive(const ossimString&);
+ void setImagePointRemoved(const ossimString&);
+ void setPointPositionContent(const ossimString&);
+ void setRegistrationReportContent(const ossimString&);
+
+ // Button click slots
+ void autoMeas();
+ void addObsPoint();
+ void registerImages();
+ void dropPoint();
+ void clearPoint();
+ void acceptReg();
+ void resetReg();
+
+ // Point table slots
+ void setPointCellClicked(int, int);
+ void setPointRowClicked(int);
+ void setPointColClicked(int);
+ void displayPointTableContextMenuRow(QPoint);
+ void displayPointTableContextMenuCol(QPoint);
+
+ // Image table slots
+ void displayImageTableContextMenu(QPoint);
+
+ void displayClosing(QObject* obj);
+
+ signals:
+ void registrationExecuted(DataManager::NodeListType&);
+ void pointDropExecuted(DataManager::NodeListType&);
+ void autoMeasInitiated(DataManager::NodeListType&);
+ void syncExecuted(ossimGui::RegPoint*, ossimRefPtr<DataManager::Node>);
+ void resetModeExecuted(DataManager::NodeListType&);
+ void clearPointExecuted(DataManager::NodeListType&);
+ void acceptRegExecuted(DataManager::NodeListType&);
+ void resetRegExecuted(DataManager::NodeListType&);
+
+ protected:
+ bool m_isActive;
+ std::vector<ossimGui::RegistrationOverlay*> m_overlaysReg;
+ std::vector<ossimGui::MetricOverlay*> m_overlaysMet;
+ DataManager::NodeListType m_nodeList;
+ DataManager::ExploitationModeType m_exploitationMode;
+
+ bool getRowColMeasPoint(const ossimString& id,
+ ossimGui::RegistrationOverlay* ov,
+ ossim_uint32& row,
+ ossim_uint32& col);
+
+ ossim_uint32 m_currentIdCounter;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/OpenImageDialog.h b/ossimGui/include/ossimGui/OpenImageDialog.h
new file mode 100644
index 0000000..87bc30c
--- /dev/null
+++ b/ossimGui/include/ossimGui/OpenImageDialog.h
@@ -0,0 +1,71 @@
+//----------------------------------------------------------------------------
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Author: David Burken
+//
+// Description: Open image dialog for handling multiple entry images.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimGuiOpenImageDialog_HEADER
+#define ossimGuiOpenImageDialog_HEADER 1
+
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossimGui/Common.h>
+#include <ossimGui/Export.h>
+#include <QDialog>
+
+// Forward class declarations:
+class QButtonGroup;
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL OpenImageDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+
+ /** @brief default constructor */
+ OpenImageDialog( ossimImageHandler* ih,
+ QWidget* parent=0,
+ Qt::WFlags f = 0 );
+
+ /**
+ * @brief Adds selected handlers to the list.
+ *
+ * This does not clear or resize "handlers" if no entries are selected.
+ *
+ * @param handlers Initialized by this.
+ */
+ void handlerList(ossimGui::HandlerList& handlers);
+
+ public slots:
+
+ /**
+ * @brief Connected to "cancel" button.
+ * Override QDialog::reject to uncheck all entries on cancel.
+ */
+ void reject();
+
+ /**
+ * @brief Connected to "all" check box.
+ */
+ void allStateChanged( int state );
+
+ private:
+
+ // Hold group of check boxes. One for each entry.
+ QButtonGroup* m_entryButtonGroup;
+
+ // Holds pointer to open image handler.
+ ossimRefPtr<ossimImageHandler> m_ih;
+ };
+}
+
+#endif /* #ifndef ossimGuiOpenImageDialog_HEADER */
+
diff --git a/ossimGui/include/ossimGui/OpenImageUrlJob.h b/ossimGui/include/ossimGui/OpenImageUrlJob.h
new file mode 100644
index 0000000..0070e0a
--- /dev/null
+++ b/ossimGui/include/ossimGui/OpenImageUrlJob.h
@@ -0,0 +1,34 @@
+#ifndef ossimGuiOpenImageUrlJob_HEADER
+#define ossimGuiOpenImageUrlJob_HEADER
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/parallel/ossimJob.h>
+#include <ossimGui/Common.h>
+#include <ossimGui/Export.h>
+#include <QtCore/QUrl>
+namespace ossimGui
+{
+ class OSSIMGUI_DLL OpenImageUrlJob : public ossimJob
+ {
+ public:
+
+ OpenImageUrlJob(const OpenImageUrlJob& src):m_url(src.m_url), m_handlers(src.m_handlers){}
+ OpenImageUrlJob(const QUrl& url)
+ :m_url(url)
+ {
+ }
+ virtual void start();
+ ossimGui::HandlerList& handlerList()
+ {
+ return m_handlers;
+ }
+ const ossimGui::HandlerList& handlerList()const
+ {
+ return m_handlers;
+ }
+ protected:
+ QUrl m_url;
+ ossimGui::HandlerList m_handlers;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/OssimObjectFactory.h b/ossimGui/include/ossimGui/OssimObjectFactory.h
new file mode 100644
index 0000000..d3347ab
--- /dev/null
+++ b/ossimGui/include/ossimGui/OssimObjectFactory.h
@@ -0,0 +1,37 @@
+#ifndef ossimGuiOssimObjectFactory_HEADER
+#define ossimGuiOssimObjectFactory_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimObjectFactory.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL OssimObjectFactory : public ossimObjectFactory
+ {
+ public:
+ static OssimObjectFactory* instance();
+
+ /*!
+ * Creates an object given a type name.
+ */
+ virtual ossimObject* createObject(const ossimString& typeName)const;
+
+ /*!
+ * Creates and object given a keyword list.
+ */
+ virtual ossimObject* createObject(const ossimKeywordlist& kwl,
+ const char* prefix=0)const;
+
+ /*!
+ * This should return the type name of all objects in all factories.
+ * This is the name used to construct the objects dynamially and this
+ * name must be unique.
+ */
+ virtual void getTypeNameList(std::vector<ossimString>& typeList)const;
+
+ protected:
+ OssimObjectFactory();
+ static OssimObjectFactory* m_instance;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/OverlayBase.h b/ossimGui/include/ossimGui/OverlayBase.h
new file mode 100644
index 0000000..bfad2e7
--- /dev/null
+++ b/ossimGui/include/ossimGui/OverlayBase.h
@@ -0,0 +1,33 @@
+#ifndef ossimGuiOverlayBase_HEADER
+#define ossimGuiOverlayBase_HEADER
+
+#include <QtGui/QWidget>
+#include <QtGui/QGraphicsItem>
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimObject.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimDpt.h>
+
+class QGraphicsScene;
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL OverlayBase : public QObject
+ {
+ Q_OBJECT
+
+ public:
+ OverlayBase(const ossimString& overlayId, QGraphicsScene* scene);
+ virtual bool isActive()const {return m_isActive;}
+ virtual void setActive(const bool& active) {m_isActive = active;}
+ virtual QGraphicsItem* getItem(const ossimString& id);
+
+ protected:
+ QGraphicsScene* m_scene;
+ bool m_isActive;
+ ossimString m_overlayId;
+
+ };
+}
+
+#endif // ossimGuiOverlayBase_HEADER
diff --git a/ossimGui/include/ossimGui/PlanetMdiSubWindow.h b/ossimGui/include/ossimGui/PlanetMdiSubWindow.h
new file mode 100644
index 0000000..edc9a7d
--- /dev/null
+++ b/ossimGui/include/ossimGui/PlanetMdiSubWindow.h
@@ -0,0 +1,78 @@
+#ifndef ossimGuiPlanetMdiSubWindow_HEADER
+#define ossimGuiPlanetMdiSubWindow_HEADER
+#include <ossimGui/MdiSubWindowBase.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimConnectableObjectListener.h>
+#include <ossim/base/ossimVisitor.h>
+#include <QtGui/QMouseEvent>
+#include <ossimGui/GlWidget.h>
+#include <ossimPlanet/ossimPlanetViewMatrixBuilder.h>
+#include <ossimPlanet/ossimPlanetTextureLayerGroup.h>
+#include <osg/ref_ptr>
+#include <ossim/base/ossimViewInterface.h>
+
+
+
+class QMenu;
+class QToolBar;
+class QMenuBar;
+class QMainWindow;
+class ossimConnectableObject;
+namespace ossimGui {
+ class ImageScrollWidget;
+
+ class OSSIMGUI_DLL PlanetMdiSubWindow : public MdiSubWindowBase
+ {
+ Q_OBJECT
+ public:
+ typedef std::map<ossimRefPtr<ossimObject>, osg::ref_ptr<ossimPlanetTextureLayer> > ChainToTextureType;
+ PlanetMdiSubWindow( QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ virtual ~PlanetMdiSubWindow();
+
+ ossimGui::ImageScrollWidget* scrollWidget();
+ virtual void sync(View& syncInfo);
+ virtual void setConnectableObject(ConnectableObject* connectable);
+ virtual void setPlanet(ossimPlanet* planet){m_planet = planet;}
+
+ public slots:
+ void stateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
+ void syncView(View& view);
+
+ protected:
+ class OSSIMGUI_DLL InputListener : public ossimConnectableObjectListener
+ {
+ public:
+ InputListener(PlanetMdiSubWindow* w)
+ :m_window(w)
+ {
+ }
+ PlanetMdiSubWindow* window(){return m_window;}
+ void setWindow(PlanetMdiSubWindow* w){m_window = w;}
+ virtual void disconnectInputEvent(ossimConnectionEvent& /* event */);
+ virtual void connectInputEvent(ossimConnectionEvent& /* event */);
+
+ protected:
+ PlanetMdiSubWindow* m_window;
+ };
+ friend class ConnectionListener;
+
+ // for now we will overide the standard close and make sure we only hide
+ // by doing the default accept.
+ //
+ void closeEvent ( QCloseEvent * event );
+
+ virtual bool event(QEvent* evt);
+
+ GlViewer* m_planetViewer;
+ osg::ref_ptr<ossimPlanet> m_planet;
+ osg::ref_ptr<ossimPlanetManipulator> m_manipulator;
+ osg::ref_ptr<ossimPlanetTextureLayerGroup> m_textureLayers;
+ ChainToTextureType m_chainToTextureMap;
+
+ InputListener* m_inputListener;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/PolygonRemapperDialog.h b/ossimGui/include/ossimGui/PolygonRemapperDialog.h
new file mode 100644
index 0000000..0596349
--- /dev/null
+++ b/ossimGui/include/ossimGui/PolygonRemapperDialog.h
@@ -0,0 +1,78 @@
+//----------------------------------------------------------------------------
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for simple text data, e.g. position information.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimGuiPolygonRemapperDialog_HEADER
+#define ossimGuiPolygonRemapperDialog_HEADER 1
+
+#include <ossim/base/ossimGpt.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/imaging/ossimGeoPolyCutter.h>
+
+#include <QDialog>
+class ossimDpt;
+class ossimDrect;
+class ossimGeoPolyCutter;
+class QMouseEvent;
+class QString;
+class QTextEdit;
+class QCheckBox;
+class QLineEdit;
+class QLabel;
+
+namespace ossimGui
+{
+ class ImageScrollView;
+
+ class PolygonRemapperDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+
+ /** @brief default constructor */
+ PolygonRemapperDialog( QWidget* parent=0, Qt::WFlags f = 0 );
+
+ void setWidget( ossimGui::ImageScrollView* widget );
+ void setPolyCutter( ossimGeoPolyCutter* polygon );
+
+ enum Mode
+ {
+ UNKNOWN,
+ ACCEPTING_POINTS
+ };
+
+ public slots:
+
+ void track( const ossimDpt& scenePt );
+ void mousePress(QMouseEvent* e, const ossimDpt& scenePoint);
+ void getPolyPoint();
+ void toggleEnableDisable();
+ void toggleCutType();
+ void setFillType();
+
+ protected:
+
+ private:
+ void fireRefreshEvent();
+ void sceneToImage( const ossimDpt& scenePt, ossimDpt& imagePt ) const;
+
+ QTextEdit* m_textEdit;
+ ossimGui::ImageScrollView* m_widget;
+ ossimRefPtr<ossimGeoPolyCutter> m_polyCutter;
+ QPushButton* m_addPolygonBt;
+ QCheckBox* m_enableDisableCb;
+ QCheckBox* m_toggleCutTypeCb;
+ QLineEdit* m_fillValueLe;
+ QPushButton* m_setfillBt;
+ std::vector<ossimGpt> m_polygon;
+ Mode m_mode;
+ };
+}
+
+#endif /* #ifndef ossimGuiPolygonRemapperDialog_HEADER */
diff --git a/ossimGui/include/ossimGui/PositionInformationDialog.h b/ossimGui/include/ossimGui/PositionInformationDialog.h
new file mode 100644
index 0000000..42815f3
--- /dev/null
+++ b/ossimGui/include/ossimGui/PositionInformationDialog.h
@@ -0,0 +1,48 @@
+//----------------------------------------------------------------------------
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for simple text data, e.g. position information.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimGuiPositionInformationDialog_HEADER
+#define ossimGuiPositionInformationDialog_HEADER 1
+
+#include <QDialog>
+
+class ossimDpt;
+class QString;
+class QTextEdit;
+
+namespace ossimGui
+{
+ class ImageScrollView;
+
+ class PositionInformationDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+
+ /** @brief default constructor */
+ PositionInformationDialog( QWidget* parent=0, Qt::WFlags f = 0 );
+
+ void setWidget( ossimGui::ImageScrollView* widget );
+
+ public slots:
+
+ void track( const ossimDpt& scenePt );
+
+ protected:
+
+ QTextEdit* m_textEdit;
+ ossimGui::ImageScrollView* m_widget;
+
+ private:
+ void sceneToImage( const ossimDpt& scenePt, ossimDpt& imagePt ) const;
+ };
+}
+
+#endif /* #ifndef ossimGuiPositionInformationDialog_HEADER */
diff --git a/ossimGui/include/ossimGui/ProcessInterfaceJob.h b/ossimGui/include/ossimGui/ProcessInterfaceJob.h
new file mode 100644
index 0000000..48a3351
--- /dev/null
+++ b/ossimGui/include/ossimGui/ProcessInterfaceJob.h
@@ -0,0 +1,39 @@
+#ifndef ossimGuiProecessInterfaceJob_HEADER
+#define ossimGuiProecessInterfaceJob_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/parallel/ossimJob.h>
+#include <ossim/base/ossimProcessInterface.h>
+#include <ossim/base/ossimProcessListener.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL ProcessInterfaceJob : public ossimJob
+ {
+ public:
+ ProcessInterfaceJob():m_processInterface(0){}
+
+ virtual void setState(int value, bool on=true);
+ virtual void start();
+ ossimObject* object(){return m_obj.get();}
+
+ protected:
+ class ProgressListener : public ossimProcessListener
+ {
+ public:
+ ProgressListener(ossimJob* job):m_job(job){}
+ virtual void processProgressEvent(ossimProcessProgressEvent& event);
+
+ ossimJob* m_job;
+
+ };
+ friend class ProgressListener;
+ void setPercentComplete(double value);
+
+
+ mutable OpenThreads::Mutex m_processInterfaceMutex;
+ ossimRefPtr<ossimObject> m_obj;
+ ossimProcessInterface* m_processInterface;
+ };
+}
+
+#endif
diff --git a/ossimGui/include/ossimGui/ProgressDialog.h b/ossimGui/include/ossimGui/ProgressDialog.h
new file mode 100644
index 0000000..659b4a3
--- /dev/null
+++ b/ossimGui/include/ossimGui/ProgressDialog.h
@@ -0,0 +1,40 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for progress widget.
+//
+//---
+// $Id$
+
+#ifndef ossimGuiProgressDialog_HEADER
+#define ossimGuiProgressDialog_HEADER 1
+
+#include <QDialog>
+
+namespace ossimGui
+{
+ class ProgressWidget;
+
+ class ProgressDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+
+ /** @brief default constructor */
+ ProgressDialog( QWidget* parent=0, Qt::WFlags f = 0 );
+
+ virtual ~ProgressDialog();
+
+ ossimGui::ProgressWidget* progressWidget();
+
+ public slots:
+
+ private:
+
+ ossimGui::ProgressWidget* m_widget;
+ };
+}
+
+#endif /* #ifndef ossimGuiProgressDialog_HEADER */
diff --git a/ossimGui/include/ossimGui/ProgressWidget.h b/ossimGui/include/ossimGui/ProgressWidget.h
new file mode 100644
index 0000000..3ab5f1f
--- /dev/null
+++ b/ossimGui/include/ossimGui/ProgressWidget.h
@@ -0,0 +1,38 @@
+#ifndef ossimGuiProgressWidget_HEADER
+#define ossimGuiProgressWidget_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimProcessProgressEvent.h>
+#include <ossim/base/ossimProcessListener.h>
+#include <ossim/base/ossimRefPtr.h>
+
+#include <QtGui/QProgressBar>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL ProgressWidget : public QProgressBar
+ {
+ Q_OBJECT
+ public:
+ ProgressWidget(QWidget* parent);
+ virtual ~ProgressWidget();
+ virtual void setObject(ossimObject* obj);
+
+ virtual bool event(QEvent * e );
+ protected:
+ class Listener : public ossimProcessListener
+ {
+ public:
+ Listener(ProgressWidget* w):m_widget(w){}
+ virtual void processProgressEvent(ossimProcessProgressEvent& event);
+
+ ProgressWidget* m_widget;
+
+ };
+ void removeListener();
+ void addListener();
+
+ ossimRefPtr<ossimObject> m_object;
+ Listener* m_listener;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/PropertyEditorDialog.h b/ossimGui/include/ossimGui/PropertyEditorDialog.h
new file mode 100644
index 0000000..765669b
--- /dev/null
+++ b/ossimGui/include/ossimGui/PropertyEditorDialog.h
@@ -0,0 +1,42 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for property editor.
+//
+//---
+// $Id$
+
+#ifndef ossimGuiPropertyEditorDialog_HEADER
+#define ossimGuiPropertyEditorDialog_HEADER 1
+
+#include <QDialog>
+
+class ossimObject;
+
+namespace ossimGui
+{
+ class DataManagerPropertyView;
+
+ class PropertyEditorDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+
+ /** @brief default constructor */
+ PropertyEditorDialog( QWidget* parent=0, Qt::WFlags f = 0 );
+
+ void setObject( ossimObject* input );
+
+ public slots:
+
+ protected:
+
+ private:
+
+ ossimGui::DataManagerPropertyView* m_propertyView;
+ };
+}
+
+#endif /* #ifndef ossimGuiPropertyEditorDialog_HEADER */
diff --git a/ossimGui/include/ossimGui/RegPoint.h b/ossimGui/include/ossimGui/RegPoint.h
new file mode 100644
index 0000000..0245d53
--- /dev/null
+++ b/ossimGui/include/ossimGui/RegPoint.h
@@ -0,0 +1,50 @@
+#ifndef ossimGuiRegPoint_HEADER
+#define ossimGuiRegPoint_HEADER
+
+#include <QtGui/QWidget>
+#include <QtGui/QGraphicsItem>
+#include <QtGui/QGraphicsTextItem>
+#include <QtGui/QGraphicsLineItem>
+#include <QtGui/QGraphicsRectItem>
+#include <QtGui/QPen>
+#include <ossimGui/Export.h>
+#include <ossimGui/AnnotationItem.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+
+
+namespace ossimGui {
+
+ class OSSIMGUI_DLL RegPoint : public AnnotationItem
+ {
+
+ public:
+ RegPoint(const ossimDpt& scenePos,
+ const ossimDpt& imgPos,
+ const ossimString& overlayId,
+ const ossimString& id = "");
+ virtual ossimDpt getImgPos()const {return m_imgPos;}
+ virtual bool isControlPoint()const {return m_isControlPoint;}
+
+ virtual void setAsControlPoint(const bool& control) {m_isControlPoint = control;}
+ virtual void setUsable(const bool& active);
+
+ protected:
+ virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+
+ QLineF m_ver;
+ QLineF m_hor;
+ qreal m_len;
+ QPen m_pen;
+ QPen m_savedPen;
+
+ ossimDpt m_imgPos;
+ bool m_isControlPoint;
+ };
+
+}
+
+#endif // ossimGuiRegPoint_HEADER
diff --git a/ossimGui/include/ossimGui/RegistrationOverlay.h b/ossimGui/include/ossimGui/RegistrationOverlay.h
new file mode 100644
index 0000000..1c87854
--- /dev/null
+++ b/ossimGui/include/ossimGui/RegistrationOverlay.h
@@ -0,0 +1,66 @@
+#ifndef ossimGuiRegistrationOverlay_HEADER
+#define ossimGuiRegistrationOverlay_HEADER
+
+// #include <QtGui/QWidget>
+#include <ossimGui/OverlayBase.h>
+#include <ossimGui/Export.h>
+#include <ossimGui/RegPoint.h>
+#include <ossimGui/RoiSelection.h>
+#include <ossim/base/ossimObject.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+#include <ossim/base/ossimDpt.h>
+#include <map>
+
+
+namespace ossimGui {
+
+ class IvtGeomTransform;
+
+ class OSSIMGUI_DLL RegistrationOverlay : public OverlayBase
+ {
+ Q_OBJECT
+
+ public:
+ RegistrationOverlay(const ossimString& overlayId, QGraphicsScene* scene);
+ virtual void reset();
+
+ virtual void addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id);
+ virtual void addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt);
+ virtual void removePoint(const ossimString& id);
+ virtual void togglePointActive(const ossimString& id);
+
+ virtual void addRoi(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimDpt& widHgt, const ossimString& id);
+ virtual void dragRoi(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id);
+ virtual void removeRoi(const ossimString& id);
+ virtual ossimGui::RoiSelection* getRoiSelection(const ossimString& id);
+
+ virtual bool getImgPoint(const ossimString& id, ossimDpt& imgPt, bool& isActive);
+ virtual ossimGui::RegPoint* getRegPoint(const ossimString& id);
+ virtual ossimString getCurrentId()const {return m_currentId;}
+ virtual ossim_uint32 getNumPoints()const;
+ virtual bool isControlImage()const {return m_isControlImage;}
+ virtual bool hasAdjParInterface()const {return m_hasAdjParInterface;}
+
+ virtual void setVisible(const bool& visible);
+ virtual void setAsControl(const bool& controlImage);
+ virtual void setHasAdjParInterface(const bool& hasAdjIface);
+ virtual void setCurrentId(const ossimString& id) {m_currentId = id;}
+ virtual void setView(ossimRefPtr<IvtGeomTransform> ivtg);
+
+ signals:
+ void pointActivated(const ossimString&);
+ void pointDeactivated(const ossimString&);
+ void pointRemoved(const ossimString&);
+
+ protected:
+ ossimString m_currentId;
+ bool m_isControlImage;
+ bool m_hasAdjParInterface;
+
+ };
+
+}
+
+#endif // ossimGuiRegistrationOverlay_HEADER
diff --git a/ossimGui/include/ossimGui/RoiRectAnnotator.h b/ossimGui/include/ossimGui/RoiRectAnnotator.h
new file mode 100644
index 0000000..f156003
--- /dev/null
+++ b/ossimGui/include/ossimGui/RoiRectAnnotator.h
@@ -0,0 +1,148 @@
+//----------------------------------------------------------------------------
+//
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Author: David Burken
+//
+// Description: Region Of Interest (ROI) rectangle annotator object.
+//
+// $Id$
+//----------------------------------------------------------------------------
+#ifndef ossimGuiRoiRectAnnotator_HEADER
+#define ossimGuiRoiRectAnnotator_HEADER 1
+
+#include <ossim/base/ossimListenerManager.h>
+#include <ossim/base/ossimIpt.h>
+#include <QObject>
+#include <QtGui/QColor>
+#include <vector>
+
+class ossimIrect;
+class QMouseEvent;
+class QPainter;
+class QPoint;
+class QRectF;
+
+namespace ossimGui
+{
+ class ImageScrollView;
+
+ class RoiRectAnnotator
+ : public QObject, public ossimListenerManager
+ {
+ Q_OBJECT
+
+ public:
+
+ RoiRectAnnotator();
+ virtual ~RoiRectAnnotator();
+
+ /**
+ * @param widget The widget to paint to.
+ *
+ * @note This will connect the widgets paintYourGraphics
+ * signal to slot paint.
+ */
+ void setImageWidget(ossimGui::ImageScrollView* widget);
+
+ /** Set theEnableFlag to true enabling the paint method. */
+ void enablePaint();
+
+ /** Set theEnableFlag to false short circuiting the paint method. */
+ void disablePaint();
+
+ /**
+ * @param pts The points to draw.
+ *
+ * @note Points should be in QT space.
+ * 0,0 = upper left, x positive right, y positive down.
+ */
+ void setPoints(const std::vector<ossimIpt>& pts);
+
+ /** Clears thePoints. */
+ void clear();
+
+ /**
+ * @param pts Vector of ossimIpts to initialize.
+ *
+ * @note Points are in QT space.
+ * 0,0 = upper left, x positive right, y positive down.
+ */
+ virtual void getPoints(std::vector<ossimIpt>& pts) const;
+
+ /**
+ * Set the roi rectangle.
+ *
+ * @param rect Rectangle to set.
+ *
+ * @note This method takes a rectangle that's in native QImage space.
+ *
+ * */
+ void setRoiRect(const ossimIrect& rect);
+
+ /**
+ * @return the current roi rectangle.
+ *
+ * @note This method returns a rectangle that's in QImage space.
+ */
+ ossimIrect getRoiRect() const;
+
+ public slots:
+
+ void mousePress(QMouseEvent* e);
+ void mouseMove(QMouseEvent* e);
+ void mouseRelease(QMouseEvent* e);
+
+ /**
+ * Slot to hook up to the widget's paintYourGraphics signal.
+ */
+ void paint(QPainter* p, const QRectF& rect);
+
+ private:
+
+ /** Force viewport update. */
+ void refresh();
+
+ /** @brief Copy QPoint to ossimIpt. */
+ void qPtToIpt( const QPoint& qpt, ossimIpt& ipt ) const;
+
+ /**
+ * Called by base class slot paint.
+ */
+ virtual void paintAnnotation(QPainter* p, const QRectF& rect);
+
+ private:
+ /** Hidden from use copy constructor. */
+ RoiRectAnnotator( const ossimGui::RoiRectAnnotator&);
+
+ /** Hidden from use assignment operator. */
+ RoiRectAnnotator& operator=( const ossimGui::RoiRectAnnotator&);
+
+ /** The widget to paint to. */
+ ImageScrollView* m_widget;
+
+ /**
+ * Enables/disables call to paintAnnotation method.
+ * Defaulted to true in constructor.
+ */
+ bool m_enableFlag;
+
+ bool m_roiLeftPressedFlag;
+ bool m_roiMiddlePresedFlag;
+ ossimIpt m_roiPressStart;
+ QColor m_penColor;
+
+ /**
+ * Points which drawing to widget will be based on.
+ *
+ * @note These points are stored non shifted in QT widget space.
+ * 0,0 = upper left, x positive right, y positive down.
+ */
+ std::vector<ossimIpt> m_points;
+ };
+}
+
+#endif /* #ifndef ossimGuiRoiRectAnnotator_HEADER */
+
diff --git a/ossimGui/include/ossimGui/RoiSelection.h b/ossimGui/include/ossimGui/RoiSelection.h
new file mode 100644
index 0000000..635471c
--- /dev/null
+++ b/ossimGui/include/ossimGui/RoiSelection.h
@@ -0,0 +1,51 @@
+#ifndef ossimGuiRoiSelection_HEADER
+#define ossimGuiRoiSelection_HEADER
+
+#include <QtGui/QWidget>
+#include <QtGui/QGraphicsItem>
+#include <QtGui/QGraphicsTextItem>
+#include <QtGui/QGraphicsLineItem>
+#include <QtGui/QGraphicsRectItem>
+#include <QtGui/QPen>
+#include <ossimGui/Export.h>
+#include <ossimGui/AnnotationItem.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimIrect.h>
+#include <ossim/base/ossimString.h>
+
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL RoiSelection : public AnnotationItem
+ {
+
+ public:
+ RoiSelection(const ossimDpt& scenePos,
+ const ossimDpt& imagePos,
+ const ossimDpt& widHgt,
+ const ossimString& overlayId,
+ const ossimString& rid = "");
+ virtual void drag(const ossimDpt& scenePos, const ossimDpt& imagePos);
+ virtual void redefine(ossimDpt* scenePos, ossimDpt* imagePos);
+ virtual ossimIrect getRectImg() const;
+
+ protected:
+ virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+
+ QRectF m_rect;
+ QPen m_pen;
+ QPen m_savedPen;
+
+ // Scene coordinates
+ ossimDpt m_scnPos[2];
+
+ // Image coordinates
+ ossimDpt m_imgPos[2];
+ };
+
+}
+
+#endif // ossimRoiSelection_HEADER
diff --git a/ossimGui/include/ossimGui/SetViewVisitor.h b/ossimGui/include/ossimGui/SetViewVisitor.h
new file mode 100644
index 0000000..c11fd70
--- /dev/null
+++ b/ossimGui/include/ossimGui/SetViewVisitor.h
@@ -0,0 +1,42 @@
+#ifndef ossimGuiSetViewVisitor_HEADER
+#define ossimGuiSetViewVisitor_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimString.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+
+namespace ossimGui
+{
+class OSSIMGUI_DLL SetViewVisitor : public ossimTypeNameVisitor
+{
+public:
+ SetViewVisitor(ossimObject* view,
+ int visitorType =(VISIT_INPUTS|VISIT_CHILDREN))
+ :ossimTypeNameVisitor("ossimViewInterface", false,visitorType),
+ m_obj(view)
+ {
+ m_viewPoint.makeNan();
+ }
+ SetViewVisitor(const SetViewVisitor& src)
+ :ossimTypeNameVisitor(src),
+ m_obj(src.m_obj)
+ {
+ m_viewPoint.makeNan();
+ }
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new SetViewVisitor(*this);}
+
+ void setView();
+ void setGeometry(ossimImageGeometry* obj){m_obj = obj;}
+ void setViewPoint(const ossimDpt& pt){m_viewPoint = pt;}
+ void setResamplerType(const ossimString& value){m_resamplerType = value;}
+protected:
+ ossimDpt m_viewPoint;
+ ossimRefPtr<ossimObject> m_obj;
+ ossimString m_resamplerType;
+};
+
+}
+
+
+#endif
diff --git a/ossimGui/include/ossimGui/StaticTileImageCache.h b/ossimGui/include/ossimGui/StaticTileImageCache.h
new file mode 100644
index 0000000..dfa5c47
--- /dev/null
+++ b/ossimGui/include/ossimGui/StaticTileImageCache.h
@@ -0,0 +1,134 @@
+//*******************************************************************
+// Author: Garrett Potts (gpotts at imagelinks.com)
+//*************************************************************************
+// $Id$
+#ifndef ossimGuiStaticTileImageCache_HEADER
+#define ossimGuiStaticTileImageCache_HEADER
+#include <QtGui/QImage>
+#include <vector>
+#include <ossim/base/ossimReferenced.h>
+#include <ossim/base/ossimIpt.h>
+#include <ossim/base/ossimIrect.h>
+#include <ossimGui/Export.h>
+#include <OpenThreads/Mutex>
+namespace ossimGui
+{
+ class OSSIMGUI_DLL StaticTileImageCache :public ossimReferenced
+ {
+ public:
+ StaticTileImageCache(const ossimIpt& tileSize=ossimIpt(0,0));
+ virtual ~StaticTileImageCache();
+
+ QImage& getCache();
+ const QImage& getCache()const;
+ const ossimIrect& getRect()const;
+ const ossimIrect& getActualRect()const;
+
+ /*!
+ * Will invalidate the entire cache and set the image cache to blank
+ */
+ void flush();
+
+ /*!
+ * Will determine the til that is associated with the pt
+ * and will invalidate that tile and blank out that portion of the image
+ */
+ void flush(const ossimIpt& pt);
+
+ /*!
+ * Will invalidate all tiles that fall within the defined rect
+ */
+ void flush(const ossimIrect& rect);
+
+ /*!
+ * This will do a non destructive resize or translate
+ * of the cache.
+ */
+ void setRect(const ossimIrect& newRect);
+
+ /*!
+ * Will return true or false if the tile rectangle underneath
+ * the passed in point is valid.
+ */
+ bool isValid(const ossimIpt& pt)const;
+
+ /*!
+ * Will return true or false if the tile rectangle underneath
+ * the passed in point is valid.
+ */
+ ossim_int32 getTileIndex(const ossimIpt& origin)const;
+ ossim_int32 getTileIndex(ossim_int32 x,
+ ossim_int32 y)const;
+ /*!
+ * will return the tile rectangle at the point.
+ */
+ ossimIrect getTileRect(const ossimIpt& pt)const;
+
+ /*!
+ * Given the passed in point it will resize QImage and copy the tile.
+ * Note the image object will have its offset X, Y set to be the upper left
+ * coordinate of the tile being copied.
+ */
+ bool getTile(const ossimIpt& pt,
+ QImage& image)const;
+
+ ossimIpt getTileOrigin(const ossimIpt& pt)const;
+ /*!
+ * Will use the offset method of the passed in image and
+ * copy a sub rect of the cache out. Note: This will not resize
+ * the image. It keeps it the same size as the passed in image.
+ */
+ void getSubImage(QImage& image)const;
+
+ /*!
+ * sets the new tile size. The current implementation
+ * will invalidate the entire cache.
+ */
+ void setTileSize(const ossimIpt& tileSize);
+
+ /*!
+ * Returns the current tile size used in the cache.
+ */
+ const ossimIpt& getTileSize()const;
+
+ /*!
+ * The passed in image can cover several tiles but this image object
+ * must be on a tile boundary in order for it to succeed.
+ */
+ bool addTile(const QImage& image);
+
+ /*!
+ * Will use the clip rect to paint the tiles. If one is not defined it will
+ * check to see if there is a viewport rect and paint that rect.
+ */
+ void paintTiles(QPainter* p);
+
+ static ossim_int32 computeTileId(const ossimIpt& origin,
+ const ossimIrect& tileBounderyRect,
+ const ossimIpt& tileSize);
+
+ bool nextInvalidTile(ossimIrect& rect)const;
+ bool hasInvalidTiles()const;
+
+ protected:
+ QImage* m_cache;
+ ossimIrect m_cacheRect;
+ ossimIrect m_actualRect;
+ ossimIpt m_tileSize;
+ std::vector<bool> m_validTileArray;
+ ossimIpt m_numberOfTiles;
+ mutable OpenThreads::Mutex m_mutex;
+
+ ossim_int32 getTileIndex(const ossimIrect& rect,
+ const ossimIpt& numberOfTiles,
+ const ossimIpt& origin)const;
+
+ ossim_int32 getTileIndex(const ossimIrect& rect,
+ const ossimIpt& numberOfTiles,
+ ossim_int32 x,
+ ossim_int32 y)const;
+
+
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/Util.h b/ossimGui/include/ossimGui/Util.h
new file mode 100644
index 0000000..38274d3
--- /dev/null
+++ b/ossimGui/include/ossimGui/Util.h
@@ -0,0 +1,33 @@
+#ifndef ossimGuiUtil_HEADER
+#define ossimGuiUtil_HEADER
+
+#include <ossimGui/Export.h>
+#include <QtGui/QWidget>
+#include <QtCore/QStringList>
+#include <ossim/base/ossimString.h>
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL Util
+ {
+ public:
+ template <class T>
+ static T findParentOfType(QObject* startChild)
+ {
+ T result = dynamic_cast<T> (startChild);
+ QObject* current = startChild;
+ while(current&&!result)
+ {
+ current = current->parent();
+ result = dynamic_cast<T> (current);
+ }
+
+ return result;
+ }
+ static void imageWriterTypes(QStringList& result);
+ static void imageWriterTypes(std::vector<ossimString>& result);
+ };
+
+
+}
+#endif
diff --git a/ossimGui/include/ossimGui/View.h b/ossimGui/include/ossimGui/View.h
new file mode 100644
index 0000000..5263e45
--- /dev/null
+++ b/ossimGui/include/ossimGui/View.h
@@ -0,0 +1,116 @@
+#ifndef ossimGuiView_HEADER
+#define ossimGuiView_HEADER
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/base/ossimReferenced.h>
+#include <ossimGui/Export.h>
+
+namespace ossimGui{
+ class OSSIMGUI_DLL View : public ossimReferenced
+ {
+ public:
+ enum GeomType
+ {
+ GEOM_TYPE_UNKNOWN = 0,
+ GEOM_TYPE_MAP_PROJECTION = 1,
+ GEOM_TYPE_SENSOR_MODEL = 2
+ };
+ enum SyncType
+ {
+ SYNC_TYPE_NONE = 0,
+ SYNC_TYPE_CURSOR = 1, // paints cursor
+ SYNC_TYPE_POSITION = 2, // will adjust scrolls
+ SYNC_TYPE_GEOM = 4, // will propagate geometry
+ SYNC_TYPE_RESAMPLER= 8,
+ SYNC_TYPE_ALL = (SYNC_TYPE_CURSOR|SYNC_TYPE_POSITION|SYNC_TYPE_GEOM|SYNC_TYPE_RESAMPLER)
+ };
+
+
+ View()
+ :m_geomType(GEOM_TYPE_UNKNOWN),
+ m_syncType(SYNC_TYPE_NONE)
+ {
+ m_lookPosition.makeNan();
+ }
+ View (int sync, ossimImageGeometry* geom)
+ :m_geomType(GEOM_TYPE_UNKNOWN),
+ m_syncType(static_cast<SyncType>(sync&SYNC_TYPE_ALL)),
+ m_view(geom)
+
+ {
+ m_lookPosition.makeNan();
+ if(geom&&geom->getProjection())
+ {
+ if(geom->getProjection()->canCastTo("ossimMapProjection")) m_geomType = GEOM_TYPE_MAP_PROJECTION;
+ else if(geom->getProjection()->canCastTo("ossimSensorModel")) m_geomType = GEOM_TYPE_SENSOR_MODEL;
+ }
+ }
+ View(int sync, const ossimDpt& position)
+ :m_geomType(GEOM_TYPE_UNKNOWN),
+ m_syncType(static_cast<SyncType>(sync&SYNC_TYPE_ALL)),
+ m_lookPosition(position)
+ {
+ }
+ View(int sync, const ossimDpt& position, ossimImageGeometry* geom)
+ :m_geomType(GEOM_TYPE_UNKNOWN),
+ m_syncType(static_cast<SyncType>(sync&SYNC_TYPE_ALL)),
+ m_lookPosition(position),
+ m_view(geom)
+ {
+ if(geom&&geom->getProjection())
+ {
+ if(geom->getProjection()->canCastTo("ossimMapProjection")) m_geomType = GEOM_TYPE_MAP_PROJECTION;
+ else if(geom->getProjection()->canCastTo("ossimSensorModel")) m_geomType = GEOM_TYPE_SENSOR_MODEL;
+ }
+ }
+ View(const View& src)
+ :m_syncType(src.m_syncType),
+ m_lookPosition(src.m_lookPosition),
+ m_view(src.m_view.valid()?src.m_view->dup():0),
+ m_resamplerType(src.m_resamplerType)
+ {
+ }
+ virtual View* dup()const{return new View(*this);}
+
+ void setSyncType(int type, bool flag=true)
+ {
+ if(flag) m_syncType = static_cast<SyncType>((m_syncType|type)&SYNC_TYPE_ALL);
+ else m_syncType = static_cast<SyncType>((~type)&m_syncType);
+
+ }
+ GeomType geomType()const{return m_geomType;}
+ SyncType syncType()const{return m_syncType;}
+ bool lookPositionValid(){return !m_lookPosition.hasNans();}
+ const ossimDpt& lookPosition()const{return m_lookPosition;}
+ ossimGpt lookPositionAsGpt()const
+ {
+ ossimGpt result;
+ result.makeNan();
+ if(geometry()&&!m_lookPosition.hasNans())
+ {
+ geometry()->localToWorld(m_lookPosition, result);
+ }
+ return result;
+ }
+ const ossimString& resamplerType()const{return m_resamplerType;}
+ void setResamplerType(const ossimString& value){m_resamplerType = value;}
+ virtual const ossimImageGeometry* geometry()const{return viewAs<ossimImageGeometry>();}
+ virtual ossimImageGeometry* geometry(){return viewAs<ossimImageGeometry>();}
+
+ /**
+ * This might move to a base class later. For now until we figure out 3-D views
+ * we will leave it here
+ */
+ template<class T>
+ T* viewAs(){return dynamic_cast<T*>(m_view.get());}
+ template<class T>
+ const T* viewAs()const{return dynamic_cast<const T*>(m_view.get());}
+ protected:
+ GeomType m_geomType;
+ SyncType m_syncType;
+ // ossimGpt m_lookPosition;
+ ossimDpt m_lookPosition;
+ ossimRefPtr<ossimObject> m_view;
+ ossimString m_resamplerType;
+ };
+}
+#endif
diff --git a/ossimGui/include/ossimGui/ViewManipulator.h b/ossimGui/include/ossimGui/ViewManipulator.h
new file mode 100644
index 0000000..87db11f
--- /dev/null
+++ b/ossimGui/include/ossimGui/ViewManipulator.h
@@ -0,0 +1,37 @@
+#ifndef ossimGuiViewManipulator_HEADER
+#define ossimGuiViewManipulator_HEADER
+#include <ossimGui/Export.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/base/ossimDrect.h>
+
+namespace ossimGui{
+ class OSSIMGUI_DLL ViewManipulator : public ossimReferenced
+ {
+ public:
+ ViewManipulator();
+ ViewManipulator(ossimObject* obj);
+ void setObject(ossimObject* geom);
+ template<class T>
+ T* getObjectAs()
+ {
+ return dynamic_cast<T*>(m_obj.get());
+ }
+ template<class T>
+ const T* getObjectAs()const
+ {
+ return dynamic_cast<T*>(m_obj.get());
+ }
+ void setFullResScale(const ossimDpt& scale);
+ void fullRes(ossimDpt& center);
+ void fit(const ossimDrect& inputRect,
+ const ossimDrect& targetRect);
+ void zoomIn(ossimDpt& center, double factor=2.0);
+ void zoomOut(ossimDpt& center, double factor=2.0);
+
+ protected:
+ ossimImageGeometry* asGeometry();
+ ossimDpt m_fullResolutionScale;
+ ossimRefPtr<ossimObject> m_obj;
+ };
+}
+#endif
diff --git a/ossimGui/src/ossimGui/About.cpp b/ossimGui/src/ossimGui/About.cpp
new file mode 100644
index 0000000..7902ecd
--- /dev/null
+++ b/ossimGui/src/ossimGui/About.cpp
@@ -0,0 +1,10 @@
+#include <ossimGui/About.h>
+#include <QtGui/QPixmap>
+ossimGui::About::About(QWidget* parent)
+:QDialog(parent)
+{
+ setupUi(this);
+ m_logo->setPixmap(QPixmap(":/logos/RadiantBlue2.png"));
+ setAttribute(Qt::WA_DeleteOnClose);
+ connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(close()));
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/AdjustableParameterEditor.cpp b/ossimGui/src/ossimGui/AdjustableParameterEditor.cpp
new file mode 100644
index 0000000..3c26e1c
--- /dev/null
+++ b/ossimGui/src/ossimGui/AdjustableParameterEditor.cpp
@@ -0,0 +1,405 @@
+#include <ossimGui/AdjustableParameterEditor.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <QtGui/QTableWidgetItem>
+#include <QtGui/QFileDialog>
+static const int NAME_INDEX = 0;
+static const int SIGMA_INDEX = 1;
+static const int PARAMETER_INDEX = 2;
+static const int SLIDER_INDEX = 3;
+static const int VALUE_INDEX = 4;
+
+ossimGui::AdjustableParameterEditor::AdjustableParameterEditor(QWidget* parent, Qt::WindowFlags f)
+:QDialog(parent, f),
+m_interface(0)
+{
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ connect(m_adjustableParameterTable, SIGNAL(cellChanged(int, int)), this, SLOT(valueChanged(int, int)));
+ connect(m_resetButton, SIGNAL(clicked()), this, SLOT(resetTable()));
+ connect(m_keepAdjustmentButton, SIGNAL(clicked()), this, SLOT(keepAdjustment()));
+ connect(m_saveButton, SIGNAL(clicked()), this, SLOT(saveAdjustment()));
+ connect(m_closeButton, SIGNAL(clicked()), this,SLOT(close()));
+ connect(m_copyAdjustmentButton, SIGNAL(clicked()), this,SLOT(copyAdjustment()));
+ connect(m_deleteAdjustmentButton, SIGNAL(clicked()), this,SLOT(deleteAdjustment()));
+ connect(m_adjustmentSelectionBox, SIGNAL(activated(const QString&)), this,SLOT(selectionListChanged()));
+ connect(m_adjustmentDescriptionInput, SIGNAL(textChanged(const QString&)), this, SLOT(adjustmentDescriptionChanged(const QString&)));
+ connect(this, SIGNAL(sourceChanged(const QString&)), this, SLOT(setSource(const QString&)));
+}
+
+void ossimGui::AdjustableParameterEditor::setObject(ossimObject* obj)
+{
+ m_object = obj;
+ if(m_object.valid())
+ {
+ m_interface = dynamic_cast<ossimAdjustableParameterInterface*>(obj);
+ if(!m_interface)
+ {
+ ossimImageSource* isource = dynamic_cast<ossimImageSource*>(obj);
+ if(isource)
+ {
+ ossimRefPtr<ossimImageGeometry> geom = isource->getImageGeometry();
+ if(geom.valid())
+ {
+ m_interface = dynamic_cast<ossimAdjustableParameterInterface*>(geom->getProjection());
+ }
+ }
+ }
+ }
+
+ setImageSource();
+
+ transferToDialog();
+}
+
+void ossimGui::AdjustableParameterEditor::setImageSource()
+{
+ ossimString imageSource(" ");
+
+ if(m_object.valid())
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ m_object->accept(visitor);
+ ossimImageHandler* handler = visitor.getObjectAs<ossimImageHandler>();
+ if(handler)
+ {
+ imageSource = handler->getFilename();
+ }
+ }
+
+ QString source(imageSource.data());
+ emit sourceChanged(source);
+}
+
+void ossimGui::AdjustableParameterEditor::setSource(const QString& source)
+{
+ m_imageSourceLabel->setText(source);
+}
+
+
+ossimFilename ossimGui::AdjustableParameterEditor::findDefaultFilename()
+{
+ ossimFilename result;
+ if(m_object.valid())
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler", true);
+ m_object->accept(visitor);
+ ossimImageHandler* handler = visitor.getObjectAs<ossimImageHandler>();
+
+ if(handler)
+ {
+ result = handler->createDefaultGeometryFilename();
+ }
+ }
+
+ return result;
+}
+
+
+void ossimGui::AdjustableParameterEditor::transferToDialog()
+{
+ transferToList();
+ transferToTable();
+}
+
+void ossimGui::AdjustableParameterEditor::transferToList()
+{
+ m_adjustmentSelectionBox->blockSignals(true);
+ m_adjustmentDescriptionInput->blockSignals(true);
+ m_adjustmentSelectionBox->clear();
+ if(m_interface)
+ {
+ ossim_uint32 n = m_interface->getNumberOfAdjustments();
+ ossim_int32 idx = 0;
+
+ for(idx = 0; idx < (int)n; ++idx)
+ {
+ m_adjustmentSelectionBox->addItem(ossimString::toString(idx).c_str());
+ }
+ ossim_uint32 adjIdx = m_interface->getCurrentAdjustmentIdx();
+ m_adjustmentSelectionBox->setCurrentIndex(adjIdx);
+ m_adjustmentDescriptionInput->setText(m_interface->getAdjustmentDescription().c_str());
+ }
+ m_adjustmentSelectionBox->blockSignals(false);
+ m_adjustmentDescriptionInput->blockSignals(false);
+}
+
+void ossimGui::AdjustableParameterEditor::transferToTable()
+{
+ if(!m_interface)
+ {
+ m_adjustableParameterTable->clearContents();
+ return;
+ }
+ if(m_interface)
+ {
+ m_adjustableParameterTable->blockSignals(true);
+
+ int numAdjustables = m_interface->getNumberOfAdjustableParameters();
+ if(numAdjustables > 0)
+ {
+ if(m_adjustableParameterTable->rowCount() != numAdjustables)
+ {
+ m_adjustableParameterTable->setRowCount(numAdjustables);
+ }
+ for(int idx = 0; idx < numAdjustables; ++idx)
+ {
+ ossimString description = m_interface->getParameterDescription(idx).c_str();
+ double sigma = m_interface->getParameterSigma(idx);
+ double parameter = m_interface->getAdjustableParameter(idx);
+ double offset = m_interface->computeParameterOffset(idx);
+
+ if(!m_adjustableParameterTable->item(idx, NAME_INDEX))
+ {
+ m_adjustableParameterTable->setItem(idx, NAME_INDEX, new QTableWidgetItem(description.c_str()));
+ }
+ else
+ {
+ m_adjustableParameterTable->item(idx, NAME_INDEX)->setText(description.c_str());
+ }
+
+ if(!m_adjustableParameterTable->item(idx, SIGMA_INDEX))
+ {
+ m_adjustableParameterTable->setItem(idx, SIGMA_INDEX, new QTableWidgetItem(QString().setNum(sigma)));
+ }
+ else
+ {
+ m_adjustableParameterTable->item(idx, SIGMA_INDEX)->setText(QString().setNum(sigma));
+
+ }
+ if(!m_adjustableParameterTable->item(idx, PARAMETER_INDEX))
+ {
+ m_adjustableParameterTable->setItem(idx, PARAMETER_INDEX, new QTableWidgetItem(QString().setNum(parameter)));
+ }
+ else
+ {
+ m_adjustableParameterTable->item(idx, PARAMETER_INDEX)->setText(QString().setNum(parameter));
+ }
+ if(!m_adjustableParameterTable->item(idx, VALUE_INDEX))
+ {
+ m_adjustableParameterTable->setItem(idx, VALUE_INDEX, new QTableWidgetItem(QString().setNum(offset)));
+ }
+ else
+ {
+ m_adjustableParameterTable->item(idx, VALUE_INDEX)->setText(QString().setNum(offset));
+ }
+// if(!m_adjustableParameterTable->item(idx, SLIDER_INDEX))
+// {
+// m_adjustableParameterTable->setItem(idx, SLIDER_INDEX, new QTableWidgetItem(QString().setNum(value)));
+// }
+// else
+// {
+// m_adjustableParameterTable->item(idx, SLIDER_INDEX)->setText(QString().setNum(m_interface->getAdjustableParameter(idx)));
+// }
+
+ AdjustableParameterSlider* slider = 0;
+ if(!m_adjustableParameterTable->cellWidget(idx, SLIDER_INDEX))
+ {
+ slider = new AdjustableParameterSlider(idx, SLIDER_INDEX);
+ connect(slider, SIGNAL(parameterChanged(int, int)), this, SLOT(valueChanged(int, int)));
+ m_adjustableParameterTable->setCellWidget(idx, SLIDER_INDEX, slider);
+ }
+ else
+ {
+ slider = dynamic_cast<AdjustableParameterSlider*>(m_adjustableParameterTable->cellWidget(idx, SLIDER_INDEX));
+ }
+
+ if(slider)
+ {
+ slider->blockSignals(true);
+ slider->setTracking(true);
+ slider->setMinimum(-100);
+ slider->setMaximum(100);
+ slider->setValue((int)(parameter*100.0));
+ slider->blockSignals(false);
+ }
+ }
+ }
+ else
+ {
+ m_adjustableParameterTable->clearContents();
+ }
+
+ m_adjustableParameterTable->blockSignals(false);
+ }
+
+}
+
+void ossimGui::AdjustableParameterEditor::resetTable()
+{
+ if(!m_interface) return;
+ int numAdjustables = m_interface->getNumberOfAdjustableParameters();
+ if(numAdjustables > 0)
+ {
+ m_interface->setDirtyFlag(true);
+ m_interface->resetAdjustableParameters(true);
+ transferToTable();
+ fireRefreshEvent();
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::keepAdjustment()
+{
+ if(m_interface)
+ {
+ m_interface->setDirtyFlag(true);
+ m_interface->keepAdjustment();
+ transferToDialog();
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::saveAdjustment()
+{
+ if(!m_interface) return;
+
+ if(m_filename == "")
+ {
+ m_filename = findDefaultFilename();
+
+ QString file = QFileDialog::getSaveFileName((QWidget*)this, tr("Save Geometry"), tr(m_filename.c_str()), tr("*.geom"));
+ if(file != "")
+ {
+ m_filename = file.toAscii().data();
+ ossimKeywordlist kwl;
+ m_interface->getBaseObject()->saveState(kwl);
+
+ if(kwl.write(m_filename))
+ {
+ m_interface->setDirtyFlag(false);
+ }
+ }
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::copyAdjustment()
+{
+ if(m_interface)
+ {
+ m_interface->setDirtyFlag(true);
+ m_interface->copyAdjustment(true);
+ transferToDialog();
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::deleteAdjustment()
+{
+ if(m_interface)
+ {
+ m_interface->setDirtyFlag(true);
+ m_interface->eraseAdjustment(true);
+ if(m_interface->getNumberOfAdjustments() < 1)
+ {
+ m_interface->initAdjustableParameters();
+ }
+ transferToDialog();
+ fireRefreshEvent();
+ }
+}
+void ossimGui::AdjustableParameterEditor::selectionListChanged()
+{
+ if(m_interface)
+ {
+ m_interface->setDirtyFlag(true);
+ ossim_uint32 idx = m_adjustmentSelectionBox->currentText().toUInt();
+ m_interface->setCurrentAdjustment(idx, true);
+ transferToDialog();
+ fireRefreshEvent();
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::valueChanged(int row, int col)
+{
+ m_adjustableParameterTable->blockSignals(true);
+ QSlider* slider = dynamic_cast<QSlider*>(m_adjustableParameterTable->cellWidget(row, SLIDER_INDEX));
+ if(!slider) return;
+ if(col == SLIDER_INDEX)
+ {
+ m_interface->setDirtyFlag(true);
+ QSlider* slider = (QSlider*)m_adjustableParameterTable->cellWidget(row, col);
+
+ int value = slider->value();
+ double multiplier = (double)value/100.0;
+ m_interface->setAdjustableParameter(row, multiplier, true);
+ ossimString parameterValue = ossimString::toString(m_interface->getAdjustableParameter(row));
+ if(parameterValue == ".") parameterValue = "0";
+
+ m_adjustableParameterTable->item(row, PARAMETER_INDEX)->setText(parameterValue.c_str());
+
+ ossimString valueOffset = ossimString::toString(m_interface->computeParameterOffset(row));
+
+ //if(valueOffset == ".") valueOffset = "0";
+
+ m_adjustableParameterTable->item(row, VALUE_INDEX)->setText(valueOffset.c_str());
+ fireRefreshEvent();
+ }
+ else if(col == SIGMA_INDEX)
+ {
+ m_interface->setDirtyFlag(true);
+ ossimString sigma = m_adjustableParameterTable->item(row,col)->text().toAscii().data();
+ m_interface->setParameterSigma(row, sigma.toDouble(), true);
+ fireRefreshEvent();
+ transferToTable();
+ }
+ else if(col == PARAMETER_INDEX)
+ {
+ m_interface->setDirtyFlag(true);
+ ossimString param = m_adjustableParameterTable->item(row,col)->text().toAscii().data();
+ m_interface->setAdjustableParameter(row, param.toDouble(), true);
+ fireRefreshEvent();
+ transferToTable();
+ }
+ else if(col == VALUE_INDEX)
+ {
+ m_interface->setDirtyFlag(true);
+ double center = m_interface->getParameterCenter(row);
+ double sigma = m_interface->getParameterSigma(row);
+ double minValue = center - sigma;
+ double maxValue = center + sigma;
+ double value = ossimString(m_adjustableParameterTable->item(row,col)->text().toAscii().data()).toDouble();
+ double x = 0.0;
+
+ if(sigma != 0.0)
+ {
+ //
+ // sigma*x + center = value;
+ // x = (value - center)/sigma
+ x = (value - center)/sigma;
+
+ value = center + x*sigma;
+
+ if(value < minValue)
+ {
+ x = -1;
+ }
+ else if(value >maxValue)
+ {
+ x = 1.0;
+ }
+ m_interface->setAdjustableParameter(row, x, true);
+ fireRefreshEvent();
+ transferToTable();
+ }
+ }
+ m_adjustableParameterTable->blockSignals(false);
+}
+void ossimGui::AdjustableParameterEditor::fireRefreshEvent()
+{
+ if(m_object.valid())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ m_object->accept(visitor);
+ }
+}
+
+void ossimGui::AdjustableParameterEditor::adjustmentDescriptionChanged(const QString& value)
+{
+ if(m_interface)
+ {
+ m_interface->setDirtyFlag(true);
+ m_interface->setAdjustmentDescription(value.toAscii().data());
+ }
+}
diff --git a/ossimGui/src/ossimGui/AnnotationItem.cpp b/ossimGui/src/ossimGui/AnnotationItem.cpp
new file mode 100644
index 0000000..87822f4
--- /dev/null
+++ b/ossimGui/src/ossimGui/AnnotationItem.cpp
@@ -0,0 +1,41 @@
+#include <ossimGui/AnnotationItem.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <QtGui/QToolTip>
+#include <iostream>
+
+
+ossimGui::AnnotationItem::AnnotationItem(const ossimString& overlayId, const ossimString& id)
+:
+m_id(id),
+m_isEnabled(true),
+m_overlayId(overlayId)
+{
+ m_annPen.setColor(Qt::blue);
+ m_annPen.setCapStyle(Qt::RoundCap);
+ m_annPen.setWidth(0);
+}
+
+void ossimGui::AnnotationItem::setID(const ossimString& id)
+{
+ m_id = id;
+}
+
+void ossimGui::AnnotationItem::setUsable(const bool& enable)
+{
+ m_isEnabled = enable;
+ update();
+}
+
+void ossimGui::AnnotationItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
+{
+ m_annPen.setColor(Qt::cyan);
+ update();
+}
+
+void ossimGui::AnnotationItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
+{
+ m_annPen.setColor(Qt::blue);
+ update();
+}
diff --git a/ossimGui/src/ossimGui/AutoMeasurementDialog.cpp b/ossimGui/src/ossimGui/AutoMeasurementDialog.cpp
new file mode 100644
index 0000000..d95d1f5
--- /dev/null
+++ b/ossimGui/src/ossimGui/AutoMeasurementDialog.cpp
@@ -0,0 +1,436 @@
+#include <ossimGui/MainWindow.h>
+#include <ossimGui/AutoMeasurementDialog.h>
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/MetricOverlay.h>
+#include <ossimGui/RegPoint.h>
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/Util.h>
+#include <QtGui/QMenu>
+#include <QtGui/QMainWindow>
+#include <QtGui/QApplication>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+#include <QtGui/QComboBox>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/projection/ossimImageViewTransform.h>
+#include <ossimGui/GatherImageViewProjTransVisitor.h>
+
+
+ossimGui::AutoMeasurementDialog::AutoMeasurementDialog(
+ QWidget* parent,
+ DataManager::NodeListType& nodeList,
+ ossimTieMeasurementGeneratorInterface* tGen)
+: QDialog(parent),
+ m_tGen(tGen)
+{
+ initDialog();
+
+ // Save node list
+ m_nodeList = nodeList;
+
+ initContent();
+}
+
+
+void ossimGui::AutoMeasurementDialog::initDialog()
+{
+ setupUi(this);
+
+ // Detector selection
+ m_detComboBox->addItem("ORB");
+ m_detComboBox->addItem("BRISK");
+ m_detComboBox->addItem("FAST");
+ m_detComboBox->addItem("STAR");
+ m_detComboBox->addItem("GFTT");
+ m_detComboBox->addItem("MSER");
+
+ // Descriptor-Extractor selection
+ m_extComboBox->addItem("FREAK");
+ m_extComboBox->addItem("ORB");
+ m_extComboBox->addItem("BRIEF");
+ m_extComboBox->addItem("BRISK");
+
+ // Detector selection (uchar-based)
+ m_matComboBox->addItem("BruteForce-Hamming");
+ m_matComboBox->addItem("BruteForce-HammingLUT");
+ m_matComboBox->addItem("FlannBased");
+
+ // Set primary connections
+ connect(m_execMeasButton, SIGNAL(clicked()), this, SLOT(execMeas()));
+ connect(m_acceptMeasButton, SIGNAL(clicked()), this, SLOT(acceptMeas()));
+ connect(m_resetMeasButton, SIGNAL(clicked()), this, SLOT(resetMeas()));
+ connect(m_dismissButton, SIGNAL(clicked()), this, SLOT(dismissMeas()));
+
+ connect(m_detComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(selectDetector(QString)));
+ connect(m_extComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(selectExtractor(QString)));
+ connect(m_matComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(selectMatcher(QString)));
+
+ connect(m_xGridSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setGridSizeX(int)));
+ connect(m_yGridSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setGridSizeY(int)));
+
+ connect(m_maxMatchSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaxMatches(int)));
+ m_maxMatchSpinBox->setValue(5);
+
+ connect(m_cbUseGrid, SIGNAL(toggled(bool)), this, SLOT(setUseGridChecked(bool)));
+}
+
+void ossimGui::AutoMeasurementDialog::displayClosing(QObject* obj)
+{
+ DataManager::NodeListType::iterator iter = m_nodeList.begin();
+ while(iter != m_nodeList.end())
+ {
+ ConnectableDisplayObject* displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ if((subWindow == obj) || (subWindow == 0))
+ {
+ iter = m_nodeList.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+}
+
+void ossimGui::AutoMeasurementDialog::initContent()
+{
+ // Set up ROI selector connections
+ // ossim_uint32 idxLayer = 0;
+ ConnectableDisplayObject* displayObj;
+ ImageMdiSubWindow* subWindow;
+ std::vector<ossimImageSource*> src;
+ DataManager::NodeListType::iterator iter = m_nodeList.begin();
+
+ while(iter != m_nodeList.end())
+ {
+ displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+ subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ m_scrollViews.push_back(subWindow->scrollWidget());
+ connect(m_scrollViews.back(), SIGNAL(mouseBox(ImageScrollView*, const ossimDpt&, const ossimDpt&)),
+ this, SLOT(setBox(ImageScrollView*, const ossimDpt&, const ossimDpt&)));
+ connect(subWindow, SIGNAL(destroyed(QObject*)), this, SLOT(displayClosing(QObject*)));
+ ++iter;
+ }
+
+ // Initialize the measurement generator
+ m_tGen->init(m_report);
+
+ // Default to show the OpenCV match window
+ // TODO: Checkbox should be added to the GUI
+ m_tGen->setShowCvWindow(true);
+
+ updateCurrentAlgorithmFields();
+
+ m_acceptMeasButton->setEnabled(false);
+ m_execMeasButton->setEnabled(true);
+
+ // Disable grid because check box is unchecked
+ m_xGridSpinBox->setEnabled(false);
+ m_yGridSpinBox->setEnabled(false);
+}
+
+
+// Initiate auto measurement
+void ossimGui::AutoMeasurementDialog::execMeas()
+{
+ if (m_tGen->isValidCollectionBox())
+ {
+ m_acceptMeasButton->setEnabled(true);
+ m_execMeasButton->setEnabled(false);
+
+ // Run the OpenCV detector/extractor/matcher
+ m_tGen->run();
+
+ setMeasurementReportContent(m_report.str());
+
+//==== TODO hardcopy output
+// ofstream myfile;
+// myfile.open ("/Users/dhicks/work/reg.txt");
+// myfile << m_report.str() << std::flush;
+// myfile.close();
+//==== TODO hardcopy output
+
+ }
+ else
+ {
+ ossimString noBox("Collection box not defined....");
+ setMeasurementReportContent(noBox);
+ }
+}
+
+// Accept auto measurement
+void ossimGui::AutoMeasurementDialog::acceptMeas()
+{
+ // Close openCV window
+ m_tGen->closeCvWindow();
+
+ // Signal to DataManagerWidget
+ emit acceptMeasExecuted(m_nodeList);
+}
+
+// Reset auto measurement
+void ossimGui::AutoMeasurementDialog::resetMeas()
+{
+
+ m_scrollViews.clear();
+ DataManager::NodeListType::iterator iter = m_nodeList.begin();
+ while(iter != m_nodeList.end())
+ {
+ ConnectableDisplayObject* displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ if(subWindow)
+ {
+ ossimGui::ImageScrollView* scrollWidget = subWindow->scrollWidget();
+ disconnect(scrollWidget, SIGNAL(mouseBox(ImageScrollView*, const ossimDpt&, const ossimDpt&)),
+ this, SLOT(setBox(ImageScrollView*, const ossimDpt&, const ossimDpt&)));
+ disconnect(subWindow, SIGNAL(destroyed(QObject*)), this, SLOT(displayClosing(QObject*)));
+ }
+ ++iter;
+ }
+
+ initContent();
+ m_measResultsBrowser->setText("Current measurements cleared");
+
+ // Close openCV window
+ m_tGen->closeCvWindow();
+}
+
+// Dismiss auto measurement
+void ossimGui::AutoMeasurementDialog::dismissMeas()
+{
+ // Signal to DataManagerWidget
+ emit dismissMeasExecuted();
+
+ // Close openCV window
+ m_tGen->closeCvWindow();
+}
+
+// Select detector combobox
+void ossimGui::AutoMeasurementDialog::selectDetector(QString str)
+{
+ ossimString det = str.toStdString();
+ if (m_tGen->setFeatureDetector(det))
+ m_detName->setText(det.data());
+ else
+ m_detName->setText("...");
+}
+
+// Select extractor combobox
+void ossimGui::AutoMeasurementDialog::selectExtractor(QString str)
+{
+ ossimString ext = str.toStdString();
+ if (m_tGen->setDescriptorExtractor(ext))
+ m_extName->setText(ext.data());
+ else
+ m_extName->setText("...");
+}
+
+// Select matcher combobox
+void ossimGui::AutoMeasurementDialog::selectMatcher(QString str)
+{
+ ossimString mat = str.toStdString();
+ if (m_tGen->setDescriptorMatcher(mat))
+ m_matName->setText(mat.data());
+ else
+ m_matName->setText("...");
+}
+
+// Set collection bounding box
+void ossimGui::AutoMeasurementDialog::setBox(
+ ImageScrollView* sptr, const ossimDpt& sp, const ossimDpt& ep)
+{
+
+ int primeIndex = -1;
+ int numOfScrollViews = m_scrollViews.size();
+ ossimGpt centerG;
+ centerG.makeNan();
+ ossimGpt cornG[4];
+ ossimRefPtr<IvtGeomTransform> ivtg;
+
+ // TODO not currently used
+ bool roiOK = true;
+
+ // Load ossimImageSource vector from the node list
+ std::vector<ossimImageSource*> src;
+ ossim_uint32 idxLayer = 0;
+ for (int i=0; i<numOfScrollViews; ++i)
+ {
+ src.push_back(m_scrollViews[i]->layers()->layer(idxLayer)->chain());
+ }
+ m_roiRects.resize(numOfScrollViews);
+
+ // Define ROI in primary image
+ for (int i=0; i<numOfScrollViews; ++i)
+ {
+ if (sptr == m_scrollViews[i])
+ {
+ primeIndex = i;
+
+ // Set to full resolution before defining ROI
+ ImageViewManipulator* ivm = m_scrollViews[i]->manipulator();
+ if (ivm)
+ {
+ ivm->fullRes();
+ }
+ else
+ {
+ roiOK = false;
+ }
+
+ // Box size (sp,ep image)
+ int dxI = abs(ep.x - sp.x);
+ int dyI = abs(ep.y - sp.y);
+ ossimIpt patchDimI(dxI, dyI);
+
+ // Box center (image)
+ ossimDpt centerI;
+ centerI.x = sp.x + dxI/2;
+ centerI.y = sp.y + dyI/2;
+ ossimIrect rectA(centerI, dxI, dyI);
+
+ // Center on patch (view)
+ ossimDpt centerV;
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src[i]->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ivtg = visitor.getTransformList()[0].get();
+ ivtg->imageToView(centerI, centerV);
+ ivtg->imageToGround(centerI, centerG);
+ if (centerG.isHgtNan())
+ {
+ ossim_float64 hgt = ossimElevManager::instance()->getHeightAboveEllipsoid(centerG);
+ centerG.height(hgt);
+ }
+ }
+ QPointF pt(centerV.x,centerV.y);
+ m_scrollViews[i]->centerOn(pt);
+
+ // Get patch corners in ground space
+ ossimDpt primPtsI[4];
+ ossimDpt primPtsV[4];
+ primPtsI[0] = rectA.ul();
+ primPtsI[1] = rectA.ur();
+ primPtsI[2] = rectA.lr();
+ primPtsI[3] = rectA.ll();
+ for (int k=0; k<4; ++k)
+ {
+ ivtg->imageToGround(primPtsI[k], cornG[k]);
+ if (cornG[k].isHgtNan())
+ {
+ ossim_float64 hgt = ossimElevManager::instance()->getHeightAboveEllipsoid(cornG[k]);
+ cornG[k].height(hgt);
+ }
+ ivtg->imageToView(primPtsI[k], primPtsV[k]);
+ }
+
+ // Load view coordinate rectangle for primary image
+ ossimIrect rectAv(primPtsV[0], primPtsV[1], primPtsV[2], primPtsV[3]);
+ m_roiRects[primeIndex] = rectAv;
+
+ // We could get patch to insert into imageSource vector....
+ // Note: currently don't have to do this, the later
+ // ossimTieMeasurementGenerator getTile will pull the patch
+ // out of the whole source
+ // ossimRefPtr<ossimImageData> idA = src[i]->getTile(rectAv);
+ // cout<<"idA size = "<<idA->getWidth()<<"X"<<idA->getHeight()<<endl;
+ // Load sources (TODO how ossimImageData->ossimImageSource?)
+ }
+ }
+
+ // Define ROI in remaining images
+ for (int i=0; i<numOfScrollViews; ++i)
+ {
+ if (sptr != m_scrollViews[i])
+ {
+
+ // Set to full resolution before defining ROI
+ ImageViewManipulator* ivm = m_scrollViews[i]->manipulator();
+ if (ivm)
+ {
+ ivm->fullRes();
+ }
+ else
+ {
+ roiOK = false;
+ }
+
+ // Center on patch (view)
+ ossimDpt centerI;
+ ossimDpt centerV;
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src[i]->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ivtg = visitor.getTransformList()[0].get();
+ ivtg->groundToImage(centerG, centerI);
+ ivtg->imageToView(centerI, centerV);
+ }
+ QPointF pt(centerV.x,centerV.y);
+ m_scrollViews[i]->centerOn(pt);
+
+ // Define this patch by projection from primary patch
+ ossimDpt xferPtsI[4];
+ ossimDpt xferPtsV[4];
+ for (int k=0; k<4; ++k)
+ {
+ ivtg->groundToImage(cornG[k], xferPtsI[k]);
+ ivtg->imageToView(xferPtsI[k], xferPtsV[k]);
+ }
+
+ // Load view coordinate rectangle for this image
+ ossimIrect rectXfer(xferPtsV[0],xferPtsV[1],xferPtsV[2],xferPtsV[3]);
+ m_roiRects[i] = rectXfer;
+ }
+ }
+
+
+ m_tGen->setBox(m_roiRects, primeIndex, src);
+
+ // return roiOK;
+}
+
+// Set grid parameters
+void ossimGui::AutoMeasurementDialog::setUseGridChecked(bool isChecked)
+{
+ m_tGen->setUseGrid(isChecked);
+
+ m_xGridSpinBox->setEnabled(isChecked);
+ m_yGridSpinBox->setEnabled(isChecked);
+}
+void ossimGui::AutoMeasurementDialog::setGridSizeX(int xDim)
+{
+ ossimIpt gs = m_tGen->getGridSize();
+ gs.x = xDim;
+ m_tGen->setGridSize(gs);
+}
+void ossimGui::AutoMeasurementDialog::setGridSizeY(int yDim)
+{
+ ossimIpt gs = m_tGen->getGridSize();
+ gs.y = yDim;
+ m_tGen->setGridSize(gs);
+}
+
+void ossimGui::AutoMeasurementDialog::setMaxMatches(int maxMatches)
+{
+ m_tGen->setMaxMatches(maxMatches);
+}
+
+// Load registration text browser
+void ossimGui::AutoMeasurementDialog::setMeasurementReportContent(const ossimString& report)
+{
+ QFont f( "courier", 12 );
+ m_measResultsBrowser->setFont(f);
+ m_measResultsBrowser->setLineWrapMode(QTextEdit::NoWrap);
+ m_measResultsBrowser->setText(report.data());
+}
+
+void ossimGui::AutoMeasurementDialog::updateCurrentAlgorithmFields()
+{
+ m_detName->setText(m_tGen->getFeatureDetector().data());
+ m_extName->setText(m_tGen->getDescriptorExtractor().data());
+ m_matName->setText(m_tGen->getDescriptorMatcher().data());
+}
diff --git a/ossimGui/src/ossimGui/BandSelectorEditor.cpp b/ossimGui/src/ossimGui/BandSelectorEditor.cpp
new file mode 100644
index 0000000..e51ea33
--- /dev/null
+++ b/ossimGui/src/ossimGui/BandSelectorEditor.cpp
@@ -0,0 +1,288 @@
+#include <ossimGui/BandSelectorEditor.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/imaging/ossimImageSource.h>
+
+ossimGui::BandSelectorEditor::BandSelectorEditor(QWidget* parent, Qt::WindowFlags f)
+:QDialog(parent, f)
+{
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ m_currentIndex = 0;
+ m_selectionType = N_BAND;
+ m_nBandButton->setChecked(true);
+ m_bandInput->setReadOnly(true);
+
+ connect(m_oneBandButton, SIGNAL(clicked(bool)), this, SLOT(oneBandButtonClicked(bool)));
+ connect(m_threeBandButton, SIGNAL(clicked(bool)), this, SLOT(threeBandButtonClicked(bool)));
+ connect(m_nBandButton, SIGNAL(clicked(bool)), this, SLOT(nBandButtonClicked(bool)));
+ connect(m_clearBandInputButton, SIGNAL(clicked(bool)), this, SLOT(clearBandInputButtonClicked(bool)));
+ connect(m_inputBandList, SIGNAL( clicked ( const QModelIndex &)), this, SLOT(inputBandListClicked ( const QModelIndex & )));
+ connect(m_enableButton, SIGNAL(clicked(bool)), this, SLOT(enableButtonClicked(bool)));
+ connect(m_resetButton, SIGNAL(clicked(bool)), this, SLOT(resetButtonClicked(bool)));
+ connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(okButtonClicked(bool)));
+ connect(m_cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancelButtonClicked(bool)));
+
+}
+
+void ossimGui::BandSelectorEditor::setObject(ossimObject* obj)
+{
+ m_object = dynamic_cast<ossimImageSource*>(obj); // must be at least of type osismImageSource
+ if(m_object.valid())
+ {
+ m_cancelState.clear();
+ m_object->saveState(m_cancelState);
+ }
+ initializeUiValues();
+}
+
+void ossimGui::BandSelectorEditor::oneBandButtonClicked(bool)
+{
+ if(!m_object.valid()) return;
+ std::vector<ossim_uint32> bands;
+ ossim::toSimpleVector(bands, m_object->getPropertyValueAsString("bands"));
+ m_currentBandList.resize(1);
+ if(bands.size())
+ {
+ m_currentBandList[0] = bands[0];
+ }
+ else
+ {
+ m_currentBandList[0] = 0;
+ }
+
+ m_currentIndex = 0;
+ m_selectionType = SINGLE_BAND;
+ setBandInput();
+ setCurrentBandsToObject();
+}
+
+void ossimGui::BandSelectorEditor::threeBandButtonClicked(bool)
+{
+ if(!m_object.valid()) return;
+ m_currentBandList.resize(3);
+
+ ossim_uint32 nbands = getNumberOfInputBands();
+ if(nbands >= 3)
+ {
+ m_currentBandList[0] = 0;
+ m_currentBandList[1] = 1;
+ m_currentBandList[2] = 2;
+
+ m_currentIndex = 0;
+ }
+ else
+ {
+ m_currentBandList[0] = 0;
+ m_currentBandList[1] = 0;
+ m_currentBandList[2] = 0;
+ }
+
+ m_selectionType = THREE_BAND;
+ setBandInput();
+ setCurrentBandsToObject();
+}
+
+void ossimGui::BandSelectorEditor::nBandButtonClicked(bool)
+{
+ m_currentIndex = 0;
+ m_selectionType = N_BAND;
+}
+
+void ossimGui::BandSelectorEditor::clearBandInputButtonClicked(bool)
+{
+ m_currentIndex = 0;
+ ossim_uint32 nbands = getNumberOfInputBands();
+ switch(m_selectionType)
+ {
+ case SINGLE_BAND:
+ {
+ m_currentBandList.resize(3);
+ m_currentBandList[0] = 0;
+ break;
+ }
+ case THREE_BAND:
+ {
+ m_currentBandList.resize(3);
+ if(nbands >= 3)
+ {
+ m_currentBandList[0] = 0;
+ m_currentBandList[1] = 1;
+ m_currentBandList[2] = 2;
+
+ m_currentIndex = 0;
+ }
+ else
+ {
+ m_currentBandList[0] = 0;
+ m_currentBandList[1] = 0;
+ m_currentBandList[2] = 0;
+ }
+
+ break;
+ }
+ case N_BAND:
+ {
+ m_currentBandList.resize(1);
+ m_currentBandList[0] = 0;
+ break;
+ }
+ }
+ setBandInput();
+ setCurrentBandsToObject();
+}
+
+void ossimGui::BandSelectorEditor::inputBandListClicked(const QModelIndex & index)
+{
+ ossim_uint32 band = index.data().toInt();
+ if(m_currentIndex == m_currentBandList.size())
+ {
+ m_currentBandList.push_back(band-1);
+ }
+ else
+ {
+ m_currentBandList[m_currentIndex] = band-1;
+ }
+ switch(m_selectionType)
+ {
+ case SINGLE_BAND:
+ {
+ break;
+ }
+ case THREE_BAND:
+ {
+ m_currentIndex = (m_currentIndex + 1)%3;
+ break;
+ }
+ case N_BAND:
+ {
+ ++m_currentIndex;
+ break;
+ }
+ }
+
+ m_inputBandList->clearSelection();
+ setBandInput();
+ setCurrentBandsToObject();
+}
+
+
+void ossimGui::BandSelectorEditor::enableButtonClicked(bool checked)
+{
+ if(m_object.valid())
+ {
+ m_object->setProperty("enabled", ossimString::toString(checked));
+ fireRefreshEvent();
+ }
+}
+
+void ossimGui::BandSelectorEditor::resetButtonClicked(bool)
+{
+ if(m_object.valid()) m_object->loadState(m_cancelState);
+ initializeUiValues();
+ fireRefreshEvent();
+}
+
+void ossimGui::BandSelectorEditor::okButtonClicked(bool)
+{
+ close();
+}
+
+void ossimGui::BandSelectorEditor::cancelButtonClicked(bool)
+{
+ if(m_object.valid()) m_object->loadState(m_cancelState);
+ fireRefreshEvent();
+ close();
+}
+
+void ossimGui::BandSelectorEditor::initializeUiValues()
+{
+ if(!m_object) return;
+ m_oneBandButton->blockSignals(true);
+ m_threeBandButton->blockSignals(true);
+ m_nBandButton->blockSignals(true);
+ m_enableButton->blockSignals(true);
+ m_currentBandList.clear();
+ m_enableButton->setChecked(m_object->getPropertyValueAsString("enabled").toBool());
+ ossim::toSimpleVector(m_currentBandList, m_object->getPropertyValueAsString("bands"));
+
+ if(m_currentBandList.size() == 1)
+ {
+ m_oneBandButton->setChecked(true);
+ m_selectionType = SINGLE_BAND;
+ }
+ else if(m_currentBandList.size() == 3)
+ {
+ m_threeBandButton->setChecked(true);
+ m_selectionType = THREE_BAND;
+ }
+ else
+ {
+ m_nBandButton->setChecked(true);
+ m_selectionType = N_BAND;
+ }
+ m_inputBandList->clear();
+ ossim_uint32 nInputBands = getNumberOfInputBands();
+ if(nInputBands > 0)
+ {
+ ossimString bandValue;
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nInputBands;++idx)
+ {
+ bandValue = ossimString::toString(idx+1);
+ m_inputBandList->addItem(bandValue.c_str());
+ }
+ }
+ m_currentIndex = 0;
+ setBandInput();
+
+ m_enableButton->blockSignals(false);
+ m_oneBandButton->blockSignals(false);
+ m_threeBandButton->blockSignals(false);
+ m_nBandButton->blockSignals(false);
+}
+
+void ossimGui::BandSelectorEditor::setBandInput()
+{
+ ossimString bandList;
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_currentBandList.size();++idx)
+ {
+ bandList += ossimString::toString(m_currentBandList[idx]+1);
+ if(idx+1 != m_currentBandList.size()) bandList += ",";
+ }
+ m_bandInput->setText(bandList.c_str());
+
+}
+
+ossim_uint32 ossimGui::BandSelectorEditor::getNumberOfInputBands()const
+{
+ const ossimImageSource* is = dynamic_cast<const ossimImageSource*>(m_object.get());
+ if(is)
+ {
+ return is->getNumberOfInputBands();
+ }
+
+ return 0;
+}
+
+void ossimGui::BandSelectorEditor::setCurrentBandsToObject()
+{
+ ossimString bandsString;
+ ossim::toSimpleStringList(bandsString,
+ m_currentBandList);
+ m_object->setProperty("bands", bandsString);
+
+ fireRefreshEvent();
+}
+
+void ossimGui::BandSelectorEditor::fireRefreshEvent()
+{
+ if(m_object.valid())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_PIXELS);
+ ossimEventVisitor visitor(refreshEvent.get());
+ m_object->accept(visitor);
+ }
+}
diff --git a/ossimGui/src/ossimGui/BrightnessContrastEditor.cpp b/ossimGui/src/ossimGui/BrightnessContrastEditor.cpp
new file mode 100644
index 0000000..aafc1b6
--- /dev/null
+++ b/ossimGui/src/ossimGui/BrightnessContrastEditor.cpp
@@ -0,0 +1,97 @@
+#include <ossimGui/BrightnessContrastEditor.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimRefreshEvent.h>
+
+ossimGui::BrightnessContrastEditor::BrightnessContrastEditor(QWidget* parent, Qt::WindowFlags f)
+:QDialog(parent, f)
+{
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ m_savedBrightness = 0.0;
+ m_savedContrast = 1.0;
+ m_brightnessSlider->setMinimum(-100);
+ m_brightnessSlider->setMaximum(100);
+ m_contrastSlider->setMinimum(-200);
+ m_contrastSlider->setMaximum(200);
+ connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(ok()));
+ connect(m_cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));
+ connect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(brightnessSliderChanged()));
+ connect(m_contrastSlider, SIGNAL(valueChanged(int)), this, SLOT(contrastSliderChanged()));
+ connect(m_enabled, SIGNAL(clicked(bool)), this, SLOT(enabledChanged()));
+}
+
+
+void ossimGui::BrightnessContrastEditor::setObject(ossimObject* obj)
+{
+ m_brightnessContrast = dynamic_cast<ossimConnectableObject*>(obj);
+ if(m_brightnessContrast.valid())
+ {
+ m_savedBrightness = m_brightnessContrast->getPropertyValueAsString("brightness").toDouble();
+ m_savedContrast = m_brightnessContrast->getPropertyValueAsString("contrast").toDouble();
+ ossim_int32 brightness = static_cast<ossim_int32>(m_savedBrightness*100);
+ ossim_int32 contrast = static_cast<ossim_int32>((m_savedContrast-1)*100);
+
+ m_brightnessSlider->setValue(brightness);
+ m_contrastSlider->setValue(contrast);
+ ossimString contrastValue = ossimString::toString(m_savedContrast);
+ ossimString brightnessValue = ossimString::toString(m_savedBrightness);
+ ossimString enabledValue = m_brightnessContrast->getPropertyValueAsString("enabled");
+ m_contrastEdit->setText(contrastValue.c_str());
+ m_brightnessEdit->setText(brightnessValue.c_str());
+ m_enabled->setCheckState(enabledValue.toBool()?Qt::Checked:Qt::Unchecked);
+ }
+}
+
+
+void ossimGui::BrightnessContrastEditor::ok()
+{
+ close();
+}
+
+void ossimGui::BrightnessContrastEditor::cancel()
+{
+ if(m_brightnessContrast.valid())
+ {
+ m_brightnessContrast->setProperty(ossimString("brightness"), ossimString::toString(m_savedBrightness));
+ m_brightnessContrast->setProperty(ossimString("contrast"), ossimString::toString(m_savedContrast));
+ ossimEventVisitor event(new ossimRefreshEvent(m_brightnessContrast.get()));
+ m_brightnessContrast->accept(event);
+ }
+ close();
+}
+
+void ossimGui::BrightnessContrastEditor::brightnessSliderChanged()
+{
+ if(m_brightnessContrast.valid())
+ {
+ ossimString value = ossimString::toString(m_brightnessSlider->value()/100.0);
+ m_brightnessContrast->setProperty("brightness", value);
+ m_brightnessEdit->setText(value.c_str());
+
+ ossimEventVisitor event(new ossimRefreshEvent(m_brightnessContrast.get()));
+ m_brightnessContrast->accept(event);
+ }
+}
+
+void ossimGui::BrightnessContrastEditor::contrastSliderChanged()
+{
+ if(m_brightnessContrast.valid())
+ {
+ ossimString value = ossimString::toString(1 + m_contrastSlider->value()/100.0);
+
+ m_brightnessContrast->setProperty("contrast", value);
+ m_contrastEdit->setText(value.c_str());
+ ossimEventVisitor event(new ossimRefreshEvent(m_brightnessContrast.get()));
+ m_brightnessContrast->accept(event);
+ }
+}
+
+void ossimGui::BrightnessContrastEditor::enabledChanged()
+{
+ if(m_brightnessContrast.valid())
+ {
+ m_brightnessContrast->setProperty("enabled", (m_enabled->checkState() == Qt::Unchecked)?"false":"true");
+ ossimEventVisitor event(new ossimRefreshEvent(m_brightnessContrast.get()));
+ m_brightnessContrast->accept(event);
+ }
+}
diff --git a/ossimGui/src/ossimGui/ChipperDialog.cpp b/ossimGui/src/ossimGui/ChipperDialog.cpp
new file mode 100644
index 0000000..a53cf99
--- /dev/null
+++ b/ossimGui/src/ossimGui/ChipperDialog.cpp
@@ -0,0 +1,1242 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Description: Dialog box for chipping/exporting images.
+//
+//---
+// $Id$
+
+#include <ossimGui/ChipperDialog.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/ProgressDialog.h>
+#include <ossimGui/ProgressWidget.h>
+#include <ossimGui/PropertyEditorDialog.h>
+#include <ossimGui/View.h>
+#include <ossim/base/ossimIdManager.h>
+#include <ossim/base/ossimKeywordNames.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/base/ossimProperty.h>
+#include <ossim/base/ossimROIEvent.h>
+#include <ossim/base/ossimTrace.h>
+#include <ossim/imaging/ossimGeoPolyCutter.h>
+#include <ossim/imaging/ossimIgenGenerator.h>
+#include <ossim/imaging/ossimImageWriterFactoryRegistry.h>
+
+#include <QApplication>
+#include <QComboBox>
+#include <QFileDialog>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLineEdit>
+#include <QMessageBox>
+#include <QMouseEvent>
+#include <QPoint>
+#include <QPushButton>
+#include <QSize>
+#include <QString>
+#include <QStringList>
+#include <QTextEdit>
+#include <QVBoxLayout>
+#include <QWidget>
+
+#include <cstring>
+#include <iomanip>
+#include <sstream>
+#include <vector>
+
+static ossimTrace traceDebug("ChipperDialog:debug");
+
+ossimGui::ChipperDialog::ChipperDialog(QWidget* parent, Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ ossimConnectableObjectListener(),
+ ossimROIEventListener(),
+ m_widget(0),
+ m_input(0),
+ m_outputFileLineEdit(0),
+ m_outputFilePushButton(0),
+ m_outputTypeComboBox(0),
+ m_editWriterPushButton(0),
+ m_gsdLineEdit(0),
+ m_linesLineEdit(0),
+ m_samplesLineEdit(0),
+ m_sceneRectPushButton(0),
+ m_saveSpecFilePushButton(0),
+ m_saveImagePushButton(0),
+ m_closePushButton(0),
+ m_outputFile(),
+ m_writer(0),
+ m_windowView(0),
+ m_outputView(0),
+ m_gsd(),
+ m_lines(0),
+ m_samples(0),
+ m_outputGeoPolygon(),
+ m_callBackDisabled(false),
+ m_annotator()
+{
+ m_widget = dynamic_cast<ossimGui::ImageScrollView*>(parent);
+
+ if ( m_widget )
+ {
+ // Listen for roi events from the annotator.
+ m_annotator.addListener((ossimROIEventListener*)this);
+
+ m_outputGeoPolygon.clear();
+
+ // Annotator will connect slots up to widget.
+ m_annotator.setImageWidget( m_widget );
+
+ buildDialog();
+
+ setView();
+
+ connect(m_widget, SIGNAL(viewChanged()), this, SLOT(syncView()));
+ }
+}
+
+ossimGui::ChipperDialog::~ChipperDialog()
+{
+ m_annotator.removeListener((ossimROIEventListener*)this);
+}
+
+void ossimGui::ChipperDialog::objectDestructingEvent(ossimObjectDestructingEvent& /* event */)
+{
+}
+
+void ossimGui::ChipperDialog::handleRectangleROIEvent( ossimROIEvent& event)
+{
+ if (event.getEventType() == ossimROIEvent::OSSIM_RECTANGLE_ROI)
+ {
+ if (event.getMovingFlag() == false)
+ {
+ // Mouse drag, update lines and samples.
+ getBounds( m_lines, m_samples );
+ }
+
+ // Update the geo rect from ROI rect.
+ updateOutputGrect();
+ updateDialog();
+ }
+}
+
+ossimGui::ChipperDialog::ErrorStatus ossimGui::ChipperDialog::errorStatus() const
+{
+ return ( m_widget && m_input.valid() && m_windowView.valid() )
+ ? ossimGui::ChipperDialog::OK : ossimGui::ChipperDialog::ERROR;
+}
+
+void ossimGui::ChipperDialog::buildDialog()
+{
+ // set title in Polygon Remapper Dialog
+ this->setWindowTitle( tr("chipper") );
+
+ this->setModal( false );
+
+ // setup vertical layout
+ QVBoxLayout* vbox0 = new QVBoxLayout();
+
+ // Row 1:
+ QGroupBox* outputImageGroupBox = new QGroupBox(tr("output image"));
+ outputImageGroupBox->setAlignment(Qt::AlignHCenter);
+ QHBoxLayout* hboxR1 = new QHBoxLayout();
+
+ // Line edit:
+ m_outputFileLineEdit = new QLineEdit();
+ hboxR1->addWidget(m_outputFileLineEdit);
+
+ // File dialog:
+ m_outputFilePushButton = new QPushButton( tr("file") );
+ m_outputFilePushButton->setAutoDefault(false);
+ hboxR1->addWidget(m_outputFilePushButton);
+
+ // Output type/writer:
+ m_outputTypeComboBox = new QComboBox();
+ hboxR1->addWidget(m_outputTypeComboBox);
+ buildOutputTypeComboBox(); // Populate the options.
+
+ // Edit writer:
+ m_editWriterPushButton = new QPushButton( tr("edit writer") );
+ m_editWriterPushButton->setAutoDefault(false);
+ hboxR1->addWidget(m_editWriterPushButton);
+
+ outputImageGroupBox->setLayout(hboxR1);
+
+ vbox0->addWidget(outputImageGroupBox);
+
+ // Row 2:
+
+ QHBoxLayout* hboxR2 = new QHBoxLayout();
+
+ // r2_col1 gsd:
+
+ QGroupBox* gsdGroupBox = new QGroupBox( tr("gsd in meters") );
+ gsdGroupBox->setAlignment(Qt::AlignHCenter);
+ QHBoxLayout* hbox_r2_c1 = new QHBoxLayout();
+ m_gsdLineEdit = new QLineEdit();
+ hbox_r2_c1->addWidget(m_gsdLineEdit);
+ gsdGroupBox->setLayout(hbox_r2_c1);
+ hboxR2->addWidget(gsdGroupBox);
+
+ // lines:
+ QGroupBox* linesGroupBox = new QGroupBox(tr("lines"));
+ linesGroupBox->setAlignment(Qt::AlignHCenter);
+ QHBoxLayout* hbox_r2_c2 = new QHBoxLayout();
+ m_linesLineEdit = new QLineEdit();
+ hbox_r2_c2->addWidget(m_linesLineEdit);
+ linesGroupBox->setLayout(hbox_r2_c2);
+ hboxR2->addWidget(linesGroupBox);
+
+ // samples:
+ QGroupBox* samplesGroupBox = new QGroupBox(tr("samples"));
+ samplesGroupBox->setAlignment(Qt::AlignHCenter);
+ QHBoxLayout* hbox_r2_c3 = new QHBoxLayout();
+ m_samplesLineEdit = new QLineEdit();
+ hbox_r2_c3->addWidget(m_samplesLineEdit);
+ samplesGroupBox->setLayout(hbox_r2_c3);
+ hboxR2->addWidget(samplesGroupBox);
+
+ // Scene rect button:
+ m_sceneRectPushButton = new QPushButton( tr("use scene rect") );
+ m_sceneRectPushButton->setAutoDefault(false);
+ hboxR2->addWidget( m_sceneRectPushButton );
+
+ vbox0->addLayout(hboxR2);
+
+ // Row 3:
+ QHBoxLayout* hboxR3 = new QHBoxLayout();
+
+ // save spec:
+ m_saveSpecFilePushButton = new QPushButton( tr("save spec file") );
+ m_saveSpecFilePushButton->setAutoDefault(false);
+ hboxR3->addWidget( m_saveSpecFilePushButton );
+
+ // save image:
+ m_saveImagePushButton = new QPushButton( tr("save image") );
+ m_saveImagePushButton->setAutoDefault(false);
+ hboxR3->addWidget( m_saveImagePushButton );
+
+ // close:
+ m_closePushButton = new QPushButton( tr("close") );
+ m_closePushButton->setAutoDefault(false);
+ hboxR3->addWidget( m_closePushButton );
+
+ vbox0->addLayout(hboxR3);
+
+ setLayout(vbox0);
+
+ // Signals and slots connections:
+ connect(m_closePushButton, SIGNAL(clicked()),
+ this, SLOT( close() ) );
+ connect(m_editWriterPushButton, SIGNAL(clicked()),
+ this, SLOT(editWriterPushButtonClicked()));
+ connect(m_gsdLineEdit, SIGNAL(returnPressed()),
+ this, SLOT(gsdLineEditReturnPressed()));
+ connect(m_linesLineEdit, SIGNAL(returnPressed()), this,
+ SLOT(linesLineEditReturnPressed()));
+ connect(m_outputFileLineEdit, SIGNAL(returnPressed()),
+ this, SLOT(outputFileLineEditReturnPressed()));
+ connect(m_outputFilePushButton, SIGNAL(clicked()),
+ this, SLOT(outputFilePushButtonClicked()));
+ connect(m_outputTypeComboBox, SIGNAL(activated(const QString&)),
+ this, SLOT(outputTypeComboBoxActivated(const QString&)));
+ connect(m_samplesLineEdit, SIGNAL(returnPressed()), this,
+ SLOT(samplesLineEditReturnPressed()));
+ connect(m_saveImagePushButton, SIGNAL(clicked()), this,
+ SLOT(runIgenPushButtonClicked()));
+ connect(m_saveSpecFilePushButton, SIGNAL(clicked()), this,
+ SLOT(saveSpecFilePushButtonClicked()));
+ connect(m_sceneRectPushButton, SIGNAL(clicked()),
+ this, SLOT(sceneRectPushButtonClicked()));
+
+} // ChipperDialog::buildDialog()
+
+void ossimGui::ChipperDialog::setView()
+{
+ if ( m_widget )
+ {
+ ossimRefPtr<ossimConnectableObject> input = m_widget->connectableObject()->getInput(0);
+ if ( input.valid() )
+ {
+ m_input = dynamic_cast<ossimImageSource*>( input.get() );
+ if ( m_input.valid() )
+ {
+ ossimRefPtr<ossimImageGeometry> geom = m_input->getImageGeometry();
+ if ( geom.valid() )
+ {
+ ossimRefPtr<ossimProjection> proj = geom->getProjection();
+ if ( proj.valid() )
+ {
+ m_windowView = proj;
+
+ //---
+ // Duplicate the view since we will change the gsd for writing purposes.
+ //---
+ ossimRefPtr<ossimProjection> obj = (ossimProjection*) m_windowView->dup();
+ m_outputView = PTR_CAST(ossimMapProjection, obj.get());
+ }
+
+ if ( (m_outputGeoPolygon.size() == 0) && m_windowView.valid())
+ {
+ // Must be first time through.
+ m_gsd = m_windowView->getMetersPerPixel();
+ setSceneBoundingRect();
+ }
+ else
+ {
+ updateRoiRect();
+ }
+ }
+ }
+ }
+ }
+
+} // End: ossimGui::ChipperDialog::setView()
+
+void ossimGui::ChipperDialog::setContainerView(ossimConnectableObject* container)
+{
+ if ( container && m_outputView.valid() )
+ {
+ // Set the resolution.
+ m_outputView->setMetersPerPixel( m_gsd );
+
+ // Snap the tie point to something that makes sense.
+ if ( m_outputView->isGeographic() )
+ {
+ // If geographic, snap to an arc second.
+ ossim_float64 arcSecond = 1.0/3600.0;
+ m_outputView->snapTiePointTo(arcSecond, OSSIM_DEGREES);
+ }
+ else
+ {
+ // If not geographic, snap the tie point to an even meter.
+ m_outputView->snapTiePointTo(1.0, OSSIM_METERS);
+ }
+
+ // Find all the views from input.
+ ossimTypeNameVisitor visitor( ossimString("ossimViewInterface"),
+ false, // firstofTypeFlag
+ (ossimVisitor::VISIT_INPUTS|
+ ossimVisitor::VISIT_CHILDREN) );
+ container->accept( visitor );
+
+ ossim_uint32 idx = 0;
+ const ossim_uint32 SIZE = visitor.getObjects().size();
+ for( idx = 0; idx < SIZE; ++idx )
+ {
+ ossimViewInterface* viewInterface = visitor.getObjectAs<ossimViewInterface>( idx );
+ if (viewInterface)
+ {
+ viewInterface->setView( m_outputView.get() );
+ }
+ }
+
+ // Lets initialize everyone else after we set all views just incase there are dependencies.
+ for( idx = 0; idx < SIZE; ++idx )
+ {
+ ossimRefPtr<ossimConnectableObject> obj =
+ visitor.getObjectAs<ossimConnectableObject>( idx );
+ if ( obj.valid() )
+ {
+ ossimRefreshEvent evt( obj.get() );
+ obj->fireEvent(evt);
+ obj->propagateEventToOutputs(evt);
+ }
+ }
+ }
+
+} // End: ossimGui::ChipperDialog::setContainerView( ... )
+
+void ossimGui::ChipperDialog::setSceneBoundingRect()
+{
+ if ( m_input.get() )
+ {
+ ossimIrect rect;
+ m_input->getBoundingRect( rect, 0 );
+ setWidgetRect( rect );
+ getBounds( m_lines, m_samples );
+ updateOutputGrect();
+ updateRoiRect();
+ }
+}
+
+void ossimGui::ChipperDialog::updateOutputGrect()
+{
+ if ( m_windowView.get() && m_widget )
+ {
+ //---
+ // First make sure the gsd is set.
+ // Later we'll want to make this in decimal degrees if the projection
+ // is geographic. This interface will need to be added to the igen dialog.
+ //---
+ m_outputView->setMetersPerPixel(m_gsd);
+
+ m_outputGeoPolygon.clear();
+
+ ossimIrect rect = m_annotator.getRoiRect();
+ ossimDpt dpt;
+ ossimGpt gpt;
+
+ // Upper left tie point from window view to ground space.
+ dpt = rect.ul();
+ m_windowView->lineSampleToWorld(dpt, gpt);
+
+ // Convert the ground point output view space.
+ m_outputView->worldToLineSample(gpt, dpt);
+
+ // Snap it to an even view point.
+ dpt.x = ossim::round<ossim_float64>(dpt.x);
+ dpt.y = ossim::round<ossim_float64>(dpt.y);
+
+ // Convert to ground point.
+ m_outputView->lineSampleToWorld(dpt, gpt);
+
+ // Add upper left.
+ m_outputGeoPolygon.addPoint(gpt);
+
+ // Add upper right
+ dpt.x += m_samples - 1;
+ m_outputView->lineSampleToWorld(dpt, gpt);
+ m_outputGeoPolygon.addPoint(gpt);
+
+ // Add lower right
+ dpt.y += m_lines - 1;
+ m_outputView->lineSampleToWorld(dpt, gpt);
+ m_outputGeoPolygon.addPoint(gpt);
+
+ // lower left
+ dpt.x -= m_samples -1;
+ m_outputView->lineSampleToWorld(dpt, gpt);
+ m_outputGeoPolygon.addPoint(gpt);
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "ossimGui::ChipperDialog::updateOutputGrect DEBUG:"
+ << "\nAnnotator rect: " << rect
+ << "\nlines: " << m_lines
+ << "\nsamples: " << m_samples
+ << "\nm_outputGeoPolygon\n" << m_outputGeoPolygon
+ << endl;
+ }
+ // updateDialog();
+
+ } // Matches: if ( m_windowView.get() && m_widget )
+
+} // End: ChipperDialog::updateOutputGrect()
+
+void ossimGui::ChipperDialog::updateRoiRect()
+{
+ if ( m_widget && m_windowView.get() && (m_outputGeoPolygon.size() == 4) )
+ {
+ ossimIrect rect;
+ ossimDpt dpt;
+
+ // upper left
+ m_windowView->worldToLineSample(m_outputGeoPolygon[0], dpt);
+ rect.set_ul(dpt);
+
+ // lower right
+ m_windowView->worldToLineSample(m_outputGeoPolygon[2], dpt);
+ rect.set_lr(dpt);
+
+ setWidgetRect(rect);
+
+ updateDialog();
+ }
+}
+
+void ossimGui::ChipperDialog::recalculateRect()
+{
+ if ( m_widget && m_windowView.get() )
+ {
+ ossimIrect rect = m_annotator.getRoiRect();
+
+ if (rect.hasNans() == false )
+ {
+ ossimDpt view_gsd = m_windowView->getMetersPerPixel();
+
+ double meters_in_line_dir = m_lines*m_gsd.y;
+ double meters_in_samp_dir = m_samples*m_gsd.x;
+
+ double view_lines = meters_in_line_dir / view_gsd.y;
+ double view_samps = meters_in_samp_dir / view_gsd.x;
+
+ ossimDpt center;
+ rect.getCenter(center);
+
+ ossimDrect drect;
+
+ // upper left
+ ossimDpt ul;
+ ul.x = center.x - (view_samps/2.0);
+ ul.y = center.y - (view_lines/2.0);
+ drect.set_ul(ul);
+
+ ossimDpt lr;
+ // lower right
+ lr.x = ul.x + view_samps-1;
+ lr.y = ul.y + view_lines-1;
+ drect.set_lr(lr);
+
+ // Now make an ossimIrect for the widget.
+ rect = drect;
+
+ setWidgetRect(rect);
+
+ // Update the stored geographic points.
+ updateOutputGrect();
+ }
+ }
+
+} // End: ChipperDialog::recalculateRect()
+
+void ossimGui::ChipperDialog::updateDialog()
+{
+ if ( m_widget && m_windowView.get() )
+ {
+ //---
+ // Since with the dialog box can trigger the callbacks set this
+ // so that the receivers of callback events don't execute.
+ //---
+ m_callBackDisabled = true;
+
+ // Set the gsd. Currently just using x value.
+ ossimString s = ossimString::toString(m_gsd.x, 4);
+ QString qs = s.c_str();
+ m_gsdLineEdit->setText(qs);
+
+ // Set the lines.
+ s = ossimString::toString(m_lines);
+ qs = s.c_str();
+ m_linesLineEdit->setText(qs);
+
+ // Set the samples.
+ s = ossimString::toString(m_samples);
+ qs = s.c_str();
+ m_samplesLineEdit->setText(qs);
+
+ // Set the output filename.
+ m_outputFileLineEdit->setText(m_outputFile.c_str());
+
+ // Enable the valueChanged event methods...
+ m_callBackDisabled = false;
+ }
+}
+
+void ossimGui::ChipperDialog::outputFilePushButtonClicked()
+{
+ QFileDialog fd(this);
+ fd.setFileMode(QFileDialog::AnyFile);
+ fd.setViewMode(QFileDialog::List);
+ // fd.setDirectory();
+
+ if ( fd.exec() )
+ {
+ QStringList fileNames = fd.selectedFiles();
+ if ( fileNames.size() )
+ {
+ QString file = fileNames.at(0);
+ m_outputFile = file.toStdString();
+
+ // This is from the dialog so update the line edit.
+ m_outputFileLineEdit->setText(file);
+ }
+ }
+}
+
+void ossimGui::ChipperDialog::saveSpecFilePushButtonClicked()
+{
+ if ( m_widget && m_outputView.valid() && m_writer.valid() )
+ {
+
+ if (m_outputFile == ossimFilename::NIL)
+ {
+ QString caption("Notice:");
+ QString text = "You must specify an output file!";
+
+ // Give the user an already open
+ QMessageBox::warning( this,
+ caption,
+ text,
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ return;
+ }
+
+ // Get the spec file name:
+ QString file;
+ QFileDialog fd(this);
+ fd.setFileMode(QFileDialog::AnyFile);
+ fd.setViewMode(QFileDialog::List);
+ // fd.setDirectory();
+
+ if ( fd.exec() )
+ {
+ QStringList fileNames = fd.selectedFiles();
+ if ( fileNames.size() )
+ {
+ file = fileNames.at(0);
+ }
+ }
+
+ if (m_outputFile.string() == file.toStdString())
+ {
+ QString caption("Notice:");
+ QString text = "Your spec file cannot be the same as the output file!";
+
+ // Give the user an already open
+ QMessageBox::warning( this,
+ caption,
+ text,
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ return;
+ }
+
+ // Update the ground rectangle in case someone changed the view.
+ updateOutputGrect();
+
+ ossimIgenGenerator* igen = new ossimIgenGenerator();
+
+ igen->setOutputPolygon(m_outputGeoPolygon);
+ m_outputView->setMetersPerPixel(m_gsd);
+
+ igen->setView(m_outputView.get());
+ igen->setInput( m_input.get() );
+
+ m_writer->setOutputName(m_outputFile);
+ igen->setOutput(m_writer.get());
+
+ igen->generateSpecList();
+ ossimKeywordlist kwl;
+ igen->getSpec(kwl, 0);
+
+ ossimFilename spec_file = file.toStdString();
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_INFO)
+ << "INFO ossimQtIgenController::saveSpecFile: Writing spec file = "
+ << spec_file << std::endl;
+ }
+
+ kwl.write(spec_file);
+
+ delete igen;
+ igen = 0;
+ }
+
+} // End: ossimGui::ChipperDialog::saveSpecFilePushButtonClicked()
+
+void ossimGui::ChipperDialog::runIgenPushButtonClicked()
+{
+ if ( errorStatus() == ossimGui::ChipperDialog::OK )
+ {
+ // Make sure the output file name has been set.
+ if (m_outputFile != ossimFilename::NIL)
+ {
+ // Check to see if file exist and prompt user for overrite.
+ bool continueRun = true;
+ if (m_outputFile.exists())
+ {
+ QString caption("Question:");
+ QString text = "Overwrite existing file: ";
+ text += m_outputFile.c_str();
+ int answer = QMessageBox::question( this,
+ caption,
+ text,
+ QMessageBox::Yes,
+ QMessageBox::No );
+ if (answer == QMessageBox::No)
+ {
+ continueRun = false;
+ }
+ }
+
+ if ( continueRun )
+ {
+ // Check the chain to make sure the output file is not one of the input files.
+ if ( !isInChain(m_outputFile) )
+ {
+ // Make a spec file
+ ossimFilename spec_file = m_outputFile;
+ spec_file.setExtension("spec");
+
+ if (m_outputFile != spec_file)
+ {
+ ossimRefPtr<const ossimConnectableObject> widgetInput = m_input.get();
+ if (widgetInput.get())
+ {
+ // Duplicate the widget's input
+ ossimRefPtr<ossimConnectableObject> writerInput =
+ duplicate(widgetInput.get());
+ if ( writerInput.valid() )
+ {
+ // Set up the view(s) in the container and sync them by firing event.
+ setContainerView(writerInput.get());
+ ossimPropertyEvent propEvt(writerInput.get());
+ writerInput->fireEvent(propEvt);
+ writerInput->propagateEventToOutputs(propEvt);
+
+ // Set the area of interest using a cutter.
+ ossimGeoPolyCutter* cutter = new ossimGeoPolyCutter;
+ cutter->setPolygon(m_outputGeoPolygon);
+ cutter->setView(m_outputView.get());
+
+ // Put the cutter into the chain at the end.
+ ossimImageChain* chain =
+ dynamic_cast<ossimImageChain*>(writerInput.get());
+ if (chain)
+ {
+ chain->addFirst(cutter);
+ }
+ else
+ {
+ return;
+ }
+
+ // Connect writer to the cutter.
+ m_writer->connectMyInputTo(0, writerInput.get());
+
+ // Set the output file.
+ m_writer->setOutputName(m_outputFile);
+
+ // Initialize.
+ m_writer->initialize();
+
+ // Make a progress dialog.
+ ossimGui::ProgressDialog* pd = new ossimGui::ProgressDialog(this);
+ pd->progressWidget()->setObject( m_writer.get() );
+
+ // pd->setMinimumDuration(250); Update 4 times a second.
+
+ //---
+ // Connect the progress dialog's signal "canceled()" up to our slot
+ // "saveCanceled()" so that we can tell the writer to abort.
+ //---
+ // connect( pd, SIGNAL(canceled()), this, SLOT(abortClicked()) );
+
+ // ossimProcessListener* pl = dynamic_cast<ossimProcessListener>(pd);
+ // if (pl)
+ // {
+ // Make the progress dialog a listener to the writer.
+ // m_writer->addListener(pl);
+ // }
+
+ // Set up the progress dialog...
+ QString qs = "Processing file ";
+ qs += m_outputFile.c_str();
+ // pd->progressWidget()->setLabelText(qs);
+ pd->show();
+
+ // Process the tile...
+ bool exceptionCaught = false;
+ try
+ {
+ m_writer->execute();
+ }
+ catch(std::exception& e)
+ {
+ pd->close();
+ QString caption = "Exception caught!\n";
+ QString text = e.what();
+ QMessageBox::information( this,
+ caption,
+ text,
+ QMessageBox::Ok );
+ exceptionCaught = true;
+ }
+ catch (...)
+ {
+ pd->close();
+ QString caption = "Unknown exception caught!\n";
+ QString text = "";
+ QMessageBox::information( this,
+ caption,
+ text,
+ QMessageBox::Ok );
+ exceptionCaught = true;
+ }
+
+ // Close and disconnect for next run.
+ m_writer->close();
+ m_writer->disconnectAllInputs();
+ cutter = 0;
+ writerInput = 0;
+
+ if (exceptionCaught)
+ {
+ removeFile();
+ }
+ // else if (pd->wasCanceled())
+ // {
+ // pd->close();
+ // removeFile();
+ // }
+
+ // if (pl)
+ // {
+ // m_writer->removeListener(pl);
+ // }
+
+ // Cleanup...
+ delete pd;
+ pd = 0;
+ if(m_outputFile.exists())
+ {
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "Add to datamanager autoload..." << endl;
+ }
+ // ossimQtAddImageFileEvent event(m_outputFile);
+ // ossimQtApplicationUtility::sendEventToRoot(this,
+ // &event);
+ }
+ }
+ }
+ }
+ else
+ {
+ QString caption("Notice:");
+ QString text = "Your output file ends with \".spec\"\n";
+ text += "Please select a new output file.";
+
+ // Give the user a warning.
+ QMessageBox::warning( this,
+ caption,
+ text,
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ m_outputFileLineEdit->setText("");
+ }
+ }
+ else
+ {
+ QString caption("Notice:");
+ QString text = "Your output file cannot be one of the input files!\n";
+ text += "Please select a new output file.";
+
+ // Give the user a warning.
+ QMessageBox::warning( this,
+ caption,
+ text,
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ m_outputFileLineEdit->setText("");
+ }
+ }
+ else
+ {
+ m_outputFileLineEdit->setText("");
+ }
+ }
+ }
+
+} // End: ChipperDialog::runIgenPushButtonClicked()
+
+void ossimGui::ChipperDialog::removeFile() const
+{
+ // 0 == success, -1 failure
+ int status = ossimFilename::remove( m_outputFile.c_str());
+
+ QString caption = "Processing of file aborted!";
+ QString text = "File: ";
+ text += m_outputFile.c_str();
+ if (status == 0)
+ {
+ text += "\nFile removed successfully...";
+ }
+
+ QMessageBox msgBox;
+ msgBox.setText( text );
+ msgBox.exec();
+
+ //QMessageBox::information( this,
+ // caption,
+ // text,
+ // QMessageBox::Ok );
+}
+
+bool ossimGui::ChipperDialog::isInChain(const ossimFilename& outputFile) const
+{
+ bool result = false;
+
+ if ( errorStatus() == ossimGui::ChipperDialog::OK )
+ {
+ // First get the keyword list for the chain.
+ ossimKeywordlist kwl;
+ m_input->saveStateOfAllInputs(kwl);
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "ossimGui::ChipperDialog::isInChain DEBUG:"
+ << "\nInput keyword list\n" << kwl
+ << "\noutputFile: " << outputFile
+ << std::endl;
+ }
+
+ // Check for filenames.
+ std::vector<ossimString> keys =
+ kwl.findAllKeysThatContains(ossimKeywordNames::FILENAME_KW);
+ ossim_uint32 index = 0;
+ for (index = 0; index < keys.size(); ++index)
+ {
+ // Find the filename for key.
+ ossimFilename f = kwl.find(keys[index]);
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "ossimGui::ChipperDialog::isInChain DEBUG:"
+ << "keys[" << index << "]: " << keys[index]
+ << "\ninput file for key: " << f << std::endl;
+ }
+
+ if (f == outputFile)
+ {
+ result = true;
+ }
+
+ if ( !result )
+ {
+ keys.clear();
+
+ // Check for overviews.
+ keys = kwl.findAllKeysThatContains(ossimKeywordNames::OVERVIEW_FILE_KW);
+ for (index = 0; index < keys.size(); ++index)
+ {
+ // Find the overview file for key.
+ f = kwl.find(keys[index]);
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "ossimGui::ChipperDialog::isInChain DEBUG:"
+ << "keys[" << index << "]: " << keys[index]
+ << "\ninput overview file for key: " << f << std::endl;
+ }
+
+ if (f == outputFile)
+ {
+ result = true;
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+
+} // End: ossimGui::ChipperDialog::isInChain( ... )
+
+ossimRefPtr<ossimConnectableObject> ossimGui::ChipperDialog::duplicate(
+ const ossimConnectableObject* obj) const
+{
+ ossimRefPtr<ossimConnectableObject> connectable = 0;
+
+ if(obj)
+ {
+ ossimKeywordlist kwl;
+ obj->saveState(kwl);
+
+ ossimRefPtr<ossimObject> tempObj =
+ ossimObjectFactoryRegistry::instance()->createObject(kwl);
+
+ if ( tempObj.valid() )
+ {
+ connectable = dynamic_cast<ossimConnectableObject*>( tempObj.get() );
+
+ if ( connectable.valid() )
+ {
+ ossimConnectableContainerInterface* inter =
+ dynamic_cast<ossimConnectableContainerInterface*>( connectable.get() );
+
+ if(inter)
+ {
+ inter->makeUniqueIds();
+ }
+ else
+ {
+ connectable->setId( ossimIdManager::instance()->generateId() );
+ }
+
+ for(ossim_uint32 i = 0; i < obj->getNumberOfInputs(); ++i)
+ {
+ if( obj->getInput(i) )
+ {
+ ossimRefPtr<ossimConnectableObject> newInput = duplicate( obj->getInput(i) );
+ if( newInput.valid() )
+ {
+ connectable->connectMyInputTo( newInput.get() );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return connectable;
+
+} // End: ossimGui::ChipperDialog::duplicate
+
+void ossimGui::ChipperDialog::gsdLineEditReturnPressed()
+{
+ if ( !m_callBackDisabled )
+ {
+ ossimString s = m_gsdLineEdit->text().toStdString();
+ m_gsd.x = s.toDouble();
+ m_gsd.y = m_gsd.x;
+ recalculateRect();
+ }
+}
+
+void ossimGui::ChipperDialog::linesLineEditReturnPressed()
+{
+ if ( !m_callBackDisabled )
+ {
+ ossimString s = m_linesLineEdit->text().toStdString();
+ m_lines = s.toUInt32();
+ recalculateRect();
+ }
+}
+
+void ossimGui::ChipperDialog::samplesLineEditReturnPressed()
+{
+ if ( !m_callBackDisabled )
+ {
+ ossimString s = m_samplesLineEdit->text().toStdString();
+ m_samples = s.toUInt32();
+ recalculateRect();
+ }
+}
+
+void ossimGui::ChipperDialog::outputFileLineEditReturnPressed()
+{
+ if ( !m_callBackDisabled )
+ {
+ m_outputFile = m_outputFileLineEdit->text().toStdString();
+ }
+}
+
+void ossimGui::ChipperDialog::sceneRectPushButtonClicked()
+{
+ setSceneBoundingRect();
+}
+
+void ossimGui::ChipperDialog::imageWidgetDestroyed()
+{
+}
+
+void ossimGui::ChipperDialog::editWriterPushButtonClicked()
+{
+ if ( m_writer.valid() )
+ {
+ PropertyEditorDialog* propEditor = new PropertyEditorDialog( this );
+ propEditor->setObject( m_writer.get() );
+ propEditor->exec();
+
+ delete propEditor;
+ propEditor = 0;
+
+ // In case user changed writer "image_type" say from tile_tiff to tiff_strip.
+ updateOutputTypeFromWriter();
+ }
+}
+
+void ossimGui::ChipperDialog::updateOutputTypeFromWriter()
+{
+ if ( m_writer.valid() && m_outputTypeComboBox )
+ {
+ ossimRefPtr<ossimProperty> imageTypeProp =
+ m_writer->getProperty( ossimString(ossimKeywordNames::IMAGE_TYPE_KW) );
+ if ( imageTypeProp.valid() )
+ {
+ if ( imageTypeProp->getName() == ossimKeywordNames::IMAGE_TYPE_KW )
+ {
+ QString imageType = imageTypeProp->valueToString().c_str();
+ if ( imageType.size() )
+ {
+ if ( imageType != m_outputTypeComboBox->currentText() )
+ {
+ // Update dialog:
+ for (int index = 0; index < m_outputTypeComboBox->count(); ++index)
+ {
+ if ( m_outputTypeComboBox->itemText(index) == imageType )
+ {
+ m_outputTypeComboBox->setCurrentIndex( index );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::ChipperDialog::outputTypeComboBoxActivated( const QString & type )
+{
+ createWriter( type );
+}
+
+void ossimGui::ChipperDialog::buildOutputTypeComboBox()
+{
+ if ( m_outputTypeComboBox )
+ {
+ m_outputTypeComboBox->clear();
+
+ std::vector<ossimString> writerList;
+ ossimImageWriterFactoryRegistry::instance()->getImageTypeList(writerList);
+
+ std::vector<ossimString>::const_iterator i = writerList.begin();
+ while (i != writerList.end())
+ {
+ QString qs = (*i).c_str();
+ m_outputTypeComboBox->addItem(qs);
+ ++i;
+ }
+
+ // Set the default output type.
+ const QString DEFAULT_WRITER_TYPE = "tiff_tiled_band_separate";
+ for (int index = 0; index < m_outputTypeComboBox->count(); ++index)
+ {
+ if (m_outputTypeComboBox->itemText(index) == DEFAULT_WRITER_TYPE)
+ {
+ m_outputTypeComboBox->setCurrentIndex( index );
+ break;
+ }
+ }
+
+ // Make a writer so the user can edit it.
+ createWriter( getWriterString() );
+ }
+
+} // End: ossimGui::ChipperDialog::buildOutputTypeComboBox()
+
+void ossimGui::ChipperDialog::createWriter(const QString& type)
+{
+ if ( m_outputTypeComboBox )
+ {
+ // Get the writer type.
+ ossimString os = type.toStdString();
+
+ // Make the writer.
+ ossimRefPtr<ossimImageFileWriter> writer =
+ ossimImageWriterFactoryRegistry::instance()->createWriter(os);
+ if ( writer.valid() )
+ {
+ if ( m_writer.valid() )
+ {
+ if (writer->getClassName() != m_writer->getClassName())
+ {
+ m_writer = writer;
+ }
+ else
+ {
+ //---
+ // Same writer but output image type may be different:
+ // Example tiff has four different output types.
+ //---
+ m_writer->setOutputImageType(writer->getOutputImageTypeString());
+
+ writer = 0; // Zero out for below code:
+ }
+ }
+ else
+ {
+ m_writer = writer;
+ }
+
+ if ( writer.valid() )
+ {
+ //---
+ // Set the writer to create overviews and a histogram as the default.
+ // The user can override this with the "edit writer" interface.
+ //---
+ m_writer->setWriteOverviewFlag(true);
+ m_writer->setWriteHistogramFlag(true);
+ }
+ }
+ }
+
+} // ossimGui::ChipperDialog::createWriter( type )
+
+QString ossimGui::ChipperDialog::getWriterString() const
+{
+ QString result = "";
+ if ( m_outputTypeComboBox )
+ {
+ result = m_outputTypeComboBox->currentText();
+ }
+ return result;
+}
+
+ossim_uint32 ossimGui::ChipperDialog::getLines() const
+{
+ ossim_uint32 result = 0;
+ if ( m_widget && m_windowView.get() )
+ {
+ ossimIrect rect = m_annotator.getRoiRect();
+ if (rect.isNan() == false )
+ {
+ double size = (rect.height() * m_windowView->getMetersPerPixel().y) / m_gsd.y;
+ result = static_cast<ossim_uint32>(floor(size));
+ }
+ }
+ return result;
+}
+
+ossim_uint32 ossimGui::ChipperDialog::getSamples() const
+{
+ ossim_uint32 result = 0;
+ if ( m_widget && m_windowView.get() )
+ {
+ ossimIrect rect = m_annotator.getRoiRect();
+ if (rect.isNan() == false )
+ {
+ double size = (rect.width() * m_windowView->getMetersPerPixel().x) / m_gsd.x;
+ result = static_cast<ossim_uint32>(floor(size));
+ }
+ }
+ return result;
+}
+
+void ossimGui::ChipperDialog::getBounds(
+ ossim_uint32& lines, ossim_uint32& samples) const
+{
+ if ( m_widget && m_windowView.get() )
+ {
+ ossimIrect rect = m_annotator.getRoiRect();
+ if (rect.isNan() == false )
+ {
+ double size = 0.0;
+ if ( m_gsd.y )
+ {
+ size = (rect.height() * m_windowView->getMetersPerPixel().y) / m_gsd.y;
+ lines = static_cast<ossim_uint32>(floor(size));
+ }
+
+ if ( m_gsd.x )
+ {
+ size = (rect.width() * m_windowView->getMetersPerPixel().x) / m_gsd.x;
+ samples = static_cast<ossim_uint32>(floor(size));
+ }
+ }
+ }
+}
+
+void ossimGui::ChipperDialog::setWidgetRect(const ossimIrect& rect)
+{
+ m_annotator.setRoiRect(rect);
+}
+
+// Slot:
+void ossimGui::ChipperDialog::syncView()
+{
+ setView();
+}
+
diff --git a/ossimGui/src/ossimGui/ConnectableDisplayObject.cpp b/ossimGui/src/ossimGui/ConnectableDisplayObject.cpp
new file mode 100644
index 0000000..093ba1d
--- /dev/null
+++ b/ossimGui/src/ossimGui/ConnectableDisplayObject.cpp
@@ -0,0 +1,46 @@
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <ossimGui/MdiSubWindowBase.h>
+
+namespace ossimGui {
+ RTTI_DEF1(ConnectableDisplayObject, "ConnectableDisplayObject", ConnectableImageObject);
+
+ ConnectableDisplayObject::ConnectableDisplayObject(MdiSubWindowBase* d)
+ :ConnectableImageObject(), m_display(d)
+ {
+ }
+ void ConnectableDisplayObject::close()
+ {
+ if(m_display)
+ {
+ bool testAtt = m_display->testAttribute(Qt::WA_DeleteOnClose);
+ m_display->close();
+ if(testAtt)
+ {
+ m_display = 0;
+ }
+ }
+ }
+
+ bool ConnectableDisplayObject::saveState(ossimKeywordlist& kwl, const char* prefix)const
+ {
+ bool result = ConnectableImageObject::saveState(kwl, prefix);
+
+ if(m_display)
+ {
+ }
+
+ return result;
+ }
+
+ bool ConnectableDisplayObject::loadState(const ossimKeywordlist& kwl, const char* prefix)
+ {
+ bool result = ConnectableImageObject::loadState(kwl, prefix);
+
+
+ if(m_display)
+ {
+ }
+
+ return result;
+ }
+}
diff --git a/ossimGui/src/ossimGui/ConnectableImageObject.cpp b/ossimGui/src/ossimGui/ConnectableImageObject.cpp
new file mode 100644
index 0000000..8afae7a
--- /dev/null
+++ b/ossimGui/src/ossimGui/ConnectableImageObject.cpp
@@ -0,0 +1,45 @@
+#include <ossimGui/ConnectableImageObject.h>
+#include <ossim/imaging/ossimImageSource.h>
+namespace ossimGui {
+ RTTI_DEF1(ConnectableImageObject, "ConnectableImageObject", ConnectableObject);
+}
+
+bool ossimGui::ConnectableImageObject::canConnectMyInputTo(ossim_int32 myInputIndex,
+ const ossimConnectableObject* object)const
+{
+ return dynamic_cast<const ossimImageSource*>(object);
+}
+
+ossimDrect ossimGui::ConnectableImageObject::getBounds()const
+{
+ ossimDrect result;
+ getBounds(result);
+ return result;
+}
+
+void ossimGui::ConnectableImageObject::getBounds(ossimDrect& result)const
+{
+ result.makeNan();
+
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < getNumberOfInputs(); ++idx)
+ {
+ const ossimImageSource* is = dynamic_cast<const ossimImageSource*> (getInput(idx));
+ if(is)
+ {
+ ossimDrect rect = is->getBoundingRect();
+ if(result.hasNans())
+ {
+ result = rect;
+ }
+ else
+ {
+ if(!rect.hasNans())
+ {
+ result.combine(rect);
+ }
+ }
+
+ }
+ }
+}
diff --git a/ossimGui/src/ossimGui/ConnectableObject.cpp b/ossimGui/src/ossimGui/ConnectableObject.cpp
new file mode 100644
index 0000000..ebbbc1c
--- /dev/null
+++ b/ossimGui/src/ossimGui/ConnectableObject.cpp
@@ -0,0 +1,29 @@
+#include <ossimGui/ConnectableObject.h>
+namespace ossimGui{
+
+RTTI_DEF1(ConnectableObject, "ConnectableObject", ossimConnectableObject);
+
+
+ bool ConnectableObject::saveState(ossimKeywordlist& kwl, const char* prefix)const
+ {
+ bool result = ossimConnectableObject::saveState(kwl, prefix);
+
+ kwl.add(ossimString(prefix)+"auto_delete", m_autoDelete);
+
+ return result;
+ }
+ bool ConnectableObject::loadState(const ossimKeywordlist& kwl, const char* prefix)
+ {
+ bool result = ossimConnectableObject::loadState(kwl, prefix);
+
+ ossimString auto_delete = kwl.find(ossimString(prefix), "auto_delete");
+
+ if(!auto_delete.empty())
+ {
+ m_autoDelete = auto_delete.toBool();
+ }
+
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/CopyChainVisitor.cpp b/ossimGui/src/ossimGui/CopyChainVisitor.cpp
new file mode 100644
index 0000000..fa63f57
--- /dev/null
+++ b/ossimGui/src/ossimGui/CopyChainVisitor.cpp
@@ -0,0 +1,28 @@
+#include <ossimGui/CopyChainVisitor.h>
+
+namespace ossimGui
+{
+ void CopyChainVisitor::reset()
+ {
+ m_currentIndex = 0;
+ m_kwl.clear();
+ ossimVisitor::reset();
+ m_kwl.add("type", "ossimConnectableContainer", true);
+ }
+ void CopyChainVisitor::visit(ossimObject* obj)
+ {
+ if(!hasVisited(obj))
+ {
+ ossimVisitor::visit(obj);
+ ossimString prefix = ossimString("object")+ossimString::toString(m_currentIndex)+".";
+ obj->saveState(m_kwl, prefix);
+ ++m_currentIndex;
+ }
+ }
+
+ ossimObject* CopyChainVisitor::newContainer()const
+ {
+ return ossimObjectFactoryRegistry::instance()->createObject(m_kwl);
+ }
+
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/DataManager.cpp b/ossimGui/src/ossimGui/DataManager.cpp
new file mode 100644
index 0000000..3f5e301
--- /dev/null
+++ b/ossimGui/src/ossimGui/DataManager.cpp
@@ -0,0 +1,1432 @@
+#include <ossimGui/DataManager.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/GatherImageViewProjTransVisitor.h>
+#include <ossimGui/IvtGeomTransform.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/MetricOverlay.h>
+#include <ossimGui/ImageWidget.h>
+#include <ossimGui/MultiImageDialog.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/base/ossimDate.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/imaging/ossimImageSourceFactoryRegistry.h>
+#include <ossim/imaging/ossimImageChain.h>
+#include <ossim/imaging/ossimImageCombiner.h>
+#include <ossim/projection/ossimProjection.h>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossim/base/ossimAdjustmentExecutive.h>
+#include <ossim/base/ossimPointObservation.h>
+#include <ossim/base/ossimObservationSet.h>
+
+#ifdef OSSIM_PLANET_ENABLED
+#include <ossimGui/PlanetMdiSubWindow.h>
+#endif
+
+#include <iostream>
+
+ossimGui::DataManager::Node::Node(ossimRefPtr<ossimObject> source, const ossimString& /* name */, const ossimString& /* description */)
+:m_object(source.get())
+{
+ setId();
+}
+
+ossimObject* ossimGui::DataManager::Node::getObject()
+{
+ return m_object.get();
+}
+
+const ossimObject* ossimGui::DataManager::Node::getObject()const
+{
+ return m_object.get();
+}
+
+void ossimGui::DataManager::Node::setObject(ossimObject* obj)
+{
+ m_object = obj;
+ setId();
+}
+
+bool ossimGui::DataManager::Node::supportsInputs()const
+{
+ bool result = false;
+ const ossimConnectableObject* connectable = getObjectAsConnectable();
+ if(connectable)
+ {
+ result = ((!connectable->getInputListIsFixedFlag())||
+ (connectable->getInputListIsFixedFlag()&&connectable->getNumberOfInputs()>0));
+ }
+
+ return result;
+}
+
+ossimConnectableObject* ossimGui::DataManager::Node::getObjectAsConnectable()
+{
+ return dynamic_cast<ossimConnectableObject*>(m_object.get());
+}
+
+const ossimConnectableObject* ossimGui::DataManager::Node::getObjectAsConnectable()const
+{
+ return dynamic_cast<const ossimConnectableObject*>(m_object.get());
+}
+
+bool ossimGui::DataManager::Node::saveState(ossimKeywordlist& kwl, const ossimString& prefix)const
+{
+ kwl.add(prefix,
+ "name",
+ m_name.toAscii().data(),
+ true);
+ kwl.add(prefix,
+ "description",
+ m_description.toAscii().data(),
+ true);
+ if(m_object.valid())
+ {
+ m_object->saveState(kwl, prefix);
+ }
+
+ return true;
+}
+
+bool ossimGui::DataManager::Node::loadState(const ossimKeywordlist& kwl, const ossimString& prefix)
+{
+ m_name = kwl.find(prefix, "name");
+ m_description = kwl.find(prefix, "description");
+
+ m_object = ossimObjectFactoryRegistry::instance()->createObject(kwl, prefix.c_str());
+ setId();
+ return m_object.valid();
+}
+
+void ossimGui::DataManager::Node::setId()
+{
+ ossimConnectableObject* connectable = getObjectAsConnectable();
+ if(connectable)
+ {
+ m_id = connectable->getId();
+ }
+}
+
+ossimGui::DataManager::DataManager()
+{
+ m_mdiArea = 0;
+ m_defaultReprojectionChainTemplate = "type:ossimImageChain\n"
+ "object0.type:ossimBandSelector\n"
+ "object5.type:ossimHistogramRemapper\n"
+ "object10.type:ossimCacheTileSource\n"
+ "object20.type:ossimImageRenderer\n"
+ "object20.max_levels_to_compute:0\n"
+ "object20.image_view_trans.type:ossimImageViewProjectionTransform\n"
+ "object30.type:ossimCacheTileSource\n"
+ "object40.type:ossimBrightnessContrastSource\n"
+ "object50.type:ossimHsiRemapper\n";
+
+ m_defaultAffineChainTemplate = "type:ossimImageChain\n"
+ "object0.type:ossimBandSelector\n"
+ "object5.type:ossimHistogramRemapper\n"
+ "object10.type:ossimCacheTileSource\n"
+ "object20.type:ossimImageRenderer\n"
+ "object20.max_levels_to_compute:0\n"
+ "object20.image_view_trans.type:ossimImageViewAffineTransform\n"
+ "object30.type:ossimCacheTileSource\n"
+ "object40.type:ossimBrightnessContrastSource\n"
+ "object50.type:ossimHsiRemapper\n";
+}
+
+bool ossimGui::DataManager::remove(ossimRefPtr<Node> obj, bool notifyFlag)
+{
+ ossimRefPtr<Callback> callback;
+ bool result = false;
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ result = removeIndexMapping(obj.get());
+ if(result)
+ {
+ NodeListType::iterator sourceIter = std::find(m_sourceList.begin(),
+ m_sourceList.end(),
+ obj.get());
+ if(sourceIter != m_sourceList.end())
+ {
+ m_sourceList.erase(sourceIter);
+ }
+ NodeListType::iterator chainIter = std::find(m_chainList.begin(),
+ m_chainList.end(),
+ obj.get());
+ if(chainIter != m_chainList.end())
+ {
+ m_chainList.erase(chainIter);
+ }
+
+ NodeListType::iterator displayIter = std::find(m_displayList.begin(),
+ m_displayList.end(),
+ obj.get());
+ if(displayIter != m_displayList.end())
+ {
+ m_displayList.erase(displayIter);
+ }
+ callback = m_callback;
+ }
+ }
+ if(result)
+ {
+ //std::cout << "ossimGui::DataManager::remove(:REMOVING " << obj->getObject()->getClassName() << std::endl;
+ if(obj->getObjectAsConnectable()) obj->getObjectAsConnectable()->disconnect();
+ if(callback.valid()&&callback->enabled()&¬ifyFlag)
+ {
+ callback->nodeRemoved(obj.get());
+ obj = 0;
+ }
+ }
+
+
+ return result;
+}
+
+bool ossimGui::DataManager::remove(NodeListType& nodes, bool notifyFlag)
+{
+ ossim_uint32 idx = 0;
+ NodeListType nodesRemoved;
+ bool result = true;
+ for(idx = 0; idx < nodes.size();++idx)
+ {
+ if(remove(nodes[idx], false))
+ {
+ nodesRemoved.push_back(nodes[idx]);
+ }
+ else
+ {
+ result = false;
+ }
+
+ }
+ if(notifyFlag)
+ {
+ ossimRefPtr<Callback> callback;
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ if(m_callback.valid()&&m_callback->enabled())
+ {
+ callback = m_callback;
+ }
+ }
+ if(callback.valid())
+ {
+ callback->nodesRemoved(nodesRemoved);
+ nodesRemoved.clear();
+ }
+ }
+
+ return result;
+}
+
+
+bool ossimGui::DataManager::nodeExists(ossimObject* obj)const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return (m_nodeMap.find(obj)!=m_nodeMap.end());
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::findNode(ossimObject* obj)
+{
+ // OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ m_mutex.lock();
+ ossimRefPtr<ossimGui::DataManager::Node> result = 0;
+
+ NodeMapType::iterator iter = m_nodeMap.find(obj);
+
+ if(iter != m_nodeMap.end())
+ {
+ result = iter->second;
+ }
+ m_mutex.unlock();
+ return result;
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::addSource(ossimRefPtr<ossimObject> obj, bool notifyFlag)
+{
+ ossimRefPtr<Node> result;
+ ossimRefPtr<Callback> callback;
+ if(obj.valid()&&!nodeExists(obj.get()))
+ {
+ QString defaultName = "";
+ QString defaultDescription = "";
+ result = new Node(obj.get());
+ // ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*> (obj.get());
+ ossimImageHandler* handler = dynamic_cast<ossimImageHandler*> (obj.get());
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (obj.get());
+ if(handler)
+ {
+ defaultName = " Entry " + ossimString::toString(handler->getCurrentEntry())+ ": " + ossimString(handler->getFilename());
+ }
+ else
+ {
+ defaultName = obj->getClassName().c_str();
+ }
+
+ result->setName(defaultName);
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ if(handler)
+ {
+ m_sourceList.push_back(result.get());
+ }
+ else if(chain)
+ {
+ m_chainList.push_back(result.get());
+ }
+ else if(dynamic_cast<ConnectableDisplayObject*> (obj.get()))
+ {
+ m_displayList.push_back(result.get());
+ }
+ else
+ {
+ m_sourceList.push_back(result.get());
+ }
+ addIndexMapping(result.get());
+ if(m_callback.valid()&&m_callback->enabled()&¬ifyFlag)
+ {
+ callback = m_callback;
+ }
+ }
+ }
+ if(result.valid()&&callback.valid())
+ {
+ callback->nodeAdded(result.get());
+ }
+ return result.get();
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createDefaultImageChain(ossimRefPtr<Node> input, bool notifyFlag)
+{
+ ossimRefPtr<Node> result;
+ ossimConnectableObject* connectableInput = input->getObjectAsConnectable();
+ ossimRefPtr<Callback> callback;
+
+ if(connectableInput)
+ {
+ ossimImageSource* source = dynamic_cast<ossimImageSource*> (input->getObjectAsConnectable());
+ if(source)
+ {
+ ossimRefPtr<ossimImageGeometry> geom = source->getImageGeometry();
+ if(geom.valid()&&geom->getProjection())
+ {
+ result = createChainFromTemplate(m_defaultReprojectionChainTemplate, input.get(), false);
+ result->setName("Reprojection Chain:" + input->name());
+ }
+ else
+ {
+ result = createChainFromTemplate(m_defaultAffineChainTemplate, input.get(), false);
+ result->setName("Affine Chain:" + input->name());
+ }
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ callback = m_callback;
+ }
+ }
+
+ }
+ if(callback.valid()&&callback->enabled()&¬ifyFlag)
+ {
+ callback->nodeAdded(result.get());
+ }
+ return result.get();
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createChainFromTemplate(const ossimString& templatChain,
+ ossimRefPtr<Node> input,
+ bool notifyFlag)
+{
+ ossimKeywordlist kwl;
+
+ if(kwl.parseString(templatChain))
+ {
+ return createChainFromTemplate(kwl, input.get(), notifyFlag);
+ }
+
+ return 0;
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createChainFromTemplate(const ossimKeywordlist& templatChain,
+ ossimRefPtr<Node> input,
+ bool notifyFlag)
+{
+ ossimRefPtr<Node> result;
+ ossimConnectableObject* connectableInput = input->getObjectAsConnectable();
+ ossimRefPtr<Callback> callback;
+
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(templatChain);
+ if(obj.valid())
+ {
+ ossimRefPtr<ossimConnectableObject> connectable = dynamic_cast<ossimConnectableObject*> (obj.get());
+ connectable->connectMyInputTo(connectableInput);
+ result = new Node(connectable.get());
+
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ m_chainList.push_back(result.get());
+ addIndexMapping(result.get());
+
+ result->setName(input->name());
+ callback = m_callback;
+ }
+ }
+ if(callback.valid()&&callback->enabled()&¬ifyFlag)
+ {
+ callback->nodeAdded(result.get());
+ }
+
+ return result.get();
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createDefaultCombinerChain(const ossimString& combinerType, NodeListType& nodeList, bool notifyFlag)
+{
+ ossimRefPtr<Node> result;
+ ossimRefPtr<ossimImageSource> obj = ossimImageSourceFactoryRegistry::instance()->createImageSource(combinerType);
+ ossimRefPtr<ossimImageCombiner> combinerObj = dynamic_cast<ossimImageCombiner*>(obj.get());
+ ossimRefPtr<Callback> callback;
+ if(combinerObj.valid())
+ {
+ // we will need to make the combiner chain a template as well and remove from here
+ ossimString combinerChain =
+ "type:ossimImageChain\n"
+ "object0.type:ossimBandSelector\n"
+ "object5.type:ossimHistogramRemapper\n"
+ "object40.type:ossimBrightnessContrastSource\n"
+ "object50.type:ossimHsiRemapper\n";
+
+ ossimKeywordlist kwl;
+ if(kwl.parseString(combinerChain))
+ {
+ ossimRefPtr<ossimImageSource> chainObj = ossimImageSourceFactoryRegistry::instance()->createImageSource(kwl);
+ if(chainObj.valid())
+ {
+ ossimRefPtr<ossimImageChain> chain = dynamic_cast<ossimImageChain*> (chainObj.get());
+ if(chain.valid())
+ {
+ chain->addLast(combinerObj.get());
+ result = new Node(chain.get());
+ m_chainList.push_back(result.get());
+ result->setName(combinerType.c_str());
+ addIndexMapping(result.get());
+ if(!nodeList.empty())
+ {
+ NodeListType::iterator iter = nodeList.begin();
+ while(iter!=nodeList.end())
+ {
+ if((*iter)->getObject())
+ {
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ chain->connectMyInputTo(connectable);
+ }
+ }
+ ++iter;
+ }
+ }
+ if(m_callback.valid()&&m_callback->enabled()&¬ifyFlag)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ callback = m_callback.get();
+ }
+ }
+ }
+ }
+ }
+ if(result.valid())
+ {
+ if(callback.valid())
+ {
+ callback->nodeAdded(result.get());
+ }
+ }
+ return result;
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createDefault2dImageDisplay(ossimRefPtr<Node> input, bool notifyFlag)
+{
+ ImageMdiSubWindow* display = new ImageMdiSubWindow();
+ ossimRefPtr<ossimGui::DataManager::Node> result = addSource(display->connectableObject(), notifyFlag);
+ if(m_mdiArea)
+ {
+ m_mdiArea->addSubWindow(display);
+ }
+
+ // Connect input
+ if(display->connectableObject()&&input.valid()&&input->getObjectAsConnectable())
+ {
+ display->connectableObject()->connectMyInputTo(0, input->getObjectAsConnectable());
+ }
+
+ // Set title
+ if(result.valid())
+ {
+ ossimConnectableObject* connectable = result->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ if(!visitor.getObjects().empty())
+ {
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+ ossimString source = input->getFilename();
+ QString windowTitle = QFontMetrics(QFont()).elidedText
+ (source.data(), Qt::ElideLeft, display->width()-100);
+ display->setWindowTitle(windowTitle);
+ }
+ }
+ else
+ {
+ display->setWindowTitle(result->name());
+ }
+ }
+
+ // Set the current mode for the new display
+ display->scrollWidget()->setExploitationMode(m_exploitationMode);
+
+ return result.get();
+}
+
+ossimRefPtr<ossimGui::DataManager::Node> ossimGui::DataManager::createDefault3dPlanetaryDisplay(bool notifyFlag)
+{
+#ifdef OSSIM_PLANET_ENABLED
+ PlanetMdiSubWindow* display = new PlanetMdiSubWindow();
+ if(m_mdiArea)
+ {
+ m_mdiArea->addSubWindow(display);
+ }
+ ossimRefPtr<ossimGui::DataManager::Node> result = addSource(display->connectableObject(), notifyFlag);
+ if(result.valid())
+ {
+ result->setName("Planetary Viewer");
+ display->setWindowTitle("Planetary Viewer");
+ }
+ display->show();
+ return result.get();
+#else
+ return 0;
+#endif
+}
+
+void ossimGui::DataManager::accept(ossimVisitor& visitor)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ NodeListType::iterator iter = m_sourceList.begin();
+ while(iter != m_sourceList.end())
+ {
+ (*iter)->accept(visitor);
+ ++iter;
+ }
+
+ iter = m_chainList.begin();
+ while(iter != m_chainList.end())
+ {
+ (*iter)->accept(visitor);
+
+ ++iter;
+ }
+ iter = m_displayList.begin();
+ while(iter != m_displayList.end())
+ {
+ (*iter)->accept(visitor);
+
+ ++iter;
+ }
+}
+
+void ossimGui::DataManager::print()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx =0; idx < m_sourceList.size();++idx)
+ {
+ std::cout << "Name: " << m_sourceList[idx]->name().toAscii().data() << std::endl;
+ }
+
+ for(idx=0;idx < m_chainList.size();++idx)
+ {
+ std::cout << "Name: " << m_chainList[idx]->name().toAscii().data() << std::endl;
+ }
+ for(idx=0;idx < m_displayList.size();++idx)
+ {
+ std::cout << "Name: " << m_displayList[idx]->name().toAscii().data() << std::endl;
+ }
+
+}
+
+void ossimGui::DataManager::clear(bool notifyFlag)
+{
+ ossimRefPtr<Callback> callback;
+ NodeListType removedNodes;
+ {
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+
+ removedNodes.insert(removedNodes.end(), m_sourceList.begin(), m_sourceList.end());
+ removedNodes.insert(removedNodes.end(), m_chainList.begin(), m_chainList.end());
+ removedNodes.insert(removedNodes.end(), m_displayList.begin(), m_displayList.end());
+ m_sourceList.clear();
+ m_chainList.clear();
+ m_displayList.clear();
+ }
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < removedNodes.size(); ++idx)
+ {
+ remove(removedNodes[idx],false);
+ }
+ if(m_callback.valid()&&m_callback->enabled()&¬ifyFlag)
+ {
+ callback = m_callback;
+ }
+ }
+ if(callback.valid())
+ {
+ callback->nodesRemoved(removedNodes);
+ }
+ ossim_uint32 idx = 0;
+ // disconnect outside the scope lock for there might be a call to the remove from outside this interface
+ for(idx = 0; idx < removedNodes.size(); ++idx)
+ {
+ ossimConnectableObject* connectable = removedNodes[idx]->getObjectAsConnectable();
+ if(connectable) connectable->disconnect();
+ }
+}
+
+bool ossimGui::DataManager::saveState(ossimKeywordlist& kwl, const ossimString& prefix)const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+
+ kwl.add(prefix,
+ "type",
+ "DataManager",
+ true);
+ ossimString nodePrefix = prefix + "objectList.object";
+ ossim_uint32 idx = 0;
+ ossim_uint32 nodeIdx = 0;
+ for(idx =0; idx < m_sourceList.size();++idx)
+ {
+ ossimString nodeNumberPrefix = nodePrefix + ossimString::toString(nodeIdx) + ".";
+ m_sourceList[idx]->saveState(kwl, nodeNumberPrefix);
+ ++nodeIdx;
+ }
+
+ for(idx=0;idx < m_chainList.size();++idx)
+ {
+ ossimString nodeNumberPrefix = nodePrefix + ossimString::toString(nodeIdx) + ".";
+ m_chainList[idx]->saveState(kwl, nodeNumberPrefix);
+
+ ++nodeIdx;
+ }
+ for(idx=0;idx < m_displayList.size();++idx)
+ {
+ ossimString nodeNumberPrefix = nodePrefix + ossimString::toString(nodeIdx) + ".";
+ m_displayList[idx]->saveState(kwl, nodeNumberPrefix);
+
+ ++nodeIdx;
+ }
+ return true;
+}
+
+bool ossimGui::DataManager::loadState(const ossimKeywordlist& kwl, const ossimString& prefix)
+{
+ bool result = true;
+ NodeListType nodes;
+
+ ossimRefPtr<Callback> callback;
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ if(m_callback.valid()&&m_callback->enabled())
+ {
+ callback = m_callback;
+ }
+ ossimString copyPrefix = prefix;
+ ossimString type = kwl.find(copyPrefix, "type");
+ ossimString regExpression = ossimString("^(") + copyPrefix + "objectList.object[0-9]+.)";
+ std::vector<ossimString> nodeKeys;
+ kwl.getSubstringKeyList( nodeKeys, regExpression );
+ ossim_uint32 nNodes = nodeKeys.size();
+ ossim_uint32 nodeKeyOffset = (copyPrefix.size()+ossimString("objectList.object").size());
+ std::vector<ossim_uint32> nodeKeyIndices(nNodes);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nodeKeyIndices.size();++idx)
+ {
+ ossimString numberStr(nodeKeys[idx].begin() + nodeKeyOffset,
+ nodeKeys[idx].end());
+ nodeKeyIndices[idx] = numberStr.toInt();
+ }
+ std::sort(nodeKeyIndices.begin(), nodeKeyIndices.end());
+
+
+ // first allocate the nodes before we can connect them
+ //
+ for(idx=0;((idx < nodeKeyIndices.size())&&result);++idx)
+ {
+ ossimString newPrefix = copyPrefix;
+ newPrefix += ossimString("objectList.object");
+ newPrefix += ossimString::toString(nodeKeyIndices[idx]);
+ newPrefix += ossimString(".");
+
+ ossimRefPtr<Node> node = new Node();
+ if(node->loadState(kwl, newPrefix))
+ {
+ nodes.push_back(node.get());
+ if(node->supportsInputs())
+ {
+ if(dynamic_cast<ConnectableDisplayObject*> (node->getObject()))
+ {
+ m_displayList.push_back(node.get());
+ }
+ else
+ {
+ m_chainList.push_back(node.get());
+ }
+
+ }
+ else
+ {
+ m_sourceList.push_back(node.get());
+ }
+ addIndexMapping(node.get());
+ }
+ else
+ {
+ result = false;
+ }
+
+ }
+ if(result)
+ {
+ for(idx = 0; idx < nodeKeyIndices.size();++idx)
+ {
+ ossimRefPtr<ossimConnectableObject> connectable = nodes[idx]->getObjectAsConnectable();
+ if(connectable.valid())
+ {
+ if(nodes[idx]->supportsInputs())
+ {
+ ossimString newPrefix = copyPrefix;
+ newPrefix += ossimString("objectList.object");
+ newPrefix += ossimString::toString(nodeKeyIndices[idx]);
+ newPrefix += ossimString(".");
+ std::vector<ossimId> ids;
+ findInputConnectionIds(ids, kwl, newPrefix);
+ if(ids.size())
+ {
+ ossim_uint32 idsIndex = 0;
+ for(idsIndex = 0; idsIndex < ids.size(); ++idsIndex)
+ {
+ ossimRefPtr<Node> inputNode = findNodeNoMutex(ids[idsIndex]);
+ if(inputNode.valid())
+ {
+ ossimRefPtr<ossimConnectableObject> inputConnectable = inputNode->getObjectAsConnectable();
+ if(inputConnectable.valid())
+ {
+ connectable->connectMyInputTo(inputConnectable.get());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if(!nodes.empty()&&callback.valid())
+ {
+ callback->nodesAdded(nodes);
+ }
+ return result;
+}
+
+bool ossimGui::DataManager::removeIndexMapping(Node* node)
+{
+ bool objectFound = false;
+ NodeMapType::iterator nodeMapIter=m_nodeMap.find(node->getObject());
+ if(nodeMapIter!=m_nodeMap.end())
+ {
+ objectFound = true;
+ m_nodeMap.erase(nodeMapIter);
+ }
+ NodeIdMapType::iterator idMapIter=m_idMap.find(node->id());
+ if(idMapIter!=m_idMap.end())
+ {
+ objectFound = true;
+ m_idMap.erase(idMapIter);
+ }
+
+ return objectFound;
+}
+ossimGui::DataManager::Node* ossimGui::DataManager::findNode(const ossimId& id)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return findNodeNoMutex(id);
+}
+
+ossimGui::DataManager::Node* ossimGui::DataManager::findNodeNoMutex(const ossimId& id)
+{
+ Node* result = 0;
+ NodeIdMapType::iterator idMapIter=m_idMap.find(id);
+
+ if(idMapIter != m_idMap.end())
+ {
+ result = idMapIter->second.get();
+ }
+
+ return result;
+}
+
+void ossimGui::DataManager::addIndexMapping(Node* node)
+{
+ if(node)
+ {
+ m_idMap.insert(std::make_pair(node->id(), node));
+ m_nodeMap.insert(std::make_pair(node->getObject(), node));
+ }
+}
+
+void ossimGui::DataManager::findInputConnectionIds(std::vector<ossimId>& result,
+ const ossimKeywordlist& kwl,
+ const ossimString& prefix)
+{
+ ossimString copyPrefix = prefix;
+ ossim_uint32 idx = 0;
+
+ ossimString regExpression = ossimString("^") + ossimString(prefix) + "input_connection[0-9]+";
+ vector<ossimString> keys =
+ kwl.getSubstringKeyList( regExpression );
+
+ ossim_int32 offset = (ossim_int32)(copyPrefix+"input_connection").size();
+ ossim_uint32 numberOfKeys = (ossim_uint32)keys.size();
+ std::vector<int> numberList(numberOfKeys);
+ for(idx = 0; idx < numberList.size();++idx)
+ {
+ ossimString numberStr(keys[idx].begin() + offset,
+ keys[idx].end());
+ numberList[idx] = numberStr.toInt();
+ }
+ std::sort(numberList.begin(), numberList.end());
+ copyPrefix += ossimString("input_connection");
+ for(idx=0;idx < numberList.size();++idx)
+ {
+ const char* lookup = kwl.find(copyPrefix,ossimString::toString(numberList[idx]));
+ if(lookup)
+ {
+ ossim_int64 id = ossimString(lookup).toInt64();
+ result.push_back(ossimId(id));
+ }
+ }
+}
+
+void ossimGui::DataManager::setExploitationMode(int expMode)
+{
+ m_exploitationMode = static_cast<ExploitationModeType> (expMode);
+
+ for(ossim_uint32 idx = 0; idx < m_displayList.size();++idx)
+ {
+ ConnectableDisplayObject* displayObj = m_displayList[idx]->getObjectAs<ConnectableDisplayObject>();
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ subWindow->scrollWidget()->setExploitationMode(expMode);
+ }
+ }
+}
+
+void ossimGui::DataManager::setAutoMeasActive(const bool state)
+{
+ for(ossim_uint32 idx = 0; idx < m_displayList.size();++idx)
+ {
+ ConnectableDisplayObject* displayObj = m_displayList[idx]->getObjectAs<ConnectableDisplayObject>();
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ subWindow->scrollWidget()->setAutoMeasActive(state);
+ }
+ }
+}
+
+void ossimGui::DataManager::syncImagesTo(ossimRefPtr<DataManager::Node> node)
+{
+ ConnectableDisplayObject* displayObj = node->getObjectAs<ConnectableDisplayObject>();
+
+ // Get point from sync image
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ ossimDpt vp = subWindow->scrollWidget()->getLastClickedPoint();
+ syncImagesTo(vp, node);
+ }
+}
+
+
+void ossimGui::DataManager::syncImagesTo(const ossimDpt& sp, ossimRefPtr<DataManager::Node> node)
+{
+ ConnectableDisplayObject* displayObj = node->getObjectAs<ConnectableDisplayObject>();
+ ossim_uint32 idxLayer = 0;
+ ossimGpt gp;
+ gp.makeNan();
+
+ // Get the ground point
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ ossimImageSource* src = subWindow->scrollWidget()->layers()->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ivtg->viewToGround(sp, gp);
+ if (gp.isHgtNan())
+ {
+ ossim_float64 hgt =
+ ossimElevManager::instance()->getHeightAboveEllipsoid(gp);
+ gp.height(hgt);
+ }
+ }
+ }
+ }
+
+ // Reproject and move all images to sync point
+ if (!gp.hasNans())
+ {
+ for(ossim_uint32 idx = 0; idx < m_displayList.size(); ++idx)
+ {
+ ConnectableDisplayObject* displayObj =
+ m_displayList[idx]->getObjectAs<ConnectableDisplayObject>();
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ ossimImageSource* src = subWindow->scrollWidget()->layers()->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ossimDpt vp;
+ subWindow->getImageActions()->fullRes();
+ ivtg->groundToView(gp, vp);
+ subWindow->scrollWidget()->setPositionGivenView(vp);
+ subWindow->scrollWidget()->setLastClickedPoint(vp);
+
+ // ossimDpt ip;
+ // ivtg->viewToImage(vp, ip);
+ // std::cout<<"\n ...set position to "<<ip<<std::endl;
+ }
+ }
+ }
+ }
+ }
+}
+
+
+bool ossimGui::DataManager::setAutoMeasureResults(NodeListType& nodes,
+ ossimTieMeasurementGeneratorInterface* tGen)
+{
+ bool measOK = true;
+ ossim_uint32 idxLayer = 0;
+
+ ConnectableDisplayObject* displayObj;
+ ImageMdiSubWindow* subWindow;
+
+ // Load ossimImageSource vector
+ std::vector<ossimImageSource*> src;
+ NodeListType::iterator iter = nodes.begin();
+ while(iter != nodes.end())
+ {
+ displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+ subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ src.push_back(subWindow->scrollWidget()->layers()->layer(idxLayer)->chain());
+ ++iter;
+ }
+
+ // Load measurements
+ ossimRefPtr<IvtGeomTransform> ivtg;
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ ossimDpt scenePoint;
+ RegistrationOverlay* currentOverlay;
+ for (int m=0; m<tGen->numMeasurements(); ++m)
+ {
+ // Create column for point in table
+ m_miDialog->addObsPoint();
+
+ // Add measurements to current column
+ int img = 0;
+ iter = nodes.begin();
+ while(iter != nodes.end())
+ {
+ currentOverlay = regOverlayForNode(*iter);
+ src[img]->accept(visitor);
+ ivtg = visitor.getTransformList()[0].get();
+
+ ossimDpt pt = tGen->pointIndexedAt(img,m);
+// std::cout<<"measx "<<m<<", img "<<img<<" = "<<pt<<endl;
+ if (!pt.hasNans())
+ {
+ ivtg->imageToView(pt, scenePoint);
+ currentOverlay->addPoint(scenePoint, pt);
+ }
+
+ ++img;
+ ++iter;
+ }
+ }
+
+ return measOK;
+}
+
+
+bool ossimGui::DataManager::intersectRays(NodeListType& nodes)
+{
+ bool intersectionOK;
+ ostringstream report;
+
+ DptSet_t measSet;
+ NodeListType::iterator iter = nodes.begin();
+ std::vector<ossimRefPtr<ossimProjection> > proj;
+ m_imgSet = new ossimSensorModelTuple();
+
+ int kk = 0;
+ ossim_uint32 idxLayer = 0;
+ ossimDpt imgPt;
+
+ report<<"\nSingle-ray..."<<endl;
+
+ while(iter != nodes.end())
+ {
+ bool isActive = false;
+ MetricOverlay* currentOverlay = metOverlayForNode(*iter);
+
+ // Get current point
+ if (currentOverlay->getImgPoint(currentOverlay->getCurrentId(), imgPt, isActive))
+ {
+
+ if (isActive)
+ {
+
+ ConnectableDisplayObject* displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ ossimImageSource* src = subWindow->scrollWidget()->layers()->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+
+ if (visitor.getTransformList().size() == 1)
+ {
+ // Transform to true image coordinates and populate measurement set
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ // Save coordinates
+ measSet.push_back(imgPt);
+
+ // Single-ray drop comparison
+ ossimGpt gp;
+ ivtg->imageToGround(imgPt, gp);
+ report<<" Image "<<kk+1<<": "<<gp<<endl;
+ }
+
+ // Populate sensor model set
+ ossimRefPtr<ossimImageGeometry> geom = ivtg->getGeom();
+ if (geom != NULL)
+ {
+ proj.push_back(geom->getProjection());
+ if (proj.back() != NULL)
+ {
+ ossimSensorModel* m = dynamic_cast<ossimSensorModel*>(proj.back().get());
+ if(m)
+ {
+ m_imgSet->addImage(m);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
+ ++iter;
+ ++kk;
+ }
+
+ ossimEcefPoint intECF;
+ NEWMAT::Matrix covMat(3,3);
+
+ // Execute multi-ray intersection solution
+ ossimSensorModelTuple::IntersectStatus stat = m_imgSet->intersect(measSet, intECF, covMat);
+
+ ossimGpt intG(intECF);
+ double dh = ossimGeoidManager::instance()->offsetFromEllipsoid(intG);
+ double hgtMSL = intG.height() - dh;
+
+ ossimString statS;
+ if (stat==0)
+ {
+ statS = "OPERATION_SUCCESS";
+ intersectionOK = true;
+ }
+ else if (stat==1)
+ {
+ statS = "ERROR_PROP_UNAVAILABLE";
+ intersectionOK = true;
+ }
+ else
+ {
+ statS = "OPERATION_FAIL";
+ intersectionOK = false;
+ }
+
+ report << "\nMulti-ray..." << std::endl;
+
+ if (stat==0 || stat==1)
+ {
+ report << setprecision(15);
+ report << " Position: (" << intG.latd() << ", " << intG.lond() << ") DD" << std::endl;
+ report << setprecision(3);
+ report << " HAE: " << intG.height() << " m" << std::endl;
+ report << " MSL: " << hgtMSL << " m" << std::endl;
+ report << setprecision(1);
+ report << " ECEF: (" << intECF[0] << ", " << intECF[1] << ", " << intECF[2] << ") m" << std::endl;
+ }
+ report << "\n Status: " << statS << std::endl;
+
+ m_miDialog->setPointPositionContent(report.str());
+
+ delete m_imgSet;
+ return intersectionOK;
+}
+
+
+bool ossimGui::DataManager::clearCurrentPoint(NodeListType& nodes)
+{
+ bool clearOK = true;
+ NodeListType::iterator iter = nodes.begin();
+
+ while(iter != nodes.end())
+ {
+ MetricOverlay* currentOverlay = metOverlayForNode(*iter);
+ currentOverlay->reset();
+
+ ++iter;
+ }
+
+ return clearOK;
+}
+
+
+bool ossimGui::DataManager::loadImageGeometries(NodeListType& nodes)
+{
+ bool status = true;
+ m_imgGeoms.clear();
+ NodeListType::iterator iter = nodes.begin();
+ while(iter != nodes.end())
+ {
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+ ossimRefPtr<ossimImageGeometry> geom = new ossimImageGeometry(*input->getImageGeometry());
+ m_imgGeoms.push_back(geom);
+ }
+ ++iter;
+ }
+ return status;
+}
+
+
+bool ossimGui::DataManager::saveImageGeometries(NodeListType& nodes)
+{
+ bool status = true;
+ NodeListType::iterator iter = nodes.begin();
+ ossim_uint32 k = 0;
+
+ ossimLocalTm stamp;
+ stamp.now();
+ ostringstream tmp;
+ int fmt = ossimLocalTm::ossimLocalTmFormatDMY|
+ ossimLocalTm::ossimLocalTmFormatMonText|
+ ossimLocalTm::ossimLocalTmFormatPadMon|
+ ossimLocalTm::ossimLocalTmFormatYearShort;
+ tmp<<"GeoCell_";
+ stamp.printDate(tmp, fmt);
+ tmp<<"_";
+ stamp.printTime(tmp);
+ string adjTag(tmp.str());
+
+ while(iter != nodes.end())
+ {
+ // Skip control image
+ if (!regOverlayForNode(*iter)->isControlImage())
+ {
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+ input->setImageGeometry(m_imgGeoms[k].get());
+
+ ossimAdjustableParameterInterface* iface = input->getImageGeometry()->getAdjustableParameterInterface();
+ if (iface != NULL)
+ {
+ iface->setAdjustmentDescription(adjTag);
+ }
+ }
+ }
+ ++iter;
+ ++k;
+ }
+ return status;
+}
+
+
+bool ossimGui::DataManager::registerImages(NodeListType& nodes)
+{
+ bool solutionOK = false;
+ bool useRegistration = true;
+
+ ossimObservationSet obsSet;
+
+ ossimString id;
+ ossimColumnVector3d gSigmas;
+ ossimGpt gp;
+
+ // Load copies of current image geometries
+ loadImageGeometries(nodes);
+
+ // Load the observation set
+ for (ossim_uint32 obs=0; obs<m_miDialog->getNumObs(); ++obs)
+ {
+ id = m_miDialog->getIdByIndex(obs);
+ ossimDpt imgPt;
+
+ // Initialize ground point
+ gp.makeNan();
+ gSigmas[0] = 50;
+ gSigmas[1] = 50;
+ gSigmas[2] = 50;
+
+ ossimRefPtr<ossimPointObservation> pt = new ossimPointObservation(gp, id, gSigmas);
+
+ // Iterate over nodes to get image measurements
+ NodeListType::iterator iter = nodes.begin();
+ while(iter != nodes.end())
+ {
+ bool isActive = false;
+ RegistrationOverlay* currentOverlay = regOverlayForNode(*iter);
+
+ if (currentOverlay->getImgPoint(id, imgPt, isActive))
+ {
+ if (isActive)
+ {
+ // Get image handler
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ ossimRefPtr<ossimImageHandler> input =
+ dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+ if ( input.valid() )
+ {
+ // If control, set ground coordinates and reset sigmas
+ if (currentOverlay->isControlImage())
+ {
+ // Point drop to get control coordinates
+ ossimGpt worldPt;
+ input->getImageGeometry()->localToWorld(imgPt, worldPt);
+ if (worldPt.isHgtNan())
+ {
+ ossim_float64 hgt =
+ ossimElevManager::instance()->getHeightAboveEllipsoid(worldPt);
+ worldPt.height(hgt);
+ }
+ pt->Gpt() = worldPt;
+
+ // TODO Tighten up control sigmas
+ pt->setGroundSigmas(1,1,1);
+ }
+ else
+ {
+ // Get image filename
+ ossimFilename filename = input->getFilename().expand();
+
+ // Add measurement to point observation
+ pt->addMeasurement(imgPt, filename);
+ }
+ }
+ }
+ }
+ }
+
+ ++iter;
+ }
+
+ // Add point observation to set
+ if (pt->numMeas() > 0)
+ {
+ obsSet.addObservation(pt);
+ }
+ }
+
+
+ // Set image geometries prior to adjustment
+ if (useRegistration)
+ {
+ NodeListType::iterator iter = nodes.begin();
+ ossim_uint32 k = 0;
+ while(iter != nodes.end())
+ {
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+
+ if(input.valid())
+ {
+ ossimFilename filename = input->getFilename().expand();
+
+ for (ossim_uint32 i=0; i<obsSet.numImages(); ++i)
+ {
+ if (filename == obsSet.imageFile(i))
+ {
+ // If control image, lock all parameters (TODO not needed if image removed?)
+ if (regOverlayForNode(*iter)->isControlImage())
+ {
+ ossimAdjustableParameterInterface* iface = m_imgGeoms[k]->getAdjustableParameterInterface();
+ if (iface != NULL)
+ {
+ iface->lockAllParametersCurrentAdjustment();
+ }
+ }
+
+ obsSet.setImageGeom(i, m_imgGeoms[k].get());
+ }
+ }
+ }
+
+ }
+ ++iter;
+ ++k;
+ }
+ }
+
+
+ // std::cout<<"\nObservation Summary...";
+ ossim_uint32 idx = 0;
+ for (ossim_uint32 no=0; no<obsSet.numObs(); ++no)
+ {
+ // std::cout<<"\n Obs: "<<no+1;
+ for (ossim_uint32 meas=0; meas<obsSet.observ(no)->numMeas(); ++meas)
+ {
+ NEWMAT::Matrix coords(1,2);
+ obsSet.observ(no)->getMeasurement(meas, coords);
+ ++idx;
+ // std::cout<<"\n Meas: "<<imIdx+1<<" "<<coords(1,1)<<","<<coords(1,2);
+ }
+ }
+
+ ostringstream report;
+ ossimAdjustmentExecutive adjExec(report);
+
+ if (adjExec.initializeSolution(obsSet))
+ {
+ if (adjExec.isValid())
+ {
+ solutionOK = adjExec.runSolution();
+ adjExec.summarizeSolution();
+ }
+ }
+
+ m_miDialog->setRegistrationReportContent(report.str());
+
+ return solutionOK;
+}
+
+
+bool ossimGui::DataManager::resetMode(NodeListType& /* nodes */)
+{
+ return true;
+}
+
+
+bool ossimGui::DataManager::resetAdj(NodeListType& nodes)
+{
+ NodeListType::iterator iter = nodes.begin();
+
+ while(iter != nodes.end())
+ {
+ ossimConnectableObject* connectable = (*iter)->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ if(visitor.getObjects().size() > 0)
+ {
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+
+ if(input.valid())
+ {
+ ossimRefPtr<ossimImageGeometry> geom = input->getImageGeometry();
+ if(geom.valid())
+ {
+ ossimAdjustableParameterInterface* adjustableParamterInterface =
+ geom->getAdjustableParameterInterface();
+
+ if(adjustableParamterInterface)
+ {
+ adjustableParamterInterface->setDirtyFlag(true);
+ adjustableParamterInterface->eraseAdjustment(true);
+ if(adjustableParamterInterface->getNumberOfAdjustments() < 1)
+ {
+ adjustableParamterInterface->initAdjustableParameters();
+ }
+ }
+ }
+ }
+ }
+ }
+ ++iter;
+ }
+ return true;
+}
+
+ossimGui::RegistrationOverlay* ossimGui::DataManager::regOverlayForNode(ossimRefPtr<Node> node)
+{
+ RegistrationOverlay* regOverlay = 0;
+
+ ConnectableDisplayObject* displayObj = node->getObjectAs<ConnectableDisplayObject>();
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ regOverlay = subWindow->scrollWidget()->regOverlay();
+ }
+
+ return regOverlay;
+}
+
+ossimGui::MetricOverlay* ossimGui::DataManager::metOverlayForNode(ossimRefPtr<Node> node)
+{
+ ossimGui::MetricOverlay* metOverlay = 0;
+
+ ConnectableDisplayObject* displayObj = node->getObjectAs<ConnectableDisplayObject>();
+ if(displayObj && displayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ metOverlay = subWindow->scrollWidget()->metOverlay();
+ }
+
+ return metOverlay;
+}
+
diff --git a/ossimGui/src/ossimGui/DataManagerPropertyView.cpp b/ossimGui/src/ossimGui/DataManagerPropertyView.cpp
new file mode 100644
index 0000000..efef1b2
--- /dev/null
+++ b/ossimGui/src/ossimGui/DataManagerPropertyView.cpp
@@ -0,0 +1,370 @@
+#include <ossimGui/DataManagerPropertyView.h>
+#include <ossim/base/ossimBooleanProperty.h>
+#include <ossim/base/ossimContainerProperty.h>
+#include <ossim/base/ossimStringProperty.h>
+#include <ossim/base/ossimNumericProperty.h>
+
+namespace ossimGui
+{
+ StringChoicePropertyWidget::StringChoicePropertyWidget(QWidget* parent)
+ :QComboBox(parent),m_property(0), m_delegate(0)
+ {
+ connect(this, SIGNAL(currentIndexChanged ( int )), this, SLOT(valueChanged()));
+ }
+
+ void StringChoicePropertyWidget::setDelegateInformation(DataManagerProperty* prop, const QAbstractItemDelegate* delegate)
+ {
+ m_property = prop;
+ m_delegate = delegate;
+ }
+
+ void StringChoicePropertyWidget::valueChanged()
+ {
+ if(m_property&&m_delegate)
+ {
+ m_delegate->setModelData ( this, m_property->model(), m_property->index() );
+ }
+ }
+
+
+ BooleanPropertyWidget::BooleanPropertyWidget(QWidget* parent)
+ :QCheckBox(parent),m_property(0), m_delegate(0)
+ {
+ connect(this, SIGNAL(clicked( bool)), this, SLOT(valueChanged()));
+ }
+
+ void BooleanPropertyWidget::valueChanged()
+ {
+ if(m_property&&m_delegate)
+ {
+ m_delegate->setModelData ( this, m_property->model(), m_property->index() );
+ // m_property->model()->blockSignals(true);
+ // m_property->setData(QVariant(QString()), Qt::DisplayRole);
+ // m_property->model()->blockSignals(false);
+ }
+ }
+
+ void BooleanPropertyWidget::setDelegateInformation(DataManagerProperty* prop,
+ const QAbstractItemDelegate* delegate)
+ {
+ m_property = prop;
+ m_delegate = delegate;
+ }
+
+ void DataManagerPropertyDelegate::setEditorData ( QWidget * editor, const QModelIndex & index ) const
+ {
+ QStandardItemModel* itemModel = (QStandardItemModel*)index.model();
+ DataManagerProperty* propertyItem = dynamic_cast<DataManagerProperty*>(itemModel->itemFromIndex(index));
+ if(dynamic_cast<BooleanPropertyWidget*> (editor))
+ {
+ BooleanPropertyWidget* w = dynamic_cast<BooleanPropertyWidget*> (editor);
+ if(w)
+ {
+ if(propertyItem->property())
+ {
+ w->setProperty("checked", QVariant(propertyItem->property()->valueToString().toBool()));
+ }
+ }
+ }
+ else if(dynamic_cast<StringChoicePropertyWidget*> (editor))
+ {
+ StringChoicePropertyWidget* w = dynamic_cast<StringChoicePropertyWidget*> (editor);
+ if(w)
+ {
+ if(propertyItem->property())
+ {
+ w->setProperty("currentText", QVariant(QString(propertyItem->property()->valueToString().c_str())));
+ }
+ }
+ }
+ else
+ {
+ QItemDelegate::setEditorData(editor, index);
+ }
+
+ }
+
+ void DataManagerPropertyDelegate::setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const
+ {
+ // QStandardItemModel* itemModel = (QStandardItemModel*)model;
+ // DataManagerProperty* propertyItem = dynamic_cast<DataManagerProperty*>(itemModel->itemFromIndex(index));
+ if(dynamic_cast<BooleanPropertyWidget*> (editor))
+ {
+ BooleanPropertyWidget* w = dynamic_cast<BooleanPropertyWidget*> (editor);
+
+ model->setData(index, QVariant(w->isChecked()), Qt::EditRole);
+ }
+ else if(dynamic_cast<StringChoicePropertyWidget*> (editor))
+ {
+ StringChoicePropertyWidget* w = dynamic_cast<StringChoicePropertyWidget*> (editor);
+ model->setData(index, QVariant(w->currentText()), Qt::EditRole);
+ }
+ else
+ {
+ QItemDelegate::setModelData(editor, model, index);
+ }
+
+ }
+
+ QWidget* DataManagerPropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+ {
+ QWidget* result = 0;
+ if(index.column() == 1)
+ {
+ DataManagerProperty* itemProperty = dynamic_cast<DataManagerProperty*> (((QStandardItemModel*)index.model())->itemFromIndex(index));
+ if(itemProperty)
+ {
+ ossimRefPtr<ossimProperty> property = itemProperty->property();
+ if(property.valid())
+ {
+ if(dynamic_cast<ossimBooleanProperty*>(property.get()))
+ {
+ BooleanPropertyWidget* checkbox = new BooleanPropertyWidget(parent);
+ checkbox->setDelegateInformation(itemProperty, this);
+ checkbox->setChecked(property->valueToString().toBool());
+
+ result = checkbox;
+ result->setFocusPolicy(Qt::StrongFocus);
+ itemProperty->model()->blockSignals(true);
+ itemProperty->setData(QVariant(QString()), Qt::DisplayRole);
+ itemProperty->model()->blockSignals(false);
+ }
+ else if(dynamic_cast<ossimStringProperty*> (property.get()))
+ {
+ ossimStringProperty* stringProperty = dynamic_cast<ossimStringProperty*> (property.get());
+ if(stringProperty->hasConstraints())
+ {
+ StringChoicePropertyWidget* stringChoice = new StringChoicePropertyWidget(parent);
+ const std::vector<ossimString>& constraints = stringProperty->getConstraints();
+ ossim_uint32 idx = 0;
+ ossim_uint32 currentIdx = 0;
+ ossimString value = property->valueToString();
+ for(idx = 0; idx < constraints.size(); ++idx)
+ {
+ if(value == constraints[idx]) currentIdx = idx;
+ stringChoice->addItem(QString(tr(constraints[idx].c_str())), QVariant(constraints[idx].c_str()));
+ }
+ stringChoice->setCurrentIndex(currentIdx);
+ stringChoice->setDelegateInformation(itemProperty, this);
+ result = stringChoice;
+ result->setFocusPolicy(Qt::StrongFocus);
+ itemProperty->model()->blockSignals(true);
+ itemProperty->setData(QVariant(QString(constraints[currentIdx].c_str())), Qt::DisplayRole);
+ itemProperty->model()->blockSignals(false);
+ }
+ else
+ {
+ result = QItemDelegate::createEditor(parent, option, index);
+ }
+
+ }
+ else if(dynamic_cast<ossimNumericProperty*> (property.get()))
+ {
+ result = QItemDelegate::createEditor(parent, option, index);
+ }
+ else
+ {
+ result = QItemDelegate::createEditor(parent, option, index);
+ }
+ }
+ }
+ else
+ {
+ result = QItemDelegate::createEditor(parent, option, index);
+ }
+
+ }
+
+ return result;
+ }
+
+ void DataManagerProperty::setProperty(ossimRefPtr<ossimProperty> property)
+ {
+ m_property = property.get();
+
+ if(m_property.valid())
+ {
+ setEditable(!m_property->isReadOnly());
+ }
+ if(column() != 1)
+ {
+ setEditable(false);
+ }
+ }
+
+
+ void DataManagerProperty::populateChildren()
+ {
+ ossimContainerProperty* container = dynamic_cast<ossimContainerProperty*> (m_property.get());
+ // QStandardItemModel* itemModel = (QStandardItemModel*)index().model();
+ if(container)
+ {
+ std::vector<ossimRefPtr<ossimProperty> > currentProperties;
+ container->getPropertyList(currentProperties);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < currentProperties.size(); ++idx)
+ {
+ DataManagerProperty* nameItem = new DataManagerProperty(currentProperties[idx]->getName().c_str());
+ DataManagerProperty* valueItem = new DataManagerProperty(currentProperties[idx]->valueToString().c_str(), currentProperties[idx]);
+ QList<QStandardItem*> items;
+ items.push_back(nameItem);
+ items.push_back(valueItem);
+ appendRow(items);
+ nameItem->setProperty(currentProperties[idx].get());
+ valueItem->setProperty(currentProperties[idx].get());
+ nameItem->populateChildren();
+ }
+ }
+ }
+
+ DataManagerProperty* DataManagerProperty::rootProperty()
+ {
+ DataManagerProperty* current = this;
+ DataManagerProperty* parentItem = dynamic_cast<DataManagerProperty*>(current->parent());
+ while(parentItem)
+ {
+ parentItem = dynamic_cast<DataManagerProperty*>(current->parent());
+ if(parentItem) current = parentItem;
+ }
+ return current;
+ }
+
+ DataManagerPropertyView::DataManagerPropertyView(QWidget* parent):QTreeView(parent)
+ {
+ QList<QString> labels;
+ labels.push_back("Name");
+ labels.push_back("Value");
+ m_model= new QStandardItemModel();
+ m_model->setColumnCount(2);
+ m_model->setHorizontalHeaderLabels(labels);
+ setModel(m_model);
+ setFrameStyle(QFrame::NoFrame);
+ setAttribute(Qt::WA_MacShowFocusRect, false);
+ setAlternatingRowColors(true);
+ setItemDelegateForColumn(1, new DataManagerPropertyDelegate(this));
+ setEditTriggers(QAbstractItemView::AllEditTriggers);
+ connect(this, SIGNAL(expanded ( const QModelIndex &)), this, SLOT(expanded ( const QModelIndex &)));
+ connect(this, SIGNAL(collapsed ( const QModelIndex &)), this, SLOT(collapsed ( const QModelIndex &)));
+ }
+
+ void DataManagerPropertyView::populateChildren()
+ {
+ blockSignals(true);
+ QList<QString> labels;
+ labels.push_back("Name");
+ labels.push_back("Value");
+ m_model->clear();
+ m_model->setHorizontalHeaderLabels(labels);
+ if(m_node.valid())
+ {
+ ossimPropertyInterface* propInterface = propertyInterface();
+ if(propInterface)
+ {
+ std::vector<ossimRefPtr<ossimProperty> > currentProperties;
+ propInterface->getPropertyList(currentProperties);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < currentProperties.size(); ++idx)
+ {
+ DataManagerProperty* nameItem = new DataManagerProperty(currentProperties[idx]->getName().c_str());
+ DataManagerProperty* valueItem = new DataManagerProperty(currentProperties[idx]->valueToString().c_str(), currentProperties[idx]);
+ QList<QStandardItem*> items;
+ items.push_back(nameItem);
+ items.push_back(valueItem);
+ m_model->blockSignals(true);
+ m_model->appendRow(items);
+ nameItem->setProperty(currentProperties[idx].get());
+ valueItem->setProperty(currentProperties[idx].get());
+ nameItem->populateChildren();
+ m_model->blockSignals(false);
+ }
+ }
+ }
+ resizeColumnToContents(0);
+
+ blockSignals(false);
+ }
+
+ void DataManagerPropertyView::reloadProperties()
+ {
+
+ }
+
+ void DataManagerPropertyView::dataChanged( const QModelIndex & topLeft, const QModelIndex & /* bottomRight */)
+ {
+ if((topLeft.column() == 1)&&m_node.valid()&&propertyInterface())
+ {
+ QStandardItemModel* itemModel = (QStandardItemModel*)topLeft.model();
+ DataManagerProperty* propertyItem = dynamic_cast<DataManagerProperty*>(itemModel->itemFromIndex(topLeft));
+ if(propertyItem)
+ {
+ ossimRefPtr<ossimProperty> property = propertyItem->property();
+ if(property.valid())
+ {
+ QVariant v = propertyItem->data(Qt::EditRole);
+ if(v.isValid())
+ {
+ property->setValue(v.toString().toAscii().data());
+#if 0 /* warning C4065: switch statement contains 'default' but no 'case' labels (drb) */
+ switch(v.type())
+ {
+ default:
+ {
+ property->setValue(v.toString().toAscii().data());
+ break;
+ }
+ }
+#endif
+
+ DataManagerProperty* rootItem = propertyItem->rootProperty();
+ if(rootItem)
+ {
+ if(propertyInterface())
+ {
+
+ propertyInterface()->setProperty(rootItem->property());
+ }
+ }
+ if(property->isCacheRefresh())
+ {
+ fireRefresh(ossimRefreshEvent::REFRESH_PIXELS);
+ }
+ else if(property->isFullRefresh())
+ {
+ fireRefresh(ossimRefreshEvent::REFRESH_GEOMETRY);
+ }
+ if(property->affectsOthers())
+ {
+ reloadProperties();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void DataManagerPropertyView::mousePressEvent ( QMouseEvent * event )
+ {
+ QTreeView::mousePressEvent(event);
+ }
+
+ void DataManagerPropertyView::fireRefresh(int type)
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(static_cast<ossimRefreshEvent::RefreshType>(type));
+ ossimEventVisitor visitor(refreshEvent.get());
+ if(m_node.valid())
+ {
+ m_node->accept(visitor);
+ }
+ }
+
+
+ void DataManagerPropertyView::expanded (const QModelIndex& /* idx */)
+ {
+ resizeColumnToContents(0);
+ }
+
+ void DataManagerPropertyView::collapsed (const QModelIndex& /* idx */)
+ {
+ resizeColumnToContents(0);
+ }
+} // end namespace ossimGui
diff --git a/ossimGui/src/ossimGui/DataManagerWidget.cpp b/ossimGui/src/ossimGui/DataManagerWidget.cpp
new file mode 100644
index 0000000..468f613
--- /dev/null
+++ b/ossimGui/src/ossimGui/DataManagerWidget.cpp
@@ -0,0 +1,4104 @@
+#include <ossimGui/DataManagerWidget.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/imaging/ossimImageChain.h>
+#include <ossim/imaging/ossimImageCombiner.h>
+#include <ossim/base/ossimEvent.h>
+#include <ossim/base/ossimBooleanProperty.h>
+#include <ossim/base/ossimNumericProperty.h>
+#include <ossim/base/ossimContainerProperty.h>
+#include <ossim/base/ossimStringProperty.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/imaging/ossimImageFileWriter.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
+#include <ossim/imaging/ossimImageWriterFactoryRegistry.h>
+#include <ossim/imaging/ossimMemoryImageSource.h>
+#include <ossim/projection/ossimEquDistCylProjection.h>
+#include <ossim/projection/ossimUtmProjection.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/imaging/ossimImageSourceFactoryRegistry.h>
+#include <ossim/imaging/ossimOverviewBuilderFactoryRegistry.h>
+#include <QtGui/QMainWindow>
+#include <QtGui/QDragEnterEvent>
+#include <QtGui/QMessageBox>
+#include <QtGui/QItemDelegate>
+#include <QtGui/QHeaderView>
+#include <QtGui/QInputDialog>
+#include <QtGui/QScrollBar>
+#include <QtGui/QMenu>
+#include <QtGui/QAction>
+#include <QtGui/QFileDialog>
+#include <QtGui/QToolBar>
+#include <QtGui/QItemDelegate>
+#include <QtGui/QComboBox>
+#include <QtGui/QTableWidget>
+#include <QtGui/QMessageBox>
+#include <QtCore/QUrl>
+#include <QtGui/QStandardItemModel>
+#include <ossimGui/Common.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/OpenImageDialog.h>
+#include <ossimGui/OpenImageUrlJob.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+#include <ossimGui/MdiSubWindowBase.h>
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/GatherImageViewProjTransVisitor.h>
+#include <ossimGui/IvtGeomTransform.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/Util.h>
+#include <ossimGui/CopyChainVisitor.h>
+#include <ossimGui/ImageWriterJob.h>
+#include <ossimGui/ExportImageDialog.h>
+#include <ossimGui/MultiImageDialog.h>
+#include <ossimGui/AutoMeasurementDialog.h>
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/RegPoint.h>
+#include <set>
+
+
+void ossimGui::DataManagerWidget::RefreshVisitor::visit(ossimObject* obj)
+{
+ if(!hasVisited(obj))
+ {
+ ossimVisitor::visit(obj);
+ ossimRefPtr<DataManager::Node> node = dynamic_cast<DataManager::Node*> (obj);
+ if(node.valid())
+ {
+ DataManager::NodeListType nodes(1);
+ nodes[0] = node.get();
+ m_widget->populateTreeWithNodes(nodes);
+ }
+ }
+}
+
+namespace ossimGui
+{
+ class OSSIMGUI_DLL ImageStagerJob : public ProcessInterfaceJob
+ {
+ public:
+ enum StagerFlags
+ {
+ STAGE_NONE = 0,
+ STAGE_OVERVIEWS = 1,
+ STAGE_FULL_HISTOGRAMS = 2,
+ STAGE_FAST_HISTOGRAMS = 4,
+ STAGE_ALL = (STAGE_OVERVIEWS|STAGE_FULL_HISTOGRAMS|STAGE_FAST_HISTOGRAMS)
+ };
+ ImageStagerJob(ossimImageHandler* isource, StagerFlags f = STAGE_NONE)
+ :ProcessInterfaceJob(),
+ m_source(isource),
+ m_flags(f)
+ {
+ }
+
+ void setOverviewType(const ossimString& type){m_overviewType = type;}
+ void setStagerFlag(int flag, bool on=true)
+ {
+ if(on)
+ {
+ m_flags = static_cast<StagerFlags>((m_flags|flag)&STAGE_ALL);
+ }
+ else
+ {
+ m_flags = static_cast<StagerFlags>((m_flags&(~flag))&STAGE_ALL);
+ }
+ }
+ int flags()const{return m_flags;}
+
+ virtual void start()
+ {
+ if(m_flags&STAGE_OVERVIEWS)
+ {
+ ossimRefPtr<ossimOverviewBuilderBase> overviewBuilder = ossimOverviewBuilderFactoryRegistry::instance()->createBuilder(m_overviewType);
+ if(overviewBuilder.valid())
+ {
+ if(!m_source->createDefaultHistogramFilename().exists())
+ {
+ overviewBuilder->setHistogramMode(OSSIM_HISTO_MODE_NORMAL);
+ }
+ ossimString baseName = ("entry " + ossimString::toString(m_source->getCurrentEntry()) + ": "+ m_source->getFilename());
+ setName(("Building Overviews: " + baseName).c_str());
+ ossimRefPtr<ossimImageHandler> dupHandler = (ossimImageHandler*) m_source->dup();
+ if(dupHandler.valid())
+ {
+ overviewBuilder->setInputSource(dupHandler.get());
+ m_obj = overviewBuilder.get();
+ ProcessInterfaceJob::start();
+ }
+ dupHandler = 0;
+ m_obj = 0;
+ }
+ overviewBuilder = 0;
+ }
+ }
+
+ ossimImageHandler* handler(){return m_source.get();}
+ const ossimImageHandler* handler()const{return m_source.get();}
+
+ protected:
+ void stageOverviews();
+ void stageHistograms();
+ ossimRefPtr<ossimImageHandler> m_source;
+ ossimString m_overviewType;
+ StagerFlags m_flags;
+ };
+ class ImageStagerJobCallback : public ossimJobCallback
+ {
+ public:
+ ImageStagerJobCallback(DataManagerWidget* w, DataManagerNodeItem* i=0)
+ :m_dataManagerWidget(w),
+ m_item(i)
+ {
+ }
+ virtual void finished(ossimJob* job)
+ {
+ ossimRefPtr<ImageStagerJob> stagerJob = dynamic_cast<ImageStagerJob*> (job);
+
+ if(stagerJob.valid())
+ {
+ if(m_item)
+ {
+ DataManagerWidgetEvent* evt = new DataManagerWidgetEvent(DataManagerWidgetEvent::COMMAND_RESET);
+ evt->setItemList(m_item);
+
+ QApplication::postEvent(m_dataManagerWidget, evt);
+ }
+ }
+ stagerJob = 0;
+ }
+
+ protected:
+ DataManagerWidget* m_dataManagerWidget;
+ DataManagerNodeItem* m_item;
+
+ };
+}
+
+class TestCycleVisitor :public ossimVisitor
+{
+public:
+
+ TestCycleVisitor(int visitorType =VISIT_INPUTS,
+ ossimConnectableObject* objToFind=0):ossimVisitor(visitorType),m_objectToFind(objToFind){}
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new TestCycleVisitor(*this);}
+ virtual void reset()
+ {
+ m_objectFound=false;
+ }
+ virtual void visit(ossimConnectableObject* obj)
+ {
+ if(!hasVisited(obj))
+ {
+ ossimVisitor::visit(obj);
+
+ ossim_int32 idx = obj->findInputIndex(m_objectToFind.get());
+ if(idx >= 0)
+ {
+ m_objectFound = true;
+ }
+ }
+ }
+ void setObjectToFind(ossimConnectableObject* objToFind){m_objectToFind = objToFind;}
+ bool found()const{return m_objectFound;}
+
+protected:
+ ossimRefPtr<ossimConnectableObject> m_objectToFind;
+ bool m_objectFound;
+};
+
+namespace ossimGui
+{
+ class ImageOpenJobCallback : public ossimJobCallback
+ {
+ public:
+ ImageOpenJobCallback(DataManagerWidget* widget, ossimRefPtr<DataManager> manager):m_dataManagerWidget(widget),m_dataManager(manager){}
+ virtual void finished(ossimJob* job)
+ {
+ if(m_dataManager.valid())
+ {
+ ossimGui::OpenImageUrlJob* imageOpenJob = dynamic_cast<ossimGui::OpenImageUrlJob*> (job);
+ if(imageOpenJob)
+ {
+ ossimGui::HandlerList& handlerList =imageOpenJob->handlerList();
+ ossim_uint32 idx = 0;
+ ossim_uint32 nImages = handlerList.size();
+ DataManager::NodeListType nodeList;;
+ for(idx = 0; idx < nImages; ++idx)
+ {
+ ossimRefPtr<DataManager::Node> node = m_dataManager->addSource(handlerList[idx].get());
+ if(node.valid())
+ {
+ ossimRefPtr<DataManager::Node> chain = m_dataManager->createDefaultImageChain(node.get());
+ if(chain.valid())
+ {
+ nodeList.push_back(chain.get());
+ }
+ }
+ }
+ if(!nodeList.empty())
+ {
+ DataManagerEvent* e = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ e->setNodeList(nodeList);
+ QCoreApplication::postEvent(m_dataManagerWidget->mainWindow(), e);
+ }
+ }
+ }
+ }
+
+ protected:
+ DataManagerWidget* m_dataManagerWidget;
+ ossimRefPtr<DataManager> m_dataManager;
+ };
+}
+
+ossimGui::DataManagerWidget* ossimGui::DataManagerItem::dataManagerWidget()
+{
+ return dynamic_cast<ossimGui::DataManagerWidget*>(QTreeWidgetItem::treeWidget());
+}
+
+
+ossimGui::DataManager* ossimGui::DataManagerItem::dataManager()
+{
+ DataManagerWidget* w = dataManagerWidget();
+ if(w) return w->dataManager();
+
+ return 0;
+}
+
+void ossimGui::DataManagerItem::clearChildren()
+{
+ QList<QTreeWidgetItem*> children = takeChildren();
+ QList<QTreeWidgetItem*>::iterator iter= children.begin();
+ while(iter != children.end())
+ {
+ delete *iter;
+ ++iter;
+ }
+}
+
+ossimGui::DataManagerInputConnectionItem::DataManagerInputConnectionItem(DataManager::Node* node)
+:DataManagerItem()
+{
+ setObject(node);
+}
+
+ossimGui::DataManagerInputConnectionItem::~DataManagerInputConnectionItem()
+{
+ m_node = 0;
+}
+
+void ossimGui::DataManagerInputConnectionItem::setObject(ossimObject* node)
+{
+ m_node = dynamic_cast<DataManager::Node*>(node);
+ DataManagerItem::setObject(m_node.get());
+ if(m_node.valid())
+ {
+ setText(0, m_node->name());
+ }
+ else
+ {
+ setText(0, "<empty>");
+ }
+}
+
+ossimGui::DataManagerInputConnectionFolder::DataManagerInputConnectionFolder(DataManager::Node* node)
+:DataManagerFolder(),m_node(node)
+{
+ setText(0, "Inputs");
+ setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
+}
+
+ossimGui::DataManagerInputConnectionFolder::~DataManagerInputConnectionFolder()
+{
+ m_node = 0;
+}
+
+void ossimGui::DataManagerInputConnectionFolder::getInputs(DataManager::NodeListType& result)
+{
+ if(m_node.valid())
+ {
+ ossimConnectableObject* connectable = m_node->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimConnectableObject::ConnectableObjectList& inputList = connectable->getInputList();
+ if(!inputList.empty())
+ {
+ ossimRefPtr<DataManager> manager = dataManager();
+ if(manager.valid())
+ {
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < inputList.size();++idx)
+ {
+ ossimRefPtr<DataManager::Node> node;
+ if(inputList[idx].get())
+ {
+ node = manager->findNode(inputList[idx].get());
+ }
+ else
+ {
+ node = 0;
+ }
+
+ result.push_back(node.get());
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerInputConnectionFolder::setObject(ossimObject* node)
+{
+ m_node = dynamic_cast<DataManager::Node*>(node);
+}
+
+void ossimGui::DataManagerInputConnectionFolder::populateChildren()
+{
+ DataManager::NodeListType inputList;
+ getInputs(inputList);
+ ossim_int32 nChildren = childCount();
+ if((inputList.size() == (ossim_uint32)childCount())&&!inputList.empty())
+ {
+ ossim_int32 itemIdx = 0;
+ for(itemIdx = 0; itemIdx < nChildren; ++itemIdx)
+ {
+ DataManagerInputConnectionItem* item = dynamic_cast<DataManagerInputConnectionItem*>(child(itemIdx));
+ if(item)
+ {
+ item->setObject(inputList[itemIdx].get());
+ }
+ }
+ }
+ else
+ {
+ QList<QTreeWidgetItem *> children = takeChildren();
+ QList<QTreeWidgetItem *>::iterator iter = children.begin();
+ while(iter!=children.end())
+ {
+ DataManagerInputConnectionItem* nodeItem = dynamic_cast<DataManagerInputConnectionItem*> (*iter);
+ if(nodeItem) nodeItem->setObject(0); // clear the node outs
+ delete (*iter);
+ ++iter;
+ }
+ children.clear();
+ if(!inputList.empty())
+ {
+ DataManager::NodeListType::iterator inputListIter = inputList.begin();
+ while(inputListIter != inputList.end())
+ {
+ DataManagerInputConnectionItem* item = new DataManagerInputConnectionItem((*inputListIter).get());
+ addChild(item);
+ ++inputListIter;
+ }
+ }
+ }
+
+}
+
+ossimConnectableObject* ossimGui::DataManagerInputConnectionFolder::connectableObject()
+{
+ return m_node.valid()?m_node->getObjectAs<ossimConnectableObject>():0;
+}
+const ossimConnectableObject* ossimGui::DataManagerInputConnectionFolder::connectableObject()const
+{
+ return m_node.valid()?m_node->getObjectAs<ossimConnectableObject>():0;
+}
+
+void ossimGui::DataManagerInputConnectionFolder::connect(QList<DataManagerItem*>& nodeItems, DataManagerInputConnectionItem* targetItem)
+{
+ if(nodeItems.empty()) return;
+ ossimRefPtr<ossimConnectableObject> connectable = connectableObject();
+ if(connectable.valid())
+ {
+ // we need to check for cycles and also the validity.
+ // For now lets just make sure we can do the connections
+ //
+ DataManagerNodeItem* parentNodeItem = parentItemAs<DataManagerNodeItem>();
+ if(parentNodeItem) parentNodeItem->setNodeListenerEnabled(false);
+ QList<DataManagerItem*>::iterator iter = nodeItems.begin();
+
+ // if we are dropping on the folder then just append the new items
+ if(!targetItem||!targetItem->object())
+ {
+ bool objectsFound = false;
+ TestCycleVisitor visitorA; // be used to test if this object appears in any inputs
+ TestCycleVisitor visitorB(ossimVisitor::VISIT_NONE); // will be used to test immediate connections
+ // find first available slot
+ ossimRefPtr<ossimConnectableObject> thisNode = objectAsNode()?objectAsNode()->getObjectAs<ossimConnectableObject>():0;
+ while(iter != nodeItems.end())
+ {
+ ossimRefPtr<DataManager::Node> n = (*iter)->objectAsNode();
+ if(n.valid())
+ {
+ ossimRefPtr<ossimConnectableObject> connectableNodeToAdd = n->getObjectAs<ossimConnectableObject>();
+ visitorA.setObjectToFind(thisNode.get());
+ visitorA.reset();
+ connectable->accept(visitorA);
+ if(!visitorA.found())
+ {
+ visitorB.reset();
+ visitorB.setObjectToFind(connectableNodeToAdd.get());
+ thisNode->accept(visitorB);
+ if(!visitorB.found())
+ {
+ if(connectable!=connectableNodeToAdd.get())
+ {
+ connectable->connectMyInputTo(connectableNodeToAdd.get());
+ }
+ else
+ {
+ objectsFound = true;
+ }
+
+ }
+ else
+ {
+ objectsFound = true;
+ }
+ }
+ else
+ {
+ objectsFound = true;
+ }
+
+ }
+
+ ++iter;
+ }
+ if(objectsFound)
+ {
+ QMessageBox::warning(treeWidget(), "Warning", "Some inputs were already found and were not added.");
+ }
+ }
+ else if(targetItem)
+ {
+ int childIdx = indexOfChild(targetItem);
+ // if the target item is a child of this folder
+ if(childIdx >= 0)
+ {
+ ossimConnectableObject::ConnectableObjectList inputList = connectable->getInputList();
+ if(connectable->getInputListIsFixedFlag()&&targetItem->objectAsNode()&&(*iter)->objectAsNode())
+ {
+ ossimRefPtr<ossimConnectableObject> itemToInsert = (*iter)->objectAsNode()->getObjectAs<ossimConnectableObject>();
+ ossimRefPtr<ossimConnectableObject> target = targetItem->objectAsNode()->getObjectAs<ossimConnectableObject>();
+
+ ossimConnectableObject::ConnectableObjectList::iterator inputListIter = std::find(inputList.begin(), inputList.end(), itemToInsert.get());
+ ossimConnectableObject::ConnectableObjectList::iterator targetListIter = std::find(inputList.begin(), inputList.end(), target.get());
+ // replacing a connection
+ TestCycleVisitor visitor;
+ if(nodeItems.size() == 1)
+ {
+ if((inputListIter!=inputList.end())&&
+ (targetListIter!=inputList.end()))
+ {
+ std::iter_swap(inputListIter, targetListIter);
+ }
+ else if(targetListIter!=inputList.end())
+ {
+ visitor.setObjectToFind(itemToInsert.get());
+ visitor.reset();
+ connectable->accept(visitor);
+ if(!visitor.found())
+ {
+ visitor.setObjectToFind(connectable.get());
+ visitor.reset();
+ itemToInsert->accept(visitor);
+ if(!visitor.found())
+ {
+ if(itemToInsert.get() != connectable.get())
+ {
+ *targetListIter = itemToInsert.get();
+ }
+ else
+ {
+ QMessageBox::warning(treeWidget(), "Warning", "Cannot connect back to yourself.");
+ }
+ }
+ else
+ {
+ QMessageBox::warning(treeWidget(), "Warning", "Input was already found and was not added.");
+ }
+
+ }
+ else
+ {
+ QMessageBox::warning(treeWidget(), "Warning", "Input was already found and was not added.");
+ }
+
+ }
+ }
+ else
+ {
+ // error for now
+ }
+ }
+ else if(targetItem->objectAsNode())
+ {
+ TestCycleVisitor visitor;
+ bool cycleFlag = false;
+ if((ossim_uint32)childIdx < inputList.size())
+ {
+ ossimRefPtr<ossimConnectableObject> target = targetItem->objectAsNode()->getObjectAs<ossimConnectableObject>();
+ while(iter != nodeItems.end())
+ {
+ if((*iter)->objectAsNode())
+ {
+ ossimRefPtr<ossimConnectableObject> itemToInsert = (*iter)->objectAsNode()->getObjectAs<ossimConnectableObject>();
+
+ ossimConnectableObject::ConnectableObjectList::iterator inputListIter = std::find(inputList.begin(), inputList.end(), itemToInsert.get());
+ ossimConnectableObject::ConnectableObjectList::iterator targetListIter = std::find(inputList.begin(), inputList.end(), target.get());
+ if((*iter)->parent() != this)
+ {
+ if(targetListIter!=inputList.end())
+ {
+ if(inputListIter == inputList.end())
+ {
+ visitor.setObjectToFind(itemToInsert.get());
+ visitor.reset();
+ connectable->accept(visitor);
+ if(!visitor.found())
+ {
+ visitor.setObjectToFind(connectable.get());
+ visitor.reset();
+ itemToInsert->accept(visitor);
+ if(!visitor.found())
+ {
+ if(connectable != itemToInsert.get())
+ {
+ inputList.insert(targetListIter, itemToInsert.get());
+ }
+ else
+ {
+ cycleFlag = true;
+ }
+
+ }
+ else
+ {
+ cycleFlag = true;
+ }
+ }
+ else
+ {
+ cycleFlag = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ // need to do a move layer
+ if((inputListIter!=inputList.end())&&
+ (targetListIter!=inputList.end()))
+ {
+ // are from same parent and moving layers
+ //
+ inputList.erase(inputListIter);
+ targetListIter = std::find(inputList.begin(), inputList.end(), target.get());
+ if(targetListIter != inputList.end())
+ {
+ inputList.insert(targetListIter, itemToInsert.get());
+ }
+ }
+ }
+ }
+ ++iter;
+ }
+ }
+ if(cycleFlag)
+ {
+ QMessageBox::warning(treeWidget(), "Warning", "Some inputs were already found and were not added.");
+ }
+ }
+
+ connectable->connectInputList(inputList);
+ }
+ }
+ populateChildren();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ connectable->accept(visitor);
+ if(parentNodeItem) parentNodeItem->setNodeListenerEnabled(true);
+ }
+}
+
+void ossimGui::DataManagerInputConnectionFolder::disconnectSelected()
+{
+
+ DataManagerNodeItem* parentNodeItem = parentItemAs<DataManagerNodeItem>();
+ if(parentNodeItem) parentNodeItem->setNodeListenerEnabled(false);
+ ossim_int32 childIdx = 0;
+ ossim_int32 nChildren = childCount();
+ ossimRefPtr<ossimConnectableObject> connectable = connectableObject();
+ bool modified = false;
+ for(childIdx=0;childIdx<nChildren;++childIdx)
+ {
+ if(child(childIdx)->isSelected())
+ {
+ DataManagerInputConnectionItem* item = dynamic_cast<DataManagerInputConnectionItem*> (child(childIdx));
+ if(item&&item->object())
+ {
+ ossimRefPtr<ossimConnectableObject> obj = item->objectAsNode()->getObjectAs<ossimConnectableObject>();
+ if(obj.valid())
+ {
+ connectable->disconnect(obj.get());
+ modified = true;
+ }
+ }
+ }
+ }
+ if(modified)
+ {
+ populateChildren();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ connectable->accept(visitor);
+ }
+ if(parentNodeItem) parentNodeItem->setNodeListenerEnabled(true);
+}
+
+ossimGui::DataManagerDisplayItem::DataManagerDisplayItem(DataManager::Node* node)
+:DataManagerNodeItem(node)
+{
+ setAutoDelete(true);
+}
+
+ossimGui::DataManagerDisplayItem::~DataManagerDisplayItem()
+{
+ if(m_node.valid())
+ {
+ ConnectableDisplayObject* displayObject = m_node->getObjectAs<ConnectableDisplayObject>();
+ if(displayObject&&displayObject->display())
+ {
+ displayObject->close();
+ }
+ }
+}
+
+void ossimGui::DataManagerDisplayItem::setObject(ossimObject* n)
+{
+ if(m_node.valid())
+ {
+ ConnectableDisplayObject* displayObject = m_node->getObjectAs<ConnectableDisplayObject>();
+ if(displayObject&&displayObject->display())
+ {
+ displayObject->close();
+ }
+ }
+ DataManagerNodeItem::setObject(n);
+}
+
+
+ossimGui::DataManagerDisplayFolder::DataManagerDisplayFolder()
+:DataManagerFolder()
+{
+ setText(0, "Displays");
+}
+
+ossimGui::DataManagerImageWriterFolder::DataManagerImageWriterFolder()
+:DataManagerFolder()
+{
+ setText(0, "Writers");
+}
+
+
+
+ossimGui::DataManagerImageWriterItem::DataManagerImageWriterItem(DataManager::Node* node)
+:DataManagerNodeItem(node)
+{
+ m_autoDelete = false;
+}
+
+ossimGui::DataManagerImageWriterItem::~DataManagerImageWriterItem()
+{
+}
+
+void ossimGui::DataManagerImageWriterItem::execute()
+{
+ if(objectAsNode())
+ {
+ CopyChainVisitor visitor;
+
+ objectAsNode()->getObject()->accept(visitor);
+ ossimPropertyInterface* propInterface = objectAsNode()->getObjectAs<ossimPropertyInterface>();
+ if(dataManagerWidget())
+ {
+ ossimRefPtr<ossimJobQueue> q = dataManagerWidget()->jobQueue();
+ if(q.valid())
+ {
+ ossimString defaultName = propInterface?propInterface->getPropertyValueAsString("filename"):ossimString(text(0).toAscii().data());
+ ossimRefPtr<ossimJob> job = new ImageWriterJob(visitor.kwl());
+ job->setName("Output " + defaultName);
+ visitor.reset();
+ job->ready();
+ q->add(job.get());
+ }
+ }
+ }
+}
+
+ossimGui::DataManagerImageFileWriterItem::DataManagerImageFileWriterItem(DataManager::Node* node)
+:DataManagerImageWriterItem(node)
+{
+}
+
+ossimGui::DataManagerImageFileWriterItem::~DataManagerImageFileWriterItem()
+{
+}
+
+
+ossimGui::DataManagerImageFilterItem::DataManagerImageFilterItem()
+{
+ m_properties=0;
+}
+
+ossimGui::DataManagerImageFilterItem::~DataManagerImageFilterItem()
+{
+ m_object = 0;
+}
+
+void ossimGui::DataManagerImageFilterItem::setObject(ossimObject* obj)
+{
+ DataManagerItem::setObject(obj);
+ if(m_object.valid())
+ {
+ setText(0, m_object->getClassName().c_str());
+ }
+}
+
+ossimGui::DataManagerImageFilterFolder* ossimGui::DataManagerImageFilterItem::folder()
+{
+ return findParentItemAs<DataManagerImageFilterFolder>();
+}
+
+void ossimGui::DataManagerImageFilterItem::populateChildren()
+{
+ if(m_properties)
+ {
+ delete m_properties;
+ }
+ if(m_object.valid())
+ {
+ m_properties = new DataManagerPropertyFolder();
+ m_properties->setObject(m_object.get());
+ addChild(m_properties);
+ m_properties->populateChildren();
+ }
+}
+
+ossimGui::DataManagerImageFilterFolder::DataManagerImageFilterFolder()
+{
+ setText(0, "Filters");
+}
+
+void ossimGui::DataManagerImageFilterFolder::populateChildren()
+{
+ clearChildren();
+ if(m_object.valid())
+ {
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (m_object.get());
+ if(chain)
+ {
+ ossimConnectableObject::ConnectableObjectList& chainList = chain->getChainList();
+ ossim_uint32 nChildren =chainList.size();
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nChildren;++idx)
+ {
+ DataManagerImageFilterItem* item = new DataManagerImageFilterItem();
+ item->setObject(chainList[idx].get());
+ insertChild(0,item);
+ item->populateChildren();
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerImageFilterFolder::setObject(ossimObject* obj)
+{
+ DataManagerFolder::setObject(obj);
+ clearChildren();
+}
+
+#if 0
+void ossimGui::DataManagerImageFilterFolder::printChain()
+{
+ std::cout << "_______________________________________" << std::endl;
+ ossimKeywordlist kwl;
+ if(object())
+ {
+ object()->saveState(kwl);
+ std::cout << kwl << std::endl;
+ }
+ std::cout << "_______________________________________" << std::endl;
+}
+#endif
+
+void ossimGui::DataManagerImageFilterFolder::removeFilters()
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+
+ if(chain)
+ {
+ chain->deleteList();
+ populateChildren();
+ // printChain();
+ }
+}
+
+void ossimGui::DataManagerImageFilterFolder::removeFilter(ossimObject* obj)
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+ if(chain)
+ {
+ chain->removeChild(dynamic_cast<ossimConnectableObject*> (obj));
+ populateChildren();
+ //printChain();
+ }
+}
+
+
+
+void ossimGui::DataManagerImageFilterFolder::addFilterToFront(ossimObject* obj)
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+
+ if(chain)
+ {
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*> (obj);
+ if(connectable)
+ {
+ chain->addLast(connectable);
+ populateChildren();
+ //printChain();
+ }
+ }
+}
+
+void ossimGui::DataManagerImageFilterFolder::addFilterToEnd(ossimObject* obj)
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+
+ if(chain)
+ {
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*> (obj);
+ if(connectable)
+ {
+ chain->addFirst(connectable);
+ populateChildren();
+ // printChain();
+ }
+ }
+}
+
+void ossimGui::DataManagerImageFilterFolder::insertFilterBefore(ossimObject* newObj, ossimObject* before)
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+
+ if(chain)
+ {
+ chain->insertLeft(dynamic_cast<ossimConnectableObject*> (newObj), dynamic_cast<ossimConnectableObject*> (before));
+ populateChildren();
+ //printChain();
+ }
+}
+
+void ossimGui::DataManagerImageFilterFolder::insertFilterAfter(ossimObject* newObj, ossimObject* after)
+{
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*> (object());
+
+ if(chain)
+ {
+ chain->insertRight(dynamic_cast<ossimConnectableObject*> (newObj), dynamic_cast<ossimConnectableObject*> (after));
+ populateChildren();
+ //printChain();
+ }
+}
+
+void ossimGui::DataManagerNodeItemListener::disconnectInputEvent(ossimConnectionEvent& /* event */)
+{
+ if(!m_nodeItem) return;
+ if(m_nodeItem->markedForDeletion()||!m_nodeItem->m_node.valid()) return;
+ DataManagerWidgetEvent* e = new DataManagerWidgetEvent(DataManagerWidgetEvent::COMMAND_DISCONNECT_INPUT);
+ e->setItemList(m_nodeItem);
+ QCoreApplication::postEvent(m_nodeItem->treeWidget(), e);
+}
+
+void ossimGui::DataManagerNodeItemListener::connectInputEvent(ossimConnectionEvent& /* event */)
+{
+
+ if(!m_nodeItem) return;
+ if(m_nodeItem->markedForDeletion()||!m_nodeItem->m_node.valid()) return;
+ DataManagerWidgetEvent* e = new DataManagerWidgetEvent(DataManagerWidgetEvent::COMMAND_CONNECT_INPUT);
+ e->setItemList(m_nodeItem);
+ QCoreApplication::postEvent(m_nodeItem->treeWidget(), e);
+}
+
+ossimGui::DataManagerNodeItem::DataManagerNodeItem(DataManager::Node* node)
+:DataManagerItem(), m_listener(new DataManagerNodeItemListener(this)),m_autoDelete(true)
+{
+ m_inputConnectionFolder = new DataManagerInputConnectionFolder();
+ m_propertyFolder = new DataManagerPropertyFolder();
+ setObject(node);
+}
+
+ossimGui::DataManagerNodeItem::~DataManagerNodeItem()
+{
+ setNodeListenerEnabled(false);
+ if(m_listener) delete m_listener;
+ m_listener = 0;
+ if(m_inputConnectionFolder) delete m_inputConnectionFolder;
+ m_inputConnectionFolder = 0;
+ if(m_propertyFolder) delete m_propertyFolder;
+ m_propertyFolder = 0;
+ setObject(0);
+}
+
+void ossimGui::DataManagerNodeItem::setMarkForDeletion(bool flag)
+{
+ DataManagerItem::setMarkForDeletion(flag);
+
+ setNodeListenerEnabled(!flag);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+
+ ossim_int32 nChildren = childCount();
+ ossim_int32 idx = 0;
+ for(idx = 0; idx < nChildren; ++idx)
+ {
+ DataManagerItem* item =dynamic_cast<DataManagerItem*> (child(idx));
+ if(item)
+ {
+ item->setMarkForDeletion(flag);
+ }
+ }
+}
+
+void ossimGui::DataManagerNodeItem::setNodeListenerEnabled(bool flag)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+ if(flag)
+ {
+ if(m_node.valid())
+ {
+ ossimConnectableObject* obj = m_node->getObjectAs<ossimConnectableObject>();
+ if(obj)
+ {
+ // obj->addListener(static_cast<ossimConnectableObjectListener*>(this));
+ obj->addListener(m_listener);
+ }
+ }
+ }
+ else
+ {
+ if(m_node.valid())
+ {
+ ossimConnectableObject* obj = m_node->getObjectAs<ossimConnectableObject>();
+ if(obj)
+ {
+ //obj->removeListener(static_cast<ossimConnectableObjectListener*>(this));
+ obj->removeListener(m_listener);
+ }
+ }
+ }
+}
+
+bool ossimGui::DataManagerNodeItem::autoDelete()const
+{
+ return m_autoDelete;
+}
+
+void ossimGui::DataManagerNodeItem::setAutoDelete(bool flag)
+{
+ m_autoDelete = flag;
+}
+
+bool ossimGui::DataManagerNodeItem::isCombiner()const
+{
+ return m_combinerFlag;
+}
+
+bool ossimGui::DataManagerNodeItem::isParentCombiner()const
+{
+ const DataManagerNodeItem* parentItem = dynamic_cast<const DataManagerNodeItem*> (parent());
+ if(parentItem)
+ {
+ return parentItem->isCombiner();
+ }
+ return false;
+}
+
+void ossimGui::DataManagerNodeItem::getInputs(DataManager::NodeListType& result)
+{
+ if(m_node.valid())
+ {
+ ossimConnectableObject* connectable = m_node->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimConnectableObject::ConnectableObjectList& inputList = connectable->getInputList();
+ if(!inputList.empty())
+ {
+ ossimRefPtr<DataManager> manager = dataManager();
+ if(manager.valid())
+ {
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < inputList.size();++idx)
+ {
+ ossimRefPtr<DataManager::Node> node = manager->findNode(inputList[idx].get());
+ if(node.valid())
+ {
+ result.push_back(node.get());
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerNodeItem::setObject(ossimObject* node)
+{
+ m_combinerFlag = false;
+ setNodeListenerEnabled(false);
+
+ m_node = dynamic_cast<DataManager::Node*>(node);
+ DataManagerItem::setObject(m_node.get());
+ if(m_node.valid())
+ {
+ setText(0, m_node->name());
+ }
+
+ setNodeListenerEnabled(true);
+ if(m_node.valid())
+ {
+ ossimConnectableObject* obj = m_node->getObjectAs<ossimConnectableObject>();
+ if(obj)
+ {
+ if(dynamic_cast<const ossimImageCombiner*>(obj))
+ {
+ m_combinerFlag = true;
+ }
+ else
+ {
+ ossimImageChain* chain = dynamic_cast<ossimImageChain*>(obj);
+ if(chain)
+ {
+ m_combinerFlag = dynamic_cast<ossimImageCombiner*>(chain->getLastSource()) != 0;
+ }
+ }
+ }
+ }
+ initializePropertiesFromNode();
+ populateChildren();
+}
+
+void ossimGui::DataManagerNodeItem::initializePropertiesFromNode()
+{
+ if(!m_node.valid()) return;
+ ossimSource* source = m_node->getObjectAs<ossimSource>();
+ if (!source) return;
+ setCheckState(0, source->isSourceEnabled()?Qt::Checked:Qt::Unchecked);
+
+}
+
+void ossimGui::DataManagerNodeItem::populateChildren()
+{
+ refreshChildConnections();
+ refreshChildProperties();
+}
+
+void ossimGui::DataManagerNodeItem::refreshChildConnections()
+{
+ ossimRefPtr<ossimConnectableObject> connectable = m_node.valid()?m_node->getObjectAs<ossimConnectableObject>():0;
+ bool addConnections = false;
+ if(connectable.valid())
+ {
+ if(!connectable->getInputListIsFixedFlag()||(connectable->getNumberOfInputs() > 0))
+ {
+ addConnections = true;
+ }
+ }
+ if(addConnections)
+ {
+ if(indexOfChild(m_inputConnectionFolder) <0)
+ {
+ insertChild(0, m_inputConnectionFolder);
+ }
+ m_inputConnectionFolder->setObject(m_node.get());
+ }
+ else
+ {
+ takeChild(indexOfChild(m_inputConnectionFolder));
+ }
+
+ if(m_inputConnectionFolder)
+ {
+ m_inputConnectionFolder->populateChildren();
+ }
+}
+
+void ossimGui::DataManagerNodeItem::refreshChildProperties()
+{
+ if(m_propertyFolder)
+ {
+ if(indexOfChild(m_propertyFolder) <0)
+ {
+ insertChild(0, m_propertyFolder);
+ }
+ if(objectAsNode())
+ {
+ m_propertyFolder->setObject(objectAsNode()->getObject());
+ }
+ }
+}
+
+void ossimGui::DataManagerNodeItem::reset()
+{
+ refreshChildProperties();
+ refreshChildConnections();
+}
+
+ossimGui::DataManagerImageChainItem::DataManagerImageChainItem(DataManager::Node* node)
+:DataManagerNodeItem(node)
+{
+ m_filters = 0;
+}
+
+void ossimGui::DataManagerImageChainItem::dropItems(
+ QList<DataManagerImageChainItem*>& /* chainItemList */,
+ DataManagerNodeItem* /* targetItem */,
+ bool /* insertBefore */)
+{
+}
+
+void ossimGui::DataManagerImageChainItem::populateChildren()
+{
+ DataManagerNodeItem::populateChildren();
+ if(m_filters)
+ {
+ delete m_filters;
+ }
+ m_filters = 0;
+ if(m_node.valid())
+ {
+ m_filters = new DataManagerImageFilterFolder();
+ addChild(m_filters);
+ m_filters->setObject(m_node->getObject());
+ m_filters->populateChildren();
+ }
+}
+
+void ossimGui::DataManagerImageChainItem::clearChildren()
+{
+}
+
+void ossimGui::DataManagerRawImageSourceItem::reset()
+{
+ if(m_node.valid())
+ {
+ ossimImageHandler* handler = m_node->getObjectAs<ossimImageHandler>();
+ if(handler)
+ {
+ handler->closeOverview();
+ handler->openOverview();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ handler->accept(visitor);
+ }
+ }
+ DataManagerNodeItem::reset();
+}
+
+void ossimGui::DataManagerFolder::setMarkForDeletion(bool flag)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+
+ ossim_int32 nChildren = childCount();
+ ossim_int32 idx = 0;
+ for(idx = 0; idx < nChildren; ++idx)
+ {
+ DataManagerItem* item =dynamic_cast<DataManagerItem*> (child(idx));
+ if(item)
+ {
+ item->setMarkForDeletion(flag);
+ }
+ }
+}
+
+void ossimGui::DataManagerFolder::setNodeListenerEnabled(bool flag)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_itemMutex);
+ ossim_int32 nChildren = childCount();
+ ossim_int32 idx = 0;
+ for(idx = 0; idx < nChildren; ++idx)
+ {
+ DataManagerItem* item =dynamic_cast<DataManagerItem*> (child(idx));
+ if(item)
+ {
+ item->setNodeListenerEnabled(flag);
+ }
+ }
+}
+
+ossimGui::DataManagerPropertyFolder::DataManagerPropertyFolder()
+:DataManagerFolder()
+{
+ setText(0, "Properties");
+ setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
+}
+
+ossimGui::DataManagerPropertyFolder::~DataManagerPropertyFolder()
+{
+ m_object = 0;
+}
+
+void ossimGui::DataManagerPropertyFolder::populateChildren()
+{
+ if(childCount() > 0)
+ {
+ clearChildren();
+ }
+ if(m_object.valid())
+ {
+ ossimPropertyInterface* propertyInterface = dynamic_cast<ossimPropertyInterface*> (m_object.get());
+ if(propertyInterface)
+ {
+ std::vector<ossimRefPtr<ossimProperty> > currentProperties;
+ propertyInterface->getPropertyList(currentProperties);
+
+ // ossim_uint32 propertyIdx = 0;
+ DataManagerPropertyView* w = new DataManagerPropertyView(treeWidget());
+ w->blockSignals(true);
+ w->setObject(m_object.get());
+ DataManagerPropertyItem* propertyItem = new DataManagerPropertyItem();
+ propertyItem->setFlags(propertyItem->flags() & (~Qt::ItemIsSelectable));
+ addChild(propertyItem);
+ w->resizeColumnToContents(0);
+ dataManagerWidget()->setItemWidget(propertyItem, 0, w);
+ w->blockSignals(false);
+ }
+ }
+}
+
+
+ossimGui::DataManagerPropertyFolder* ossimGui::DataManagerPropertyItem::propertyFolder()
+{
+ return findParentItemAs<DataManagerPropertyFolder>();
+}
+
+void ossimGui::DataManagerPropertyItem::setProperty(ossimProperty* prop)
+{
+ m_property = prop;
+ setText(0, prop->getName().c_str());
+ //setText(1, prop->valueToString().c_str());
+ if(!prop->isReadOnly())
+ {
+ setFlags(flags()|Qt::ItemIsEditable);
+ }
+}
+
+ossimGui::DataManagerJobItem::DataManagerJobItem()
+:m_job(0)
+{
+ m_progressItem = new QTreeWidgetItem();
+ m_progressBar = new QProgressBar();
+ m_progressBar->setMinimum(0);
+ m_progressBar->setMaximum(100);
+ m_progressBar->reset();
+ m_progressBar->setTextVisible(true);
+ setExpanded(true);
+}
+
+ossimGui::DataManagerJobItem::~DataManagerJobItem()
+{
+ if(m_job.valid())
+ {
+ m_job->setCallback(m_jobCallback->callback());
+ }
+}
+
+void ossimGui::DataManagerJobItem::setJob(ossimJob* job)
+{
+ if(m_job.valid()&&m_jobCallback.valid())
+ {
+ m_job->setCallback(m_jobCallback->callback());
+ }
+ m_job = job;
+ if(m_job.valid())
+ {
+ m_jobCallback = new JobCallback(this, m_job->callback());
+ m_job->setCallback(m_jobCallback.get());
+ }
+ if(dataManagerWidget())
+ {
+ addChild(m_progressItem);
+ setExpanded(true);
+ dataManagerWidget()->setItemWidget(m_progressItem, 0, m_progressBar);
+ }
+ if(job->isStopped()) m_jobCallback->finished(job);
+}
+
+void ossimGui::DataManagerJobItem::cancel()
+{
+ if(m_job.valid())
+ {
+ m_job->cancel();
+
+ DataManagerJobsFolder* folder = findParentItemAs<DataManagerJobsFolder>();
+ if(folder)
+ {
+ folder->removeStoppedJobs();
+ }
+ }
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::ready(ossimJob* job)
+{
+ DataManagerJobsFolder* folder = m_jobItem->findParentItemAs<DataManagerJobsFolder>();
+ if(folder)
+ {
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_STATE_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(folder->treeWidget(), e);
+ }
+ ossimJobCallback::ready(job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::started(ossimJob* job)
+{
+ DataManagerJobsFolder* folder = m_jobItem->findParentItemAs<DataManagerJobsFolder>();
+ if(folder)
+ {
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_STATE_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(folder->treeWidget(), e);
+ }
+ ossimJobCallback::started(job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::finished(ossimJob* job)
+{
+ DataManagerJobsFolder* folder = m_jobItem->findParentItemAs<DataManagerJobsFolder>();
+ if(folder)
+ {
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_STATE_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(folder->treeWidget(), e);
+ }
+ ossimJobCallback::finished(job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::canceled(ossimJob* job)
+{
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_STATE_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(m_jobItem->treeWidget(), e);
+ ossimJobCallback::canceled(job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::nameChanged(const ossimString& name, ossimJob* job)
+{
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_PROPERTY_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(m_jobItem->treeWidget(), e);
+
+ ossimJobCallback::nameChanged(name, job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::descriptionChanged(const ossimString& description, ossimJob* job)
+{
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_PROPERTY_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(m_jobItem->treeWidget(), e);
+
+ ossimJobCallback::descriptionChanged(description, job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::idChanged(const ossimString& id, ossimJob* job)
+{
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_PROPERTY_CHANGED);
+ e->setJobList(job);
+ QCoreApplication::postEvent(m_jobItem->treeWidget(), e);
+
+ ossimJobCallback::idChanged(id, job);
+}
+
+void ossimGui::DataManagerJobItem::JobCallback::percentCompleteChanged(double percentValue, ossimJob* job)
+{
+ ossimJobCallback::percentCompleteChanged(percentValue, job);
+ DataManagerWidgetJobEvent* e = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_PERCENT_COMPLETE);
+ e->setJobList(percentValue, job);
+
+ QCoreApplication::postEvent(m_jobItem->treeWidget(), e);
+}
+
+
+ossimGui::DataManagerJobsFolder::DataManagerJobsFolder()
+:DataManagerFolder()
+{
+ setExpanded(true);
+ setText(0, "Jobs");
+ m_jobQueueCallback = new JobQueueCallback(this);
+}
+ossimGui::DataManagerJobsFolder::DataManagerJobsFolder(QTreeWidget* parent)
+:DataManagerFolder(parent)
+{
+ setExpanded(true);
+ setText(0, "Jobs");
+ m_jobQueueCallback = new JobQueueCallback(this);
+}
+ossimGui::DataManagerJobsFolder::DataManagerJobsFolder(QTreeWidgetItem* parent)
+:DataManagerFolder(parent)
+{
+ setExpanded(true);
+ setText(0, "Jobs");
+ m_jobQueueCallback = new JobQueueCallback(this);
+}
+
+ossimGui::DataManagerJobsFolder::~DataManagerJobsFolder()
+{
+}
+
+void ossimGui::DataManagerJobsFolder::removeStoppedJobs()
+{
+ m_jobsFolderMutex.lock();
+ QueueListType::iterator iter = m_queues.begin();
+ while(iter != m_queues.end())
+ {
+ (*iter)->removeStoppedJobs();
+ ++iter;
+ }
+ m_jobsFolderMutex.unlock();
+}
+
+void ossimGui::DataManagerJobsFolder::setQueue(ossimJobQueue* q)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_jobsFolderMutex);
+ m_queues.clear();
+ m_queues.push_back(q);
+ q->setCallback(m_jobQueueCallback.get());
+}
+
+
+ossimGui::DataManagerWidget::DataManagerCallback::DataManagerCallback(DataManagerWidget* widget)
+:m_dataManagerWidget(widget)
+{
+}
+
+void ossimGui::DataManagerWidget::DataManagerCallback::nodesRemoved(DataManager::NodeListType& nodes)
+{
+ QTreeWidgetItemIterator iter(m_dataManagerWidget);
+
+ // see if we are removing the planetary node
+ //
+ if(std::find(nodes.begin(), nodes.end(), m_dataManagerWidget->m_planetaryDisplayNode.get()) != nodes.end())
+ {
+ m_dataManagerWidget->m_planetaryDisplayNode = 0;
+ }
+ while(*iter)
+ {
+ DataManagerItem* item = dynamic_cast<DataManagerItem*> (*iter);
+ if(item)
+ {
+ if(std::find(nodes.begin(), nodes.end(), item->objectAsNode()) != nodes.end())
+ {
+ if(item->parent()) item->parent()->removeChild(item);
+ item->setMarkForDeletion(true);
+ if(item->objectAsNode()&&item->objectAsNode()->getObjectAsConnectable()) item->objectAsNode()->getObjectAsConnectable()->disconnect();
+ }
+ }
+ ++iter;
+ }
+
+ DataManagerEvent* e = new DataManagerEvent(DataManagerEvent::COMMAND_NODE_REMOVED);
+ e->setNodeList(nodes);
+ QCoreApplication::postEvent(m_dataManagerWidget, e);
+}
+
+void ossimGui::DataManagerWidget::DataManagerCallback::nodesAdded(DataManager::NodeListType& nodes)
+{
+ DataManagerEvent* e = new DataManagerEvent(DataManagerEvent::COMMAND_NODE_ADDED);
+ e->setNodeList(nodes);
+ QCoreApplication::postEvent(m_dataManagerWidget, e);
+}
+
+ossimGui::DataManagerWidget::DataManagerWidget(QWidget* parent)
+ : QTreeWidget(parent),
+ m_dataManager( new DataManager() ),
+ m_dataManagerCallback( new DataManagerCallback(this) ),
+ m_jobQueue(0),
+ m_displayQueue(new DisplayTimerJobQueue()),
+ m_rootImageFolder(0),
+ m_rootJobsFolder(0),
+ m_rawImageSources(0),
+ m_imageChains(0),
+ m_imageDisplays(0),
+ m_imageWriters(0),
+ m_dragStartPosition(),
+ m_activeItems(),
+ m_activeItemsMutex(),
+ m_miDialog(0),
+ m_amDialog(0),
+ m_tGen(0),
+ m_tGenObj(0),
+ m_amDialogAvailable(false),
+ m_amDialogActive(false),
+ m_filterList(),
+ m_combinerList(),
+ m_planetaryDisplayNode(),
+ m_lastOpenedDirectory()
+{
+ setAcceptDrops(true);
+
+ m_dataManager->setCallback(m_dataManagerCallback.get());
+
+ initialize();
+ //connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*, int)));
+ connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*, int)));
+ connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(itemCollapsed(QTreeWidgetItem*)));
+ connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(itemExpanded(QTreeWidgetItem*)));
+
+}
+
+bool ossimGui::DataManagerWidget::openDataManager(const ossimFilename& file)
+{
+ bool result = false;
+ ossimKeywordlist kwl;
+ if(kwl.addFile(file))
+ {
+ // If this is an OMAR project export, the project file will not have absolute
+ // paths, so update the kwl with project file path. This is based on the project
+ // file being at the same level as the folder containing the data, the
+ // structure resulting from unzipping a zip file exported from OMAR.
+ std::vector<ossimString> fn = kwl.findAllKeysThatContains("filename");
+
+ ossimFilename firstFilename(kwl[fn[0]]);
+
+ // Check for relative path and make corrections
+ if (firstFilename.isRelative())
+ {
+ ossim_uint32 idx;
+
+ for (idx=0; idx<fn.size(); ++idx)
+ {
+ ossimFilename newFn = file.path().dirCat(kwl[fn[idx]]);
+ kwl.add(fn[idx], newFn.data(), true);
+ }
+ std::vector<ossimString> ov = kwl.findAllKeysThatContains("overview_file");
+ for (idx=0; idx<ov.size(); ++idx)
+ {
+ ossimFilename newOv = file.path().dirCat(kwl[ov[idx]]);
+ kwl.add(ov[idx], newOv.data(), true);
+ }
+ std::vector<ossimString> nm = kwl.findAllKeysThatContains(".name");
+ for (idx=0; idx<nm.size(); ++idx)
+ {
+ ossimString newNm = " Entry 0: " + kwl[fn[idx]];
+ kwl.add(nm[idx], newNm.data(), true);
+ }
+ }
+
+ m_dataManagerCallback->setEnabled(false);
+ m_rootImageFolder->setMarkForDeletion(true);
+ m_dataManager->clear();
+ result =m_dataManager->loadState(kwl,"dataManager.");
+ m_activeItemsMutex.lock();
+ m_activeItems.clear();
+ m_activeItemsMutex.unlock();
+ refresh();
+ m_dataManagerCallback->setEnabled(true);
+ }
+
+ return result;
+}
+
+void ossimGui::DataManagerWidget::refresh()
+{
+ QTreeWidgetItemIterator iter1(m_rawImageSources);
+ m_rootImageFolder->setMarkForDeletion(true);
+ m_rawImageSources->clearChildren();
+ m_imageChains->clearChildren();
+ m_imageDisplays->clearChildren();
+ m_imageWriters->clearChildren();
+ RefreshVisitor visitor(this);
+
+ if(m_dataManager.valid())
+ {
+ m_dataManager->accept(visitor);
+ }
+}
+
+void ossimGui::DataManagerWidget::initialize()
+{
+ clear();
+ setColumnCount(1);
+ if(!headerItem())
+ {
+ setHeaderItem(new QTreeWidgetItem());
+ }
+
+ headerItem()->setText(0, "Data Manager");
+
+ m_rootImageFolder = new DataManagerImageFolder((QTreeWidget*)this);
+ addTopLevelItem(m_rootImageFolder);
+
+ m_rootJobsFolder = new DataManagerJobsFolder((QTreeWidget*)this);
+ addTopLevelItem(m_rootJobsFolder);
+
+ m_rawImageSources = new DataManagerRawImageSourceFolder();
+ m_imageChains = new DataManagerImageChainFolder();
+ m_imageDisplays = new DataManagerDisplayFolder();
+ m_imageWriters = new DataManagerImageWriterFolder();
+ m_rootImageFolder->setText(0, "Image Folder");
+ m_rawImageSources->setText(0, "Sources");
+ m_imageChains->setText(0, "Chains");
+ m_rootImageFolder->setExpanded(true);
+
+ m_rootImageFolder->addChild(m_rawImageSources);
+ m_rootImageFolder->addChild(m_imageChains);
+ m_rootImageFolder->addChild(m_imageDisplays);
+ m_rootImageFolder->addChild(m_imageWriters);
+
+ std::vector<ossimString> objects;
+ ossimImageSourceFactoryRegistry::instance()->getTypeNameList(objects);
+
+ ossim_uint32 idx = 0;
+ m_filterList.clear();
+ m_combinerList.clear();
+
+ for(idx = 0; idx < objects.size(); ++idx)
+ {
+
+ //ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(objects[idx]);
+ ossimRefPtr<ossimObject> obj = ossimImageSourceFactoryRegistry::instance()->createObject(objects[idx]);
+ if(dynamic_cast<ossimImageSourceFilter*>(obj.get()))
+ {
+ m_filterList.push_back(objects[idx].c_str());
+ }
+ else if(dynamic_cast<ossimImageCombiner*>(obj.get()))
+ {
+ m_combinerList.push_back(objects[idx].c_str());
+ }
+ }
+}
+
+
+QMainWindow* ossimGui::DataManagerWidget::mainWindow()
+{
+ QMainWindow* result = 0;
+ QWidget* parent = parentWidget();
+
+ while(parent&&!result)
+ {
+ result = dynamic_cast<QMainWindow*> (parent);
+ parent = parent->parentWidget();
+ }
+
+ return result;
+}
+
+void ossimGui::DataManagerWidget::incrementScrollBars(const QPoint& pos)
+{
+ int autoScrollMargin = 10;
+ QRect r = contentsRect();
+ int hAdjusted = r.height()-autoScrollMargin-(header()?header()->size().height():0);
+ QScrollBar* verticalbar = verticalScrollBar();
+ // QScrollBar* horizontalBar = horizontalScrollBar();
+ int verticalAdjustment = 0;
+ // int horizontalAdjustment = 0;
+
+ if(pos.y() > hAdjusted)
+ {
+ verticalAdjustment = (pos.y()-hAdjusted);
+ }
+ else if(pos.y() < autoScrollMargin)
+ {
+ verticalAdjustment = pos.y() - autoScrollMargin;
+ }
+
+ if(verticalbar) verticalbar->setValue(verticalbar->value() + verticalAdjustment);
+}
+
+
+void ossimGui::DataManagerWidget::dragEnterEvent ( QDragEnterEvent * event )
+{
+ event->acceptProposedAction();
+}
+
+void ossimGui::DataManagerWidget::dragLeaveEvent ( QDragLeaveEvent * /* event */ )
+{
+}
+
+void ossimGui::DataManagerWidget::dragMoveEvent ( QDragMoveEvent * e )
+{
+ incrementScrollBars(e->pos());
+}
+
+void ossimGui::DataManagerWidget::dropEvent ( QDropEvent * e )
+{
+ DataManagerItem* targetItem = dynamic_cast<DataManagerItem*>(itemAt(e->pos()));
+ DataManagerImageChainItem* targetChainItem = dynamic_cast<DataManagerImageChainItem*>(targetItem);
+ if(targetItem)
+ {
+ targetItem->setSelected(false); // make sure it is unselected for we will use current selections for the drop
+ if(dynamic_cast<DataManagerImageChainFolder*> (targetItem))
+ {
+ QList<DataManagerRawImageSourceItem*> result = grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ if(!result.empty())
+ {
+ QList<DataManagerRawImageSourceItem*>::iterator iter = result.begin();
+ while(iter != result.end())
+ {
+ m_dataManager->createDefaultImageChain((*iter)->objectAsNode());
+ ++iter;
+ }
+ }
+ }
+ else if(targetChainItem)
+ {
+ DataManagerImageChainItem* targetParentChainItem = targetChainItem->parentAs<DataManagerImageChainItem>();
+ QList<DataManagerImageChainItem*> selectedItems = grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+
+ if(targetChainItem->isParentCombiner()&&targetParentChainItem)
+ {
+ targetParentChainItem->dropItems(selectedItems, targetChainItem);
+ }
+ else if(targetChainItem->isCombiner())
+ {
+ targetChainItem->dropItems(selectedItems);
+ }
+ }
+ else
+ {
+ DataManagerInputConnectionFolder* targetConnectionFolder = dynamic_cast<DataManagerInputConnectionFolder*>(itemAt(e->pos()));
+ DataManagerInputConnectionItem* targetConnectionItem = dynamic_cast<DataManagerInputConnectionItem*>(itemAt(e->pos()));
+ if(!targetConnectionFolder)
+ {
+ if(targetConnectionItem)
+ {
+ targetConnectionFolder = targetConnectionItem->parentItemAs<DataManagerInputConnectionFolder>();
+ }
+ }
+ if(targetConnectionFolder)
+ {
+ QList<DataManagerItem*> itemList = grabSelectedChildItemsOfType<DataManagerItem>();
+
+ targetConnectionFolder->connect(itemList, targetConnectionItem);
+ }
+ }
+ }
+}
+
+
+void ossimGui::DataManagerWidget::deleteSelected()
+{
+ if(QMessageBox::question(this, "Delete Items", "Do you wish to delete the currently\nselected items?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
+ {
+ deleteSelectedItems();
+ }
+}
+
+void ossimGui::DataManagerWidget::deleteSelectedItems()
+{
+ // these are not managed and are shared links so we can just delete them
+ QList<DataManagerInputConnectionItem*> connectionItems = grabSelectedChildItemsOfType<DataManagerInputConnectionItem>();
+ if(!connectionItems.empty())
+ {
+ std::set<DataManagerInputConnectionFolder*> folderSet;
+
+ QList<DataManagerInputConnectionItem*>::iterator iter = connectionItems.begin();
+ while(iter!=connectionItems.end())
+ {
+ DataManagerInputConnectionFolder* folder =(*iter)->parentItemAs<DataManagerInputConnectionFolder>();
+ if(folder)
+ {
+ folderSet.insert(folder);
+ }
+ ++iter;
+ }
+ std::set<DataManagerInputConnectionFolder*>::iterator folderSetIterator = folderSet.begin();
+ while(folderSetIterator != folderSet.end())
+ {
+ (*folderSetIterator)->disconnectSelected();
+ ++folderSetIterator;
+ }
+ }
+
+ QList<DataManagerNodeItem*> result = grabSelectedChildItemsOfType<DataManagerNodeItem>();
+ DataManager::NodeListType itemsToDelete;
+ if(!result.empty())
+ {
+ QList<DataManagerNodeItem*>::iterator iter = result.begin();
+
+ while(iter != result.end())
+ {
+ DataManager::Node* node = (*iter)->objectAsNode();
+ ConnectableDisplayObject* obj = node->getObjectAs<ConnectableDisplayObject>();
+
+ if(obj&&obj->display()&&!obj->display()->testAttribute(Qt::WA_DeleteOnClose))
+ {
+ // display is not deleted on close.
+ obj->display()->close();
+ }
+ else
+ {
+ (*iter)->setMarkForDeletion(true);
+ (*iter)->setSelected(false);
+ if((*iter)->objectAsNode())
+ {
+ DataManager::Node* node = (*iter)->objectAsNode();
+ if(node&&node->getObjectAsConnectable())
+ {
+ node->getObjectAsConnectable()->disconnect();
+ }
+ itemsToDelete.push_back((*iter)->objectAsNode());
+ }
+ if(m_activeItems.erase((*iter))>0)
+ {
+ delete (*iter);
+ }
+ }
+ ++iter;
+ }
+ }
+
+ m_dataManager->remove(itemsToDelete, false);
+ itemsToDelete.clear();
+}
+
+void ossimGui::DataManagerWidget::cancelSelected()
+{
+ if(QMessageBox::question(this, "Cancel Jobs", "Do you wish to cancel the currently\nselected jobs?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
+ {
+ QList<DataManagerJobItem*> jobItems = grabSelectedChildItemsOfType<DataManagerJobItem>();
+ QList<DataManagerJobItem*>::iterator iter = jobItems.begin();
+ while(iter != jobItems.end())
+ {
+ (*iter)->cancel();
+ ++iter;
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::keyPressEvent ( QKeyEvent * e)
+{
+ switch(e->key())
+ {
+ case Qt::Key_Delete:
+ {
+ deleteSelected();
+ break;
+ }
+
+ case Qt::Key_S:
+ {
+ if(m_miDialog) m_miDialog->show();
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::mousePressEvent(QMouseEvent *e)
+{
+ QTreeWidget::mousePressEvent(e);
+ QTreeWidgetItem* itemSelected = itemAt(e->pos());
+ bool dropDownMenuFlag = (e->buttons() & Qt::RightButton) ||
+ ((e->buttons() & Qt::LeftButton) &&
+ (e->modifiers()&Qt::MetaModifier));
+ if(itemSelected) itemSelected->setSelected(true);
+ if(dropDownMenuFlag)
+ {
+ QList<DataManagerItem*> items = grabSelectedChildItemsOfType<DataManagerItem>();
+ if(!items.empty())
+ {
+ QMenu* menu = createMenu(items, dynamic_cast<DataManagerItem*>(itemSelected));
+ if(menu)
+ {
+ menu->popup(mapToGlobal(e->pos()), menu->menuAction());
+ }
+ }
+ }
+ else if ((e->buttons() & Qt::LeftButton)
+ && itemSelected)
+ {
+ m_dragStartPosition = e->pos();
+ }
+
+}
+
+void ossimGui::DataManagerWidget::mouseMoveEvent(QMouseEvent *e)
+{
+ if (e->buttons() == Qt::LeftButton)
+ {
+ // QPoint pos = e->pos();
+ // ossim_int32 len = (pos - m_dragStartPosition).manhattanLength();
+ if ((e->pos() - m_dragStartPosition).manhattanLength()
+ < QApplication::startDragDistance())
+ {
+ QDrag *drag = new QDrag(this);
+ QMimeData *mimeData = new QMimeData;
+
+ //mimeData->setText(commentEdit->toPlainText());
+ drag->setMimeData(mimeData);
+ //drag->setPixmap(iconPixmap);
+
+ // Qt::DropAction dropAction = drag->exec();
+ drag->exec();
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::mouseReleaseEvent(QMouseEvent * e)
+{
+ QTreeWidget::mouseReleaseEvent(e);
+}
+
+void ossimGui::DataManagerWidget::showSelected()
+{
+ QList<DataManagerItem*> items= grabSelectedChildItemsOfType<DataManagerItem>();
+
+ QList<DataManagerItem*>::iterator itemsIter = items.begin();
+ DataManagerEvent* event = new DataManagerEvent();
+ while(itemsIter != items.end())
+ {
+ event->nodeList().push_back((*itemsIter)->objectAsNode());
+
+ ++itemsIter;
+ }
+ QCoreApplication::postEvent(mainWindow(), event);
+}
+
+void ossimGui::DataManagerWidget::exportSelected()
+{
+ QList<DataManagerImageChainItem*> chainItems= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ QList<DataManagerRawImageSourceItem*> rawItems= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+
+ ossim_uint32 count = chainItems.size()+rawItems.size();
+ if(count>1)
+ {
+ QMessageBox::warning(this, "Warning", "Please select only one item to export. This can be a chain or a raw source.");
+ return;
+ }
+ // need support to output the 8 bit chain layer.
+ // we will do that later
+ //
+ ossimRefPtr<DataManager::Node> node;
+
+ if(!chainItems.empty())
+ {
+ node = (*chainItems.begin())->objectAsNode();
+ }
+ else if(!rawItems.empty())
+ {
+ node = (*rawItems.begin())->objectAsNode();
+ }
+
+ if(node.valid())
+ {
+ ossimConnectableObject* obj = node->getObjectAs<ossimConnectableObject>();
+ if(obj)
+ {
+ ExportImageDialog* dialog = new ExportImageDialog(this);
+ dialog->setObject(obj);
+ dialog->exec();
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::swipeSelected()
+{
+ QList<DataManagerItem*> items= grabSelectedChildItemsOfType<DataManagerItem>();
+
+ QList<DataManagerItem*>::iterator itemsIter = items.begin();
+ ossimRefPtr<ossimGui::DataManager::Node> node = m_dataManager->createDefault2dImageDisplay(0, true);
+ ConnectableDisplayObject* connectableDisplay = node->getObjectAs<ConnectableDisplayObject>();
+
+ while(itemsIter != items.end())
+ {
+ DataManager::Node* iterNode=(*itemsIter)->objectAsNode();
+ if(iterNode)
+ {
+ if(iterNode->getObjectAs<ossimImageSource>())
+ {
+ connectableDisplay->connectMyInputTo(iterNode->getObjectAs<ossimConnectableObject>());
+ }
+ }
+ ++itemsIter;
+ }
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(node.get());
+ QCoreApplication::postEvent(mainWindow(), event);
+
+}
+
+void ossimGui::DataManagerWidget::buildOverviewsForSelected(QAction* action)
+{
+ buildOverviewsForSelected(action->text());
+}
+
+void ossimGui::DataManagerWidget::buildOverviewsForSelected(const QString& type)
+{
+ QList<DataManagerRawImageSourceItem*> items= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ if(!items.empty())
+ {
+ QList<DataManagerRawImageSourceItem*>::iterator item = items.begin();
+ while(item!=items.end())
+ {
+ DataManager::Node* node = (*item)->objectAsNode();
+ if(node)
+ {
+ ossimRefPtr<ossimImageHandler> isource = node->getObjectAs<ossimImageHandler>();
+ if(isource.valid())
+ {
+ ossimRefPtr<ImageStagerJob> stagerJob = new ImageStagerJob(isource.get(), ImageStagerJob::STAGE_OVERVIEWS);
+ stagerJob->setCallback(new ImageStagerJobCallback(this, (*item)));
+ stagerJob->setOverviewType(type.toAscii().data());
+ m_jobQueue->add(stagerJob.get());
+ stagerJob = 0; isource = 0;
+ }
+ }
+ ++item;
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::buildOverviewsForSelected()
+{
+ buildOverviewsForSelected(QString("ossim_tiff_box"));
+}
+
+void ossimGui::DataManagerWidget::createFullHistogramsForSelected()
+{
+}
+
+void ossimGui::DataManagerWidget::createFastHistogramsForSelected()
+{
+}
+
+
+void ossimGui::DataManagerWidget::createDefaultChain()
+{
+ QList<DataManagerRawImageSourceItem*> items= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ DataManager::NodeListType nodeList;
+ DataManager::NodeListType displayList;
+ QList<DataManagerRawImageSourceItem*>::iterator item = items.begin();
+ while(item != items.end())
+ {
+ DataManager::Node* node = (*item)->objectAsNode();
+ ossimRefPtr<DataManager::Node> newNode = m_dataManager->createDefaultImageChain(node, false).get();
+
+ if(newNode.valid())
+ {
+ nodeList.push_back(newNode.get());
+ ossimRefPtr<DataManager::Node> newDisplayNode = m_dataManager->createDefault2dImageDisplay(newNode.get(), false);
+ nodeList.push_back(newDisplayNode.get());
+ displayList.push_back(newDisplayNode.get());
+ }
+ ++item;
+ }
+ populateTreeWithNodes(nodeList);
+ if(!displayList.empty())
+ {
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(displayList);
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+
+}
+
+void ossimGui::DataManagerWidget::createAffineChain()
+{
+ QList<DataManagerRawImageSourceItem*> items= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ DataManager::NodeListType nodeList;
+ DataManager::NodeListType displayList;
+ QList<DataManagerRawImageSourceItem*>::iterator item = items.begin();
+ ossimKeywordlist kwl;
+ if(kwl.parseString(m_dataManager->defaultAffineChain()))
+ {
+ while(item != items.end())
+ {
+ DataManager::Node* node = (*item)->objectAsNode();
+ ossimRefPtr<DataManager::Node> newNode = m_dataManager->createChainFromTemplate(kwl, node, false).get();
+
+ if(newNode.valid())
+ {
+ newNode->setName( "Image Chain: " + newNode->name());
+ nodeList.push_back(newNode.get());
+ ossimRefPtr<DataManager::Node> newDisplayNode = m_dataManager->createDefault2dImageDisplay(newNode.get(), false);
+ nodeList.push_back(newDisplayNode.get());
+ displayList.push_back(newDisplayNode.get());
+ }
+ ++item;
+ }
+ populateTreeWithNodes(nodeList);
+ }
+ if(!displayList.empty())
+ {
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(displayList);
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+}
+
+void ossimGui::DataManagerWidget::createMapProjectedChain()
+{
+ QList<DataManagerRawImageSourceItem*> items= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ DataManager::NodeListType nodeList;
+ DataManager::NodeListType displayList;
+ QList<DataManagerRawImageSourceItem*>::iterator item = items.begin();
+ ossimKeywordlist kwl;
+ if(kwl.parseString(m_dataManager->defaultReprojectionChain()))
+ {
+ while(item != items.end())
+ {
+ DataManager::Node* node = (*item)->objectAsNode();
+ ossimRefPtr<DataManager::Node> newNode = m_dataManager->createChainFromTemplate(kwl, node, false).get();
+
+ if(newNode.valid())
+ {
+ newNode->setName( "Reprojection Chain: " + newNode->name());
+ nodeList.push_back(newNode.get());
+ ossimRefPtr<DataManager::Node> newDisplayNode = m_dataManager->createDefault2dImageDisplay(newNode.get(), false);
+ nodeList.push_back(newDisplayNode.get());
+ displayList.push_back(newDisplayNode.get());
+ }
+ ++item;
+ }
+ populateTreeWithNodes(nodeList);
+ }
+ if(!displayList.empty())
+ {
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(displayList);
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+}
+
+void ossimGui::DataManagerWidget::createImageNormalsChain()
+{
+ QList<DataManagerRawImageSourceItem*> items= grabSelectedChildItemsOfType<DataManagerRawImageSourceItem>();
+ ossimString templateChain = "type: ossimImageChain\n";
+ templateChain += "object0.type: ossimImageToPlaneNormalFilter\n";
+ templateChain += "object1.type: ossimCacheTileSource\n";
+ templateChain += "object2.type: ossimImageRenderer\n";
+ templateChain += "object3.type: ossimCacheTileSource\n";
+
+ DataManager::NodeListType nodeList;
+ DataManager::NodeListType displayList;
+ QList<DataManagerRawImageSourceItem*>::iterator item = items.begin();
+ ossimKeywordlist kwl;
+
+ if(kwl.parseString(templateChain))
+ {
+ while(item != items.end())
+ {
+ DataManager::Node* node = (*item)->objectAsNode();
+ ossimRefPtr<DataManager::Node> newNode = m_dataManager->createChainFromTemplate(kwl, node, false).get();
+
+ if(newNode.valid())
+ {
+ newNode->setName( "Normals Chain: " + newNode->name());
+ nodeList.push_back(newNode.get());
+ ossimRefPtr<DataManager::Node> newDisplayNode = m_dataManager->createDefault2dImageDisplay(newNode.get(), false);
+ nodeList.push_back(newDisplayNode.get());
+ displayList.push_back(newDisplayNode.get());
+ }
+ ++item;
+ }
+ populateTreeWithNodes(nodeList);
+ }
+ if(!displayList.empty())
+ {
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(displayList);
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+}
+
+void ossimGui::DataManagerWidget::registrationExploitationSelected()
+{
+ m_dataManager->setExploitationMode(DataManager::REGISTRATION_MODE);
+ this->miDialog(DataManager::REGISTRATION_MODE);
+}
+
+void ossimGui::DataManagerWidget::geoPositioningExploitationSelected()
+{
+ m_dataManager->setExploitationMode(DataManager::GEOPOSITIONING_MODE);
+ this->miDialog(DataManager::GEOPOSITIONING_MODE);
+}
+
+void ossimGui::DataManagerWidget::mensurationExploitationSelected()
+{
+ m_dataManager->setExploitationMode(DataManager::MENSURATION_MODE);
+ this->miDialog(DataManager::MENSURATION_MODE);
+}
+
+void ossimGui::DataManagerWidget::aOverBMosaic()
+{
+ combineImagesWithType("ossimImageMosaic");
+}
+
+void ossimGui::DataManagerWidget::blendMosaic()
+{
+ combineImagesWithType("ossimBlendMosaic");
+}
+
+void ossimGui::DataManagerWidget::featherMosaic()
+{
+ combineImagesWithType("ossimFeatherMosaic");
+}
+
+void ossimGui::DataManagerWidget::hillShadeCombiner()
+{
+ QList<DataManagerImageChainItem*> items= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+
+ DataManager::NodeListType newNodeList;
+ DataManager::NodeListType displayList;
+ DataManager::NodeListType nodeToConnectList;
+ DataManagerImageChainItem* normalItem = 0;
+ DataManagerImageChainItem* colorItem = 0;
+ if(items.size() == 1)
+ {
+ normalItem = *items.begin();
+
+ if(normalItem->objectAsNode())
+ {
+ ossimImageSource* source = normalItem->objectAsNode()->getObjectAs<ossimImageSource>();
+ if(source)
+ {
+ if((source->getNumberOfOutputBands() !=3)||
+ (source->getMinPixelValue() < -1) ||
+ (source->getMaxPixelValue() > 1))
+ {
+ normalItem = 0;
+ }
+ }
+ }
+ }
+ else if(items.size() == 2)
+ {
+ DataManagerImageChainItem* item1 = *items.begin();
+ DataManagerImageChainItem* item2 = *(items.begin()+1);
+ if(item1&&item2)
+ {
+ ossimImageSource* source = item1->objectAsNode()->getObjectAs<ossimImageSource>();
+ if((source->getNumberOfOutputBands() == 3)&&
+ (source->getMinPixelValue() >= -1) &&
+ (source->getMaxPixelValue() <= 1))
+ {
+ normalItem = item1;
+ colorItem = item2;
+ }
+ else
+ {
+ source = item2->objectAsNode()->getObjectAs<ossimImageSource>();
+ if((source->getNumberOfOutputBands() == 3)&&
+ (source->getMinPixelValue() >= -1) &&
+ (source->getMaxPixelValue() <= 1))
+ {
+ normalItem = item2;
+ colorItem = item1;
+ }
+ }
+ }
+ }
+
+ if(normalItem)
+ {
+ nodeToConnectList.push_back(normalItem->objectAsNode());
+ if(colorItem) nodeToConnectList.push_back(colorItem->objectAsNode());
+
+ ossimRefPtr<DataManager::Node> newNode = dataManager()->createDefaultCombinerChain("ossimBumpShadeTileSource", nodeToConnectList, false);
+ newNodeList.push_back(newNode.get());
+ ossimRefPtr<DataManager::Node> newDisplayNode = m_dataManager->createDefault2dImageDisplay(newNode.get(), false);
+ newNodeList.push_back(newDisplayNode.get());
+ displayList.push_back(newDisplayNode.get());
+ }
+
+ if(!newNodeList.empty())
+ {
+ populateTreeWithNodes(newNodeList);
+ }
+ if(!displayList.empty())
+ {
+ DataManagerEvent* event = new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ event->setNodeList(displayList);
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+
+}
+
+void ossimGui::DataManagerWidget::factoryCombiner()
+{
+ bool ok = false;
+ // we will allocate a new combiner
+ QString combinerType = QInputDialog::getItem(this, "Image Combiner Selection", "Image Combiner:", m_combinerList, 0, false, &ok);
+ if(ok && (combinerType != ""))
+ {
+ combineImagesWithType(combinerType);
+ }
+}
+
+void ossimGui::DataManagerWidget::combineImagesWithType(const QString& combinerType)
+{
+ QList<DataManagerImageChainItem*> items= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ DataManager::NodeListType nodeList;
+ QList<DataManagerImageChainItem*>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ if(dynamic_cast<DataManagerImageChainItem*> ((*iter)))
+ {
+ nodeList.push_back((*iter)->objectAsNode());
+ }
+ ++iter;
+ }
+ if(!nodeList.empty())
+ {
+ ossimRefPtr<DataManager::Node> newNode = dataManager()->createDefaultCombinerChain(combinerType.toAscii().data(), nodeList);
+ if(newNode.valid())
+ {
+ DataManagerEvent* event = new DataManagerEvent();
+ event->setNodeList(newNode.get());
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+ }
+}
+
+
+void ossimGui::DataManagerWidget::geographicView()
+{
+ QList<DataManagerImageChainItem*> items= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ if(!items.empty())
+ {
+ ossimTypeNameVisitor visitor("ossimViewInterface");
+ ossimTypeNameVisitor displayVisitor("ConnectableDisplayObject", false, ossimVisitor::VISIT_OUTPUTS);
+ QList<DataManagerImageChainItem*>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ if((*iter)->objectAsNode())
+ {
+ ossimObject* obj = (*iter)->objectAsNode()->getObject();
+ obj->accept(visitor);
+ }
+ ++iter;
+ }
+ ossimCollectionVisitor::ListRef& listRef = visitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator viewIter = listRef.begin();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimDpt metersPerPixel(1.0, 1.0);
+ ossimRefPtr<ossimMapProjection> mapProj = new ossimEquDistCylProjection();
+ if(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ // grab information from the first view and then set everyone relative to that
+ if(viewInterface)
+ {
+ ossimRefPtr<ossimImageGeometry> currentViewGeom = dynamic_cast<ossimImageGeometry*>(viewInterface->getView());
+ if(currentViewGeom.valid())
+ {
+ metersPerPixel = currentViewGeom->getMetersPerPixel();
+ metersPerPixel.x = metersPerPixel.y;
+ }
+ }
+ }
+ mapProj->setMetersPerPixel(metersPerPixel);
+ ossimRefPtr<ossimImageGeometry> geom = new ossimImageGeometry(0, mapProj.get());
+ while(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ if(viewInterface)
+ {
+ ossimRefPtr<View> view = new View(View::SYNC_TYPE_GEOM, geom.get());
+ {
+ displayVisitor.reset();
+ (*viewIter)->accept(displayVisitor);
+ ossimCollectionVisitor::ListRef& displayListRef = displayVisitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator displayListIter = displayListRef.begin();
+ if(!displayListRef.empty())
+ {
+ while(displayListIter != displayListRef.end())
+ {
+ ConnectableDisplayObject* displayObject = dynamic_cast<ConnectableDisplayObject*> ((*displayListIter).get());
+ if(displayObject&&displayObject->display())
+ {
+ displayObject->display()->sync(*view);
+ }
+
+ ++displayListIter;
+ }
+ }
+ else
+ {
+ viewInterface->setView(geom.get());
+ ossimEventVisitor visitor(refreshEvent.get());
+ (*viewIter)->accept(visitor);
+ }
+
+ }
+ }
+ ++viewIter;
+ }
+ visitor.reset();
+ displayVisitor.reset();
+ }
+}
+
+void ossimGui::DataManagerWidget::scaledGeographicView()
+{
+ QList<DataManagerImageChainItem*> items= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ if(!items.empty())
+ {
+ ossimTypeNameVisitor visitor("ossimViewInterface");
+ ossimTypeNameVisitor displayVisitor("ConnectableDisplayObject", false, ossimVisitor::VISIT_OUTPUTS);
+ QList<DataManagerImageChainItem*>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ if((*iter)->objectAsNode())
+ {
+ ossimObject* obj = (*iter)->objectAsNode()->getObject();
+ obj->accept(visitor);
+ }
+ ++iter;
+ }
+ ossimCollectionVisitor::ListRef& listRef = visitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator viewIter = listRef.begin();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimDpt metersPerPixel(1.0, 1.0);
+ ossimRefPtr<ossimMapProjection> mapProj = new ossimEquDistCylProjection();
+ ossimGpt centerGround;
+ if(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ // grab information from the first view and then set everyone relative to that
+ if(viewInterface)
+ {
+ ossimRefPtr<ossimImageGeometry> currentViewGeom = dynamic_cast<ossimImageGeometry*>(viewInterface->getView());
+ if(currentViewGeom.valid())
+ {
+ metersPerPixel = currentViewGeom->getMetersPerPixel();
+ metersPerPixel.x = metersPerPixel.y;
+ ossimImageSource* imgSource=dynamic_cast<ossimImageSource*> ((*viewIter).get());
+ if(imgSource)
+ {
+ currentViewGeom->localToWorld(imgSource->getBoundingRect().midPoint(), centerGround);
+ }
+ }
+ }
+ }
+ mapProj->setMetersPerPixel(metersPerPixel);
+ mapProj->setOrigin(centerGround);
+ ossimRefPtr<ossimImageGeometry> geom = new ossimImageGeometry(0, mapProj.get());
+ while(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ if(viewInterface)
+ {
+ ossimGpt centerGround;
+ centerGround.makeNan();
+ ossimDpt metersPerPixel(1.0, 1.0);
+ ossimRefPtr<ossimMapProjection> mapProj = new ossimEquDistCylProjection();
+ mapProj->setMetersPerPixel(metersPerPixel);
+
+ ossimRefPtr<View> view = new View(View::SYNC_TYPE_GEOM, geom.get());
+ {
+ displayVisitor.reset();
+ (*viewIter)->accept(displayVisitor);
+ ossimCollectionVisitor::ListRef& displayListRef = displayVisitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator displayListIter = displayListRef.begin();
+ if(!displayListRef.empty())
+ {
+ while(displayListIter != displayListRef.end())
+ {
+ ConnectableDisplayObject* displayObject = dynamic_cast<ConnectableDisplayObject*> ((*displayListIter).get());
+ if(displayObject&&displayObject->display())
+ {
+ displayObject->display()->sync(*view);
+ }
+
+ ++displayListIter;
+ }
+ }
+ else
+ {
+ viewInterface->setView(geom.get());
+ ossimEventVisitor visitor(refreshEvent.get());
+ (*viewIter)->accept(visitor);
+ }
+
+ }
+ }
+ ++viewIter;
+ }
+ visitor.reset();
+ displayVisitor.reset();
+ }
+}
+
+void ossimGui::DataManagerWidget::utmView()
+{
+ QList<DataManagerImageChainItem*> items= grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ if(!items.empty())
+ {
+ ossimTypeNameVisitor visitor("ossimViewInterface");
+ ossimTypeNameVisitor displayVisitor("ConnectableDisplayObject", false, ossimVisitor::VISIT_OUTPUTS);
+ QList<DataManagerImageChainItem*>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ if((*iter)->objectAsNode())
+ {
+ ossimObject* obj = (*iter)->objectAsNode()->getObject();
+ obj->accept(visitor);
+ }
+ ++iter;
+ }
+ ossimCollectionVisitor::ListRef& listRef = visitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator viewIter = listRef.begin();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimDpt metersPerPixel(1.0, 1.0);
+ ossimRefPtr<ossimUtmProjection> mapProj = new ossimUtmProjection();
+ ossimGpt centerGround;
+ if(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ // grab information from the first view and then set everyone relative to that
+ if(viewInterface)
+ {
+ ossimRefPtr<ossimImageGeometry> currentViewGeom = dynamic_cast<ossimImageGeometry*>(viewInterface->getView());
+ if(currentViewGeom.valid())
+ {
+ metersPerPixel = currentViewGeom->getMetersPerPixel();
+ metersPerPixel.x = metersPerPixel.y;
+ ossimImageSource* imgSource=dynamic_cast<ossimImageSource*> ((*viewIter).get());
+ if(imgSource)
+ {
+ currentViewGeom->localToWorld(imgSource->getBoundingRect().midPoint(), centerGround);
+ }
+ }
+ }
+ }
+ mapProj->setMetersPerPixel(metersPerPixel);
+ mapProj->setZone(centerGround);
+ ossimRefPtr<ossimImageGeometry> geom = new ossimImageGeometry(0, mapProj.get());
+ while(viewIter != listRef.end())
+ {
+ ossimViewInterface* viewInterface = dynamic_cast<ossimViewInterface*>((*viewIter).get());
+ if(viewInterface)
+ {
+ ossimRefPtr<View> view = new View(View::SYNC_TYPE_GEOM, geom.get());
+ {
+ displayVisitor.reset();
+ (*viewIter)->accept(displayVisitor);
+ ossimCollectionVisitor::ListRef& displayListRef = displayVisitor.getObjects();
+ ossimCollectionVisitor::ListRef::iterator displayListIter = displayListRef.begin();
+ if(!displayListRef.empty())
+ {
+ while(displayListIter != displayListRef.end())
+ {
+ ConnectableDisplayObject* displayObject = dynamic_cast<ConnectableDisplayObject*> ((*displayListIter).get());
+ if(displayObject&&displayObject->display())
+ {
+ displayObject->display()->sync(*view);
+ }
+
+ ++displayListIter;
+ }
+ }
+ else
+ {
+ viewInterface->setView(geom.get());
+ ossimEventVisitor visitor(refreshEvent.get());
+ (*viewIter)->accept(visitor);
+ }
+
+ }
+ }
+ ++viewIter;
+ }
+ visitor.reset();
+ displayVisitor.reset();
+ }
+}
+
+void ossimGui::DataManagerWidget::openLocalImage()
+{
+ if(m_jobQueue.valid())
+ {
+ QStringList fileNames = QFileDialog::getOpenFileNames(
+ this,
+ tr("Open Image(s)"),
+ m_lastOpenedDirectory.c_str() );
+
+ if (fileNames.size() > 0)
+ {
+ for (int i = 0; i < fileNames.size(); ++i)
+ {
+ QUrl url = QUrl::fromLocalFile(fileNames.at(i));
+ OpenImageUrlJob* job = new OpenImageUrlJob(url);
+ job->setName(ossimString("open ") + url.toString().toAscii().data());
+ ImageOpenJobCallback* callback = new ImageOpenJobCallback(this, m_dataManager);
+ job->setCallback(callback);
+ m_jobQueue->add(job);
+
+ // Capture the directory for next QFileDialog::getOpenFileNames(...)
+ ossimFilename f = fileNames.at(i).toStdString();
+ if ( f.size() )
+ {
+ ossimFilename d;
+ if ( f.isDir() )
+ {
+ d = f;
+ }
+ else
+ {
+ d = f.expand().path();
+ }
+ if ( d.isDir() )
+ {
+ m_lastOpenedDirectory = d;
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::openLocalImageInteractive()
+{
+ if(m_jobQueue.valid())
+ {
+ QStringList fileNames = QFileDialog::getOpenFileNames(
+ this,
+ tr("Open Image(s)"),
+ m_lastOpenedDirectory.c_str() );
+
+ if (fileNames.size() > 0)
+ {
+ for (int i = 0; i < fileNames.size(); ++i)
+ {
+ ossimFilename file = fileNames.at(i).toStdString();
+ ossimRefPtr<ossimImageHandler> ih =
+ ossimImageHandlerRegistry::instance()->open(file);
+ if(ih.valid())
+ {
+ ossimGui::HandlerList handlers;
+
+ ossim_uint32 nEntries = ih->getNumberOfEntries();
+ if ( nEntries == 1 )
+ {
+ handlers.push_back( ih.get() );
+ }
+ else
+ {
+ // Let the user select entries.
+ ossimGui::OpenImageDialog oid( ih.get() );
+ oid.exec();
+ oid.handlerList( handlers );
+ }
+
+ if ( handlers.size() )
+ {
+ ossim_uint32 idx = 0;
+ ossim_uint32 nImages = handlers.size();
+ DataManager::NodeListType nodeList;;
+ for(idx = 0; idx < nImages; ++idx)
+ {
+ ossimRefPtr<DataManager::Node> node =
+ m_dataManager->addSource( handlers[idx].get() );
+ if(node.valid())
+ {
+ ossimRefPtr<DataManager::Node> chain =
+ m_dataManager->createDefaultImageChain(node.get());
+ if(chain.valid())
+ {
+ nodeList.push_back(chain.get());
+ }
+ }
+ }
+ if(!nodeList.empty())
+ {
+ DataManagerEvent* e =
+ new DataManagerEvent(DataManagerEvent::COMMAND_DISPLAY_NODE);
+ e->setNodeList(nodeList);
+ QCoreApplication::postEvent( mainWindow(), e );
+ }
+ }
+ }
+
+ // Capture the directory for next QFileDialog::getOpenFileNames(...)
+ ossimFilename f = fileNames.at(i).toStdString();
+ if ( f.size() )
+ {
+ ossimFilename d;
+ if ( f.isDir() )
+ {
+ d = f;
+ }
+ else
+ {
+ d = f.expand().path();
+ }
+ if ( d.isDir() )
+ {
+ m_lastOpenedDirectory = d;
+ }
+ }
+ }
+ }
+ }
+
+} // End: ossimGui::DataManagerWidget::openLocalImageInteractive()
+
+void ossimGui::DataManagerWidget::openJpipImage()
+{
+}
+
+void ossimGui::DataManagerWidget::createTiffWriter()
+{
+ createWriterFromType("ossimTiffWriter");
+}
+
+void ossimGui::DataManagerWidget::createJpegWriter()
+{
+ createWriterFromType("ossimJpegWriter");
+}
+
+void ossimGui::DataManagerWidget::createWriterFromFactory()
+{
+ QStringList writerList;
+ Util::imageWriterTypes(writerList);
+ if(!writerList.empty())
+ {
+ bool ok = false;
+ // we will allocate a new combiner
+ QString writerType = QInputDialog::getItem(this, "Image Writer Selection", "Image writer:", writerList, 0, false, &ok);
+ if(ok && (writerType != ""))
+ {
+ createWriterFromType(writerType);
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::createWriterFromType(const QString& type)
+{
+ m_activeItemsMutex.lock();
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(type.toAscii().data()));
+ if(obj.valid())
+ {
+ ossimRefPtr<DataManager::Node> node = m_dataManager->addSource(obj.get(), false);
+ if(node.valid())
+ {
+ DataManagerImageFileWriterItem* item = new DataManagerImageFileWriterItem(node.get());
+ m_imageWriters->addChild(item);
+ m_activeItems.insert(item);
+ }
+ }
+ m_activeItemsMutex.unlock();
+}
+
+void ossimGui::DataManagerWidget::executeSelected()
+{
+ QList<DataManagerImageWriterItem*> result = grabSelectedChildItemsOfType<DataManagerImageWriterItem>();
+ if(!result.empty())
+ {
+ QList<DataManagerImageWriterItem*>::iterator iter = result.begin();
+ while(iter != result.end())
+ {
+ (*iter)->execute();
+
+ ++iter;
+ }
+ }
+
+}
+
+void ossimGui::DataManagerWidget::displayCropViewport()
+{
+ QList<DataManagerDisplayItem*> result = grabSelectedChildItemsOfType<DataManagerDisplayItem>();
+ if(!result.empty())
+ {
+ QList<DataManagerDisplayItem*>::iterator iter = result.begin();
+ while(iter != result.end())
+ {
+ DataManager::Node* node = (*iter)->objectAsNode();
+ if(node)
+ {
+ ConnectableDisplayObject* diplayObj = node->getObjectAs<ConnectableDisplayObject>();
+
+ if(diplayObj&&diplayObj->display())
+ {
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(diplayObj->display());
+ if(subWindow&&subWindow->scrollWidget()&&subWindow->scrollWidget()->layers())
+ {
+ ossimIrect rect = subWindow->scrollWidget()->viewportBoundsInSceneSpace();
+
+ QRect scrollRect(rect.ul().x, rect.ul().y, rect.width(), rect.height());//subWindow->scrollWidget()->viewToScroll().mapRect(QRect(rect.ul().x, rect.ul().y, rect.width(), rect.height()));
+
+ ossimGui::Image image(scrollRect.size(), QImage::Format_RGB32);
+ image.setOffset(QPoint(scrollRect.x(), scrollRect.y()));
+ ossimGui::ImageScrollView::Layer* layer = subWindow->scrollWidget()->layers()->layer((ossim_uint32)0);
+ if(layer&&layer->tileCache()&&layer->chain())
+ {
+ layer->tileCache()->getSubImage(image);
+ ossimRefPtr<ossimImageData> data = image.toOssimImage();
+ data->setOrigin(rect.ul()); // change to the view plane origin
+ if(data.valid())
+ {
+ ossimRefPtr<ossimImageGeometry> geom = layer->chain()->getImageGeometry();
+ if(geom.valid())
+ {
+ geom = static_cast<ossimImageGeometry*>(geom->dup());
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ ossimGpt ulGpt;
+ geom->localToWorld(data->getImageRectangle().ul(), ulGpt);
+ mapProj->setUlTiePoints(ulGpt);
+
+ data->setOrigin(ossimIpt(0,0));
+ }
+ else
+ {
+
+ }
+ }
+
+
+ ossimRefPtr<ossimMemoryImageSource> imgSource = new ossimMemoryImageSource();
+ imgSource->setImage(data.get());
+ imgSource->setImageGeometry(geom.get());
+ ossimRefPtr<DataManager::Node> rawNode = dataManager()->addSource(imgSource.get()).get();
+ ossimRefPtr<DataManager::Node> chainNode = dataManager()->createDefaultImageChain(rawNode.get()).get();
+
+
+ DataManagerEvent* event = new DataManagerEvent();
+ event->setNodeList(chainNode.get());
+ QCoreApplication::postEvent(mainWindow(), event);
+ }
+ }
+ }
+ }
+ }
+ ++iter;
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::removeAllFilters()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ DataManagerImageFilterFolder* folder = dynamic_cast<DataManagerImageFilterFolder*> (*iter);
+ if(folder)
+ {
+ folder->removeFilters();
+
+ if(folder->object())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ folder->object()->accept(visitor);
+ }
+ }
+ ++iter;
+ }
+}
+
+void ossimGui::DataManagerWidget::addFilterToFront()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+
+ if(iter != items.end())
+ {
+ DataManagerImageFilterFolder* folder = dynamic_cast<DataManagerImageFilterFolder*> (*iter);
+ if(folder)
+ {
+ bool ok=false;
+ QString filterType = QInputDialog::getItem(this, "Image Filter Selection", "Image Filter:", m_filterList, 0, false, &ok);
+ if(ok &&(filterType != ""))
+ {
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(filterType.toAscii().data()));
+ if(obj.valid())
+ {
+ folder->addFilterToFront(obj.get());
+
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ // std::cout << "Will add " << filterType.toAscii().data() << " to front " << std::endl;
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::addFilterToEnd()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+
+ if(iter != items.end())
+ {
+ DataManagerImageFilterFolder* folder = dynamic_cast<DataManagerImageFilterFolder*> (*iter);
+ if(folder)
+ {
+ bool ok=false;
+ QString filterType = QInputDialog::getItem(this, "Image Filter Selection", "Image Filter:", m_filterList, 0, false, &ok);
+ if(ok &&(filterType != ""))
+ {
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(filterType.toAscii().data()));
+ if(obj.valid())
+ {
+ folder->addFilterToEnd(obj.get());
+
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ // std::cout << "Will add " << filterType.toAscii().data() << " to front " << std::endl;
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::insertFilterBefore()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+
+ if(iter != items.end())
+ {
+ DataManagerImageFilterItem* item = dynamic_cast<DataManagerImageFilterItem*> (*iter);
+ if(item)
+ {
+ DataManagerImageFilterFolder* folder = item->folder();
+ if(folder)
+ {
+ bool ok=false;
+ QString filterType = QInputDialog::getItem(this, "Image Filter Selection", "Image Filter:", m_filterList, 0, false, &ok);
+ if(ok &&(filterType != ""))
+ {
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(filterType.toAscii().data()));
+ if(obj.valid())
+ {
+ folder->insertFilterBefore(obj.get(), item->object());
+
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ // std::cout << "Will add " << filterType.toAscii().data() << " to front " << std::endl;
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::insertFilterAfter()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+
+ if(iter != items.end())
+ {
+ DataManagerImageFilterItem* item = dynamic_cast<DataManagerImageFilterItem*> (*iter);
+ if(item)
+ {
+ DataManagerImageFilterFolder* folder = item->folder();
+ if(folder)
+ {
+ bool ok=false;
+ QString filterType = QInputDialog::getItem(this, "Image Filter Selection", "Image Filter:", m_filterList, 0, false, &ok);
+ if(ok &&(filterType != ""))
+ {
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(filterType.toAscii().data()));
+ if(obj.valid())
+ {
+ folder->insertFilterAfter(obj.get(), item->object());
+
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ // std::cout << "Will add " << filterType.toAscii().data() << " to front " << std::endl;
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::removeFilter()
+{
+ QList<QTreeWidgetItem *> items= selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+
+ if(iter != items.end())
+ {
+ DataManagerImageFilterItem* item = dynamic_cast<DataManagerImageFilterItem*> (*iter);
+ DataManagerImageFilterFolder* folder = item->folder();
+
+ if(folder)
+ {
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*> (item->object());
+ ossimConnectableObject::ConnectableObjectList outputList;
+ if(connectable)
+ {
+ outputList = connectable->getOutputList();
+ }
+ folder->removeFilter(item->object());
+
+
+ ossimConnectableObject::ConnectableObjectList::iterator iter = outputList.begin();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ while(iter!=outputList.end())
+ {
+ (*iter)->accept(visitor);
+ ++iter;
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::planetaryView()
+{
+ if(m_dataManager.valid()&&!m_planetaryDisplayNode.valid())
+ {
+
+ m_planetaryDisplayNode = m_dataManager->createDefault3dPlanetaryDisplay();
+ }
+ if(m_planetaryDisplayNode.valid())
+ {
+ ConnectableDisplayObject* connectableDisplay = m_planetaryDisplayNode->getObjectAs<ConnectableDisplayObject>();
+ if(connectableDisplay)
+ {
+ if(connectableDisplay->display())
+ {
+ connectableDisplay->display()->show();
+ connectableDisplay->display()->raise();
+ }
+ }
+ QList<DataManagerImageChainItem*> items = grabSelectedChildItemsOfType<DataManagerImageChainItem>();
+ QList<DataManagerImageChainItem*>::iterator itemsIter = items.begin();
+ while(itemsIter != items.end())
+ {
+ DataManager::Node* iterNode=(*itemsIter)->objectAsNode();
+ if(iterNode)
+ {
+ if(iterNode->getObjectAs<ossimImageSource>())
+ {
+ connectableDisplay->connectMyInputTo(iterNode->getObjectAs<ossimConnectableObject>());
+ }
+ }
+ ++itemsIter;
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::unselectAll()
+{
+ QList<QTreeWidgetItem *> items = selectedItems();
+ QList<QTreeWidgetItem *>::iterator iter = items.begin();
+ while(iter != items.end())
+ {
+ (*iter)->setSelected(false);
+ ++iter;
+ }
+}
+
+const ossimFilename& ossimGui::DataManagerWidget::getLastOpenedDirectory() const
+{
+ return m_lastOpenedDirectory;
+}
+
+void ossimGui::DataManagerWidget::itemChanged( QTreeWidgetItem * item, int column )
+{
+ if(column == 0)
+ {
+ DataManagerNodeItem* nodeItem = dynamic_cast<DataManagerNodeItem*>(item);
+ if(nodeItem&&nodeItem->objectAsNode())
+ {
+ ossimRefPtr<DataManager::Node> node = nodeItem->objectAsNode();
+ if(node.valid())
+ {
+ ossimSource* source = node->getObjectAs<ossimSource>();
+ if(source)
+ {
+ // check if the enable disable flag has changed
+ //
+ bool itemEnabled = item->checkState(0)!=Qt::Unchecked;
+ if(itemEnabled !=source->isSourceEnabled())
+ {
+ source->setEnableFlag(itemEnabled);
+
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ source->accept(visitor);
+ }
+ QString name=item->text(0);
+ // now check to see if the text changed
+ //
+ if(node->name()!=name)
+ {
+ node->setName(name);
+ }
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::DataManagerWidget::itemCollapsed (QTreeWidgetItem* item)
+{
+ QTreeWidget::collapseItem(item);
+
+ DataManagerInputConnectionFolder* connectionFolder = dynamic_cast<DataManagerInputConnectionFolder*> (item);
+ if(connectionFolder)
+ {
+ connectionFolder->clearChildren();
+ }
+}
+
+void ossimGui::DataManagerWidget::itemExpanded (QTreeWidgetItem* item)
+{
+ QTreeWidget::expandItem(item);
+
+ DataManagerFolder* connectionFolder = dynamic_cast<DataManagerFolder*> (item);
+ if(connectionFolder)
+ {
+ connectionFolder->populateChildren();
+ }
+}
+
+bool ossimGui::DataManagerWidget::event( QEvent * e )
+{
+ switch(e->type())
+ {
+ case DATA_MANAGER_WIDGET_JOB_EVENT_ID:
+ {
+ DataManagerWidgetJobEvent* jEvent = dynamic_cast<DataManagerWidgetJobEvent*> (e);
+ if(jEvent)
+ {
+ switch(jEvent->command())
+ {
+ case DataManagerWidgetJobEvent::COMMAND_JOB_ADD:
+ {
+ DataManagerWidgetJobEvent::JobListType& jobList = jEvent->jobList();
+ DataManagerWidgetJobEvent::JobListType::iterator iter = jobList.begin();
+ while(iter!=jobList.end())
+ {
+ m_jobQueue->add((*iter).get());
+ ++iter;
+ }
+ break;
+ }
+ case DataManagerWidgetJobEvent::COMMAND_JOB_ADDED:
+ {
+ DataManagerWidgetJobEvent::JobListType& jobList = jEvent->jobList();
+ DataManagerWidgetJobEvent::JobListType::iterator iter = jobList.begin();
+ while(iter!=jobList.end())
+ {
+ m_rootJobsFolder->addJob((*iter).get());
+ ++iter;
+ }
+ break;
+ }
+ case DataManagerWidgetJobEvent::COMMAND_JOB_STATE_CHANGED:
+ {
+ DataManagerWidgetJobEvent::JobListType& jobList = jEvent->jobList();
+ DataManagerWidgetJobEvent::JobListType::iterator iter = jobList.begin();
+ while(iter!=jobList.end())
+ {
+ m_rootJobsFolder->stateChanged((*iter).get());
+ ++iter;
+ }
+
+ break;
+ }
+ case DataManagerWidgetJobEvent::COMMAND_JOB_PROPERTY_CHANGED:
+ {
+ DataManagerWidgetJobEvent::JobListType& jobList = jEvent->jobList();
+ DataManagerWidgetJobEvent::JobListType::iterator iter = jobList.begin();
+ while(iter!=jobList.end())
+ {
+ m_rootJobsFolder->propertyChanged((*iter).get());
+ ++iter;
+ }
+ break;
+ }
+ case DataManagerWidgetJobEvent::COMMAND_JOB_PERCENT_COMPLETE:
+ {
+ DataManagerWidgetJobEvent::JobListType& jobList = jEvent->jobList();
+ DataManagerWidgetJobEvent::JobListType::iterator iter = jobList.begin();
+ while(iter!=jobList.end())
+ {
+ m_rootJobsFolder->percentCompleteChanged((*iter).get(), jEvent->percentComplete());
+ ++iter;
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ break;
+ }
+ case DATA_MANAGER_WIDGET_EVENT_ID:
+ {
+ DataManagerWidgetEvent* wEvent = dynamic_cast<DataManagerWidgetEvent*> (e);
+ if(wEvent)
+ {
+ switch(wEvent->command())
+ {
+ case DataManagerWidgetEvent::COMMAND_CONNECT_INPUT:
+ {
+ m_activeItemsMutex.lock();
+ DataManagerWidgetEvent::ItemListType& itemList = wEvent->itemList();
+ DataManagerWidgetEvent::ItemListType::iterator iter = itemList.begin();
+ while(iter!=itemList.end())
+ {
+ if(m_activeItems.find(*iter) != m_activeItems.end())
+ {
+ (*iter)->refreshChildConnections();
+ if((*iter)->objectAsNode())
+ {
+ ossimConnectableObject* obj = (*iter)->objectAsNode()->getObjectAs<ossimConnectableObject>();
+
+ if(obj)
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_ALL);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ }
+ }
+ }
+ ++iter;
+ }
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ case DataManagerWidgetEvent::COMMAND_DISCONNECT_INPUT:
+ {
+ m_activeItemsMutex.lock();
+ DataManagerWidgetEvent::ItemListType& itemList = wEvent->itemList();
+ DataManagerWidgetEvent::ItemListType::iterator iter = itemList.begin();
+ while(iter!=itemList.end())
+ {
+ // first make sure this pointer is still active
+ if(m_activeItems.find(*iter) != m_activeItems.end())
+ {
+ if((*iter)->objectAsNode())
+ {
+ ossimRefPtr<ossimConnectableObject> obj = (*iter)->objectAsNode()->getObjectAs<ossimConnectableObject>();
+ if(obj.valid())
+ {
+ ConnectableDisplayObject* connectableDisplay = dynamic_cast<ConnectableDisplayObject*>(obj.get());
+
+ if(connectableDisplay&&connectableDisplay->display()&&!connectableDisplay->display()->testAttribute(Qt::WA_DeleteOnClose))
+ {
+ // do nothing for we don't want to auto delete an object that can't be deleted.
+ // lets just call close for it will just hide the display
+ //
+ connectableDisplay->display()->close();
+ }
+ else if((!obj->isConnected())&&((*iter)->autoDelete()))
+ {
+ m_dataManager->remove((*iter)->objectAsNode());
+ }
+ else
+ {
+ (*iter)->refreshChildConnections();
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_ALL);
+ ossimEventVisitor visitor(refreshEvent.get());
+ obj->accept(visitor);
+ }
+ }
+ }
+ }
+ ++iter;
+ }
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ case DataManagerWidgetEvent::COMMAND_DELETE_NODE:
+ {
+ m_activeItemsMutex.lock();
+
+ DataManagerWidgetEvent::ItemListType& itemList = wEvent->itemList();
+ DataManagerWidgetEvent::ItemListType::iterator iter = itemList.begin();
+ while(iter != itemList.end())
+ {
+ if((*iter)->parent()) (*iter)->parent()->removeChild(*iter);
+ m_dataManager->remove((*iter)->objectAsNode(), false);
+ (*iter)->setObject(0);
+ ++iter;
+ }
+ iter = itemList.begin();
+ while(iter != itemList.end())
+ {
+ if(m_activeItems.erase(*iter)>0)
+ {
+ delete *iter;
+ }
+ ++iter;
+ }
+ ++iter;
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ case DataManagerWidgetEvent::COMMAND_REFRESH:
+ {
+ m_activeItemsMutex.lock();
+ DataManagerWidgetEvent::ItemListType& itemList = wEvent->itemList();
+ DataManagerWidgetEvent::ItemListType::iterator iter = itemList.begin();
+ while(iter != itemList.end())
+ {
+ if(m_activeItems.find(*iter) != m_activeItems.end())
+ {
+ ossimConnectableObject* connectable = (*iter)->objectAsNode()->getObjectAs<ossimConnectableObject>();
+ if(connectable)
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_GEOMETRY);
+ ossimEventVisitor visitor(refreshEvent.get());
+ connectable->accept(visitor);
+ }
+ }
+ ++iter;
+ }
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ case DataManagerWidgetEvent::COMMAND_RESET:
+ {
+ m_activeItemsMutex.lock();
+ DataManagerWidgetEvent::ItemListType& itemList = wEvent->itemList();
+ DataManagerWidgetEvent::ItemListType::iterator iter = itemList.begin();
+ if(m_activeItems.find(*iter) != m_activeItems.end())
+ {
+ (*iter)->reset();
+ }
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ e->accept();
+ break;
+ }
+ case DATA_MANAGER_EVENT_ID:
+ {
+ DataManagerEvent* wEvent = dynamic_cast<DataManagerEvent*> (e);
+ if(wEvent)
+ {
+ DataManager::NodeListType& nodeList = wEvent->nodeList();
+ switch(wEvent->command())
+ {
+ case DataManagerEvent::COMMAND_NODE_ADDED:
+ {
+ populateTreeWithNodes(nodeList);
+ break;
+ }
+ case DataManagerEvent::COMMAND_NODE_REMOVED:
+ {
+ m_activeItemsMutex.lock();
+ QList<DataManagerItem*> itemsToDelete;
+ std::set<DataManagerItem*>::iterator activeItemsIter = m_activeItems.begin();
+ while(activeItemsIter != m_activeItems.end())
+ {
+ if(std::find(nodeList.begin(), nodeList.end(), (*activeItemsIter)->objectAsNode()) != nodeList.end())
+ {
+ itemsToDelete.push_back(*activeItemsIter);
+ }
+ ++activeItemsIter;
+ }
+ QList<DataManagerItem*>::iterator itemsToDeleteIter = itemsToDelete.begin();
+ while(itemsToDeleteIter != itemsToDelete.end())
+ {
+ if(m_activeItems.erase(*itemsToDeleteIter)>0)
+ {
+ delete *itemsToDeleteIter;
+ }
+ ++itemsToDeleteIter;
+ }
+ m_activeItemsMutex.unlock();
+ break;
+ }
+ }
+ }
+ wEvent->accept();
+ break;
+ }
+ default:
+ {
+ return QTreeWidget::event(e);
+ break;
+ }
+ }
+
+ return true;
+}
+
+void ossimGui::DataManagerWidget::populateTreeWithNodes(DataManager::NodeListType& nodes)
+{
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nodes.size();++idx)
+ {
+ ossimRefPtr<DataManager::Node> node = nodes[idx];
+ if(node->getObjectAs<ossimImageHandler>())
+ {
+ DataManagerRawImageSourceItem* source = new DataManagerRawImageSourceItem(node.get());
+ source->setFlags(source->flags()|Qt::ItemIsEditable);
+ m_rawImageSources->addChild(source);
+ m_activeItemsMutex.lock();
+ m_activeItems.insert(source);
+ m_activeItemsMutex.unlock();
+ }
+ else if(node->getObjectAs<ossimImageChain>())
+ {
+ DataManagerImageChainItem* chainItem = new DataManagerImageChainItem(node.get());
+ chainItem->setFlags(chainItem->flags()|Qt::ItemIsEditable);
+ m_imageChains->addChild(chainItem);
+ //chainItem->refreshChildConnections();
+ chainItem->populateChildren();
+ m_activeItemsMutex.lock();
+ m_activeItems.insert(chainItem);
+ m_activeItemsMutex.unlock();
+ }
+ else if(node->getObjectAs<ConnectableDisplayObject>())
+ {
+
+ DataManagerDisplayItem* item = new DataManagerDisplayItem(node.get());
+ item->setFlags(item->flags()|Qt::ItemIsEditable);
+
+ ossimConnectableObject* conn = node->getObjectAs<ossimConnectableObject>();
+ if(conn)
+ {
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ conn->accept(visitor);
+ if(!visitor.getObjects().empty())
+ {
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+ ossimString source = input->getFilename();
+ QString windowTitle = QFontMetrics(QFont()).elidedText
+ (source.data(), Qt::ElideLeft, 400);
+ item->setText(0, windowTitle);
+ m_imageDisplays->addChild(item);
+ item->refreshChildConnections();
+ }
+ }
+
+ m_activeItemsMutex.lock();
+ m_activeItems.insert(item);
+ m_activeItemsMutex.unlock();
+
+
+ ConnectableDisplayObject* connectable = node->getObjectAs<ConnectableDisplayObject>();
+ if(connectable)
+ {
+ item->setAutoDelete(connectable->autoDelete());
+ }
+ }
+ else if(node->getObjectAs<ossimImageFileWriter>())
+ {
+ DataManagerImageFileWriterItem* item = new DataManagerImageFileWriterItem(node.get());
+ item->setFlags(item->flags()|Qt::ItemIsEditable);
+ m_imageWriters->addChild(item);
+ item->refreshChildConnections();
+ m_activeItemsMutex.lock();
+ m_activeItems.insert(item);
+ m_activeItemsMutex.unlock();
+ }
+ else if(node->getObjectAs<ossimImageSource>()) // we will default to a raw source for now
+ {
+ DataManagerRawImageSourceItem* source = new DataManagerRawImageSourceItem(node.get());
+ source->setFlags(source->flags()|Qt::ItemIsEditable);
+ m_rawImageSources->addChild(source);
+ m_activeItemsMutex.lock();
+ m_activeItems.insert(source);
+ m_activeItemsMutex.unlock();
+ }
+ }
+}
+
+QModelIndex ossimGui::DataManagerWidget::indexFromDataManagerItem(DataManagerItem* item, int col)
+{
+ return indexFromItem(static_cast<QTreeWidgetItem*>(item), col);
+}
+
+QMenu* ossimGui::DataManagerWidget::createMenu(QList<DataManagerItem*>& selection, DataManagerItem* activeItem)
+{
+ ossim_uint32 nImageChainSelections = 0;
+ ossim_uint32 nRawSourceSelections = 0;
+ ossim_uint32 nInputConnections = 0;
+ ossim_uint32 nDisplayItems = 0;
+ bool hasItems = false;
+ QMenu* menu = 0;
+ menu = new QMenu(this);
+ if(dynamic_cast<DataManagerRawImageSourceFolder*>(activeItem))
+ {
+ QMenu* openMenu =new QMenu("Open Image");
+
+ QAction* localOpenImageAction = openMenu->addAction("Local");
+ QAction* localOpenImageInteractiveAction = openMenu->addAction("Local Interactive");
+ QAction* jpipOpenImageAction = openMenu->addAction("JPIP");
+ // openMenu->addAction(localOpenImageAction);
+ // openMenu->addAction(jpipOpenImageAction);
+ menu->addMenu(openMenu);
+ connect(localOpenImageAction, SIGNAL(triggered(bool)), this, SLOT(openLocalImage()));
+ connect(localOpenImageInteractiveAction, SIGNAL(triggered(bool)),
+ this, SLOT(openLocalImageInteractive()));
+ connect(jpipOpenImageAction, SIGNAL(triggered(bool)), this, SLOT(openJpipImage()));
+
+ }
+ else if(dynamic_cast<DataManagerImageWriterFolder*> (activeItem))
+ {
+ QMenu* openMenu =new QMenu("Image File Writer");
+ QAction* geotiffImageAction = openMenu->addAction("Tiff");
+ QAction* jpegImageAction = openMenu->addAction("Jpeg");
+ QAction* factoryImageAction = openMenu->addAction("Factory");
+ openMenu->addAction(geotiffImageAction);
+ openMenu->addAction(jpegImageAction);
+ openMenu->addAction(factoryImageAction);
+ menu->addMenu(openMenu);
+ connect(geotiffImageAction, SIGNAL(triggered(bool)), this, SLOT(createTiffWriter()));
+ connect(jpegImageAction, SIGNAL(triggered(bool)), this, SLOT(createJpegWriter()));
+ connect(factoryImageAction, SIGNAL(triggered(bool)), this, SLOT(createWriterFromFactory()));
+ }
+ else if(dynamic_cast<DataManagerImageWriterItem*> (activeItem))
+ {
+ QAction* executeAction = menu->addAction("Execute");
+ connect(executeAction, SIGNAL(triggered(bool)), this, SLOT(executeSelected()));
+ activeItem->setSelected(true);
+ QAction* deleteAction = menu->addAction("Delete");
+ connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteSelected()));
+ }
+ else if(dynamic_cast<DataManagerJobItem*>(activeItem))
+ {
+ QAction* cancelAction = menu->addAction("Cancel");
+ connect(cancelAction, SIGNAL(triggered(bool)), this, SLOT(cancelSelected()));
+ }
+ else if(dynamic_cast<DataManagerDisplayItem*> (activeItem))
+ {
+ QMenu* displayMenu = new QMenu("Display");
+ QAction* exportViewportAction = displayMenu->addAction("Crop viewport");
+ connect(exportViewportAction, SIGNAL(triggered(bool)), this, SLOT(displayCropViewport()));
+ menu->addMenu(displayMenu);
+
+
+ QMenu* exploitationMenu = new QMenu("Exploitation Mode");
+ QAction* registrationAction = exploitationMenu->addAction("Registration");
+ QAction* geoPositioningAction = exploitationMenu->addAction("Geo Positioning");
+ QAction* mensurationAction = exploitationMenu->addAction("Mensuration");
+ menu->addMenu(exploitationMenu);
+ connect(registrationAction, SIGNAL(triggered(bool)), this, SLOT(registrationExploitationSelected()));
+ connect(geoPositioningAction, SIGNAL(triggered(bool)), this, SLOT(geoPositioningExploitationSelected()));
+ connect(mensurationAction, SIGNAL(triggered(bool)), this, SLOT(mensurationExploitationSelected()));
+
+
+ // Multi-image sync right-click
+ QAction* miSync = menu->addAction("Sync All to Selected");
+ connect(miSync, SIGNAL(triggered(bool)), this, SLOT(miSync()));
+ }
+ else if(dynamic_cast<DataManagerImageFilterFolder*>(activeItem))
+ {
+ unselectAll();
+ selection.clear();
+ selection.push_back(activeItem);
+ activeItem->setSelected(true);
+ QAction* removeAllFilters = menu->addAction("Remove All Filters");
+ QAction* addFilterFront = menu->addAction("Add Filter To Front");
+ QAction* addFilterEnd = menu->addAction("Add Filter To End");
+ connect(removeAllFilters, SIGNAL(triggered(bool)), this, SLOT(removeAllFilters()));
+ connect(addFilterFront, SIGNAL(triggered(bool)), this, SLOT(addFilterToFront()));
+ connect(addFilterEnd, SIGNAL(triggered(bool)), this, SLOT(addFilterToEnd()));
+ }
+ else if(dynamic_cast<DataManagerImageFilterItem*> (activeItem))
+ {
+ unselectAll();
+ selection.clear();
+ selection.push_back(activeItem);
+ activeItem->setSelected(true);
+ QAction* insertFilterBef = menu->addAction("Insert Filter Before");
+ QAction* insertFilterAft = menu->addAction("Insert Filter After");
+ QAction* deleteFilterItem = menu->addAction("Remove Filter");
+ connect(insertFilterBef, SIGNAL(triggered(bool)), this, SLOT(insertFilterBefore()));
+ connect(insertFilterAft, SIGNAL(triggered(bool)), this, SLOT(insertFilterAfter()));
+ connect(deleteFilterItem, SIGNAL(triggered(bool)), this, SLOT(removeFilter()));
+ }
+ QList<DataManagerItem*>::iterator iter = selection.begin();
+ while(iter != selection.end())
+ {
+ if((*iter)->itemAs<DataManagerImageChainItem>())
+ {
+ hasItems = true;
+ ++nImageChainSelections;
+ }
+ else if((*iter)->itemAs<DataManagerRawImageSourceItem>())
+ {
+ hasItems = true;
+ ++nRawSourceSelections;
+ }
+ else if((*iter)->itemAs<DataManagerInputConnectionItem>())
+ {
+ hasItems = true;
+ ++nInputConnections;
+ }
+ else if((*iter)->itemAs<DataManagerDisplayItem>())
+ {
+ hasItems = true;
+ ++nDisplayItems;
+ }
+ ++iter;
+ }
+ if(hasItems)
+ {
+ QAction* showAction = menu->addAction("Show");
+ connect(showAction, SIGNAL(triggered(bool)), this, SLOT(showSelected()));
+
+ if(nImageChainSelections>0||nRawSourceSelections>0)
+ {
+ if(nRawSourceSelections>0)
+ {
+ QMenu* chainMenu = new QMenu("Chains");
+
+ QAction* defaultChain = chainMenu->addAction("Default");
+ QAction* affineChain = chainMenu->addAction("Affine");
+ QAction* projectedChain = chainMenu->addAction("Map Projection");
+ QAction* normalsChain = chainMenu->addAction("Image Normals");
+
+ menu->addMenu(chainMenu);
+
+ QMenu* stageMenu =new QMenu("Stage");
+ QAction* buildOverviewsAction = stageMenu->addAction("Build Default Overviews");
+ std::vector<ossimString> typeList;
+ ossimOverviewBuilderFactoryRegistry::instance()->getTypeNameList(typeList);
+ ossim_uint32 idx = 0;
+ if(!typeList.empty())
+ {
+ QMenu* overviewTypeMenu =new QMenu("Build Overviews");
+ for(idx = 0; idx < typeList.size();++idx)
+ {
+ // QAction* action = overviewTypeMenu->addAction(typeList[idx].c_str());
+ overviewTypeMenu->addAction(typeList[idx].c_str());
+ }
+ stageMenu->addMenu(overviewTypeMenu);
+ connect(overviewTypeMenu, SIGNAL(triggered(QAction*)), this, SLOT(buildOverviewsForSelected(QAction*)));
+ }
+ QAction* createFullHistogramAction = stageMenu->addAction("Build Full Histograms");
+ QAction* createFastHistogramAction = stageMenu->addAction("Build Fast Histograms");
+ QAction* scanMinMaxAction = stageMenu->addAction("Scan Min Max");
+ // QAction* buildAction = menu->addMenu(stageMenu);
+ menu->addMenu(stageMenu);
+ scanMinMaxAction->setEnabled(false);
+ createFastHistogramAction->setEnabled(false);
+ createFullHistogramAction->setEnabled(false);
+
+
+ connect(buildOverviewsAction, SIGNAL(triggered(bool)), this, SLOT(buildOverviewsForSelected()));
+ connect(createFullHistogramAction, SIGNAL(triggered(bool)), this, SLOT(createFullHistogramsForSelected()));
+ connect(createFastHistogramAction, SIGNAL(triggered(bool)), this, SLOT(createFastHistogramsForSelected()));
+
+ connect(defaultChain, SIGNAL(triggered(bool)), this, SLOT(createDefaultChain()));
+ connect(affineChain, SIGNAL(triggered(bool)), this, SLOT(createAffineChain()));
+ connect(projectedChain, SIGNAL(triggered(bool)), this, SLOT(createMapProjectedChain()));
+ connect(normalsChain, SIGNAL(triggered(bool)), this, SLOT(createImageNormalsChain()));
+ }
+ QAction* exportAction = menu->addAction("Export");
+ connect(exportAction, SIGNAL(triggered(bool)), this, SLOT(exportSelected()));
+ QAction* swipeAction = menu->addAction("Swipe");
+ connect(swipeAction, SIGNAL(triggered(bool)), this, SLOT(swipeSelected()));
+ }
+ QAction* deleteAction = menu->addAction("Delete");
+ connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteSelected()));
+
+
+ if(nImageChainSelections > 0)
+ {
+ QMenu* combineMenu =new QMenu("Combine");
+ QAction* aoverbAction = combineMenu->addAction("A over B");
+ QAction* blendAction = combineMenu->addAction("Blend");
+ QAction* featherAction = combineMenu->addAction("Feather");
+ QAction* hillShadeAction = combineMenu->addAction("Hill Shade");
+ QAction* combinerFactoryAction = combineMenu->addAction("Select from factory");
+ // QAction* combine = menu->addMenu(combineMenu);
+ menu->addMenu(combineMenu);
+
+ QMenu* viewMenu = new QMenu("View");
+ QAction* geographicAction = viewMenu->addAction("Geographic");
+ QAction* scaledGeographicAction = viewMenu->addAction("Scaled Geographic");
+ QAction* utmAction = viewMenu->addAction("Utm");
+ // QAction* view = menu->addMenu(viewMenu);
+ menu->addMenu(viewMenu);
+
+ connect(aoverbAction, SIGNAL(triggered(bool)), this, SLOT(aOverBMosaic()));
+ connect(blendAction, SIGNAL(triggered(bool)), this, SLOT(blendMosaic()));
+ connect(featherAction, SIGNAL(triggered(bool)), this, SLOT(featherMosaic()));
+ connect(hillShadeAction, SIGNAL(triggered(bool)), this, SLOT(hillShadeCombiner()));
+ connect(combinerFactoryAction, SIGNAL(triggered(bool)), this, SLOT(factoryCombiner()));
+
+ connect(geographicAction, SIGNAL(triggered(bool)), this, SLOT(geographicView()));
+ connect(scaledGeographicAction, SIGNAL(triggered(bool)), this, SLOT(scaledGeographicView()));
+ connect(utmAction, SIGNAL(triggered(bool)), this, SLOT(utmView()));
+ }
+ }
+
+#ifdef OSSIM_PLANET_ENABLED
+ QAction* planetaryView = menu->addAction("Planetary View");
+ connect(planetaryView, SIGNAL(triggered(bool)), this, SLOT(planetaryView()));
+#endif
+ return menu;
+}
+
+
+// Multi-image dialog
+void ossimGui::DataManagerWidget::miDialog(const int& mode)
+{
+ ossim_uint32 numImages;
+
+ if(!m_miDialog)
+ {
+// }
+// if(!m_miDialog->isActive())
+// {
+ // Attempt to instantiate the auto measurement generator
+ // ossimRefPtr<ossimObject> obj =
+ m_tGenObj = ossimObjectFactoryRegistry::instance()->
+ createObject(ossimString("ossimTieMeasurementGenerator"));
+ if(m_tGenObj.valid())
+ {
+ m_tGen = dynamic_cast<ossimTieMeasurementGeneratorInterface*> (m_tGenObj.get());
+ if (m_tGen)
+ {
+ m_amDialogAvailable = true;
+ }
+ }
+
+ // Populate the nodeList
+ QList<DataManagerDisplayItem*> result = grabSelectedChildItemsOfType<DataManagerDisplayItem>();
+ numImages = result.size();
+
+ DataManager::NodeListType nodeList;
+
+ for(ossim_uint32 idx = 0; idx < numImages; ++idx)
+ {
+ DataManager::Node* node = result[idx]->objectAsNode();
+ nodeList.push_back(node);
+ }
+
+ // Check for required open displays
+ bool displaysOK = true;
+ for(ossim_uint32 idx = 0; idx < nodeList.size(); ++idx)
+ {
+ ConnectableDisplayObject* displayObj = nodeList[idx]->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ if(subWindow==NULL)
+ {
+ displaysOK = false;
+ }
+ }
+
+ if (displaysOK)
+ {
+ m_miDialog = new MultiImageDialog(this);
+ m_miDialog->initContent(nodeList, m_amDialogAvailable);
+
+ // Establish connections from MultiImageDialog to DataManager
+ connect(m_miDialog, SIGNAL(registrationExecuted(DataManager::NodeListType&)),
+ this, SLOT(miReg(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(autoMeasInitiated(DataManager::NodeListType&)),
+ this, SLOT(miAutoMeas(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(pointDropExecuted(DataManager::NodeListType&)),
+ this, SLOT(miDrop(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(syncExecuted(ossimGui::RegPoint*, ossimRefPtr<DataManager::Node>)),
+ this, SLOT(miSync(ossimGui::RegPoint*, ossimRefPtr<DataManager::Node>)));
+ connect(m_miDialog, SIGNAL(resetModeExecuted(DataManager::NodeListType&)),
+ this, SLOT(miResetMode(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(clearPointExecuted(DataManager::NodeListType&)),
+ this, SLOT(miClearCurrentPoint(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(acceptRegExecuted(DataManager::NodeListType&)),
+ this, SLOT(miAcceptReg(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(resetRegExecuted(DataManager::NodeListType&)),
+ this, SLOT(miResetReg(DataManager::NodeListType&)));
+ connect(m_miDialog, SIGNAL(destroyed()), this, SLOT(miDialogDestroyed()));
+
+
+ m_miDialog->setMode(mode);
+ m_dataManager->setDialog(m_miDialog);
+ // Check minimums
+ DataManager::ExploitationModeType expMode = static_cast<DataManager::ExploitationModeType> (mode);
+ if (expMode != DataManager::NO_MODE)
+ {
+ bool okToShow = false;
+ if (expMode == DataManager::REGISTRATION_MODE && numImages>1)
+ {
+ okToShow = true;
+ }
+ else if (expMode == DataManager::GEOPOSITIONING_MODE && numImages>0)
+ {
+ okToShow = true;
+ }
+ else if (expMode == DataManager::MENSURATION_MODE && numImages>0)
+ {
+ okToShow = true;
+ }
+
+ if (okToShow)
+ {
+ m_miDialog->setWindowFlags(m_miDialog->windowFlags() | Qt::WindowStaysOnTopHint);
+ m_miDialog->show();
+ }
+ else
+ {
+ QString text("Minimum number of images required...");
+ QString geoMin("\n - Geopositioning: 1 image");
+ QString regMin("\n - Registration: 2 images");
+ QString menMin("\n - Mensuration: 1 image");
+ text += geoMin;
+ text += regMin;
+ text += menMin;
+ QMessageBox::critical(this, "ERROR", text);
+ m_miDialog->close();
+ }
+ }
+ }
+ else
+ {
+ QString text("First select 'Show' on all selected displays...");
+ QMessageBox::critical(this, "ERROR", text);
+ }
+ }
+ else
+ {
+ m_miDialog->show();
+ }
+}
+
+
+// Auto measurement dialog
+void ossimGui::DataManagerWidget::amDialog(DataManager::NodeListType& nodes)
+{
+
+ m_amDialog = new AutoMeasurementDialog(this, nodes, m_tGen);
+
+ // Establish connections between AutoMeasurementDialog and DataManager
+ connect(m_amDialog, SIGNAL(acceptMeasExecuted(DataManager::NodeListType&)),
+ this, SLOT(miAcceptMeas(DataManager::NodeListType&)));
+ connect(m_amDialog, SIGNAL(dismissMeasExecuted()),
+ this, SLOT(miDismissMeas()));
+
+ m_amDialog->setWindowFlags(m_amDialog->windowFlags() | Qt::WindowStaysOnTopHint);
+ m_amDialog->show();
+
+ // Set active flag
+ m_dataManager->setAutoMeasActive(true);
+}
+
+
+void ossimGui::DataManagerWidget::miDialogDestroyed()
+{
+ m_miDialog = 0;
+ m_dataManager->setDialog(0);
+}
+
+// Accept auto measurement
+bool ossimGui::DataManagerWidget::miAcceptMeas(DataManager::NodeListType& nodes)
+{
+ bool measAccOK = false;
+
+ if(m_dataManager.valid())
+ {
+ measAccOK = m_dataManager->setAutoMeasureResults(nodes, m_tGen);
+ }
+
+ if(m_miDialog) m_miDialog->show();
+ miDismissMeas();
+
+ return measAccOK;
+}
+
+
+// Reset auto measurement
+bool ossimGui::DataManagerWidget::miDismissMeas()
+{
+ bool dismissMeasOK = true;
+
+ delete m_amDialog;
+ m_amDialog = 0;
+ m_amDialogActive = false;
+ if(m_miDialog) m_miDialog->show();
+
+ // Set active flag
+ m_dataManager->setAutoMeasActive(false);
+
+ return dismissMeasOK;
+}
+
+
+// Multi-image auto measurement button
+bool ossimGui::DataManagerWidget::miAutoMeas(DataManager::NodeListType& nodes)
+{
+ // bool autoMeasOK = false;
+ bool autoMeasOK = true;
+
+ // Open AutoMeasurmentDialog
+ amDialog(nodes);
+ m_amDialogActive = true;
+
+ // Hide multi-image window during operation
+ if(m_miDialog) m_miDialog->hide();
+
+ // return true;
+
+ return autoMeasOK;
+}
+
+
+// Multi-image syncronization
+void ossimGui::DataManagerWidget::miSync(ossimGui::RegPoint* syncPt, ossimRefPtr<DataManager::Node> node)
+{
+ if (node != NULL)
+ {
+ ossimDpt sPt(syncPt->x(), syncPt->y());
+ m_dataManager->syncImagesTo(sPt, node);
+ }
+}
+
+
+// Multi-image syncronization
+void ossimGui::DataManagerWidget::miSync()
+{
+ QList<DataManagerDisplayItem*> result = grabSelectedChildItemsOfType<DataManagerDisplayItem>();
+
+ // Sync source is one image, so use result[0]
+ if(m_dataManager.valid())
+ {
+ DataManager::Node* node = result[0]->objectAsNode();
+ if (node)
+ {
+ m_dataManager->syncImagesTo(node);
+ }
+ }
+}
+
+
+// Multi-image intersection
+bool ossimGui::DataManagerWidget::miDrop(DataManager::NodeListType& nodes)
+{
+ bool dropOK = false;
+
+ if(m_dataManager.valid())
+ {
+ dropOK = m_dataManager->intersectRays(nodes);
+ }
+
+ return dropOK;
+}
+
+
+// Multi-image registration
+bool ossimGui::DataManagerWidget::miReg(DataManager::NodeListType& nodes)
+{
+ bool regOK = false;
+
+ if(m_dataManager.valid())
+ {
+ regOK = m_dataManager->registerImages(nodes);
+ }
+
+ return regOK;
+}
+
+
+// Multi-image registration accept
+bool ossimGui::DataManagerWidget::miAcceptReg(DataManager::NodeListType& nodes)
+{
+ bool regAccOK = false;
+
+ if(m_dataManager.valid())
+ {
+ regAccOK = m_dataManager->saveImageGeometries(nodes);
+ }
+
+ miSync();
+
+ return regAccOK;
+}
+
+
+// Multi-image registration reject
+bool ossimGui::DataManagerWidget::miResetReg(DataManager::NodeListType& nodes)
+{
+ bool resetRegOK = false;
+
+ if(m_dataManager.valid())
+ {
+ resetRegOK = m_dataManager->resetAdj(nodes);
+ }
+
+ return resetRegOK;
+}
+
+
+// Multi-image mode reset
+bool ossimGui::DataManagerWidget::miResetMode(DataManager::NodeListType& nodes)
+{
+ //std::cout << "ossimGui::DataManagerWidget::miResetMode: ................entered!!\n";
+ bool resetModeOK = false;
+
+ if(m_dataManager.valid())
+ {
+ resetModeOK = m_dataManager->resetMode(nodes);
+ }
+
+ emit resetMode();
+
+ return resetModeOK;
+}
+
+
+// Multi-image geopositioning clear current point measurements
+bool ossimGui::DataManagerWidget::miClearCurrentPoint(DataManager::NodeListType& nodes)
+{
+ bool clearOK = false;
+
+ if(m_dataManager.valid())
+ {
+ clearOK = m_dataManager->clearCurrentPoint(nodes);
+ }
+
+ return clearOK;
+}
+
+
+ossimGui::DataManager::NodeListType ossimGui::DataManagerWidget::getSelectedNodeList()
+{
+ QList<DataManagerDisplayItem*> result = grabSelectedChildItemsOfType<DataManagerDisplayItem>();
+
+ DataManager::NodeListType nodes;
+
+ if(m_dataManager.valid())
+ {
+ if(result.size() > 1)
+ {
+ QList<DataManagerDisplayItem*>::iterator iter = result.begin();
+
+ while(iter != result.end())
+ {
+ DataManager::Node* node = (*iter)->objectAsNode();
+ if(node)
+ {
+ nodes.push_back(node);
+ }
+ ++iter;
+ }
+ }
+ }
+
+ return nodes;
+}
diff --git a/ossimGui/src/ossimGui/DisplayTimerJobQueue.cpp b/ossimGui/src/ossimGui/DisplayTimerJobQueue.cpp
new file mode 100644
index 0000000..89022ad
--- /dev/null
+++ b/ossimGui/src/ossimGui/DisplayTimerJobQueue.cpp
@@ -0,0 +1,103 @@
+#include <ossimGui/DisplayTimerJobQueue.h>
+#include <iostream>
+#include <QtGui/QApplication>
+ossimGui::DisplayTimerJobQueue::DisplayTimerJobQueue()
+:m_displayTimer(new DisplayTimer(this))
+
+{
+}
+ossimGui::DisplayTimerJobQueue::~DisplayTimerJobQueue()
+{
+ if(m_displayTimer)
+ {
+ delete m_displayTimer;
+ m_displayTimer = 0;
+ }
+}
+
+ossimRefPtr<ossimJob> ossimGui::DisplayTimerJobQueue::nextJob(bool blockIfEmptyFlag)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_timeJobQueueMutex);
+ ossimRefPtr<ossimJob> result = ossimJobQueue::nextJob(false);
+ if(!result.valid()&&m_displayTimer)
+ {
+ m_displayTimer->stopProcessingJobs();
+ }
+
+ return result;
+}
+
+void ossimGui::DisplayTimerJobQueue::add(ossimJob* job, bool guaranteeUniqueFlag)
+{
+ ossimJobQueue::add(job, guaranteeUniqueFlag);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_timeJobQueueMutex);
+ if(m_displayTimer) m_displayTimer->startProcessingJobs();
+}
+
+
+ossimGui::DisplayTimerJobQueue::DisplayTimer::DisplayTimer(DisplayTimerJobQueue* q)
+:m_jobQueue(q),
+m_timerId(-1),
+m_timerInterval(10)
+{
+}
+
+ossimGui::DisplayTimerJobQueue::DisplayTimer::~DisplayTimer()
+{
+ m_jobQueue = 0;
+ if(m_timerId >=0)
+ {
+ killTimer(m_timerId);
+ m_timerId = -1;
+ }
+}
+
+void ossimGui::DisplayTimerJobQueue::DisplayTimer::startProcessingJobs()
+{
+ if(m_timerId < 0)
+ {
+ m_timerId = startTimer(m_timerInterval);
+ }
+}
+
+void ossimGui::DisplayTimerJobQueue::DisplayTimer::stopProcessingJobs()
+{
+ if(m_timerId >= 0)
+ {
+ killTimer(m_timerId);
+ m_timerId = -1;
+ }
+}
+
+void ossimGui::DisplayTimerJobQueue::DisplayTimer::setJobQueue(DisplayTimerJobQueue* que)
+{
+ m_jobQueue = que;
+}
+
+void ossimGui::DisplayTimerJobQueue::DisplayTimer::timerEvent ( QTimerEvent * event )
+{
+ if(event)
+ {
+ if((event->timerId() == m_timerId)&&m_jobQueue)
+ {
+ ossimRefPtr<ossimJob> job = m_jobQueue->nextJob();
+ if(job.valid())
+ {
+ QApplication::processEvents();
+ if(!job->isCanceled())
+ {
+ job->running();
+ job->start();
+ }
+ job->finished(); // turn on finished
+ job = 0;
+ }
+ else
+ {
+
+ }
+
+ }
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/Event.cpp b/ossimGui/src/ossimGui/Event.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/ossimGui/src/ossimGui/ExportImageDialog.cpp b/ossimGui/src/ossimGui/ExportImageDialog.cpp
new file mode 100644
index 0000000..e30b76f
--- /dev/null
+++ b/ossimGui/src/ossimGui/ExportImageDialog.cpp
@@ -0,0 +1,214 @@
+#include <ossimGui/ExportImageDialog.h>
+#include <QtGui/QMainWindow>
+#include <QtGui/QApplication>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+#include <ossimGui/CopyChainVisitor.h>
+#include <ossimGui/ImageWriterJob.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/Util.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <ossim/base/ossimScalarTypeLut.h>
+namespace ossimGui
+{
+ ExportImageDialog::ExportImageDialog(QWidget* parent)
+ :QDialog(parent)
+ {
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ connect(m_exportAbortButton, SIGNAL(clicked(bool)), this, SLOT(exportAbortClicked(bool)));
+ connect(m_closeButton, SIGNAL(clicked(bool)), this, SLOT(closeClicked(bool)));
+ connect(m_fileTypes, SIGNAL(activated(int)), this, SLOT(fileTypeActivated(int)));
+ connect(m_fileButton, SIGNAL(clicked(bool)), this, SLOT(openFileSaveDialog()));
+ m_fileButton->setEnabled(false);
+ m_exportingFlag = false;
+ }
+ void ExportImageDialog::setObject(ossimObject* obj)
+ {
+ m_connectable = dynamic_cast<ossimConnectableObject*> (obj);
+
+ populateFileTypes();
+ populateGeneralInformation();
+ }
+ void ExportImageDialog::populateFileTypes()
+ {
+ m_fileTypes->clear();
+ QStringList writerList;
+ writerList.push_back("<select writer type>");
+ Util::imageWriterTypes(writerList);
+ m_fileTypes->addItems(writerList);
+ }
+ void ExportImageDialog::populateGeneralInformation()
+ {
+ ossimImageSource* imgSource = dynamic_cast<ossimImageSource*> (m_connectable.get());
+ if(imgSource)
+ {
+ ossim_float64 k = 1024;
+ ossim_float64 meg = k*k;
+ ossim_float64 gig = meg*1024;
+ QString w;
+ QString h;
+ QString bands;
+ ossimIrect rect = imgSource->getBoundingRect();
+ w.setNum(rect.width());
+ h.setNum(rect.height());
+ bands.setNum(imgSource->getNumberOfOutputBands());
+ m_width->setText(w);
+ m_height->setText(h);
+ m_bands->setText(bands);
+ m_scalarType->setText(ossimScalarTypeLut::instance()->getEntryString(imgSource->getOutputScalarType()).c_str());
+
+ ossim_uint64 fileSize = (static_cast<ossim_uint64>(rect.width())*
+ static_cast<ossim_uint64>(rect.height())*
+ static_cast<ossim_uint64>(imgSource->getNumberOfOutputBands())*
+ static_cast<ossim_uint64>(ossim::scalarSizeInBytes(imgSource->getOutputScalarType())));
+ QString fileSizeString;
+ if(fileSize > gig)
+ {
+ double value = fileSize/gig;
+ fileSizeString.setNum(value, 'f', 2);
+ fileSizeString += " GB";
+ }
+ else if(fileSize > meg)
+ {
+ double value = fileSize/meg;
+ fileSizeString.setNum(value, 'f', 2);
+ fileSizeString += " MB";
+ }
+ else if(fileSize > k)
+ {
+ double value = fileSize/k;
+ fileSizeString.setNum(value, 'f', 2);
+ fileSizeString += " KB";
+ }
+ else
+ {
+ fileSizeString.setNum(fileSize);
+ fileSizeString += " b";
+ }
+ m_size->setText(fileSizeString);
+
+ }
+ else
+ {
+ m_width->setText("N/A");
+ m_height->setText("N/A");
+ m_scalarType->setText("N/A");
+ m_bands->setText("N/A");
+ m_size->setText("N/A");
+ }
+
+ }
+ void ExportImageDialog::populatePropertyView()
+ {
+ m_propertyView->setObject(m_writer.get());
+ }
+ void ExportImageDialog::fileTypeActivated(int idx)
+ {
+ if(idx == 0)
+ {
+ m_writer = 0;
+ populatePropertyView();
+ m_fileButton->setEnabled(false);
+ }
+ else
+ {
+ ossimFilename oldFilename = m_writer.valid()?m_writer->getFilename():ossimFilename();
+ ossimRefPtr<ossimObject> obj = ossimObjectFactoryRegistry::instance()->createObject(ossimString(m_fileTypes->itemText(idx).toAscii().data()));
+ m_writer = dynamic_cast<ossimImageFileWriter*> (obj.get());
+ if(m_writer.valid())
+ {
+ m_fileButton->setEnabled(true);
+ ossimString ext = m_writer->getExtension();
+ if(!oldFilename.empty())
+ {
+ oldFilename.setExtension(ext);
+ }
+ m_writer->setFilename(oldFilename);
+ }
+ populatePropertyView();
+ }
+ }
+
+ void ExportImageDialog::exportAbortClicked(bool)
+ {
+ if(m_exportingFlag&&m_writer.valid())
+ {
+ // now abort
+ //
+ m_writer->abort();
+ m_exportingFlag = false;
+ m_exportAbortButton->setText("Export");
+ }
+ else if(m_writer.valid())
+ {
+ if(m_writer->getFilename().empty())
+ {
+ QMessageBox::warning(this, tr("Export Image Error"),
+ tr("No filename specified"),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
+ }
+ else
+ {
+ if(m_exportInBackground->isChecked())
+ {
+ QMainWindow* mainWindow = Util::findParentOfType<QMainWindow*>(this);
+ CopyChainVisitor visitor;
+ m_writer->connectMyInputTo(0, m_connectable.get());
+ m_writer->accept(visitor);
+ ossimRefPtr<ossimJob> job = new ImageWriterJob(visitor.kwl());
+ job->setName("Output " + m_writer->getFilename());
+ job->ready();
+
+ DataManagerWidgetJobEvent* evt = new DataManagerWidgetJobEvent(DataManagerWidgetJobEvent::COMMAND_JOB_ADD);
+ evt->setJobList(job.get());
+ QApplication::postEvent(mainWindow, evt);
+ }
+ else
+ {
+ m_progressBar->setObject(m_writer.get());
+ m_writer->connectMyInputTo(0, m_connectable.get());
+ m_exportAbortButton->setText("Abort");
+ m_writer->execute();
+ m_progressBar->setObject(0);
+ m_exportingFlag = false;
+ m_exportAbortButton->setText("Export");
+ }
+ }
+ }
+ }
+ void ExportImageDialog::closeClicked(bool)
+ {
+ if(m_writer.valid())
+ {
+ if(!m_writer->isExecuting())
+ {
+ close();
+ }
+ else
+ {
+ QMessageBox::warning(this, "Warning", "Please abort the current job before closing the export window.");
+ }
+ }
+ else
+ {
+ close();
+ }
+
+ }
+
+ void ExportImageDialog::openFileSaveDialog()
+ {
+ if(m_writer.valid())
+ {
+ ossimFilename file(m_writer->getFilename());
+ QString fileName = QFileDialog::getSaveFileName(this, "Export Image", (file.isDir()?file.c_str():file.path().c_str()));
+
+ file = fileName.toAscii().data();
+ m_writer->setFilename(file);
+ populatePropertyView();
+ }
+ }
+}
diff --git a/ossimGui/src/ossimGui/GatherImageViewProjTransVisitor.cpp b/ossimGui/src/ossimGui/GatherImageViewProjTransVisitor.cpp
new file mode 100644
index 0000000..497cc6e
--- /dev/null
+++ b/ossimGui/src/ossimGui/GatherImageViewProjTransVisitor.cpp
@@ -0,0 +1,40 @@
+ #include <ossimGui/GatherImageViewProjTransVisitor.h>
+ #include <ossim/imaging/ossimImageRenderer.h>
+ #include <ossim/imaging/ossimImageHandler.h>
+
+
+ void ossimGui::GatherImageViewProjTransVisitor::visit(ossimObject* obj)
+ {
+ if(!hasVisited(obj))
+ {
+ ossimImageRenderer* renderer = dynamic_cast<ossimImageRenderer*>(obj);
+ if(renderer)
+ {
+ ossimImageViewProjectionTransform* ivpt = dynamic_cast<ossimImageViewProjectionTransform*>(renderer->getImageViewTransform());
+ if(ivpt)
+ {
+ m_transformList.push_back(new IvtGeomTransform(ivpt, ivpt->getImageGeometry()) );
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = dynamic_cast<ossimImageViewAffineTransform*>(renderer->getImageViewTransform());
+ if(ivat&&renderer->getInput())
+ {
+ ossimTypeNameVisitor v("ossimImageHandler", true);
+ renderer->accept(v);
+
+ ossimImageHandler* handler = v.getObjectAs<ossimImageHandler>(0);
+ if(handler)
+ {
+ ossimRefPtr<ossimImageGeometry> geom = handler->getImageGeometry();
+ if(geom.valid())
+ {
+ m_transformList.push_back(new IvtGeomTransform(ivat, geom.get()) );
+ }
+ }
+ }
+ }
+ }
+ ossimVisitor::visit(obj);
+ }
+ }
diff --git a/ossimGui/src/ossimGui/GlWidget.cpp b/ossimGui/src/ossimGui/GlWidget.cpp
new file mode 100644
index 0000000..d75bc5a
--- /dev/null
+++ b/ossimGui/src/ossimGui/GlWidget.cpp
@@ -0,0 +1,452 @@
+#include <ossimGui/GlWidget.h>
+#include <QtGui/QCursor>
+#include <QtCore/QTimer>
+#include <QtCore/QRect>
+#include <QtCore/QEvent>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QLayout>
+#include <QtGui/QFrame>
+#include <OpenThreads/ScopedLock>
+#include <osgUtil/LineSegmentIntersector>
+#include <osg/io_utils>
+#include <osgGA/GUIEventAdapter>
+#include <ossimPlanet/ul.h>
+
+namespace ossimGui
+{
+ GlWidget::GlWidget( QWidget * parent, const QGLWidget * shareWidget, Qt::WindowFlags f)
+ :QGLWidget(parent, shareWidget, f),
+ m_mouseNavigationFlag(true),
+ m_passAllUnhandledEventsFlag(true)
+ {
+ init();
+ }
+
+ GlWidget::GlWidget( const QGLFormat & format, QWidget * parent, const QGLWidget * shareWidget, Qt::WindowFlags f )
+ :QGLWidget(format, parent, shareWidget, f),
+ m_mouseNavigationFlag(true),
+ m_passAllUnhandledEventsFlag(true)
+ {
+ init();
+ }
+
+ GlWidget::~GlWidget()
+ {
+ std::cout << "GlWidget::~GlWidget()\n";
+ }
+
+ void GlWidget::init()
+ {
+ m_graphicsWindow = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
+ setAcceptDrops(false);
+ }
+
+ void GlWidget::doIdleAnimationFrame()
+ {
+ frameIfNeeded();
+ }
+
+ void GlWidget::setMouseNavigationFlag(bool flag)
+ {
+ m_mouseNavigationFlag = flag;
+ }
+
+ bool GlWidget::getMouseNavigationFlag()const
+ {
+ return m_mouseNavigationFlag;
+ }
+
+ void GlWidget::resizeGL( int width, int height )
+ {
+ width = ossim::max(64, width);
+ height = ossim::max(64, height);
+ m_graphicsWindow->getEventQueue()->windowResize(0, 0, width, height );
+ m_graphicsWindow->resized(0,0,width,height);
+ }
+
+ void GlWidget::keyPressEvent( QKeyEvent* event )
+ {
+ m_graphicsWindow->getEventQueue()->keyPress( qtKeyToOsg(event) );
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ }
+
+ void GlWidget::keyReleaseEvent( QKeyEvent* event )
+ {
+ m_graphicsWindow->getEventQueue()->keyRelease( qtKeyToOsg(event) );
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ }
+
+ void GlWidget::mousePressEvent( QMouseEvent* event )
+ {
+ int button = 0;
+ switch(event->button())
+ {
+ case(Qt::LeftButton): button = 1; break;
+ case(Qt::MidButton): button = 2; break;
+ case(Qt::RightButton): button = 3; break;
+ case(Qt::NoButton): button = 0; break;
+ default: button = 0; break;
+ }
+ m_graphicsWindow->getEventQueue()->mouseButtonPress(event->x(), event->y(), button);
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ emit signalMousePressEvent(event);
+ }
+
+ void GlWidget::mouseReleaseEvent( QMouseEvent* event )
+ {
+ int button = 0;
+ switch(event->button())
+ {
+ case(Qt::LeftButton): button = 1; break;
+ case(Qt::MidButton): button = 2; break;
+ case(Qt::RightButton): button = 3; break;
+ case(Qt::NoButton): button = 0; break;
+ default: button = 0; break;
+ }
+ m_graphicsWindow->getEventQueue()->mouseButtonRelease(event->x(), event->y(), button);
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ emit signalMouseReleaseEvent(event);
+ }
+
+ void GlWidget::mouseMoveEvent( QMouseEvent* event )
+ {
+ m_graphicsWindow->getEventQueue()->mouseMotion(event->x(), event->y());
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ emit signalMouseMoveEvent(event);
+
+ }
+
+ void GlWidget::mouseDoubleClickEvent( QMouseEvent * event )
+ {
+ int button = 0;
+ switch(event->button())
+ {
+ case(Qt::LeftButton): button = 1; break;
+ case(Qt::MidButton): button = 2; break;
+ case(Qt::RightButton): button = 3; break;
+ case(Qt::NoButton): button = 0; break;
+ default: button = 0; break;
+ }
+ m_graphicsWindow->getEventQueue()->mouseDoubleButtonPress(event->x(), event->y(), button);
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ }
+
+ void GlWidget::wheelEvent(QWheelEvent * event)
+ {
+ m_graphicsWindow->getEventQueue()->mouseScroll(event->delta()>0?osgGA::GUIEventAdapter::SCROLL_UP:osgGA::GUIEventAdapter::SCROLL_DOWN);
+ addModifiers(m_graphicsWindow->getEventQueue(), event->modifiers());
+ if(m_passAllUnhandledEventsFlag)
+ {
+ event->ignore();
+ }
+ }
+
+#if 0
+ void GlWidget::dropEvent ( QDropEvent * event )
+ {
+ emit signalDropEvent(event);
+ }
+
+ void GlWidget::dragEnterEvent(QDragEnterEvent *event)
+ {
+ emit signalDragEnterEvent(event);
+ }
+#endif
+ osgGA::GUIEventAdapter::KeySymbol GlWidget::qtKeyToOsg(QKeyEvent * e)const
+ {
+ int qtKey = e->key();
+ switch(qtKey)
+ {
+ case Qt::Key_Up:
+ {
+ return(osgGA::GUIEventAdapter::KEY_Up);
+ }
+ case Qt::Key_Down:
+ {
+ return (osgGA::GUIEventAdapter::KEY_Down);
+ }
+ case Qt::Key_Left:
+ {
+ return (osgGA::GUIEventAdapter::KEY_Left);
+ }
+ case Qt::Key_Right:
+ {
+ return (osgGA::GUIEventAdapter::KEY_Right);
+ }
+ case Qt::Key_Return:
+ {
+ return (osgGA::GUIEventAdapter::KEY_Return);
+ }
+ default:
+ {
+ if((qtKey >= Qt::Key_A)&&(qtKey <= Qt::Key_Z))
+ {
+ QString s = e->text();
+ std::string stdString = s.toStdString();
+ char c = *stdString.begin();
+ return (osgGA::GUIEventAdapter::KeySymbol)(c);
+ }
+ }
+ }
+
+ return (osgGA::GUIEventAdapter::KeySymbol)(qtKey);
+ }
+
+ void GlWidget::addModifiers(osg::ref_ptr<osgGA::EventQueue> eventQueue, Qt::KeyboardModifiers modifier)
+ {
+ if(!eventQueue.valid()) return;
+ unsigned int modKeyMask = 0;
+ osgGA::GUIEventAdapter* adapter = eventQueue->getCurrentEventState();
+ if(!adapter) return;
+ if(modifier & Qt::ShiftModifier)
+ {
+ modKeyMask|=osgGA::GUIEventAdapter::MODKEY_SHIFT;
+ }
+ if(modifier & Qt::ControlModifier)
+ {
+ modKeyMask|=osgGA::GUIEventAdapter::MODKEY_CTRL;
+ }
+ if(modifier & Qt::AltModifier)
+ {
+ modKeyMask|=osgGA::GUIEventAdapter::MODKEY_ALT;
+ }
+ if(modifier & Qt::MetaModifier)
+ {
+ modKeyMask|=osgGA::GUIEventAdapter::MODKEY_META;
+ }
+ adapter->setModKeyMask(modKeyMask);
+ }
+
+ GlViewer::GlViewer(QWidget * parent, const QGLWidget * shareWidget, Qt::WindowFlags f)
+ :GlWidget( parent, shareWidget, f ),
+ m_timerInterval(0),
+ m_timer(0)
+ {
+ setViewer(new ossimPlanetViewer);
+ setCurrentSimulationTime();
+ setTargetFramesPerSecond(60);
+ m_currentSimulationTime = USE_REFERENCE_TIME;
+ timer()->setInterval(m_timerInterval);
+ timer()->setSingleShot(false);
+ timer()->start();
+ }
+
+ GlViewer::GlViewer( const QGLFormat & format, QWidget * parent, const QGLWidget * shareWidget, Qt::WindowFlags f )
+ :GlWidget(format, parent, shareWidget, f),
+ m_timerInterval(0),
+ m_timer(0)
+ {
+ setViewer(new ossimPlanetViewer);
+ setCurrentSimulationTime();
+ setTargetFramesPerSecond(60);
+ m_currentSimulationTime = USE_REFERENCE_TIME;
+ timer()->setInterval(m_timerInterval);
+ timer()->setSingleShot(false);
+ timer()->start();
+ }
+
+ GlViewer::~GlViewer()
+ {
+ clearPointersInViewer();
+ }
+
+ void GlViewer::setViewer(ossimPlanetViewer* viewer)
+ {
+ clearPointersInViewer();
+ ossim_uint32 idx = 0;
+ m_viewer = viewer;
+ if(m_viewer.valid())
+ {
+ m_viewer->getCamera()->setGraphicsContext(getGraphicsWindow());
+ osgViewer::ViewerBase::Cameras cameraList;
+ m_viewer->getCameras(cameraList);
+ for(idx = 0; idx < cameraList.size();++idx)
+ {
+ cameraList[idx]->setGraphicsContext(getGraphicsWindow());
+ }
+ // initialize some size for the view port for this canvas if it doesn't have any
+ //
+ int w=width(), h=height();
+
+ // let's default to something
+ w = w>0?w:10;
+ h = h>0?h:10;
+ if((w > 0)&&(h>0))
+ {
+ m_viewer->getCamera()->setViewport(new osg::Viewport(0,0,w,h));
+ m_viewer->getCamera()->setProjectionMatrixAsPerspective(45.0,
+ static_cast<double>(w)/
+ static_cast<double>(h),
+ 1.0,
+ 50.0);
+ }
+ }
+ }
+
+ void GlViewer::resizeGL( int width, int height )
+ {
+ width = ossim::max(64, width);
+ height = ossim::max(64, height);
+ GlWidget::resizeGL(width, height);
+ if(m_viewer.valid()&&m_viewer->getCamera())
+ {
+ m_viewer->getCamera()->getViewport()->setViewport(0,0,width,height);
+ double fovy, aspectRatio, znear, zfar;
+ m_viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, znear, zfar);
+ aspectRatio = static_cast<double>(width)/static_cast<double>(height);
+ m_viewer->getCamera()->setProjectionMatrixAsPerspective(fovy,
+ aspectRatio,
+ znear,
+ zfar);
+ }
+ }
+
+ void GlViewer::clearPointersInViewer()
+ {
+ if(m_viewer.valid())
+ {
+ ossim_uint32 idx = 0;
+ osgViewer::ViewerBase::Cameras cameraList;
+ m_viewer->getCameras(cameraList);
+ for(idx = 0; idx < cameraList.size();++idx)
+ {
+ cameraList[idx]->setGraphicsContext(0);
+ }
+ }
+ }
+ void GlViewer::setTargetFrameTimeInMilliseconds(float millisecondRate)
+ {
+ m_frameRateLimiter = millisecondRate;
+ }
+
+ void GlViewer::setTargetFramesPerSecond(float framesPerSecond)
+ {
+ setTargetFrameTimeInMilliseconds(1000.0/framesPerSecond);
+ }
+
+ QTimer *GlViewer::timer()
+ {
+ if(!m_timer)
+ {
+ m_timer=new QTimer(this);
+ connect(m_timer,SIGNAL(timeout()),this,SLOT(doIdleAnimationFrame()));
+ }
+ return m_timer;
+ }
+
+#if 0
+ void GlViewer::requestRedraw()
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(theDrawMutex);
+ theRequestRedrawFlag = true;
+ if(!timer()->isActive())
+ {
+ timer()->setInterval(theTimerInterval);
+ timer()->start();
+ }
+ }
+#endif
+#if 0
+ void GlViewer::requestContinuousUpdate(bool needed)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(theDrawMutex);
+ theRequestContinuousUpdateFlag = needed;
+ if(needed)
+ {
+ if(!timer()->isActive())
+ {
+ timer()->setInterval(theTimerInterval);
+ timer()->start();
+ }
+ }
+ }
+#endif
+
+ ossimPlanetViewer* GlViewer::viewer()
+ {
+ return m_viewer.get();
+ }
+
+ void GlViewer::setCurrentSimulationTime(double simtime)
+ {
+ m_currentSimulationTime = simtime;
+ }
+
+ void GlViewer::frameIfNeeded()
+ {
+ //OpenThreads::ScopedLock<OpenThreads::Mutex> lock(theDrawMutex);
+ bool doVBlankLimit = false;
+ osg::Timer_t beginT = osg::Timer::instance()->tick();
+ osg::Timer_t endT;
+ if((m_viewer->continuousUpdateFlag()||
+ m_viewer->getAndSetRedrawFlag(false))&&isVisible())
+ {
+ updateGL();
+ doVBlankLimit = format().swapInterval() < 0;
+ endT = osg::Timer::instance()->tick();
+ }
+ else
+ {
+ noRenderCycle();
+ doVBlankLimit = true;
+ endT = osg::Timer::instance()->tick();
+ }
+ if(doVBlankLimit)
+ {
+ double test = osg::Timer::instance()->delta_m(beginT, endT);
+ if(test < m_frameRateLimiter)
+ {
+ ulMilliSecondSleep((int)(m_frameRateLimiter-test));
+ }
+ }
+#if 0
+ std::cout << "---" << std::endl;
+ std::cout << (getDatabasePager()->requiresUpdateSceneGraph()||getDatabasePager()->requiresCompileGLObjects()) << std::endl;
+ std::cout << getDatabasePager()->getFileRequestListSize() << std::endl
+ << getDatabasePager()->getDataToCompileListSize() << std::endl;
+#endif
+ }
+
+ void GlViewer::noRenderCycle()//double simtime)
+ {
+ if(!m_viewer.valid())return;
+ m_viewer->advance(m_currentSimulationTime);
+ getGraphicsWindow()->getEventQueue()->frame(m_viewer->getViewerFrameStamp()->getReferenceTime());
+ m_viewer->eventTraversal();
+ m_viewer->updateTraversal();
+ }
+
+ void GlViewer::paintGL()
+ {
+ if(m_viewer.valid())
+ {
+ m_viewer->frame(m_currentSimulationTime);
+ }
+ }
+
+ void GlViewer::mouseMoveEvent( QMouseEvent* event )
+ {
+ GlWidget::mouseMoveEvent(event);
+ }
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/HistogramRemapperEditor.cpp b/ossimGui/src/ossimGui/HistogramRemapperEditor.cpp
new file mode 100644
index 0000000..b300a2d
--- /dev/null
+++ b/ossimGui/src/ossimGui/HistogramRemapperEditor.cpp
@@ -0,0 +1,403 @@
+#include <ossimGui/HistogramRemapperEditor.h>
+
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/base/ossimHistogramSource.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+
+class ossimHistogramVisitor : public ossimVisitor
+{
+public:
+ ossimHistogramVisitor()
+ :ossimVisitor(ossimVisitor::VISIT_INPUTS | ossimVisitor::VISIT_CHILDREN)
+ {
+ }
+ ossimHistogramVisitor(const ossimHistogramVisitor& src)
+ :ossimVisitor(src),
+ m_histogram(src.m_histogram)
+ {
+ }
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new ossimHistogramVisitor(*this);}
+ virtual void visit(ossimConnectableObject* obj)
+ {
+ if(!hasVisited(obj))
+ {
+ ossimImageHandler* handler = dynamic_cast<ossimImageHandler*>(obj);
+ ossimHistogramSource* histoSource = dynamic_cast<ossimHistogramSource*>(obj);
+
+ if(handler)
+ {
+ ossimFilename file = handler->createDefaultHistogramFilename();
+ if(file.exists())
+ {
+ m_histogram = new ossimMultiResLevelHistogram();
+ if(!m_histogram->importHistogram(file))
+ {
+ stopTraversal();
+ m_histogram = 0;
+ }
+ }
+ }
+ else if(histoSource)
+ {
+ m_histogram = histoSource->getHistogram();
+ if(m_histogram.valid())
+ {
+ stopTraversal();
+ }
+ }
+ }
+ ossimVisitor::visit(obj);
+ }
+
+ ossimRefPtr<ossimMultiResLevelHistogram> m_histogram;
+};
+
+
+const char* stretchModes[] = {"None", "linear_auto_min_max", "linear_1std_from_mean", "linear_2std_from_mean", "linear_3std_from_mean", "linear_one_piece", 0};
+
+ossimGui::HistogramRemapperEditor::HistogramRemapperEditor(QWidget* parent, Qt::WindowFlags f)
+:QDialog(parent, f)
+{
+ setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
+ connect(m_bandComboBox, SIGNAL(activated(int)), this, SLOT(bandActivated(int)));
+ connect(m_stretchModeComboBox, SIGNAL(activated(int)), this, SLOT(stretchModeActivated(int)));
+ connect(m_histogramFilePushButton, SIGNAL(clicked(bool)), this, SLOT(openHistogramButton(bool)));
+ connect(m_enableButton, SIGNAL(clicked(bool)), this, SLOT(enableButtonClicked(bool)));
+ connect(m_resetButton, SIGNAL(clicked(bool)), this, SLOT(resetButtonClicked(bool)));
+ connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(okButtonClicked(bool)));
+ connect(m_cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancelButtonClicked(bool)));
+ connect(m_histogramWidget, SIGNAL(clipPenetrationsAdjusted(double, double)), SLOT(clipPenetrationsAdjusted(double, double)));
+ m_histogramWidget->setShowClipPointsFlag(true);
+
+}
+
+void ossimGui::HistogramRemapperEditor::setObject(ossimObject* obj)
+{
+ m_histogramRemapper = dynamic_cast<ossimHistogramRemapper*>(obj);
+ m_cancelState.clear();
+ if(m_histogramRemapper.valid()) m_histogramRemapper->saveState(m_cancelState);
+ initializeUiValues();
+}
+
+void ossimGui::HistogramRemapperEditor::setHistogram(const ossimFilename& file)
+{
+ if(!m_histogramRemapper.valid()) return;
+
+ if(m_histogramRemapper->openHistogram(file))
+ {
+
+ initializeUiValues();
+ populateClipPoints();
+ fireRefreshEvent();
+ }
+ else
+ {
+ QMessageBox::warning(this,
+ tr("My Application"),
+ tr("Unable to open histogram file") + file.c_str(),
+ QMessageBox::Ok);
+ }
+}
+
+void ossimGui::HistogramRemapperEditor::initializeUiValues()
+{
+ m_multiResHistogram = 0;
+ if(m_histogramRemapper.valid())
+ {
+ m_stretchModeComboBox->blockSignals(true);
+
+ m_enableButton->setChecked(m_histogramRemapper->ossimConnectableObject::getPropertyValueAsString("enabled").toBool());
+ m_multiResHistogram = m_histogramRemapper->getHistogram();
+
+ if(!m_multiResHistogram.valid())
+ {
+ ossimHistogramVisitor visitor;
+ m_histogramRemapper->accept(visitor);
+
+ m_multiResHistogram = visitor.m_histogram;
+ m_histogramRemapper->setHistogram(m_multiResHistogram.get());
+ }
+ m_stretchModeComboBox->clear();
+ m_stretchModeComboBox->addItem("none");
+ m_stretchModeComboBox->addItem("auto");
+ m_stretchModeComboBox->addItem("1 STD");
+ m_stretchModeComboBox->addItem("2 STD");
+ m_stretchModeComboBox->addItem("3 STD");
+ m_stretchModeComboBox->addItem("linear");
+
+ ossim_uint32 nBands = m_histogramRemapper->getNumberOfOutputBands();
+ ossim_uint32 idx = 0;
+ m_bandComboBox->clear();
+ m_bandComboBox->addItem("master");
+ for(idx = 0; idx < nBands;++idx)
+ {
+ m_bandComboBox->addItem(ossimString::toString(idx).c_str());
+ }
+ calculateAverageHistogram();
+ m_histogramWidget->setHistogram(m_averageHistogram.get());
+
+ ossimString stretchMode = m_histogramRemapper->getStretchModeString();
+ if(stretchMode == "linear_auto_min_max")
+ {
+ m_stretchModeComboBox->setCurrentIndex(1);
+ }
+ else if(stretchMode == "linear_1std_from_mean")
+ {
+ m_stretchModeComboBox->setCurrentIndex(2);
+ }
+ else if(stretchMode == "linear_2std_from_mean")
+ {
+ m_stretchModeComboBox->setCurrentIndex(3);
+ }
+ else if(stretchMode == "linear_3std_from_mean")
+ {
+ m_stretchModeComboBox->setCurrentIndex(4);
+ }
+ else if(stretchMode == "linear_one_piece")
+ {
+ m_stretchModeComboBox->setCurrentIndex(5);
+ }
+ else
+ {
+ m_stretchModeComboBox->setCurrentIndex(0);
+ }
+
+ m_histogramFileLineEdit->setText(m_histogramRemapper->getHistogramFile().c_str());
+ m_stretchModeComboBox->blockSignals(false);
+ }
+ else
+ {
+
+ }
+ populateClipPoints();
+
+}
+
+void ossimGui::HistogramRemapperEditor::populateClipPoints()
+{
+ QString currentText = m_bandComboBox->currentText();
+ bool masterFlag = currentText=="master";
+ double value =0.0;
+ if(m_histogramRemapper.valid())
+ {
+ value = masterFlag?m_histogramRemapper->getLowNormalizedClipPoint():m_histogramRemapper->getLowNormalizedClipPoint(currentText.toLong());
+ m_lowClipPercentLineEdit->setText(QString().setNum(value, 'g', 8));
+ value = masterFlag?m_histogramRemapper->getHighNormalizedClipPoint():m_histogramRemapper->getHighNormalizedClipPoint(currentText.toLong());
+ m_highClipPercentLineEdit->setText(QString().setNum(value, 'g', 8));
+
+ value = masterFlag?m_histogramRemapper->getLowClipPoint():m_histogramRemapper->getLowClipPoint(currentText.toLong());
+ m_lowClipValueLineEdit->setText(QString().setNum(value, 'g', 8));
+ value = masterFlag?m_histogramRemapper->getHighClipPoint():m_histogramRemapper->getHighClipPoint(currentText.toLong());
+ m_highClipValueLineEdit->setText(QString().setNum(value, 'g', 8));
+
+ value = masterFlag?m_histogramRemapper->getMidPoint():m_histogramRemapper->getMidPoint(currentText.toLong());
+ m_midPointLineEdit->setText(QString().setNum(value, 'g', 8));
+
+ value = masterFlag?m_histogramRemapper->getMinOutputValue():m_histogramRemapper->getMinOutputValue(currentText.toLong());
+ m_outputMinValue->setText(QString().setNum(value, 'g', 8));
+ value = masterFlag?m_histogramRemapper->getMaxOutputValue():m_histogramRemapper->getMaxOutputValue(currentText.toLong());
+ m_outputMaxValue->setText(QString().setNum(value, 'g', 8));
+
+ m_histogramWidget->blockSignals(true);
+ m_histogramWidget->setPenetration(masterFlag?m_histogramRemapper->getLowNormalizedClipPoint():m_histogramRemapper->getLowNormalizedClipPoint(currentText.toLong()),
+ 1.0-(masterFlag?m_histogramRemapper->getHighNormalizedClipPoint():m_histogramRemapper->getHighNormalizedClipPoint(currentText.toLong()))
+ );
+ m_histogramWidget->blockSignals(false);
+ }
+}
+
+void ossimGui::HistogramRemapperEditor::bandActivated ( int index )
+{
+ if(!m_histogramRemapper.valid()) return;
+ if(index == 0)
+ {
+ m_histogramWidget->setHistogram(m_averageHistogram.get());
+ }
+ else if(index > 0)
+ {
+ m_histogramWidget->setHistogram(m_multiResHistogram->getHistogram(index-1).get());
+ }
+ else
+ {
+ m_histogramWidget->setHistogram(0);
+ }
+ populateClipPoints();
+}
+
+void ossimGui::HistogramRemapperEditor::stretchModeActivated(int index)
+{
+ if(!m_histogramRemapper.valid()) return;
+
+ m_histogramRemapper->setStretchModeAsString(stretchModes[index], true);
+ if(stretchModes[index] == "linear_one_piece")
+ {
+ m_histogramWidget->setReadOnly(false);
+ }
+ else
+ {
+ m_histogramWidget->setReadOnly(true);
+ }
+
+ populateClipPoints();
+ fireRefreshEvent();
+}
+
+void ossimGui::HistogramRemapperEditor::openHistogramButton(bool)
+{
+ if(!m_histogramRemapper.valid()) return;
+ QFileDialog* fd = new QFileDialog( this );
+ ossimFilename tempFile = m_histogramRemapper->getHistogramFile();
+ if(!tempFile.empty())
+ {
+ fd->setDirectory(tempFile.path().c_str());
+ }
+
+ QString file;
+ if (fd->exec() == QDialog::Accepted )
+ {
+ QStringList files = fd->selectedFiles();
+ if(!files.empty())
+ {
+ ossimFilename f = (*(files.begin())).toAscii().data();
+ setHistogram(f);
+
+ }
+ }
+
+ delete fd;
+ fd = NULL;
+
+}
+
+void ossimGui::HistogramRemapperEditor::calculateAverageHistogram()
+{
+ if(!m_multiResHistogram.valid()) return;
+ m_averageHistogram = 0;
+ ossim_uint32 band = 0;
+ ossim_uint32 nBands = m_histogramRemapper->getNumberOfOutputBands();
+ std::vector<ossimRefPtr<ossimHistogram> > h;
+ if(nBands<1) return;
+ h.resize(nBands);
+
+ if(!h.size()) return;
+ bool validDrawFlag = true;
+ for(band = 0; band < nBands; ++ band)
+ {
+ h[band] = m_multiResHistogram->getHistogram(band);
+ }
+
+ float minValue = 99999.0;
+ float maxValue = -99999.0;
+ float max_count = 0.0;
+
+ ossim_uint32 maxBins = 0;
+ for (band = 0; band < nBands; ++band)
+ {
+ if(h[band].valid())
+ {
+ float hmin = (h[band]->GetRangeMin());
+ float hmax = (h[band]->GetRangeMax());
+ float hmax_count = h[band]->GetMaxCount();
+ ossim_uint32 res = h[band]->GetRes();
+ maxBins = res > maxBins?res:maxBins;
+ minValue = hmin < minValue ? hmin : minValue;
+ maxValue = hmax > maxValue ? hmax : maxValue;
+ // max_count = hmax_count > max_count ? hmax_count : max_count;
+ max_count += hmax_count;
+ }
+ }
+ m_averageHistogram = new ossimHistogram(maxBins, minValue, maxValue);
+ ossim_uint32 binIdx = 0;
+ float delta = (maxValue-minValue)/maxBins;
+ float* sumCounts = m_averageHistogram->GetCounts();
+ ossim_int32 sumIndex = 0;
+ float value = 0.0;
+ memset(sumCounts, '\0', sizeof(float)*maxBins);
+ value = minValue+delta*0.5;
+ for(binIdx = 0; binIdx < maxBins;++binIdx)
+ {
+ // value = minValue+delta*binIdx;
+ sumIndex = m_averageHistogram->GetIndex(value);
+ if(sumIndex >= 0)
+ {
+ for(band = 0; band < nBands; ++band)
+ {
+ if(h[band].valid())
+ {
+ sumCounts[sumIndex] += h[band]->GetCount(value);
+ }
+ }
+ }
+ value+=delta;
+ }
+ // ossimKeywordlist kwl;
+ // m_averageHistogram->saveState(kwl);
+ // std::cout << "#################################\n"<<kwl<< std::endl;
+
+}
+
+void ossimGui::HistogramRemapperEditor::clipPenetrationsAdjusted(double minValue, double maxValue)
+{
+ QString currentText = m_bandComboBox->currentText();
+ bool masterFlag = currentText=="master";
+
+ if(masterFlag)
+ {
+ m_histogramRemapper->setLowNormalizedClipPoint(minValue);
+ m_histogramRemapper->setHighNormalizedClipPoint(1.0-maxValue);
+
+ }
+ else
+ {
+ int idx = currentText.toLong();
+ m_histogramRemapper->setLowNormalizedClipPoint(minValue, idx);
+ m_histogramRemapper->setHighNormalizedClipPoint(1.0-maxValue, idx);
+ }
+ populateClipPoints();
+ fireRefreshEvent();
+}
+
+void ossimGui::HistogramRemapperEditor::enableButtonClicked(bool checked)
+{
+ if(m_histogramRemapper.valid())
+ {
+ m_histogramRemapper->ossimConnectableObject::setProperty("enabled", ossimString::toString(checked));
+ fireRefreshEvent();
+ }
+}
+
+void ossimGui::HistogramRemapperEditor::resetButtonClicked(bool)
+{
+ if(m_histogramRemapper.valid()) m_histogramRemapper->loadState(m_cancelState);
+ initializeUiValues();
+ fireRefreshEvent();
+}
+
+void ossimGui::HistogramRemapperEditor::okButtonClicked(bool)
+{
+ close();
+}
+
+void ossimGui::HistogramRemapperEditor::cancelButtonClicked(bool)
+{
+ if(m_histogramRemapper.valid()) m_histogramRemapper->loadState(m_cancelState);
+ fireRefreshEvent();
+ close();
+}
+
+void ossimGui::HistogramRemapperEditor::fireRefreshEvent()
+{
+ if(m_histogramRemapper.valid())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_PIXELS);
+ ossimEventVisitor visitor(refreshEvent.get());
+ m_histogramRemapper->accept(visitor);
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/HistogramWidget.cpp b/ossimGui/src/ossimGui/HistogramWidget.cpp
new file mode 100644
index 0000000..b34d851
--- /dev/null
+++ b/ossimGui/src/ossimGui/HistogramWidget.cpp
@@ -0,0 +1,277 @@
+//*******************************************************************
+// Copyright (C) 2003 ImageLinks Inc.
+//
+// OSSIM is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation.
+//
+// This software is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+//
+// You should have received a copy of the GNU General Public License
+// along with this software. If not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-
+// 1307, USA.
+//
+// See the GPL in the COPYING.GPL file for more details.
+//
+// Author: David Burken <dburken at imagelinks.com>
+//
+// Description:
+//
+// Class definition for ossimQtHistogramWidget.
+//
+// Derived from QWidget.
+//
+// A QT Widget for displaying histograms.
+//
+//*************************************************************************
+// $Id: ossimQtHistogramWidget.cpp 12805 2008-05-07 19:41:34Z gpotts $
+
+#include <ossimGui/HistogramWidget.h>
+#include <ossim/imaging/ossimHistogramRemapper.h>
+#include <ossim/base/ossimHistogram.h>
+#include <QtGui/QPainter>
+#include <QtGui/QMouseEvent>
+
+const int WIDTH = 258;
+const int HEIGHT = 130;
+
+
+ossimGui::HistogramWidget::HistogramWidget(QWidget* parent)//,
+ //Qt::WindowFlags f)
+ :
+ QGraphicsView(parent),//, f),
+m_showClipPointsFlag(false)
+{
+ setMinimumWidth(WIDTH);
+ setMinimumHeight(HEIGHT);
+ m_readOnly = false;
+// setMaximumWidth(WIDTH);
+// setMaximumHeight(HEIGHT);
+ //setBackgroundColor(Qt::white);
+ // paintHistogram(0);
+}
+
+ossimGui::HistogramWidget::~HistogramWidget()
+{
+}
+
+void ossimGui::HistogramWidget::setHistogram(ossimHistogram* histogram)
+{
+ m_histogram = histogram;
+ //ossimKeywordlist kwl;
+ //m_histogram->saveState(kwl);
+ //std::cout << kwl << std::endl;
+ if(m_histogram.valid())
+ {
+ updateScaledHistogram();
+ }
+ else
+ {
+ m_scaledHistogram = 0;
+ }
+
+ viewport()->update();
+}
+
+void ossimGui::HistogramWidget::resizeEvent ( QResizeEvent * event )
+{
+ QWidget::resizeEvent(event);
+ updateScaledHistogram();
+}
+
+void ossimGui::HistogramWidget::setPenetration(double minValue, double maxValue)
+{
+ m_minFraction = minValue;
+ m_maxFraction = maxValue;
+
+ if(m_histogram.valid())
+ {
+ viewport()->update();
+ emit clipPenetrationsAdjusted(m_minFraction, m_maxFraction);
+ }
+}
+
+void ossimGui::HistogramWidget::setClipPoints(double minValue, double maxValue)
+{
+ if(m_histogram.valid())
+ {
+ m_minFraction = m_histogram->getLowFractionFromValue(ossim::min(minValue, maxValue));
+ m_maxFraction = m_histogram->getHighFractionFromValue(ossim::max(minValue, maxValue));
+ viewport()->update();
+ emit clipPenetrationsAdjusted(m_histogram->LowClipVal(m_minFraction), m_histogram->LowClipVal(m_maxFraction));
+ }
+}
+
+void ossimGui::HistogramWidget::getClipPoints(double& minValue, double& maxValue)
+{
+ minValue = m_histogram->LowClipVal(m_minFraction);
+ maxValue = m_histogram->HighClipVal(m_maxFraction);
+}
+
+void ossimGui::HistogramWidget::setShowClipPointsFlag(bool flag)
+{
+ bool updateFlag = flag != m_showClipPointsFlag;
+ m_showClipPointsFlag = flag;
+
+ if(updateFlag) viewport()->update();
+}
+
+
+
+void ossimGui::HistogramWidget::updateScaledHistogram()
+{
+ if(m_histogram.valid())
+ {
+ ossim_uint32 w = width();
+ ossim_uint32 h = height();
+ float minValue = m_histogram->GetRangeMin();//floor(m_histogram->GetMinVal());
+ float maxValue = m_histogram->GetRangeMax();//ceil(m_histogram->GetMaxVal());
+ float maxBins = m_histogram->GetRes();
+ m_scaledHistogram = new ossimHistogram(w, minValue, maxValue);
+ float* counts = m_histogram->GetCounts();
+ float* sumCounts = m_scaledHistogram->GetCounts();
+ ossim_uint32 binIdx = 0;
+ float delta = (maxValue - minValue)/maxBins;
+ ossim_int32 sumIndex = 0;
+ float value = 0.0;
+ memset(sumCounts, '\0', sizeof(float)*w);
+ value = minValue + delta*.5;
+ for(binIdx = 0; binIdx < maxBins;++binIdx)
+ {
+ sumIndex = m_scaledHistogram->GetIndex(value);
+ if(sumIndex >= 0)
+ {
+ //std::cout << "counts["<<binIdx<<"]"<<counts[binIdx] << std::endl;
+ sumCounts[sumIndex] += counts[binIdx];//m_histogram->GetCount(value);
+ }
+// value = minValue+delta*binIdx;
+ value += delta;
+ }
+ //sumCounts[0] = 0;
+ /*
+ ossim_uint32 idx = 0;
+ ossim_float64 colWidth = m_scaledHistogram->GetBucketSize();
+ for(idx = 0; idx < w; ++idx)
+ {
+ ossim_float64 tempMin = minValue + idx*colWidth;
+ sumCounts[idx] += m_histogram->ComputeArea(tempMin, tempMin +colWidth);
+ }
+ */
+ m_scaledHistogram = m_scaledHistogram->fillInteriorEmptyBins();
+ m_scaledNormalizer = m_scaledHistogram->GetMaxCount();
+// ossimKeywordlist kwl;
+
+// m_scaledHistogram->saveState(kwl);
+// std::cout << kwl << std::endl;
+
+#if 0
+ float sumMaxCount= m_scaledHistogram->GetMaxCount();
+ sumCounts = m_scaledHistogram->GetCounts();
+
+
+ int height = 0;
+ if(sumMaxCount > 0.0)
+ {
+ ossim_uint32 col;
+ for (col = 0; col < w; ++col)
+ {
+ sumCounts[col] = ossim::round<int>((sumCounts[col]/sumMaxCount)*h);
+ }
+ }
+#endif
+ }
+}
+
+void ossimGui::HistogramWidget::paintEvent(QPaintEvent* /* event */)
+{
+ QPainter p(viewport());
+ QPainter* painter=&p;
+ const int H = height();
+ //QPainter p(this);
+ QPen p1(Qt::black, 1);
+
+ // ossimKeywordlist kwl;
+
+ // m_scaledHistogram->saveState(kwl);
+ //std::cout << rect.x()<<","<<rect.y()<<","<<rect.width()<<","<<rect.height() << std::endl;
+
+ if (m_scaledHistogram.valid())
+ {
+ // p.drawRect(QRect(0,0,width()-1,H-1));
+ float* sumCounts = m_scaledHistogram->GetCounts();
+ ossim_int32 col;
+ ossim_int32 res = m_scaledHistogram->GetRes();
+
+ for (col = 0; col <res; ++col)
+ {
+ //std::cout << sumCounts[col] << std::endl;
+ painter->drawLine(col, H, col, (H)-(sumCounts[col]/m_scaledNormalizer)*H);
+ }
+ if(m_showClipPointsFlag)
+ {
+ double clipMinxValue = m_scaledHistogram->GetIndex(m_scaledHistogram->LowClipVal(m_minFraction));
+ double clipMaxxValue = m_scaledHistogram->GetIndex(m_scaledHistogram->HighClipVal(m_maxFraction));
+ painter->save();
+ QBrush alphaBrush(painter->brush());
+ alphaBrush.setColor(QColor(255,255,255,128));
+ alphaBrush.setStyle(Qt::SolidPattern);
+ painter->setBrush(alphaBrush);
+ QSize thisSize = size();
+ double clipW = fabs(clipMaxxValue-clipMinxValue);
+ painter->drawRect(QRect(clipMinxValue,0,clipW,H));
+ painter->restore();
+ }
+ }
+}
+
+double ossimGui::HistogramWidget::getMaxBinCount()
+{
+ return 0.0;
+}
+
+void ossimGui::HistogramWidget::adjustClips(const QPoint& point)
+{
+ if(m_readOnly) return;
+ if(point.x() > width()||point.x() < 0) return;
+ if(m_scaledHistogram.valid())
+ {
+ //std::cout << m_scaledHistogram->LowClipVal(m_minFraction) << ", " << m_scaledHistogram->HighClipVal(m_maxFraction) << std::endl;
+ double clipMinxIndex = m_scaledHistogram->GetIndex(m_scaledHistogram->LowClipVal(m_minFraction));
+ double clipMaxxIndex = m_scaledHistogram->GetIndex(m_scaledHistogram->HighClipVal(m_maxFraction));
+
+
+ double center = (clipMinxIndex + clipMaxxIndex)*0.5;
+ double x = point.x();
+ double binSize = m_scaledHistogram->GetBucketSize();
+ double value = m_scaledHistogram->LowClipVal(0) + x*binSize;
+ if(x < center)
+ {
+ setPenetration(m_scaledHistogram->getLowFractionFromValue(value), m_maxFraction);
+ }
+ else if(x > center)
+ {
+ setPenetration(m_minFraction, m_scaledHistogram->getHighFractionFromValue(value));
+ }
+ }
+}
+
+
+void ossimGui::HistogramWidget::mousePressEvent(QMouseEvent *e)
+{
+ if(e->buttons()&Qt::LeftButton)
+ {
+ adjustClips(e->pos());
+ }
+}
+
+void ossimGui::HistogramWidget::mouseMoveEvent(QMouseEvent *e)
+{
+ if(e->buttons()&Qt::LeftButton)
+ {
+ adjustClips(e->pos());
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/HsiRemapperEditor.cpp b/ossimGui/src/ossimGui/HsiRemapperEditor.cpp
new file mode 100644
index 0000000..43f084f
--- /dev/null
+++ b/ossimGui/src/ossimGui/HsiRemapperEditor.cpp
@@ -0,0 +1,500 @@
+#include <ossimGui/HsiRemapperEditor.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimNumericProperty.h>
+
+static const char* HSI_REMAPPER_PROPERTY_PREFIX[] = { "hsi_red_", "hsi_yellow_", "hsi_green_", "hsi_cyan_", "hsi_blue_", "hsi_magenta_", "hsi_master_"};
+
+enum {
+ HSI_REMAPPER_ACTIVE_RED = 0,
+ HSI_REMAPPER_ACTIVE_YELLOW = 1,
+ HSI_REMAPPER_ACTIVE_GREEN = 2,
+ HSI_REMAPPER_ACTIVE_CYAN = 3,
+ HSI_REMAPPER_ACTIVE_BLUE = 4,
+ HSI_REMAPPER_ACTIVE_MAGENTA = 5,
+ HSI_REMAPPER_ACTIVE_ALL = 6
+};
+
+ossimGui::HsiRemapperEditor::HsiRemapperEditor(QWidget* parent, Qt::WindowFlags f )
+:QDialog(parent, f)
+{
+ setupUi(this);
+
+ m_hueOffsetSlider->setMinimum(0);
+ m_hueOffsetSlider->setMaximum(360);
+ m_hueLowRangeSlider->setMinimum(0);
+ m_hueLowRangeSlider->setMaximum(400);
+ m_hueHighRangeSlider->setMinimum(0);
+ m_hueHighRangeSlider->setMaximum(400);
+ m_hueBlendRangeSlider->setMinimum(0);
+ m_hueBlendRangeSlider->setMaximum(400);
+ m_intensityOffsetSlider->setMinimum(0);
+ m_intensityOffsetSlider->setMaximum(400);
+ m_saturationOffsetSlider->setMinimum(0);
+ m_saturationOffsetSlider->setMaximum(400);
+ m_lowIntensityClipSlider->setMinimum(0);
+ m_lowIntensityClipSlider->setMaximum(400);
+ m_highIntensityClipSlider->setMinimum(0);
+ m_highIntensityClipSlider->setMaximum(400);
+ m_whiteObjectClipSlider->setMinimum(0);
+ m_whiteObjectClipSlider->setMaximum(400);
+
+ setAttribute(Qt::WA_DeleteOnClose);
+ connect(m_hueOffsetSlider, SIGNAL(valueChanged(int)), this, SLOT(hueOffsetChanged(int)));
+ connect(m_hueLowRangeSlider, SIGNAL(valueChanged(int)), this, SLOT(hueLowChange(int)));
+ connect(m_hueHighRangeSlider, SIGNAL(valueChanged(int)), this, SLOT(hueHighChange(int)));
+ connect(m_hueBlendRangeSlider, SIGNAL(valueChanged(int)), this, SLOT(hueBlendChange(int)));
+ connect(m_saturationOffsetSlider, SIGNAL(valueChanged(int)), this, SLOT(saturationOffsetChange(int)));
+
+ connect(m_intensityOffsetSlider, SIGNAL(valueChanged(int)), this, SLOT(intensityOffsetChange(int)));
+ connect(m_lowIntensityClipSlider, SIGNAL(valueChanged(int)), this, SLOT(lowIntensityClipChange(int)));
+ connect(m_highIntensityClipSlider, SIGNAL(valueChanged(int)), this, SLOT(highIntensityClipChange(int)));
+ connect(m_whiteObjectClipSlider, SIGNAL(valueChanged(int)), this, SLOT(whitObjectClipChange(int)));
+ connect(m_redButton, SIGNAL(clicked(bool)), this, SLOT(redButtonClicked()));
+ connect(m_yellowButton, SIGNAL(clicked(bool)), this, SLOT(yellowButtonClicked()));
+ connect(m_greenButton, SIGNAL(clicked(bool)), this, SLOT(greenButtonClicked()));
+ connect(m_cyanButton, SIGNAL(clicked(bool)), this, SLOT(cyanButtonClicked()));
+ connect(m_blueButton, SIGNAL(clicked(bool)), this, SLOT(blueButtonClicked()));
+ connect(m_magentaButton, SIGNAL(clicked(bool)), this, SLOT(magentaButtonClicked()));
+ connect(m_allButton, SIGNAL(clicked(bool)), this, SLOT(allButtonClicked()));
+
+ connect(m_resetAllButton, SIGNAL(clicked(bool)), this, SLOT(resetAllButtonClicked()));
+ connect(m_resetGroupButton, SIGNAL(clicked(bool)), this, SLOT(resetGroupButtonClicked()));
+ connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(okButtonClicked()));
+ connect(m_cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancelButtonClicked()));
+
+ connect(m_enableButton, SIGNAL(clicked(bool)), this, SLOT(enableButtonClicked(bool)));
+
+ m_allButton->setChecked(true);
+ m_activeGroup = HSI_REMAPPER_ACTIVE_ALL;
+}
+
+void ossimGui::HsiRemapperEditor::setObject(ossimObject* obj)
+{
+ m_object = dynamic_cast<ossimHsiRemapper*>(obj);
+ if(m_object.valid())
+ {
+ m_cancelState.clear();
+ m_object->saveState(m_cancelState);
+ }
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::hueOffsetChanged(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_hueOffsetRange[0] + (m_hueOffsetRange[1] - m_hueOffsetRange[0])*static_cast<double>(value)/m_hueOffsetSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"hue_offset", ossimString::toString(propValue));
+ m_hueOffsetValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::hueLowChange(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_hueLowRange[0] + (m_hueLowRange[1] - m_hueLowRange[0])*static_cast<double>(value)/m_hueLowRangeSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"hue_low_range", ossimString::toString(propValue));
+ m_hueLowRangeValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::hueHighChange(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_hueHighRange[0] + (m_hueHighRange[1] - m_hueHighRange[0])*static_cast<double>(value)/m_hueHighRangeSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"hue_high_range", ossimString::toString(propValue));
+ m_hueHighRangeValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::hueBlendChange(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_hueBlendRange[0] + (m_hueBlendRange[1] - m_hueBlendRange[0])*static_cast<double>(value)/m_hueBlendRangeSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"hue_blend_range", ossimString::toString(propValue));
+ m_hueBlendRangeValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::saturationOffsetChange(int value)
+{
+
+ if(!m_object.valid()) return;
+ double propValue = (m_saturationOffsetRange[0] + (m_saturationOffsetRange[1] - m_saturationOffsetRange[0])*static_cast<double>(value)/m_saturationOffsetSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"saturation_offset", ossimString::toString(propValue));
+ m_saturationOffsetValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+
+}
+
+void ossimGui::HsiRemapperEditor::intensityOffsetChange(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_intensityOffsetRange[0] + (m_intensityOffsetRange[1] - m_intensityOffsetRange[0])*static_cast<double>(value)/m_intensityOffsetSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"intensity_offset", ossimString::toString(propValue));
+ m_intensityOffsetValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::lowIntensityClipChange(int value)
+{
+ if(!m_object.valid()) return;
+
+ double propValue = (m_lowIntensityClipRange[0] + (m_lowIntensityClipRange[1] - m_lowIntensityClipRange[0])*static_cast<double>(value)/m_lowIntensityClipSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"intensity_low_clip", ossimString::toString(propValue));
+ m_lowIntensityClipValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::highIntensityClipChange(int value)
+{
+ if(!m_object.valid()) return;
+
+ double propValue = (m_highIntensityClipRange[0] + (m_highIntensityClipRange[1] - m_highIntensityClipRange[0])*static_cast<double>(value)/m_highIntensityClipSlider->maximum());
+ m_object->ossimConnectableObject::setProperty(getPropertyPrefix()+"intensity_high_clip",ossimString::toString(propValue));
+ m_highIntensityClipValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::whitObjectClipChange(int value)
+{
+ if(!m_object.valid()) return;
+ double propValue = (m_whiteObjectClipRange[0] + (m_whiteObjectClipRange[1] - m_whiteObjectClipRange[0])*static_cast<double>(value)/m_whiteObjectClipSlider->maximum());
+ m_object->ossimConnectableObject::setProperty("hsi_white_object_clip", ossimString::toString(propValue));
+ m_whiteObjectClipValueLabel->setText(ossimString::toString(roundForDisplay(propValue)).c_str());
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::redButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_RED;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::yellowButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_YELLOW;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::greenButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_GREEN;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::cyanButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_CYAN;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::blueButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_BLUE;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::magentaButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_MAGENTA;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::allButtonClicked()
+{
+ m_activeGroup = HSI_REMAPPER_ACTIVE_ALL;
+ initializeUiValues();
+}
+
+void ossimGui::HsiRemapperEditor::enableButtonClicked(bool checked)
+{
+ if(!m_object.valid()) return;
+ static_cast<ossimConnectableObject*>(m_object.get())->setProperty("enabled", ossimString::toString(checked));
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::resetGroupButtonClicked()
+{
+ if(!m_object.valid()) return;
+ m_object->resetGroup(m_activeGroup);
+ initializeUiValues();
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::resetAllButtonClicked()
+{
+ if(!m_object.valid()) return;
+ m_object->resetAll();
+ initializeUiValues();
+ fireRefreshEvent();
+}
+
+void ossimGui::HsiRemapperEditor::okButtonClicked()
+{
+ close();
+}
+
+void ossimGui::HsiRemapperEditor::cancelButtonClicked()
+{
+ if(m_object.valid()) m_object->loadState(m_cancelState);
+ fireRefreshEvent();
+ close();
+}
+
+ossimString ossimGui::HsiRemapperEditor::getPropertyPrefix()const
+{
+ return ossimString(HSI_REMAPPER_PROPERTY_PREFIX[m_activeGroup]);
+}
+
+void ossimGui::HsiRemapperEditor::fireRefreshEvent()
+{
+ if(m_object.valid())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent = new ossimRefreshEvent(ossimRefreshEvent::REFRESH_PIXELS);
+ ossimEventVisitor visitor(refreshEvent.get());
+ m_object->accept(visitor);
+ }
+}
+
+double ossimGui::HsiRemapperEditor::roundForDisplay(double value, int precision)const
+{
+ return ( static_cast<ossim_int32>(value*precision)/static_cast<double>(precision) );
+}
+
+void ossimGui::HsiRemapperEditor::initializeUiValues()
+{
+ if(!m_object.valid()) return;
+ m_hueOffsetSlider->blockSignals(true);
+ m_hueLowRangeSlider->blockSignals(true);
+ m_hueHighRangeSlider->blockSignals(true);
+ m_hueBlendRangeSlider->blockSignals(true);
+ m_saturationOffsetSlider->blockSignals(true);
+ m_lowIntensityClipSlider->blockSignals(true);
+ m_highIntensityClipSlider->blockSignals(true);
+ m_whiteObjectClipSlider->blockSignals(true);
+ m_enableButton->blockSignals(true);
+
+ m_enableButton->setChecked(m_object->isSourceEnabled());
+
+ ossimString prefix = getPropertyPrefix();
+ ossimRefPtr<ossimNumericProperty> hueOffset;
+ ossimRefPtr<ossimNumericProperty> lowRange;
+ ossimRefPtr<ossimNumericProperty> highRange;
+ ossimRefPtr<ossimNumericProperty> blendRange;
+ ossimRefPtr<ossimNumericProperty> saturationOffset;
+ ossimRefPtr<ossimNumericProperty> intensityOffset;
+ ossimRefPtr<ossimNumericProperty> intensityLowClip;
+ ossimRefPtr<ossimNumericProperty> intensityHighClip;
+ ossimRefPtr<ossimNumericProperty> whiteObjectClip;
+
+ switch(m_activeGroup)
+ {
+ case HSI_REMAPPER_ACTIVE_ALL:
+ {
+ m_hueOffsetSlider->setEnabled(true);
+ m_hueLowRangeSlider->setEnabled(false);
+ m_hueHighRangeSlider->setEnabled(false);
+ m_hueBlendRangeSlider->setEnabled(false);
+ m_saturationOffsetSlider->setEnabled(true);
+ m_lowIntensityClipSlider->setEnabled(true);
+ m_highIntensityClipSlider->setEnabled(true);
+ m_whiteObjectClipSlider->setEnabled(true);
+
+
+ break;
+ }
+ default:
+ {
+ m_hueOffsetSlider->setEnabled(true);
+ m_hueLowRangeSlider->setEnabled(true);
+ m_hueHighRangeSlider->setEnabled(true);
+ m_hueBlendRangeSlider->setEnabled(true);
+ m_saturationOffsetSlider->setEnabled(true);
+ m_lowIntensityClipSlider->setEnabled(false);
+ m_highIntensityClipSlider->setEnabled(false);
+ m_whiteObjectClipSlider->setEnabled(false);
+
+ break;
+ }
+ }
+ hueOffset = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"hue_offset").get());
+ lowRange = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"hue_low_range").get());
+ highRange = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"hue_high_range").get());
+ blendRange = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"hue_blend_range").get());
+ saturationOffset = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"saturation_offset").get());
+ intensityOffset = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"intensity_offset").get());
+ intensityLowClip = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"intensity_low_clip").get());
+ intensityHighClip = dynamic_cast<ossimNumericProperty*>(m_object->getProperty(prefix+"intensity_high_clip").get());
+ whiteObjectClip = dynamic_cast<ossimNumericProperty*>(m_object->getProperty("hsi_white_object_clip").get());
+
+ m_hueOffsetRange[0] = 0.0;
+ m_hueOffsetRange[1] = 1.0;
+ m_hueLowRange[0] = 0.0;
+ m_hueLowRange[1] = 1.0;
+ m_hueHighRange[0] = 0.0;
+ m_hueHighRange[1] = 1.0;
+ m_hueBlendRange[0] = 0.0;
+ m_hueBlendRange[1] = 1.0;
+ m_saturationOffsetRange[0] = 0.0;
+ m_saturationOffsetRange[1] = 1.0;
+ m_intensityOffsetRange[0] = 0.0;
+ m_intensityOffsetRange[1] = 1.0;
+ m_lowIntensityClipRange[0] = 0.0;
+ m_lowIntensityClipRange[1] = 1.0;
+ m_highIntensityClipRange[0] = 0.0;
+ m_highIntensityClipRange[1] = 1.0;
+ m_whiteObjectClipRange[0] = 0.0;
+ m_whiteObjectClipRange[1] = 1.0;
+
+
+ if(hueOffset.valid())
+ {
+ ossimString value = hueOffset->ossimProperty::valueToString();
+ m_hueOffsetRange[0] = hueOffset->getMinValue();
+ m_hueOffsetRange[1] = hueOffset->getMaxValue();
+ double range = m_hueOffsetRange[1] - m_hueOffsetRange[0];
+ double relative = value.toDouble() - m_hueOffsetRange[0];
+ double t = relative/range;
+ m_hueOffsetSlider->setValue(t*m_hueOffsetSlider->maximum());
+ m_hueOffsetValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_hueOffsetValueLabel->setText("");
+ }
+ if(lowRange.valid())
+ {
+ ossimString value = lowRange->ossimProperty::valueToString();
+ m_hueLowRange[0] = lowRange->getMinValue();
+ m_hueLowRange[1] = lowRange->getMaxValue();
+ double range = m_hueLowRange[1] - m_hueLowRange[0];
+ double relative = value.toDouble() - m_hueLowRange[0];
+ double t = relative/range;
+ m_hueLowRangeSlider->setValue(t*m_hueLowRangeSlider->maximum());
+ m_hueLowRangeValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_hueLowRangeValueLabel->setText("");
+ }
+ if(highRange.valid())
+ {
+ ossimString value = highRange->ossimProperty::valueToString();
+ m_hueHighRange[0] = highRange->getMinValue();
+ m_hueHighRange[1] = highRange->getMaxValue();
+ double range = m_hueHighRange[1] - m_hueHighRange[0];
+ double relative = value.toDouble() - m_hueHighRange[0];
+ double t = relative/range;
+ m_hueHighRangeSlider->setValue(t*m_hueHighRangeSlider->maximum());
+ m_hueHighRangeValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_hueHighRangeValueLabel->setText("");
+ }
+ if(blendRange.valid())
+ {
+ ossimString value = blendRange->ossimProperty::valueToString();
+ m_hueBlendRange[0] = blendRange->getMinValue();
+ m_hueBlendRange[1] = blendRange->getMaxValue();
+ double range = m_hueBlendRange[1] - m_hueBlendRange[0];
+ double relative = value.toDouble() - m_hueBlendRange[0];
+ double t = relative/range;
+ m_hueBlendRangeSlider->setValue(t*m_hueBlendRangeSlider->maximum());
+ m_hueBlendRangeValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_hueBlendRangeValueLabel->setText("");
+ }
+ if(saturationOffset.valid())
+ {
+ ossimString value = saturationOffset->ossimProperty::valueToString();
+ m_saturationOffsetRange[0] = saturationOffset->getMinValue();
+ m_saturationOffsetRange[1] = saturationOffset->getMaxValue();
+ double range = m_saturationOffsetRange[1] - m_saturationOffsetRange[0];
+ double relative = value.toDouble() - m_saturationOffsetRange[0];
+ double t = relative/range;
+ m_saturationOffsetSlider->setValue(t*m_saturationOffsetSlider->maximum());
+ m_saturationOffsetValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_saturationOffsetValueLabel->setText("");
+ }
+
+ if(intensityOffset.valid())
+ {
+ ossimString value = intensityOffset->ossimProperty::valueToString();
+ m_intensityOffsetRange[0] = intensityOffset->getMinValue();
+ m_intensityOffsetRange[1] = intensityOffset->getMaxValue();
+ double range = m_intensityOffsetRange[1] - m_intensityOffsetRange[0];
+ double relative = value.toDouble() - m_intensityOffsetRange[0];
+ double t = relative/range;
+ m_intensityOffsetSlider->setValue(t*m_intensityOffsetSlider->maximum());
+ m_intensityOffsetValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_intensityOffsetValueLabel->setText("");
+ }
+
+ if(intensityLowClip.valid())
+ {
+ ossimString value = intensityLowClip->ossimProperty::valueToString();
+ m_lowIntensityClipRange[0] = intensityLowClip->getMinValue();
+ m_lowIntensityClipRange[1] = intensityLowClip->getMaxValue();
+ double range = m_lowIntensityClipRange[1] - m_lowIntensityClipRange[0];
+ double relative = value.toDouble() - m_lowIntensityClipRange[0];
+ double t = relative/range;
+ m_lowIntensityClipSlider->setValue(t*m_lowIntensityClipSlider->maximum());
+ m_lowIntensityClipValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_lowIntensityClipValueLabel->setText("");
+ }
+ if(intensityHighClip.valid())
+ {
+ ossimString value = intensityHighClip->ossimProperty::valueToString();
+ m_highIntensityClipRange[0] = intensityHighClip->getMinValue();
+ m_highIntensityClipRange[1] = intensityHighClip->getMaxValue();
+ double range = m_highIntensityClipRange[1] - m_highIntensityClipRange[0];
+ double relative = value.toDouble() - m_highIntensityClipRange[0];
+ double t = relative/range;
+ m_highIntensityClipSlider->setValue(t*m_highIntensityClipSlider->maximum());
+ m_highIntensityClipValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_highIntensityClipValueLabel->setText("");
+ }
+ if(whiteObjectClip.valid())
+ {
+ ossimString value = whiteObjectClip->ossimProperty::valueToString();
+ m_whiteObjectClipRange[0] = whiteObjectClip->getMinValue();
+ m_whiteObjectClipRange[1] = whiteObjectClip->getMaxValue();
+ double range = m_whiteObjectClipRange[1] - m_whiteObjectClipRange[0];
+ double relative = value.toDouble() - m_whiteObjectClipRange[0];
+ double t = relative/range;
+ m_whiteObjectClipSlider->setValue(t*m_whiteObjectClipSlider->maximum());
+ m_whiteObjectClipValueLabel->setText(value.c_str());
+ }
+ else
+ {
+ m_whiteObjectClipValueLabel->setText("");
+ }
+
+ m_hueOffsetSlider->blockSignals(false);
+ m_hueLowRangeSlider->blockSignals(false);
+ m_hueHighRangeSlider->blockSignals(false);
+ m_hueBlendRangeSlider->blockSignals(false);
+ m_saturationOffsetSlider->blockSignals(false);
+ m_lowIntensityClipSlider->blockSignals(false);
+ m_highIntensityClipSlider->blockSignals(false);
+ m_whiteObjectClipSlider->blockSignals(false);
+ m_enableButton->blockSignals(false);
+}
+
+
diff --git a/ossimGui/src/ossimGui/Image.cpp b/ossimGui/src/ossimGui/Image.cpp
new file mode 100644
index 0000000..bc535f4
--- /dev/null
+++ b/ossimGui/src/ossimGui/Image.cpp
@@ -0,0 +1,118 @@
+#include <ossimGui/Image.h>
+
+ossimGui::Image::Image(ossimRefPtr<ossimImageData> data, bool includeOffset)
+:QImage()
+{
+ setImage(data, includeOffset);
+}
+
+void ossimGui::Image::setImage(ossimRefPtr<ossimImageData> data, bool includeOffset)
+{
+ if(data.valid())
+ {
+ int aWidth = data->getWidth();
+ int aHeight = data->getHeight();
+ *this = QImage(aWidth, aHeight, QImage::Format_RGB32);
+ if(data->getBuf()&&(data->getScalarType() == OSSIM_UINT8))
+ {
+ ossim_uint8* buf[3];
+ int numberOfBands = data->getNumberOfBands();
+ int aWidth = data->getWidth();
+ int aHeight = data->getHeight();
+ int maxPixels = aWidth*aHeight;
+ int offset;
+ ossim_uint32* resultBuffer = (ossim_uint32*)bits();
+ if(numberOfBands >= 3)
+ {
+ buf[0] = static_cast<ossim_uint8*>(data->getBuf(0));
+ buf[1] = static_cast<ossim_uint8*>(data->getBuf(1));
+ buf[2] = static_cast<ossim_uint8*>(data->getBuf(2));
+ }
+ else
+ {
+ buf[0] = static_cast<ossim_uint8*>(data->getBuf(0));
+ buf[1] = static_cast<ossim_uint8*>(data->getBuf(0));
+ buf[2] = static_cast<ossim_uint8*>(data->getBuf(0));
+ }
+ if(resultBuffer)
+ {
+ for(offset = 0; offset < maxPixels;++offset,++resultBuffer)
+ {
+ *resultBuffer = ((ossim_uint32)'0xff')<<24 |
+ ((ossim_uint32)*buf[0])<<16 |
+ ((ossim_uint32)*buf[1])<<8 |
+ ((ossim_uint32)*buf[2]);
+
+ ++buf[0];++buf[1];++buf[2];
+ }
+ }
+ else
+ {
+ fill(0);
+ }
+ }
+ else // empty buff or not 8-bit then blank out the tile
+ {
+ fill(0);
+ }
+ if(includeOffset)
+ {
+ ossimIpt origin = data->getOrigin();
+ setOffset(QPoint(origin.x, origin.y));
+ }
+ }
+}
+
+ossimRefPtr<ossimImageData> ossimGui::Image::toOssimImage()
+{
+ ossimRefPtr<ossimImageData> result;
+ ossimScalarType scalarType = OSSIM_SCALAR_UNKNOWN;
+ switch(format())
+ {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ {
+ result = new ossimImageData(0,
+ OSSIM_UINT8,
+ 3,
+ width(),
+ height());
+ result->setImageRectangle(ossimIrect(offset().x(), offset().y(), offset().x()+width()-1, offset().y()+height()-1));
+ result->initialize();
+ ossim_uint8* bands[3];
+ bands[0] = static_cast<ossim_uint8*>(result->getBuf(0));
+ bands[1] = static_cast<ossim_uint8*>(result->getBuf(1));
+ bands[2] = static_cast<ossim_uint8*>(result->getBuf(2));
+ ossim_uint32 area = width()*height();
+ ossim_uint32 idx = 0;
+ ossim_uint32* buffer = reinterpret_cast<ossim_uint32*>(bits());
+ for(idx = 0; idx < area;++idx,bands[0]++,bands[1]++,bands[2]++,buffer++)
+ {
+ ossim_uint32 value = *buffer;
+ if((value>>24)&0xff)
+ {
+ *bands[0] = static_cast<ossim_uint8>((value>>16)&0xff);
+ *bands[1] = static_cast<ossim_uint8>((value>>8)&0xff);
+ *bands[2] = static_cast<ossim_uint8>((value)&0xff);
+ }
+ else
+ {
+ *bands[0] = 0;
+ *bands[1] = 0;
+ *bands[2] = 0;
+ }
+ }
+ result->validate();
+ break;
+ }
+ default:
+ {
+ ossimNotify(ossimNotifyLevel_WARN) << "ossimGui::Image::newOssimImage(): Unable to store image in the requested format. Format not supported\n";
+ break;
+ }
+ }
+
+ return result.get();
+}
+
+
diff --git a/ossimGui/src/ossimGui/ImageMdiSubWindow.cpp b/ossimGui/src/ossimGui/ImageMdiSubWindow.cpp
new file mode 100644
index 0000000..4222a04
--- /dev/null
+++ b/ossimGui/src/ossimGui/ImageMdiSubWindow.cpp
@@ -0,0 +1,1309 @@
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/AdjustableParameterEditor.h>
+#include <ossimGui/BandSelectorEditor.h>
+#include <ossimGui/BrightnessContrastEditor.h>
+#include <ossimGui/ChipperDialog.h>
+#include <ossimGui/CopyChainVisitor.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/ExportImageDialog.h>
+#include <ossimGui/HistogramRemapperEditor.h>
+#include <ossimGui/HsiRemapperEditor.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/ImageViewManipulator.h>
+#include <ossimGui/PolygonRemapperDialog.h>
+#include <ossimGui/PositionInformationDialog.h>
+#include <ossimGui/SetViewVisitor.h>
+#include <ossim/base/ossimAdjustableParameterInterface.h>
+#include <ossim/base/ossimGeoidManager.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossim/imaging/ossimFilterResampler.h>
+#include <ossim/imaging/ossimImageChain.h>
+#include <ossim/imaging/ossimImageRenderer.h>
+#include <ossim/imaging/ossimGeoPolyCutter.h>
+#include <ossim/projection/ossimImageViewAffineTransform.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <ossim/projection/ossimImageViewTransform.h>
+#include <ossim/projection/ossimMapProjection.h>
+#include <QtGui/QMenuBar>
+#include <QtGui/QPushButton>
+#include <QtGui/QToolBar>
+#include <QtGui/QToolButton>
+#include <QtGui/QMenu>
+#include <QtGui/QComboBox>
+#include <QtGui/QMdiArea>
+#include <QtGui/QLabel>
+#include <QtGui/QMainWindow>
+#include <QtGui/QStatusBar>
+#include <QtGui/QApplication>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+#include <iostream>
+#include <fstream>
+
+ossimGui::ImageActions::Visitor::Visitor()
+:ossimVisitor(ossimVisitor::VISIT_INPUTS | ossimVisitor::VISIT_CHILDREN)
+{
+ reset();
+}
+
+void ossimGui::ImageActions::Visitor::reset()
+{
+ ossimVisitor::reset();
+ m_imageAdjustments.clear();
+ m_isProjected = false;
+ m_isAffine = false;
+ m_imageHandlers.clear();
+ m_bandSelectors.clear();
+ m_histogramRemappers.clear();
+ m_hsiRemappers.clear();
+ m_imageRenderers.clear();
+ m_viewInterfaces.clear();
+ m_scalarRemappers.clear();
+ m_hsiRemappers.clear();
+ m_brightnessContrastSources.clear();
+ m_containers.clear();
+}
+
+void ossimGui::ImageActions::Visitor::visit(ossimConnectableObject* obj)
+{
+ if(!hasVisited(obj))
+ {
+ ossimVisitor::visit(obj);
+ if(obj->canCastTo("ossimViewInterface"))
+ {
+ m_viewInterfaces.push_back(obj);
+ }
+
+
+ if(obj->canCastTo("ossimBandSelector"))
+ {
+ m_bandSelectors.push_back(obj);
+ }
+ else if(obj->canCastTo("ossimImageHandler"))
+ {
+ ossimImageSource* is = dynamic_cast<ossimImageSource*> (obj);
+ m_imageHandlers.push_back(obj);
+ if(is)
+ {
+ ossimRefPtr<ossimImageGeometry> geom = is->getImageGeometry();
+ if(geom.valid()&&dynamic_cast<ossimAdjustableParameterInterface*>(geom->getProjection()))
+ {
+ m_imageAdjustments.push_back(obj);
+ }
+ }
+ }
+ else if(obj->canCastTo("ossimScalarRemapper"))
+ {
+ m_scalarRemappers.push_back(obj);
+ }
+ else if(obj->canCastTo("ossimBrightnessContrastSource"))
+ {
+ m_brightnessContrastSources.push_back(obj);
+ }
+ else if(obj->canCastTo("ossimHistogramRemapper"))
+ {
+ m_histogramRemappers.push_back(obj);
+ }
+ else if(obj->canCastTo("ossimHsiRemapper"))
+ {
+ m_hsiRemappers.push_back(obj);
+ }
+ else if(obj->canCastTo("ossimImageRenderer"))
+ {
+ ossimImageRenderer* renderer = dynamic_cast<ossimImageRenderer*>(obj);
+ if(renderer)
+ {
+ m_imageRenderers.push_back(obj);
+ if(dynamic_cast<ossimImageViewProjectionTransform*> (renderer->getImageViewTransform()))
+ {
+ m_isProjected = true;
+ }
+ else if(dynamic_cast<ossimImageViewAffineTransform*> (renderer->getImageViewTransform()))
+ {
+ m_isAffine = true;
+ }
+ }
+ }
+ else if(obj->canCastTo("ossimConnectableContainerInterface"))
+ {
+ m_containers.push_back(obj);
+ }
+
+ }
+}
+
+ossimGui::ImageActions::ImageActions()
+:m_widget(0)
+{
+ m_syncType = View::SYNC_TYPE_NONE;
+ m_currentScenePoint.makeNan();
+}
+
+void ossimGui::ImageActions::exportImage()
+{
+ // need support to output the 8 bit chain layer.
+ // we will do that later
+ //
+ ExportImageDialog* dialog = new ExportImageDialog(m_widget);
+ dialog->setObject(m_widget->connectableObject()->getInput(0));
+ dialog->exec();
+}
+
+void ossimGui::ImageActions::saveAs()
+{
+ ChipperDialog* dialog = new ChipperDialog( m_widget );
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ // connect(this, SIGNAL(syncView(View&)), dialog, SLOT(syncView(View&)));
+ connect(this, SIGNAL(syncView(View&)), dialog, SLOT(syncView()));
+
+ if ( dialog->errorStatus() == ossimGui::ChipperDialog::OK )
+ {
+ dialog->show();
+ // dialog->exec();
+ }
+}
+
+void ossimGui::ImageActions::exportKeywordlist()
+{
+ if(m_widget->connectableObject()->getInput(0))
+ {
+ QString fileName = QFileDialog::getSaveFileName(NULL, "Export Image");
+
+ ossimFilename file = fileName.toAscii().data();
+ CopyChainVisitor visitor;
+
+ if(!file.empty())
+ {
+ std::ofstream ostr(file.c_str());
+ m_widget->connectableObject()->getInput(0)->accept(visitor);
+
+ visitor.kwl().writeToStream(ostr);
+ }
+ }
+
+}
+
+void ossimGui::ImageActions::editBandSelector()
+{
+ if(!m_visitor.m_bandSelectors.empty())
+ {
+ BandSelectorEditor* editor = new BandSelectorEditor(m_widget);
+ editor->setObject(m_visitor.m_bandSelectors[0].get());
+ editor->show();
+ }
+}
+
+void ossimGui::ImageActions::editHsiAdjustments()
+{
+ if(!m_visitor.m_hsiRemappers.empty())
+ {
+ HsiRemapperEditor* editor = new HsiRemapperEditor(m_widget);
+ editor->setObject(m_visitor.m_hsiRemappers[0].get());
+ editor->show();
+ //std::cout << "Editing HSI adjustments === " << m_visitor.m_hsiRemappers[0].get() << std::endl;
+ }
+}
+
+void ossimGui::ImageActions::editHistogramRemapper()
+{
+ if(!m_visitor.m_histogramRemappers.empty())
+ {
+ HistogramRemapperEditor* editor = new HistogramRemapperEditor(m_widget);
+ editor->setObject(m_visitor.m_histogramRemappers[0].get());
+ editor->show();
+ }
+}
+
+void ossimGui::ImageActions::editBrightnessContrast()
+{
+ if(!m_visitor.m_brightnessContrastSources.empty())
+ {
+ BrightnessContrastEditor* editor = new BrightnessContrastEditor(m_widget);
+ editor->setObject(m_visitor.m_brightnessContrastSources[0].get());
+ editor->show();
+ }
+}
+
+void ossimGui::ImageActions::showPolygonRemapper()
+{
+ if ( m_widget )
+ {
+ ossimRefPtr<ConnectableImageObject> inputConnection = m_widget->connectableObject();
+ if ( inputConnection.valid() )
+ {
+ ossimTypeNameVisitor visitor(ossimString("ossimGeoPolyCutter"),
+ true,
+ ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
+
+ inputConnection->accept(visitor);
+
+
+ ossimRefPtr<ossimGeoPolyCutter> polyCutter = 0;
+
+ if ( visitor.getObjects().size() )
+ {
+ polyCutter = visitor.getObjectAs<ossimGeoPolyCutter> ( 0 );
+ }
+ else
+ {
+ ossimRefPtr<ossimImageGeometry> geom = m_widget->getGeometry();
+ if ( geom.valid() )
+ {
+ polyCutter = new ossimGeoPolyCutter;
+
+ polyCutter->setView( geom.get() );
+
+ // Set to null inside:
+ polyCutter->setCutType( ossimGeoPolyCutter::OSSIM_POLY_NULL_INSIDE );
+
+ //ossimRefPtr<ossimImageChain> ic = dynamic_cast<ossimImageChain*> (inputConnection.get());
+
+ ossimTypeNameVisitor icVisitor(ossimString("ossimImageChain"),
+ true,
+ ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
+
+ inputConnection->accept(icVisitor);
+ if (icVisitor.getObjects().size() )
+ {
+ ossimRefPtr<ossimImageChain> imageChain = icVisitor.getObjectAs<ossimImageChain> ( 0 );
+
+ if (imageChain.valid() )
+ {
+ imageChain->addFirst(polyCutter.get() );
+ }
+ }
+ }
+
+ }
+
+ if ( polyCutter.valid() )
+ {
+ PolygonRemapperDialog* editor = new PolygonRemapperDialog( m_widget );
+ editor->setWidget( m_widget );
+ editor->setPolyCutter( polyCutter.get() );
+
+ connect( m_widget, SIGNAL( track(const ossimDpt& ) ),
+ editor, SLOT(track(const ossimDpt&)));
+ connect( m_widget, SIGNAL( mousePress(QMouseEvent*, const ossimDpt&) ),
+ editor, SLOT(mousePress(QMouseEvent*, const ossimDpt&)));
+
+ editor->show();
+ }
+
+ } // if ( inputConnection.valid() )
+
+ } // if ( m_widget.valid() )
+
+} // End: ossimGui::ImageActions::showPolygonRemapper()
+
+void ossimGui::ImageActions::showPositionInformation()
+{
+ PositionInformationDialog* editor = new PositionInformationDialog( m_widget );
+ editor->setWidget( m_widget );
+ connect( m_widget, SIGNAL( track(const ossimDpt& ) ), editor, SLOT(track(const ossimDpt&)));
+ editor->show();
+}
+
+void ossimGui::ImageActions::editGeometryAdjustments()
+{
+ if(!m_visitor.m_imageAdjustments.empty())
+ {
+ AdjustableParameterEditor* editor = new AdjustableParameterEditor(m_widget);
+ editor->setObject(m_visitor.m_imageAdjustments[0].get());
+ editor->show();
+ }
+}
+
+void ossimGui::ImageActions::editView()
+{
+ if(!m_visitor.m_imageRenderers.empty())
+ {
+ //std::cout << "Editing view === " << m_visitor.m_imageRenderers[0].get() << std::endl;
+ }
+}
+
+void ossimGui::ImageActions::fitToWindow()
+{
+ ossimDrect currentViewSize = m_widget->connectableObject()->getBounds();
+ m_widget->manipulator()->fit();
+ m_currentScenePoint = m_widget->viewportBoundsInSceneSpace().midPoint();
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::fullRes()
+{
+ m_widget->manipulator()->fullRes();
+ m_currentScenePoint = m_widget->viewportBoundsInSceneSpace().midPoint();
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::zoomIn(double factor)
+{
+ m_widget->manipulator()->zoomIn(factor);
+ m_currentScenePoint = m_widget->viewportBoundsInSceneSpace().midPoint();
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::zoomOut(double factor)
+{
+ m_widget->manipulator()->zoomOut(factor);
+ m_currentScenePoint = m_widget->viewportBoundsInSceneSpace().midPoint();
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::syncingOptionsChanged(const QString& value)
+{
+ if(value == "<Select Syncing>" || value == "None")
+ {
+ m_syncType = View::SYNC_TYPE_NONE;
+ }
+ else if(value == "Cursor")
+ {
+ m_syncType = View::SYNC_TYPE_CURSOR;
+ }
+ else if(value == "Position")
+ {
+ m_syncType = View::SYNC_TYPE_POSITION;
+ }
+ else if(value == "Full")
+ {
+ m_syncType = View::SYNC_TYPE_ALL;
+ m_syncType = m_syncType&(~View::SYNC_TYPE_CURSOR);
+ }
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::layerOptionsChanged(int idx)
+{
+ m_widget->setMultiLayerAlgorithm(idx);
+}
+
+void ossimGui::ImageActions::track(const ossimDpt& scenePoint)
+{
+ m_currentScenePoint = scenePoint;
+ setupAndExecuteSyncing();
+}
+
+void ossimGui::ImageActions::interpolationTypeChanged(const QString& value)
+{
+ if(!m_visitor.m_imageRenderers.empty())
+ {
+ ossimVisitor::ListRef::iterator rendererIterator = m_visitor.m_imageRenderers.begin();
+ while(rendererIterator != m_visitor.m_imageRenderers.end())
+ {
+ ossimPropertyInterface* propertyInterface = dynamic_cast<ossimPropertyInterface*> (rendererIterator->get());
+ if(propertyInterface)
+ {
+ propertyInterface->setProperty("filter_type", value.toAscii().data());
+ }
+ ++rendererIterator;
+ }
+ rendererIterator = m_visitor.m_imageRenderers.begin();
+ ossimEventVisitor visitor(new ossimRefreshEvent());
+ while(rendererIterator != m_visitor.m_imageRenderers.end())
+ {
+ (*rendererIterator)->accept(visitor);
+ ++rendererIterator;
+ }
+ }
+ m_resamplerType = value;
+ if(m_syncType&View::SYNC_TYPE_RESAMPLER)
+ {
+ setupAndExecuteSyncing();
+ }
+}
+
+void ossimGui::ImageActions::addActions(QMainWindow* mainWindow)
+{
+ if(!m_widget) return;
+ // collect all the types we want direct pointers to
+ //
+ m_visitor.reset();
+ m_widget->connectableObject()->accept(m_visitor);
+
+
+ if(!mainWindow) return;
+ QMenuBar* menuBar = mainWindow?mainWindow->menuBar():0;
+
+ QMenu* imageMenu = menuBar->findChild<QMenu*>( "imageMenu");
+ QAction* action = 0;
+ if(!imageMenu)
+ {
+ imageMenu = new QMenu("Image", menuBar);
+ imageMenu->setObjectName("imageMenu");
+ QMenu* windowMenu = menuBar->findChild<QMenu*>("windowMenu");
+ if(windowMenu)
+ {
+ action = menuBar->insertMenu(windowMenu->menuAction(), imageMenu);
+ }
+ else
+ {
+ }
+ }
+
+ action = imageMenu->findChild<QAction*>("exportImageAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Export");
+ action->setObjectName("exportImageAction");
+ action->setEnabled(true);
+
+ }
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(exportImage()));
+
+ action = imageMenu->findChild<QAction*>("saveAsAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Save as");
+ action->setObjectName("saveAsAction");
+ action->setEnabled(true);
+
+ }
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(saveAs()));
+
+ action = imageMenu->findChild<QAction*>("exportKeywordListAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Export Keywordlist");
+ action->setObjectName("exportKeywordListAction");
+ action->setEnabled(true);
+ }
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(exportKeywordlist()));
+
+ imageMenu->addSeparator();
+
+ action = imageMenu->findChild<QAction*>("imageSelectBandsAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Band Selection");
+ action->setObjectName("imageSelectBandsAction");
+ }
+ if(!m_visitor.m_bandSelectors.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editBandSelector()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ action = imageMenu->findChild<QAction*>("imageBrightnessContrastAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Brightness Contrast");
+ action->setObjectName("imageBrightnessContrastAction");
+ }
+ if(!m_visitor.m_brightnessContrastSources.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editBrightnessContrast()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ action = imageMenu->findChild<QAction*>("imageGeometryAdjustmentAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Geometry Adjustment");
+ action->setObjectName("imageGeometryAdjustmentAction");
+ }
+ if(!m_visitor.m_imageAdjustments.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editGeometryAdjustments()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ action = imageMenu->findChild<QAction*>("imageHistogramRemapperAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Histogram Remapper");
+ action->setObjectName("imageHistogramRemapperAction");
+ }
+ if(!m_visitor.m_histogramRemappers.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editHistogramRemapper()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ action = imageMenu->findChild<QAction*>("polygonRemapperAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Polygon Remapper");
+ action->setObjectName("polygonRemapperAction");
+ action->setEnabled( true );
+ }
+ connect(action, SIGNAL(triggered(bool)),this, SLOT( showPolygonRemapper() ));
+
+ action = imageMenu->findChild<QAction*>("imageHsiAdjustmentsAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("HSI Adjustments");
+ action->setObjectName("imageHsiAdjustmentsAction");
+ }
+ if(!m_visitor.m_hsiRemappers.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editHsiAdjustments()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ imageMenu->addSeparator();
+
+ action = imageMenu->findChild<QAction*>("positionInformationAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("Position Information");
+ action->setObjectName("positionInformationAction");
+ action->setEnabled( true );
+ }
+ connect(action, SIGNAL(triggered(bool)),this, SLOT( showPositionInformation() ));
+
+ action = imageMenu->findChild<QAction*>("imageViewAction");
+ if(!action)
+ {
+ action = imageMenu->addAction("View");
+ action->setObjectName("imageViewAction");
+ }
+ if(!m_visitor.m_imageRenderers.empty())
+ {
+ connect(action, SIGNAL(triggered(bool)),this, SLOT(editView()));
+ action->setEnabled(true);
+ }
+ else
+ {
+ action->setEnabled(false);
+ }
+
+ /****************************** setup tool bar ******************************/
+ QToolBar* toolbar = mainWindow?mainWindow->findChild<QToolBar*>( "imageToolBar"):0;
+
+ if(!toolbar&&mainWindow)
+ {
+ toolbar = new QToolBar();
+ toolbar->setObjectName("imageToolBar");
+ mainWindow->addToolBar(toolbar);
+ }
+ QComboBox* interpolationType = toolbar->findChild<QComboBox*>("interpolationType");
+ QToolButton* fitToWindow = toolbar->findChild<QToolButton*>("fitToWindowButton");
+ QToolButton* fullResButton = toolbar->findChild<QToolButton*>("fullResButton");
+ QToolButton* zoomInButton = toolbar->findChild<QToolButton*>("zoomInButton");
+ QToolButton* zoomOutButton = toolbar->findChild<QToolButton*>("zoomOutButton");
+ QComboBox* syncingOptions = toolbar->findChild<QComboBox*>("syncingOptions");
+ if(!m_visitor.m_imageRenderers.empty())
+ {
+ ossimImageRenderer* renderer = dynamic_cast<ossimImageRenderer*>(m_visitor.m_imageRenderers[0].get());
+ // already have a toolbar there
+ //QLabel* interpolationTypeLabel = 0;
+ if(!interpolationType)
+ {
+ interpolationType = new QComboBox();
+ std::vector<ossimString> filterTypes;
+ ossimFilterResampler filterResampler;
+ filterResampler.getFilterTypes(filterTypes);
+ interpolationType->setObjectName("interpolationType");
+ ossim_uint32 idx = 0;
+ ossimString currentFilterValue = renderer->getPropertyValueAsString("filter_type").c_str();
+ // ossim_uint32 savedIdx = 0;
+ interpolationType->addItem("<Select Interpolation>");
+ for(idx =0; idx < filterTypes.size();++idx)
+ {
+ interpolationType->addItem(filterTypes[idx].c_str());
+ }
+ // interpolationTypeLabel = new QLabel("Interpolation Type:");
+ //interpolationTypeLabel->setObjectName("interpolationTypeLabel");
+ // toolbar->addWidget(interpolationTypeLabel);
+ toolbar->addWidget(interpolationType);
+ }
+ else
+ {
+ interpolationType->setEnabled(true);
+
+ }
+ {
+ std::vector<ossimString> filterTypes;
+ ossimFilterResampler filterResampler;
+ filterResampler.getFilterTypes(filterTypes);
+ ossim_uint32 idx = 0;
+ ossimString currentFilterValue = renderer->getPropertyValueAsString("filter_type").c_str();
+ ossim_int32 savedIdx = -1;
+ for(idx =0; idx < filterTypes.size();++idx)
+ {
+ if(currentFilterValue==filterTypes[idx]) savedIdx = idx;
+ }
+ interpolationType->setCurrentIndex(savedIdx+1);
+ m_resamplerType = interpolationType->currentText();
+ }
+ connect(interpolationType, SIGNAL(activated (const QString &)), this, SLOT(interpolationTypeChanged(const QString &)));
+ }
+ else
+ {
+ if(interpolationType) interpolationType->setEnabled(false);
+ }
+
+ if(!m_visitor.m_viewInterfaces.empty())
+ {
+ if(!fitToWindow)
+ {
+ // fitToWindow = new QPushButton("Fit");
+ fitToWindow = new QToolButton();
+ fitToWindow->setText("Fit");
+ fitToWindow->setObjectName("fitToWindowButton");
+ fitToWindow->setIcon(QIcon(":/themes/default/mActionZoomFullExtent.png"));
+ toolbar->addWidget(fitToWindow);
+ }
+ else
+ {
+ fitToWindow->setEnabled(true);
+ }
+ if(!fullResButton)
+ {
+ fullResButton = new QToolButton();
+ fullResButton->setIcon(QIcon(":/themes/default/mActionZoomActual.png"));
+ fullResButton->setText("Full Res");
+ fullResButton->setObjectName("fullResButton");
+ toolbar->addWidget(fullResButton);
+ }
+ else
+ {
+ fullResButton->setEnabled(true);
+ }
+ if(!zoomInButton)
+ {
+ zoomInButton = new QToolButton();
+ zoomInButton->setIcon(QIcon(":/themes/default/mActionZoomIn.png"));
+ zoomInButton->setText("+");
+ zoomInButton->setObjectName("zoomInButton");
+ toolbar->addWidget(zoomInButton);
+ }
+ else
+ {
+ zoomInButton->setEnabled(true);
+ }
+ if(!zoomOutButton)
+ {
+ zoomOutButton = new QToolButton();
+ zoomOutButton->setIcon(QIcon(":/themes/default/mActionZoomOut.png"));
+ zoomOutButton->setText("-");
+ zoomOutButton->setObjectName("zoomOutButton");
+ toolbar->addWidget(zoomOutButton);
+ }
+ else
+ {
+ zoomOutButton->setEnabled(true);
+ }
+ //QLabel* syncingOptionsLabel = 0;
+ if(!syncingOptions)
+ {
+ syncingOptions = new QComboBox();
+ syncingOptions->setObjectName("syncingOptions");
+ syncingOptions->addItem("<Select Syncing>");
+ syncingOptions->addItem("None");
+ syncingOptions->addItem("Full");
+ syncingOptions->addItem("Position");
+ syncingOptions->addItem("Cursor");
+ //syncingOptionsLabel = new QLabel("syncing:");
+ //syncingOptionsLabel->setObjectName("syncingOptionsLabel");
+ //toolbar->addWidget(syncingOptionsLabel);
+ toolbar->addWidget(syncingOptions);
+ }
+ else
+ {
+ syncingOptions->setEnabled(true);
+ syncingOptionsChanged(syncingOptions->currentText());
+ }
+ connect(fitToWindow, SIGNAL(clicked(bool)),this, SLOT(fitToWindow()));
+ connect(fullResButton, SIGNAL(clicked(bool)),this, SLOT(fullRes()));
+ connect(zoomInButton, SIGNAL(clicked(bool)),this, SLOT(zoomIn()));
+ connect(zoomOutButton, SIGNAL(clicked(bool)),this, SLOT(zoomOut()));
+ connect(syncingOptions, SIGNAL(activated (const QString &)), this, SLOT(syncingOptionsChanged(const QString &)));
+ }
+ else
+ {
+ if(fitToWindow)
+ {
+ fitToWindow->setEnabled(false);
+ }
+ if(fullResButton)
+ {
+ fullResButton->setEnabled(false);
+ }
+ if(zoomInButton)
+ {
+ zoomInButton->setEnabled(false);
+ }
+ if(zoomOutButton)
+ {
+ zoomOutButton->setEnabled(false);
+ }
+ }
+
+ QComboBox* layerOptions = toolbar->findChild<QComboBox*>("layerOptions");
+ // QLabel* layerOptionsLabel = 0;
+ if(!layerOptions)
+ {
+ layerOptions = new QComboBox();
+ layerOptions->setObjectName("layerOptions");
+ layerOptions->addItem("<Select Swipe Mode>");
+ layerOptions->addItem("Horizontal Swipe");
+ layerOptions->addItem("Vertical Swipe");
+ layerOptions->addItem("Box Swipe");
+ layerOptions->addItem("Circle Swipe");
+ //LayerOptions->addItem("Animation");
+ //layerOptionsLabel = new QLabel("Layer Options:");
+ //layerOptionsLabel->setObjectName("layerOptionsLabel");
+ // toolbar->addWidget(layerOptionsLabel);
+ toolbar->addWidget(layerOptions);
+ }
+ else
+ {
+ layerOptions->setEnabled(true);
+ }
+ layerOptions->setCurrentIndex(m_widget->multiLayerAlgorithmType());
+
+ connect(layerOptions, SIGNAL(activated (int)), this, SLOT(layerOptionsChanged(int)));
+
+// connect(m_widget, SIGNAL( mouseMove(QMouseEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(mouseMove(QMouseEvent*, const ossimDrect& , const ossimDpt& )));
+// connect(m_widget, SIGNAL( mouseDoubleClick(QMouseEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(mouseDoubleClick(QMouseEvent*, const ossimDrect& , const ossimDpt& )));
+// connect(m_widget, SIGNAL( mousePress(QMouseEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(mousePress(QMouseEvent*, const ossimDrect& , const ossimDpt& )));
+// connect(m_widget, SIGNAL( mouseRelease(QMouseEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(mouseRelease(QMouseEvent*, const ossimDrect& , const ossimDpt& )));
+// connect(m_widget, SIGNAL( wheel(QWheelEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(wheel(QWheelEvent*, const ossimDrect& , const ossimDpt& )));
+
+ connect(m_widget, SIGNAL( track(const ossimDpt& )),
+ this, SLOT(track(const ossimDpt&)));
+}
+
+void ossimGui::ImageActions::removeActions(QMainWindow* mainWindow)
+{
+ disconnect(m_widget, 0, this, 0);
+
+ /********************** REMOVE MENU ****************************/
+ QMenuBar* menuBar = mainWindow->menuBar();
+
+ QMenu* imageMenu = menuBar->findChild<QMenu*>("imageMenu");
+ if(imageMenu)
+ {
+ QAction* action = imageMenu->findChild<QAction*>("imageSelectBandsAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("imageHsiAdjustmentsAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("imageHistogramRemapperAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("imageGeometryAdjustmentAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("imageViewAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("imageBrightnessContrastAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("exportImageAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("saveAsAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ action = imageMenu->findChild<QAction*>("exportKeywordListAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+
+ //
+
+ action = imageMenu->findChild<QAction*>("polygonRemapperAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+
+ //
+
+ action = imageMenu->findChild<QAction*>("positionInformationAction");
+ if(action)
+ {
+ disconnect(action, 0, this, 0);
+ }
+ }
+
+ /********************** REMOVE TOOLBAR ****************************/
+ QToolBar* imageToolBar = mainWindow->findChild<QToolBar*>("imageToolBar");
+
+ if(imageToolBar)
+ {
+ QWidget* widget = imageToolBar->findChild<QWidget*>("interpolationType");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("fitToWindowButton");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("fullResButton");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("zoomInButton");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("zoomOutButton");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("syncingOptions");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+ widget = imageToolBar->findChild<QWidget*>("layerOptions");
+ if(widget)
+ {
+ widget->disconnect(this);
+ }
+
+ //imageToolBar->hide();
+ }
+
+}
+
+void ossimGui::ImageActions::setupAndExecuteSyncing()
+{
+ ossimRefPtr<ossimImageGeometry> geom = getView();
+ if(geom.valid()&&!m_currentScenePoint.hasNans()&&(m_syncType!=View::SYNC_TYPE_NONE))
+ {
+ int syncType = m_syncType;
+
+ View view(syncType, m_currentScenePoint, geom.get());
+ view.setResamplerType(m_resamplerType.toAscii().data());
+ if(view.geomType() != View::GEOM_TYPE_MAP_PROJECTION)
+ {
+ view.setSyncType(View::SYNC_TYPE_GEOM, false); // we will for now only synch full scale if its of type map projection
+ }
+ emit syncView(view);
+ }
+}
+
+ossimImageGeometry* ossimGui::ImageActions::getView()
+{
+ return m_widget->getGeometry();
+}
+
+
+ossimGui::ImageMdiSubWindow::ImageMdiSubWindow( QWidget * parent, Qt::WindowFlags flags)
+:MdiSubWindowBase(parent, flags)
+{
+ m_connectableObject = new ConnectableDisplayObject(this);
+ m_actions = new ImageActions();
+ setAttribute(Qt::WA_DeleteOnClose);
+ setGeometry(0,0,512,512);
+ setMinimumSize(QSize(64,64));
+ m_imageScrollView = new ImageScrollView();
+ m_imageScrollView->setConnectableObject(static_cast<ConnectableImageObject*>(m_connectableObject.get()));
+ setWidget(m_imageScrollView);
+ m_actions->setWidget(m_imageScrollView);
+ connect(this, SIGNAL(windowStateChanged ( Qt::WindowStates , Qt::WindowStates )),this, SLOT(stateChanged(Qt::WindowStates , Qt::WindowStates)));
+ m_containerListener = new ContainerListener(this);
+// connect(m_imageScrollWidget, SIGNAL( mouseMove(QMouseEvent*, const ossimDrect& , const ossimDpt& )),
+// this, SLOT(mouseMove(QMouseEvent*, const ossimDrect& , const ossimDpt& )));
+}
+
+ossimGui::ImageMdiSubWindow::~ImageMdiSubWindow()
+{
+ removeListeners();
+ if(m_containerListener) delete m_containerListener;
+ m_containerListener = 0;
+ if(m_connectableObject.valid())
+ {
+ static_cast<ConnectableDisplayObject*>(m_connectableObject.get())->setDisplay(0);
+ m_imageScrollView->setConnectableObject(0);
+ }
+ if(m_actions)
+ {
+ delete m_actions;
+ m_actions = 0;
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::setConnectableObject(ConnectableObject* connectable)
+{
+ if(m_connectableObject.valid())
+ {
+ m_imageScrollView->setConnectableObject(0);
+ m_connectableObject->disconnect();
+ static_cast<ConnectableDisplayObject*>(m_connectableObject.get())->setDisplay(0);
+ }
+ MdiSubWindowBase::setConnectableObject(connectable);
+ if(m_connectableObject.valid())
+ {
+ m_imageScrollView->setConnectableObject(static_cast<ConnectableImageObject*>(m_connectableObject.get()));
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::closeEvent(QCloseEvent* /* event */)
+{
+ removeItems();
+}
+
+void ossimGui::ImageMdiSubWindow::stateChanged( Qt::WindowStates oldState, Qt::WindowStates newState)
+{
+ if((oldState == Qt::WindowNoState) && (newState & Qt::WindowActive))
+ {
+ // must be coming from an inactive state. Analyze the chain we are
+ addItems();
+ connect(m_actions, SIGNAL(syncView(View&)), this, SLOT(syncView(View&)));
+ }
+ else if(newState == Qt::WindowNoState)
+ {
+ // we must be coming from an active state so remove our dynamic items
+ removeItems();
+ disconnect(m_actions, 0, this, 0);
+ m_actions->visitor().reset();
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::syncView(View& viewInfo)
+{
+ if(mdiArea())
+ {
+ QList<QMdiSubWindow *> wList = mdiArea()->subWindowList();
+ QList<QMdiSubWindow *>::iterator currentWindow= wList.begin();
+ while(currentWindow != wList.end())
+ {
+ ossimGui::MdiSubWindowBase* w = dynamic_cast<ossimGui::MdiSubWindowBase*>(*currentWindow);
+ if( w && (w!=this) )
+ {
+ w->sync(viewInfo);
+ }
+ else if( w == this )
+ {
+ // if we are the ones syncing then lets do some informational readouts
+ // such as RGB values, GEO coordinates, ... etc
+ //
+ ossimRefPtr<ossimImageGeometry> geom = viewInfo.geometry();
+ if(geom.valid())
+ {
+ std::ostringstream out;
+
+ ossimDrect viewSpaceRect = m_imageScrollView->viewportBoundsInSceneSpace();
+ ossimDpt viewPoint = viewInfo.lookPosition();
+ ossimDpt eastingNorthing;
+ ossimDpt minProjectionPlanePt, maxProjectionPlanePt;
+ minProjectionPlanePt.makeNan();
+ maxProjectionPlanePt.makeNan();
+ ossimRefPtr<ossimMapProjection> mapProj = dynamic_cast<ossimMapProjection*> (geom->getProjection());
+ ossimGpt lookGpt = viewInfo.lookPositionAsGpt();
+ // ossim_int32 pcsCode = -1;
+ if(mapProj.valid())
+ {
+ // pcsCode = mapProj->getPcsCode();
+ if(!mapProj->isGeographic())
+ {
+ mapProj->lineSampleToEastingNorthing(
+ viewSpaceRect.ll(), minProjectionPlanePt);
+ mapProj->lineSampleToEastingNorthing(
+ viewSpaceRect.ur(), maxProjectionPlanePt);
+ }
+ else
+ {
+ ossimGpt tempGpt;
+ geom->localToWorld(viewSpaceRect.ll(), tempGpt);
+ minProjectionPlanePt = tempGpt;
+ geom->localToWorld(viewSpaceRect.ur(), tempGpt);
+ maxProjectionPlanePt = tempGpt;
+ }
+ }
+ else
+ {
+ ossimGpt corners[4];
+ geom->localToWorld(viewSpaceRect.ul(), corners[0]);
+ geom->localToWorld(viewSpaceRect.ur(), corners[1]);
+ geom->localToWorld(viewSpaceRect.lr(), corners[2]);
+ geom->localToWorld(viewSpaceRect.ll(), corners[3]);
+ minProjectionPlanePt.x = (ossim::min(ossim::min(ossim::min(corners[0].lond(),corners[1].lond()), corners[2].lond()), corners[3].lond()));
+ maxProjectionPlanePt.x = (ossim::max(ossim::max(ossim::max(corners[0].lond(), corners[1].lond()), corners[2].lond()), corners[3].lond()));
+ minProjectionPlanePt.y = (ossim::min(ossim::min(ossim::min(corners[0].latd(), corners[1].latd()), corners[2].latd()), corners[3].latd()));
+ maxProjectionPlanePt.y = (ossim::max(ossim::max(ossim::max(corners[0].latd(), corners[1].latd()), corners[2].latd()), corners[3].latd()));
+ }
+ if(mainWindow())
+ {
+ QStatusBar* statusBar = mainWindow()->statusBar();
+ std::ostringstream location;
+ ossim_float64 h = ossimElevManager::instance()->getHeightAboveMSL(lookGpt);
+ ossim_float64 alat = fabs(lookGpt.latd());
+ ossim_float64 alon = fabs(lookGpt.lond());
+ location << ossimString::toString(alat) <<((lookGpt.latd()>=0)?" N":" S")<< ", " << ossimString::toString(alon)<< ((lookGpt.lond()>=0)?" E":" W") << std::endl;
+ bool fixed = true;
+ location << " MSL: " << ossimString::toString(h, 2, fixed);
+ location << " x: " << ossimString::toString(viewPoint.x);
+ location << " y: " << ossimString::toString(viewPoint.y);
+ if(statusBar)
+ {
+ statusBar->showMessage(QString(location.str().c_str()));
+ }
+
+ }
+#if 0
+ ossim_uint32 fixedWidth = 15;
+ out<< std::setiosflags( ios::left ) << std::setw(fixedWidth) << "location:" << lookGpt << std::endl;
+ if(!minProjectionPlanePt.hasNans()&& !maxProjectionPlanePt.hasNans())
+ {
+ out.setf(std::ios::fixed);
+ out << std::setiosflags( ios::left ) << "BBOX=" << minProjectionPlanePt.x << "," << minProjectionPlanePt.y << "," << maxProjectionPlanePt.x << "," << maxProjectionPlanePt.y << std::endl;
+ if(pcsCode > 0)
+ {
+ out << "EPSG:" << pcsCode << "\n";
+ }
+ }
+#endif
+ }
+ }
+ ++currentWindow;
+ }
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::setJobQueue(ossimJobQueue* q)
+{
+ m_imageScrollView->setJobQueue(q);
+}
+
+ossimGui::ImageScrollView* ossimGui::ImageMdiSubWindow::scrollWidget()
+{
+ return m_imageScrollView;
+}
+
+void ossimGui::ImageMdiSubWindow::sync(View& view)
+{
+ ossimGpt oldCenter;
+
+ oldCenter.makeNan();
+ ossimDrect rect = m_imageScrollView->viewportBoundsInSceneSpace();
+
+ ossimRefPtr<ossimImageGeometry> widgetGeometry = m_imageScrollView->getGeometry();
+ if(widgetGeometry.valid())
+ {
+
+ widgetGeometry->localToWorld(rect.midPoint(), oldCenter);
+ }
+ // first let's sync track cursor and position
+ //
+ ossimRefPtr<ossimImageGeometry> trackGeom = view.geometry();
+ ossimRefPtr<ossimImageGeometry> geom = view.geometry();
+ int syncType = view.syncType();
+
+ SetViewVisitor visitor(geom.get());
+ connectableObject()->accept(visitor);
+
+ // if I have no view interfaces to set them I can't sync
+ // so fall back to the current projection so we can still cursor track
+ // and position track
+ //
+ if(syncType&View::SYNC_TYPE_GEOM)
+ {
+ if(!visitor.getObject()||m_imageScrollView->manipulator()->isAffine())
+ {
+ syncType = syncType&(~View::SYNC_TYPE_GEOM);
+ }
+ }
+
+ if(!(syncType&View::SYNC_TYPE_GEOM))
+ {
+ trackGeom = widgetGeometry.get();
+ }
+
+ if(!(syncType&View::SYNC_TYPE_GEOM))
+ {
+ visitor.setGeometry(0);
+ }
+ if(view.syncType()&View::SYNC_TYPE_RESAMPLER)
+ {
+ visitor.setResamplerType(view.resamplerType());
+ }
+ if(m_imageScrollView)
+ {
+ if(m_imageScrollView->manipulator()&&!m_imageScrollView->manipulator()->isAffine())
+ {
+ if((view.geomType() != View::GEOM_TYPE_UNKNOWN)&&(view.geometry()))
+ {
+ m_imageScrollView->manipulator()->setObject(view.geometry()->dup());
+ }
+ }
+ }
+ // now set the view
+ visitor.setView();
+
+ // now set the scroll positions for the view
+ //
+ bool hasProjection = trackGeom.valid()?trackGeom->getProjection()!=0:false;
+ if(trackGeom.valid()&&hasProjection)
+ {
+ ossimGpt referencePosition = view.lookPositionAsGpt();
+
+
+ if(!view.lookPositionValid())
+ {
+ referencePosition = oldCenter;
+ }
+ if(!referencePosition.isLatNan()&&!referencePosition.isLonNan())
+ {
+ ossimDpt viewPoint;
+ trackGeom->worldToLocal(referencePosition, viewPoint);
+ if(syncType&View::SYNC_TYPE_CURSOR)
+ {
+ m_imageScrollView->setTrackPoint(viewPoint);
+ }
+ else
+ {
+ ossimDpt nanPt;
+ nanPt.makeNan();
+ m_imageScrollView->setTrackPoint(nanPt);
+ }
+ if(syncType&View::SYNC_TYPE_POSITION||
+ syncType&View::SYNC_TYPE_GEOM)
+ {
+ m_imageScrollView->centerOn(viewPoint.x, viewPoint.y);
+ }
+ }
+ else
+ {
+
+ }
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::addItems()
+{
+ QMainWindow* mainWin = mainWindow();
+ if(!mainWin) return;
+ removeListeners();
+ m_actions->addActions(mainWin);
+ addListeners();
+}
+
+ossimImageGeometry* ossimGui::ImageMdiSubWindow::getView()
+{
+ return m_imageScrollView->getGeometry();
+}
+
+void ossimGui::ImageMdiSubWindow::addOrSetupToolbar()
+{
+ QMainWindow* mainWin = mainWindow();
+ if(!mainWin) return;
+
+ /****************************** End setup tool bar ******************************/
+}
+
+void ossimGui::ImageMdiSubWindow::removeItems()
+{
+ QMainWindow* mainWin = mainWindow();
+ if(!mainWin) return;
+ removeListeners();
+ m_actions->removeActions(mainWin);
+
+}
+
+void ossimGui::ImageMdiSubWindow::addListeners()
+{
+ if(m_actions)
+ {
+ ossim_uint32 idx = 0;
+ ImageActions::Visitor& visitor = m_actions->visitor();
+ for(idx = 0; idx < visitor.m_containers.size();++idx)
+ {
+ ossimListenerManager* manager = dynamic_cast<ossimListenerManager*> (visitor.m_containers[idx].get());
+ manager->addListener(m_containerListener);
+ }
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::removeListeners()
+{
+ if(m_actions)
+ {
+ ossim_uint32 idx = 0;
+ ImageActions::Visitor& visitor = m_actions->visitor();
+ for(idx = 0; idx < visitor.m_containers.size();++idx)
+ {
+ ossimListenerManager* manager = dynamic_cast<ossimListenerManager*> (visitor.m_containers[idx].get());
+ manager->removeListener(m_containerListener);
+ }
+ }
+}
+
+void ossimGui::ImageMdiSubWindow::ContainerListener::containerEvent(ossimContainerEvent& /* event */)
+{
+ QApplication::postEvent(m_window, new QEvent((QEvent::Type)ossimGui::WINDOW_REFRESH_ACTIONS_EVENT_ID));
+}
+
+bool ossimGui::ImageMdiSubWindow::event(QEvent* evt)
+{
+ switch(evt->type())
+ {
+ //---
+ // Getting warning:
+ // warning: case value ‘1004’ not in enumerated type ‘QEvent::Type’
+ //---
+ case ossimGui::WINDOW_REFRESH_ACTIONS_EVENT_ID:
+ {
+ if(windowState()&Qt::WindowActive)
+ {
+ removeItems();
+ addItems();
+ }
+ return true;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ return MdiSubWindowBase::event(evt);
+}
+
+
diff --git a/ossimGui/src/ossimGui/ImageScrollView.cpp b/ossimGui/src/ossimGui/ImageScrollView.cpp
new file mode 100644
index 0000000..76d165c
--- /dev/null
+++ b/ossimGui/src/ossimGui/ImageScrollView.cpp
@@ -0,0 +1,1115 @@
+
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/DisplayTimerJobQueue.h>
+#include <ossimGui/GatherImageViewProjTransVisitor.h>
+#include <ossimGui/MetricOverlay.h>
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/RegPoint.h>
+#include <ossimGui/RoiSelection.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/imaging/ossimImageData.h>
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <QtCore/QTime>
+#include <QtOpenGL/QGLWidget>
+#include <QtGui/QGraphicsRectItem>
+
+namespace ossimGui
+{
+ImageViewJob::ImageViewJob()
+ : m_maxProcessingTime(20),
+ m_tileCache(0),
+ m_inputSource(0),
+ m_imageViewJobMutex()
+{
+}
+
+void ImageViewJob::start()
+{
+ if(m_inputSource.valid())
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_imageViewJobMutex);
+ QTime start = QTime::currentTime();
+ ossimDrect cacheRect(m_tileCache->getRect());
+ // ossimDpt ulCachePt = cacheRect.ul();
+ ossimIrect rect;
+ //ossimDpt ul;
+ // Because the cache rect is a sub rect of the scroll we need the upper left which starts at offset 0,0 in scroll space
+ //m_cacheToView.map(0.0, 0.0, &ul.x, &ul.y);
+ while(m_tileCache->nextInvalidTile(rect) && (!isCanceled()))
+ {
+ // shift to zero based rectangle and then set back for opying purposes.
+ ossimRefPtr<ossimImageData> data =m_inputSource->getTile(rect);
+ data->setImageRectangle(rect);
+ ossimGui::Image img(data.get());
+ if(data.valid())
+ {
+ m_tileCache->addTile(ossimGui::Image(data.get(), true));
+ }
+ else
+ {
+ img = QImage(rect.width(), rect.height(), QImage::Format_RGB32);
+ img.fill(0);
+ img.setOffset(QPoint(rect.ul().x, rect.ul().y));
+
+ m_tileCache->addTile(img);
+ }
+
+ QTime end = QTime::currentTime();
+ if(start.msecsTo(end) >= m_maxProcessingTime)
+ {
+ break;
+ }
+ }
+ }
+}
+
+ImageScrollView::Layer::Layer(ossimConnectableObject* obj)
+ : m_inputObject(obj),
+ m_scalarRemapperChain( new ossimImageChain() ),
+ m_tileCache( new StaticTileImageCache() )
+{
+ m_scalarRemapperChain->addFirst(new ossimScalarRemapper());
+ m_scalarRemapperChain->addFirst(new ossimCacheTileSource());
+ if(obj) m_scalarRemapperChain->connectMyInputTo(0, obj);
+}
+
+ImageScrollView::Layer::~Layer()
+{
+ clear();
+}
+
+ImageScrollView::Layers::Layers()
+ : m_layers(0),
+ m_mutex()
+{
+}
+
+ImageScrollView::Layers::~Layers()
+{
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ m_layers[idx]->clear();
+ m_layers[idx] = 0;
+ }
+ m_layers.clear();
+}
+
+ImageScrollView::Layer* ImageScrollView::Layers::layer(ossim_uint32 idx)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return layerNoMutex(idx);
+}
+
+ImageScrollView::Layer* ImageScrollView::Layers::layer(ossimConnectableObject* input)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return layerNoMutex(input);
+}
+
+void ImageScrollView::Layers::setCacheRect(const ossimDrect& rect)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ m_layers[idx]->tileCache()->setRect(rect);
+ }
+}
+
+ImageScrollView::Layer* ImageScrollView::Layers::layerNoMutex(ossim_uint32 idx)
+{
+ Layer* result = 0;
+ if(idx < m_layers.size())
+ {
+ return m_layers[idx].get();
+ }
+
+ return result;
+}
+
+ImageScrollView::Layer* ImageScrollView::Layers::layerNoMutex(ossimConnectableObject* input)
+{
+ Layer* result = 0;
+ LayerListType::iterator iter = std::find_if(m_layers.begin(), m_layers.end(), FindConnectable(input));
+ if(iter != m_layers.end())
+ {
+ result = (*iter).get();
+ }
+
+ return result;
+}
+
+ImageScrollView::Layer* ImageScrollView::Layers::findFirstDirtyLayer()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size();++idx)
+ {
+ if(m_layers[idx]->tileCache()->hasInvalidTiles())
+ {
+ return m_layers[idx].get();
+ }
+ }
+
+ return 0;
+}
+
+bool ImageScrollView::Layers::isEmpty()const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return m_layers.empty();
+}
+
+void ImageScrollView::Layers::adjustLayers(ossimConnectableObject* connectable)
+{
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ LayerListType layers;
+ ossim_uint32 nInputs = connectable->getNumberOfInputs();
+ for(ossim_uint32 inputIdx = 0; inputIdx<nInputs;++inputIdx)
+ {
+ ossimRefPtr<ossimConnectableObject> inputObj = connectable->getInput(inputIdx);
+ ossimRefPtr<Layer> tempLayer = layerNoMutex(inputObj.get());
+ if(tempLayer.valid())
+ {
+ layers.push_back(tempLayer.get());
+ }
+ else // allocate a new display layer
+ {
+ tempLayer = new Layer(inputObj.get());
+ layers.push_back(tempLayer.get());
+ }
+ }
+ // Now any old layers that were removed lets fully remove
+ //
+ LayerListType::iterator iter = m_layers.begin();
+ while(iter!=m_layers.end())
+ {
+ if(std::find(layers.begin(), layers.end(), (*iter).get())==layers.end())
+ {
+ (*iter)->clear();
+ }
+ ++iter;
+ }
+
+ m_layers = layers;
+ // ossim_uint32 idx = 0;
+ }
+}
+
+void ImageScrollView::Layers::flushDisplayCaches()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ if(m_layers[idx]->tileCache()) m_layers[idx]->tileCache()->flush();
+ }
+}
+
+ImageScrollView::ImageScrollView (QWidget* parent)
+ : QGraphicsView(parent),
+ m_lastClickedPoint(),
+ m_trackPoint(),
+ m_oldTrackPoint(),
+ m_trackingFlag( true ),
+ m_mouseInsideFlag( false ),
+ m_showTrackingCursorFlag( false ),
+ m_amDialogActive( false ),
+ m_mouseStartPoint(),
+ m_activePointStart(),
+ m_activePointEnd(),
+ m_imageViewJob( new ImageViewJob() ),
+ m_layers( new Layers() ),
+ m_listener( new ConnectionListener(this) ),
+ m_jobQueue( new DisplayTimerJobQueue() ),
+ m_inputBounds(),
+ m_multiLayerAlgorithm( BOX_SWIPE_ALGORITHM ),
+ m_exploitationMode( DataManager::NO_MODE ),
+ m_manipulator(0),
+ m_connectableObject(0),
+ m_regOverlay(0),
+ m_metricOverlay(0),
+ m_roiId("RegROI")
+{
+ setScene(new QGraphicsScene());
+ m_lastClickedPoint.makeNan();
+ m_trackPoint.makeNan();
+ m_oldTrackPoint.makeNan();
+ m_inputBounds.makeNan();
+ m_imageViewJob->setCallback(new Callback(this));
+ m_manipulator = new ImageViewManipulator(this);
+ viewport()->setCursor(Qt::CrossCursor);
+ m_regOverlay = new RegistrationOverlay("Reg", scene());
+ m_metricOverlay = new MetricOverlay("Met", scene());
+
+ // this->setBackgroundRole(QPalette::Window);
+ // setViewport(new QGLWidget());
+ // m_layers = new Layers();
+ // m_imageViewJob = new ImageViewJob();
+ // m_imageViewJob->setCallback(new Callback(this));
+ // m_multiLayerAlgorithm = BOX_SWIPE_ALGORITHM;
+ // m_trackPoint.makeNan();
+ // m_oldTrackPoint.makeNan();
+ // m_trackingFlag = true;
+ // m_mouseInsideFlag = false;
+ // m_showTrackingCursorFlag = false;
+}
+
+ImageScrollView::ImageScrollView (QGraphicsScene* scene, QWidget* parent)
+ : QGraphicsView(scene, parent),
+ m_lastClickedPoint(),
+ m_trackPoint(),
+ m_oldTrackPoint(),
+ m_trackingFlag( true ),
+ m_mouseInsideFlag( false ),
+ m_showTrackingCursorFlag( false ),
+ m_amDialogActive( false ),
+ m_mouseStartPoint(),
+ m_activePointStart(),
+ m_activePointEnd(),
+ m_imageViewJob( new ImageViewJob() ),
+ m_layers( new Layers() ),
+ m_listener( new ConnectionListener(this) ),
+ m_jobQueue( new DisplayTimerJobQueue() ),
+ m_inputBounds(),
+ m_multiLayerAlgorithm( BOX_SWIPE_ALGORITHM ),
+ m_exploitationMode( DataManager::NO_MODE ),
+ m_manipulator(0),
+ m_connectableObject(0),
+ m_regOverlay(0),
+ m_metricOverlay(0),
+ m_roiId("RegROI")
+{
+ m_lastClickedPoint.makeNan();
+ m_trackPoint.makeNan();
+ m_oldTrackPoint.makeNan();
+ m_inputBounds.makeNan();
+ m_imageViewJob->setCallback(new Callback(this));
+ m_manipulator = new ImageViewManipulator(this);
+ viewport()->setCursor(Qt::CrossCursor);
+ m_regOverlay = new RegistrationOverlay( "Reg", scene );
+ m_metricOverlay = new MetricOverlay("Met", scene);
+
+ //setViewport(new QGLWidget());
+ // m_layers = new Layers();
+ // m_imageViewJob = new ImageViewJob();
+ // m_imageViewJob->setCallback(new Callback(this));
+ // m_multiLayerAlgorithm = BOX_SWIPE_ALGORITHM;
+ // m_trackPoint.makeNan();
+ // m_oldTrackPoint.makeNan();
+ // m_trackingFlag = true;
+ // m_mouseInsideFlag = false;
+ // m_showTrackingCursorFlag = false;
+ // m_manipulator = new ImageViewManipulator(this);
+ // viewport()->setCursor(Qt::CrossCursor);
+ // m_regOverlay = new RegistrationOverlay("Reg", scene);
+ // m_metricOverlay = new MetricOverlay("Met", scene);
+}
+
+ImageScrollView::~ImageScrollView()
+{
+ m_manipulator->setImageScrollView(0);
+ m_imageViewJob->cancel();
+ if(m_connectableObject.get()&&m_listener)
+ {
+ if(m_listener)
+ {
+ m_connectableObject->removeListener(m_listener);
+ }
+ m_connectableObject->disconnect();
+ }
+ if(m_listener)
+ {
+ delete m_listener;
+ m_listener = 0;
+ }
+ m_connectableObject = 0;
+ m_layers = 0;
+ if(m_manipulator.valid())
+ {
+ }
+}
+void ImageScrollView::setManipulator(ImageViewManipulator* manipulator)
+{
+ if(m_manipulator.valid())
+ {
+ m_manipulator->setImageScrollView(0);
+ }
+ m_manipulator = manipulator;
+ manipulator->setImageScrollView(this);
+}
+
+ImageViewManipulator* ImageScrollView::manipulator()
+{
+ return m_manipulator.get();
+}
+
+void ImageScrollView::setConnectableObject(ConnectableImageObject* c)
+{
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->removeListener(m_listener);
+ }
+ m_connectableObject = c;
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->addListener(m_listener);
+ }
+ if(m_connectableObject.valid()) inputConnected();
+}
+
+void ImageScrollView::refreshDisplay()
+{
+ m_layers->flushDisplayCaches();
+ m_inputBounds = m_connectableObject->getBounds();
+ updateSceneRect();
+
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageViewJob->isRunning()) m_imageViewJob->ready();
+
+ m_jobQueue->add(m_imageViewJob.get());
+ }
+}
+
+ossimDrect ImageScrollView::viewportBoundsInSceneSpace()const
+{
+ QRectF r = mapToScene(viewport()->rect()).boundingRect();
+ return ossimDrect(r.x(),r.y(),r.x()+r.width()-1,r.y()+r.height()-1);
+}
+
+void ImageScrollView::setJobQueue(ossimJobQueue* jobQueue)
+{
+ m_jobQueue = jobQueue;
+}
+
+void ImageScrollView::inputConnected(ossim_int32 /* idx */)
+{
+ m_layers->adjustLayers(m_connectableObject.get());
+ m_inputBounds = m_connectableObject->getBounds();
+ updateSceneRect();
+ if(m_connectableObject->getNumberOfInputs() == 1)
+ {
+ ossimDpt midPt = m_inputBounds.midPoint();
+ centerOn(midPt.x, midPt.y);
+
+ if(m_manipulator.valid())
+ {
+ m_manipulator->initializeToCurrentView();
+ }
+ }
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageViewJob->isRunning()) m_imageViewJob->ready();
+ m_jobQueue->add(m_imageViewJob.get());
+ }
+}
+
+void ImageScrollView::inputDisconnected(ossim_int32 /* idx */)
+{
+ m_layers->adjustLayers(m_connectableObject.get());
+
+ m_inputBounds = m_connectableObject->getBounds();
+
+ updateSceneRect();
+
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageViewJob->isRunning()) m_imageViewJob->ready();
+ m_jobQueue->add(m_imageViewJob.get());
+ }
+}
+
+void ImageScrollView::setCacheRect()
+{
+ QRectF r = mapToScene(viewport()->rect()).boundingRect();
+
+
+ ossimIpt ul(r.x(), r.y());//origin.x(), origin.y());
+ ossimIpt lr(r.x()+ r.width()-1,
+ r.y()+ r.height()-1);
+
+ ossimIrect rect(ul.x, ul.y, lr.x, lr.y);
+ m_layers->setCacheRect(rect);
+}
+
+
+void ImageScrollView::resizeEvent(QResizeEvent* event)
+{
+ QGraphicsView::resizeEvent(event);
+ if(!m_inputBounds.hasNans())
+ {
+ setCacheRect();
+ }
+ if(m_layers->findFirstDirtyLayer())
+ {
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageViewJob->isRunning()) m_imageViewJob->ready();
+ m_jobQueue->add(m_imageViewJob.get());
+ }
+ }
+ if(m_manipulator.valid())
+ {
+ m_manipulator->resizeEvent(event);
+ }
+}
+
+void ImageScrollView::scrollContentsBy( int dx, int dy )
+{
+ QGraphicsView::scrollContentsBy( dx,dy );
+
+ if(m_manipulator.valid())
+ {
+ m_manipulator->scrollContentsBy(dx, dy);
+ }
+ if(!m_inputBounds.hasNans())
+ {
+ setCacheRect();
+ }
+ if(m_layers->findFirstDirtyLayer())
+ {
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageViewJob->isRunning()) m_imageViewJob->ready();
+ m_jobQueue->add(m_imageViewJob.get());
+ }
+ }
+}
+
+ConnectableImageObject* ImageScrollView::connectableObject()
+{
+ return m_connectableObject.get();
+}
+
+ossimImageGeometry* ImageScrollView::getGeometry()
+{
+ ossimImageGeometry* result = 0;
+ if ( m_connectableObject.get() )
+ {
+ ossimImageSource* is = dynamic_cast<ossimImageSource*>(m_connectableObject->getInput());
+ if(is)
+ {
+ result = is->getImageGeometry().get();
+ }
+ }
+ return result;
+}
+
+void ImageScrollView::getRgb(const ossimIpt& location,
+ ossim_uint8& r,
+ ossim_uint8& g,
+ ossim_uint8& b)
+{
+ if ( m_layers.get() )
+ {
+ ossimRefPtr<Layer> topLayer = m_layers->layer( (ossim_uint32)0 );
+ if( topLayer.valid() )
+ {
+ ossimRefPtr<StaticTileImageCache> topTileCache = topLayer->tileCache();
+ if ( topTileCache.valid() )
+ {
+ // Scene to QImage offset:
+ ossimIpt offset = topTileCache->getRect().ul();
+
+ // QImage point:
+ ossimIpt pt(location.x - offset.x, location.y - offset.y);
+
+ QColor rgb = topTileCache->getCache().pixel( pt.x, pt.y );
+ r = rgb.red();
+ g = rgb.green();
+ b = rgb.blue();
+ }
+ }
+ }
+}
+
+void ImageScrollView::getRaw(const ossimIpt& location,
+ std::vector<ossim_float64>& values)
+{
+ if ( m_connectableObject.get() )
+ {
+ ossimImageSource* is = dynamic_cast<ossimImageSource*>(m_connectableObject->getInput());
+ if(is)
+ {
+ // Find the image handlers in the chain
+ ossimTypeNameVisitor visitor(ossimString("ossimImageHandler"),
+ true,
+ ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
+ is->accept(visitor);
+
+ // If there are multiple image handlers, e.g. a mosaic do not uses.
+ if ( visitor.getObjects().size() == 1 )
+ {
+ ossimRefPtr<ossimImageHandler> ih = visitor.getObjectAs<ossimImageHandler>( 0 );
+ if ( ih.valid() )
+ {
+ ossimIrect rect(location.x, location.y, location.x+1, location.y+1);
+ ossimRefPtr<ossimImageData> id = ih->getTile(rect, 0);
+
+ if ( id.valid() )
+ {
+ const ossim_uint32 BANDS = id->getNumberOfBands();
+
+ values.resize( BANDS );
+ for( ossim_uint32 i = 0; i < BANDS; ++i )
+ {
+ values[i] = id->getPix( location, i );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+const ossimDpt& ImageScrollView::trackPoint()const
+{
+ return m_trackPoint;
+}
+
+void ImageScrollView::setTrackPoint(const ossimDpt& position)
+{
+ if(position.hasNans())
+ {
+ m_trackPoint.makeNan();
+ }
+ else
+ {
+ //QPointF p = mapFromScene(position.x, position.y);
+ m_trackPoint = position;//ossimDpt(p.x(),p.y());
+ // on windows we can't call just update we must call viewport()->update
+ if(!m_mouseInsideFlag) viewport()->update();//update();
+ }
+}
+
+void ImageScrollView::updateSceneRect()
+{
+ if(!m_inputBounds.hasNans())
+ {
+ //resetTransform();
+ //resetMatrix();
+ //setTransform(QTransform(1.0,0.0,0.0,1.0,-m_inputBounds.ul().x, -m_inputBounds.ul().y));
+
+ setSceneRect(m_inputBounds.ul().x,
+ m_inputBounds.ul().y,
+ m_inputBounds.width(),
+ m_inputBounds.height());
+ setCacheRect();
+ }
+ else
+ {
+ setSceneRect(0,0,0,0);
+ }
+}
+
+void ImageScrollView::drawBackground(QPainter* painter,
+ const QRectF& rect )
+{
+ if((m_layers->numberOfLayers() > 1)&&(m_multiLayerAlgorithm!=NO_ALGORITHM))
+ {
+ paintMultiLayer(*painter, rect);
+ }
+ else
+ {
+ ossimRefPtr<Layer> topLayer = m_layers->layer((ossim_uint32)0);
+ if(topLayer.valid())
+ {
+ ossimRefPtr<StaticTileImageCache> topTileCache = topLayer->tileCache();
+ if(topTileCache.valid())
+ {
+ ossimIrect irect = topTileCache->getRect();
+ ossimIpt topOriginOffset = ossimDpt(irect.ul().x,
+ irect.ul().y);
+ //std::cout << "CACHE === " << topOriginOffset.x<<","<<topOriginOffset.y
+ // << ","<<irect.width() << "," << irect.height() << std::endl;
+ //std::cout << "RECT === " << rect.x()<<","<<rect.y()<<","
+ // << rect.width() << "," << rect.height() << std::endl;
+ //painter->drawImage(topOriginOffset.x,
+ // topOriginOffset.y,
+ // topTileCache->getCache());
+ painter->drawImage(rect.x(),//topOriginOffset.x,
+ rect.y(),//topOriginOffset.y,
+ topTileCache->getCache(),
+ rect.x()-topOriginOffset.x,
+ rect.y()-topOriginOffset.y,
+ rect.width(),
+ rect.height());
+ }
+ }
+ }
+}
+
+void ImageScrollView::drawForeground(QPainter* painter, const QRectF& inputRect)
+{
+ if(!m_trackPoint.hasNans()&&m_showTrackingCursorFlag&&m_trackingFlag)
+ {
+ ossimIpt roundedPoint(m_trackPoint);
+ bool hasClipping = painter->hasClipping();
+ painter->setClipping(false);
+ painter->setPen(QColor(255, 255, 255));
+
+ ossimIrect rect = viewportBoundsInSceneSpace();//(0,0,size().width()-1, size().height()-1);
+ // ossimIpt ul = rect.ul();
+ // ossimIpt lr = rect.lr();
+ int left = rect.ul().x;
+ int right = rect.lr().x;
+ int top = rect.ul().y;
+ int bottom = rect.lr().y;
+ if(rect.pointWithin(roundedPoint))
+ {
+ // draw horizontal
+ //
+ int x1 = left;
+ int x2 = right;
+ int y1 = roundedPoint.y;
+ int y2 = y1;
+ painter->drawLine(x1, y1, x2, y2);
+
+ // draw vertical
+ x1 = roundedPoint.x;
+ x2 = x1;
+ y1 = top;
+ y2 = bottom;
+ painter->drawLine(x1, y1, x2, y2);
+ }
+ painter->setClipping(hasClipping);
+ }
+
+ m_oldTrackPoint = m_trackPoint;
+
+ emit paintYourGraphics(painter, inputRect);
+
+ // Fix painter color.
+}
+
+void ImageScrollView::paintMultiLayer(QPainter& painter, const QRectF& /* rect */)
+{
+ if(m_multiLayerAlgorithm != ANIMATION_ALGORITHM)
+ {
+ ossimRefPtr<Layer> topLayer = m_layers->layer((ossim_uint32)0);
+ ossimRefPtr<Layer> bottomLayer = m_layers->layer((ossim_uint32)1);
+ if(topLayer.valid()&&bottomLayer.valid())
+ {
+ ossimRefPtr<StaticTileImageCache> topTileCache = topLayer->tileCache();
+ ossimRefPtr<StaticTileImageCache> bottomTileCache = bottomLayer->tileCache();
+
+ if(topTileCache.valid()&&bottomTileCache.valid())
+ {
+ ossimIrect rect = topTileCache->getRect();
+ QRectF rectF(rect.ul().x, rect.ul().y, rect.width(), rect.height()); // = m_scrollToLocal.mapRect(QRectF(rect.ul().x, rect.ul().y, rect.width(), rect.height()));
+ ossimIpt topOriginOffset = ossimDpt(rectF.x(), rectF.y());
+ // for scrolling we need to offset from the tile location to the actual rect indicated by the viewport.
+ //
+ ossim_uint32 w = rect.width();
+ ossim_uint32 h = rect.height();
+ switch(m_multiLayerAlgorithm)
+ {
+ case HORIZONTAL_SWIPE_ALGORITHM:
+ {
+ ossim_float64 topLayerx = topOriginOffset.x;
+ ossim_float64 bottomLayerx = m_activePointEnd.x();
+ ossim_float64 topLayerWidth = bottomLayerx - topLayerx;
+ painter.drawImage(topLayerx, topOriginOffset.y,
+ topTileCache->getCache(),0,0,topLayerWidth,h);
+ painter.drawImage(topLayerx+topLayerWidth, topOriginOffset.y, bottomTileCache->getCache(), topLayerWidth, 0);
+ break;
+ }
+ case VERTICAL_SWIPE_ALGORITHM:
+ {
+ ossim_int64 topLayery = topOriginOffset.y;
+ ossim_int64 bottomLayery = m_activePointEnd.y();
+ ossim_int64 topLayerHeight = bottomLayery - topLayery;
+ painter.drawImage(topOriginOffset.x, topLayery, topTileCache->getCache(), 0, 0, w, topLayerHeight);
+ painter.drawImage(topOriginOffset.x, topLayery+topLayerHeight, bottomTileCache->getCache(), 0, topLayerHeight);
+ break;
+ }
+ case BOX_SWIPE_ALGORITHM:
+ {
+ painter.drawImage(topOriginOffset.x, topOriginOffset.y, topTileCache->getCache());
+ ossim_float64 minx = ossim::min(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_float64 maxx = ossim::max(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_float64 miny = ossim::min(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_float64 maxy = ossim::max(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_float64 w = maxx-minx;
+ ossim_float64 h = maxy-miny;
+ ossim_float64 x = minx;
+ ossim_float64 y = miny;
+ //QPointF scrollPoint = m_localToScroll.map(QPointF(x,y));
+ ossimDrect cacheRect = bottomTileCache->getRect();
+ ossimDpt delta = ossimDpt(x,y) - cacheRect.ul();
+
+ painter.drawImage(x, y, bottomTileCache->getCache(), delta.x, delta.y, w, h);
+ break;
+ }
+ case CIRCLE_SWIPE_ALGORITHM:
+ {
+ // QImage& cacheImage = topTileCache->getCache();
+ // draw top and then overlay the bottom
+ ossim_float64 minx = ossim::min(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_float64 maxx = ossim::max(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_float64 miny = ossim::min(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_float64 maxy = ossim::max(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_float64 w = maxx-minx;
+ ossim_float64 h = maxy-miny;
+ ossim_float64 x = minx;
+ ossim_float64 y = miny;
+
+ if(w < 1) w = 1;
+ if(h < 1) h = 1;
+ //QPointF scrollPoint = m_localToScroll.map(QPointF(x,y));
+ // ossimDpt cachePt = ossimDpt(scrollPoint.x(), scrollPoint.y()) - topTileCache->getRect().ul();
+ painter.save();
+ painter.drawImage(topOriginOffset.x, topOriginOffset.y, topTileCache->getCache());
+ painter.setBrush(QBrush(bottomTileCache->getCache()));
+ painter.setPen(Qt::NoPen);
+
+ // this part is a little tricky but for the texturing to be placed in the ellipse properly
+ // I had to add a translation for the painter because the cache might extend past the current scroll region because it
+ // is on tile boundaries
+ //
+ // Because we shift for texturing with the QBrush we must undo the shift when drawing the ellipse so it lines up with
+ // the mouse draws. The topOriginOffset holds the shift.
+ //
+ painter.translate(topOriginOffset.x, topOriginOffset.y);
+ painter.drawEllipse(x-topOriginOffset.x,y-topOriginOffset.y,w,h);
+ painter.restore();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ // refreshDisplay();
+ }
+ }
+ else
+ {
+ }
+}
+
+void ImageScrollView::mouseDoubleClickEvent ( QMouseEvent * e )
+{
+ QGraphicsView::mouseDoubleClickEvent(e);
+
+ if(!m_inputBounds.hasNans())
+ {
+ QPointF p = mapToScene(e->pos());
+ ossimDpt scenePoint(p.x(), p.y());
+ ossimDrect sceneViewRect = viewportBoundsInSceneSpace();
+
+ emit mouseDoubleClick(e, sceneViewRect, scenePoint);//viewportPoint, localPoint, viewPoint);
+ }
+ //QPointF p = mapToScene(e->pos());
+ //if(m_trackingFlag)
+ //{
+ // emit track(ossimDpt(p.x(), p.y()));
+ // }
+}
+
+void ImageScrollView::emitTracking(const ossimDpt& pt)
+{
+ emit track(pt);
+}
+
+void ImageScrollView::mousePressEvent ( QMouseEvent * e )
+{
+ bool consumeEvent = false;
+ m_manipulator->mousePressEvent(e, consumeEvent);
+ m_mouseStartPoint = e->pos();
+ QPointF p = mapToScene(e->pos());
+ if(!consumeEvent)
+ {
+ QGraphicsView::mousePressEvent(e);
+ }
+ m_activePointStart = p;
+ m_activePointEnd = p;
+
+ m_lastClickedPoint.x = p.x();
+ m_lastClickedPoint.y = p.y();
+
+ emit mousePress(e);
+ emit mousePress(e, m_lastClickedPoint);
+
+ // Transform to true image coordinates
+ ossim_uint32 idxLayer = 0;
+ ossimImageSource* src = m_layers->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ossimDpt imagePoint;
+ ossimDpt scenePoint(p.x(), p.y());
+ ivtg->viewToImage(scenePoint, imagePoint);
+
+ // Registration
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE && m_regOverlay->isActive())
+ {
+ // ROI selector for auto
+ if (m_amDialogActive)
+ {
+ m_regOverlay->removeRoi(m_roiId);
+ ossimDpt widHgt(1,1);
+ m_regOverlay->addRoi(scenePoint, imagePoint, widHgt, m_roiId);
+ }
+ // Manual tie point
+ else
+ {
+ m_regOverlay->addPoint(scenePoint, imagePoint);
+ }
+ }
+
+ // Point drop
+ else if (m_exploitationMode == DataManager::GEOPOSITIONING_MODE)
+ {
+ m_metricOverlay->addPoint(scenePoint, imagePoint);
+ }
+ }
+ }
+}
+
+void ImageScrollView::mouseMoveEvent ( QMouseEvent * e )
+{
+ bool consumeEvent = false;
+ m_manipulator->mouseMoveEvent(e, consumeEvent);
+ if(!consumeEvent)
+ {
+ QGraphicsView::mouseMoveEvent(e);
+ }
+
+ if(e->buttons() & Qt::LeftButton)
+ {
+ m_activePointEnd = mapToScene(e->pos());
+ if(m_layers->numberOfLayers() > 1)
+ {
+ refreshDisplay();
+ //update();
+ }
+
+ if (m_amDialogActive)
+ {
+ QPointF p = mapToScene(e->pos());
+ ossimDpt scenePoint(p.x(), p.y());
+
+ // Transform to true image coordinates
+ ossim_uint32 idxLayer = 0;
+ ossimImageSource* src = m_layers->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ossimDpt imagePoint;
+ ivtg->viewToImage(scenePoint, imagePoint);
+ m_regOverlay->dragRoi(scenePoint, imagePoint, m_roiId);
+ }
+ }
+ }
+ }
+ emit mouseMove(e);
+}
+
+
+void ImageScrollView::mouseReleaseEvent ( QMouseEvent * e )
+{
+ bool consumeEvent = false;
+ m_manipulator->mouseReleaseEvent(e, consumeEvent);
+ QPointF p = mapToScene(e->pos());
+ if(!consumeEvent)
+ {
+ QGraphicsView::mouseReleaseEvent(e);
+ }
+ m_activePointEnd = p;
+
+ // If auto measurement window active, emit ROI complete signal
+ if (m_amDialogActive)
+ {
+ ossimGui::RoiSelection* roiSelection = m_regOverlay->getRoiSelection(m_roiId);
+ if(roiSelection)
+ {
+ ossimIrect imgRect =roiSelection->getRectImg();
+ ossimDpt imageStart = imgRect.ul();
+ ossimDpt imageStop = imgRect.lr();
+ emit mouseBox(this, imageStart, imageStop);
+ }
+ }
+
+ emit mouseRelease(e);
+}
+
+void ossimGui::ImageScrollView::wheelEvent ( QWheelEvent * e )
+{
+ bool consumeEvent = false;
+ m_manipulator->wheelEvent(e, consumeEvent);
+ if(!consumeEvent)
+ {
+ QGraphicsView::wheelEvent(e);
+ }
+
+#if 0
+ QPointF p = mapToScene(e->pos());
+ //if(m_trackingFlag)
+ //{
+ // emit track(ossimDpt(p.x(), p.y()));
+ //}
+
+ if(!m_inputBounds.hasNans())
+ {
+ QRectF sceneRect = mapToScene(viewport()->rect()).boundingRect();
+ QPointF scenePoint = mapToScene(e->pos());
+ emit wheel(e,
+ ossimDrect(sceneRect.x(), sceneRect.y(),
+ sceneRect.x()+sceneRect.width()-1,
+ sceneRect.y()+sceneRect.height()-1),
+ ossimDpt(scenePoint.x(), scenePoint.y()));
+ }
+#endif
+}
+
+void ossimGui::ImageScrollView::enterEvent ( QEvent * e)
+{
+ bool consumeEvent = false;
+ if(m_manipulator.valid())
+ {
+ m_manipulator->enterEvent(e, consumeEvent);
+ }
+ if(!consumeEvent)
+ {
+ QGraphicsView::enterEvent(e);
+ }
+}
+
+void ImageScrollView::leaveEvent ( QEvent * e)
+{
+ bool consumeEvent = false;
+ if(m_manipulator.valid())
+ {
+ m_manipulator->leaveEvent(e, consumeEvent);
+ }
+ if(!consumeEvent)
+ {
+ QGraphicsView::enterEvent(e);
+ }
+}
+
+void ImageScrollView::keyPressEvent ( QKeyEvent * e )
+{
+ bool consumeEvent = false;
+ if(m_manipulator.valid())
+ {
+ m_manipulator->keyPressEvent(e, consumeEvent);
+ }
+ if(!consumeEvent)
+ {
+ QGraphicsView::keyPressEvent(e);
+ }
+
+//??????????? test keys/functions ???????????????????????
+ switch(e->key())
+ {
+ case Qt::Key_H:
+ {
+ break;
+ }
+ }
+
+ if(e->key() == Qt::Key_A)
+ {
+ m_regOverlay->setVisible(true);
+ }
+ if(e->key() == Qt::Key_D)
+ {
+ m_regOverlay->setVisible(false);
+ }
+//??????????? test keys ???????????????????????
+}
+
+void ImageScrollView::keyReleaseEvent ( QKeyEvent * e )
+{
+ bool consumeEvent = false;
+ if(m_manipulator.valid())
+ {
+ m_manipulator->keyReleaseEvent(e, consumeEvent);
+ }
+ if(!consumeEvent)
+ {
+ QGraphicsView::keyReleaseEvent(e);
+ }
+}
+
+
+void ossimGui::ImageScrollView::setExploitationMode(int expMode)
+{
+ m_exploitationMode = static_cast<DataManager::ExploitationModeType> (expMode);
+
+ // Toggle annotation visibility based on mode
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE)
+ {
+ m_regOverlay->setVisible(true);
+ m_metricOverlay->setVisible(false);
+ }
+ else if (m_exploitationMode == DataManager::GEOPOSITIONING_MODE)
+ {
+ m_regOverlay->setVisible(false);
+ m_metricOverlay->setVisible(true);
+ }
+ else if (m_exploitationMode == DataManager::MENSURATION_MODE)
+ {
+ m_regOverlay->setVisible(false);
+ m_metricOverlay->setVisible(false);
+ // TODO overlay use here?
+ }
+}
+
+
+void ossimGui::ImageScrollView::setAutoMeasActive(const bool state)
+{
+ m_amDialogActive = state;
+
+ if (!m_amDialogActive)
+ m_regOverlay->removeRoi(m_roiId);
+}
+
+
+void ossimGui::ImageScrollView::setPositionGivenView(const ossimDpt& position)
+{
+ centerOn(position.x, position.y);;
+}
+
+
+// Currently called by ImageViewManipulator zoom functions
+void ossimGui::ImageScrollView::zoomAnnotation()
+{
+ ossim_uint32 idxLayer = 0;
+ ossimImageSource* src = m_layers->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ m_regOverlay->setView(ivtg);
+ m_metricOverlay->setView(ivtg);
+ }
+ }
+}
+
+// Called by ImageViewManipulator::setViewToChains()
+void ossimGui::ImageScrollView::emitViewChanged()
+{
+ emit viewChanged();
+}
+
+}
diff --git a/ossimGui/src/ossimGui/ImageViewManipulator.cpp b/ossimGui/src/ossimGui/ImageViewManipulator.cpp
new file mode 100644
index 0000000..bc694af
--- /dev/null
+++ b/ossimGui/src/ossimGui/ImageViewManipulator.cpp
@@ -0,0 +1,627 @@
+#include <ossimGui/ImageViewManipulator.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/SetViewVisitor.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/imaging/ossimImageRenderer.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/projection/ossimMapProjection.h>
+#include <ossim/projection/ossimImageViewAffineTransform.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <QtCore/QRectF>
+
+namespace ossimGui
+{
+ ImageViewManipulator::ImageViewManipulator(ImageScrollView* scrollView)
+ :m_scrollView(0),
+ m_fullResolutionScale(1.0,1.0)
+ {
+ //m_sceneItemUpdate = new SceneItemUpdate();
+ setImageScrollView(scrollView);
+
+ }
+ void ImageViewManipulator::setObject(ossimObject* obj)
+ {
+ m_obj = obj;
+ ossimImageViewTransform* ivt = getObjectAs<ossimImageViewTransform>();
+ if(ivt)
+ {
+ m_fullResolutionScale = ivt->getInputMetersPerPixel();
+ }
+ if(m_fullResolutionScale.hasNans())
+ {
+ m_fullResolutionScale = ossimDpt(1.0,1.0);
+ }
+ }
+
+ void ImageViewManipulator::setImageScrollView(ImageScrollView* scrollView)
+ {
+ m_fullResolutionScale = ossimDpt(1.0,1.0);
+ m_scrollView = scrollView;
+ if(m_scrollView)
+ {
+ m_scrollView->setMouseTracking(true);
+ }
+ }
+
+ void ImageViewManipulator::initializeToCurrentView()
+ {
+ if(m_scrollView)
+ {
+ //ossimDpt center = m_scrollView->getInputBounds().midPoint();
+ //m_centerPoint = center;
+
+ m_fullResolutionScale = ossimDpt(1.0,1.0);
+
+ ossimTypeNameVisitor visitor("ossimImageRenderer", true);
+ m_scrollView->connectableObject()->accept(visitor);
+
+
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*>(visitor.getObject());
+ ossimViewInterface* geomSource = connectable?dynamic_cast<ossimViewInterface*>(connectable):0;
+ ossimImageSource* is = connectable?dynamic_cast<ossimImageSource*>(connectable->getInput()):0;
+
+ if(geomSource)
+ {
+ if(geomSource->getView())
+ {
+ m_obj = (ossimObject*)(geomSource->getView()->dup());
+ }
+ }
+ if(!is)
+ {
+ visitor.reset();
+ visitor.setTypeName("ossimImageHandler");
+ m_scrollView->connectableObject()->accept(visitor);
+ is = dynamic_cast<ossimImageSource*>(visitor.getObject());
+ }
+ bool affineFlag = isAffine();
+ if(is)
+ {
+ ossim_uint32 nLevels = is->getNumberOfDecimationLevels();
+ nLevels = nLevels?nLevels:1;
+ ossim_float64 nLevelsPower2 = 1<<(nLevels-1);
+ ossim_float64 zoomInFactor = 1<<7;
+ ossimRefPtr<ossimImageGeometry> geom = is->getImageGeometry();
+ if(!affineFlag&&geom.valid()&&geom->getProjection())
+ {
+ m_fullResolutionScale = geom->getMetersPerPixel();
+ m_fullResolutionScale.x = m_fullResolutionScale.y;
+ m_scaleRange.m_min = m_fullResolutionScale.y*(1.0/zoomInFactor);
+ m_scaleRange.m_max = m_fullResolutionScale.y*nLevelsPower2;
+ }
+ else
+ {
+ m_scaleRange.m_min =1.0/nLevelsPower2;
+ m_scaleRange.m_max = zoomInFactor;
+ }
+ }
+ setCommonCenter();
+ }
+ }
+ bool ImageViewManipulator::isAffine()const
+ {
+ return (getObjectAs<const ossimImageViewAffineTransform>()!=0);
+ }
+
+ void ImageViewManipulator::fit()
+ {
+ ossimTypeNameVisitor visitor("ossimImageRenderer", true);
+ m_scrollView->connectableObject()->accept(visitor);
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*>(visitor.getObject());
+ ossim_float64 viewportWidth = m_scrollView->size().width()-16;
+ ossim_float64 viewportHeight = m_scrollView->size().height()-16;
+ ossimDpt saveCenter = m_centerPoint;
+ if(connectable)
+ {
+ ossimImageSource* inputSource = dynamic_cast<ossimImageSource*>(connectable->getInput());
+ ossimImageRenderer* renderer = dynamic_cast<ossimImageRenderer*>(connectable);
+
+ ossimImageViewAffineTransform* ivat = dynamic_cast<ossimImageViewAffineTransform*>(renderer->getImageViewTransform());
+ ossimImageViewProjectionTransform* ivpt = dynamic_cast<ossimImageViewProjectionTransform*>(renderer->getImageViewTransform());
+
+ if(ivpt)
+ {
+ ossimImageGeometry* iGeom = ivpt->getImageGeometry();
+ ossimImageGeometry* vGeom = asGeometry();
+ if(iGeom&&vGeom)
+ {
+
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(vGeom->getProjection());
+
+ if(mapProj)
+ {
+ // ossimDpt savedMpp = mapProj->getMetersPerPixel();
+ ossimDpt mpp = m_fullResolutionScale;
+ mapProj->setMetersPerPixel(m_fullResolutionScale);
+ ossimDrect rect = inputSource->getBoundingRect();
+ std::vector<ossimGpt> gpoints(4);
+ std::vector<ossimDpt> ipoints(4);
+ iGeom->localToWorld(rect.ul(), gpoints[0]);
+ iGeom->localToWorld(rect.ur(), gpoints[1]);
+ iGeom->localToWorld(rect.lr(), gpoints[2]);
+ iGeom->localToWorld(rect.ll(), gpoints[3]);
+
+ vGeom->worldToLocal(gpoints[0], ipoints[0]);
+ vGeom->worldToLocal(gpoints[1], ipoints[1]);
+ vGeom->worldToLocal(gpoints[2], ipoints[2]);
+ vGeom->worldToLocal(gpoints[3], ipoints[3]);
+
+ ossimDrect fullBounds = ossimDrect(ipoints);
+
+ double scaleX = static_cast<double>(fullBounds.width())/static_cast<double>(viewportWidth);
+ double scaleY = static_cast<double>(fullBounds.height())/static_cast<double>(viewportHeight);
+ double largestScale = ossim::max(scaleX, scaleY);
+ mpp.x*=largestScale;
+ mpp.y*=largestScale;
+
+
+ mapProj->setMetersPerPixel(mpp);
+ }
+ }
+ }
+ else if(ivat)
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ ossimDrect inputBounds = m_scrollView->getInputBounds();
+ double scaleX = static_cast<double>(inputBounds.width())/static_cast<double>(viewportWidth);
+ double scaleY = static_cast<double>(inputBounds.height())/static_cast<double>(viewportHeight);
+ double largestScale = ossim::max(scaleX, scaleY);
+ if(ivat)
+ {
+ ossimDpt tempCenter;
+
+ double x = 1.0/largestScale;
+ double y = x;
+ ivat->scale(x,y);
+ }
+
+ }
+ }
+
+ m_centerPoint = saveCenter;
+ setViewToChains();
+ }
+ void ImageViewManipulator::setFullResScale(const ossimDpt& scale)
+ {
+ m_fullResolutionScale = scale;
+ }
+
+ void ImageViewManipulator::fullRes()
+ {
+ ossimImageGeometry* geom = asGeometry();
+
+ if(geom)
+ {
+ ossimGpt tempCenter;
+ if(geom->getProjection())
+ {
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(m_fullResolutionScale);
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt tempCenter;
+ ivat->scale(m_fullResolutionScale.x, m_fullResolutionScale.y);
+ }
+ }
+ setViewToChains();
+
+ m_scrollView->zoomAnnotation();
+ }
+
+ void ImageViewManipulator::zoomIn(double factor)
+ {
+ bool modified = false;
+ if(!m_scrollView) return;
+ ossimImageGeometry* geom = asGeometry();
+ ossimDpt saveCenter = m_centerPoint;
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+ mpp.x/=factor;
+ mpp.y/=factor;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ if(m_scaleRange.isValid())
+ {
+ if(mpp.y>m_scaleRange.m_min)
+ {
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ modified = true;
+ }
+ }
+ }
+ else
+ {
+ mapProj->setMetersPerPixel(mpp);
+ modified = false;
+ }
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt scale = ivat->getScale();
+ ossimDpt factorScale(scale.x*factor,scale.y*factor);
+ if(m_scaleRange.isValid())
+ {
+ if(factorScale.x < m_scaleRange.m_max&&
+ factorScale.y < m_scaleRange.m_max)
+ {
+ ivat->scale(factorScale.x,factorScale.y);
+ modified = true;
+ }
+ }
+ else
+ {
+ ivat->scale(factorScale.x,factorScale.y);
+ modified = true;
+ }
+ }
+ }
+ m_centerPoint = saveCenter;
+ if(modified)
+ {
+ setViewToChains();
+ }
+
+ m_scrollView->zoomAnnotation();
+ }
+
+ void ImageViewManipulator::zoomOut(double factor)
+ {
+ if(!m_scrollView) return;
+ bool modified = false;
+ ossimImageGeometry* geom = asGeometry();
+ ossimDpt saveCenter = m_centerPoint;
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+ mpp.x*=factor;
+ mpp.y*=factor;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ if(m_scaleRange.isValid())
+ {
+ if(mpp.y <= m_scaleRange.m_max)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ modified = true;
+ }
+ }
+ else
+ {
+ mapProj->setMetersPerPixel(mpp);
+ modified = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt scale = ivat->getScale();
+
+ ossimDpt factorScale(scale.x/factor,scale.y/factor);
+ if(m_scaleRange.isValid())
+ {
+ if( factorScale.x >= m_scaleRange.m_min &&
+ factorScale.y >= m_scaleRange.m_min )
+ {
+ ivat->scale(factorScale.x,factorScale.y);
+ modified = true;
+ }
+ }
+ else
+ {
+ ivat->scale(factorScale.x,factorScale.y);
+ modified = true;
+ }
+ }
+ }
+ m_centerPoint = saveCenter;
+ if(modified)
+ {
+ setViewToChains();
+ }
+
+ m_scrollView->zoomAnnotation();
+ }
+
+ void ImageViewManipulator::fit(const ossimIrect& inputRect,
+ const ossimIrect& targetRect)
+ {
+ ossimImageGeometry* geom = asGeometry();
+ double scaleX = static_cast<double>(inputRect.width())/static_cast<double>(targetRect.width());
+ double scaleY = static_cast<double>(inputRect.height())/static_cast<double>(targetRect.height());
+ double largestScale = ossim::max(scaleX, scaleY);
+ ossimDpt saveCenter = m_centerPoint;
+
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+
+ mpp.x*=largestScale;
+ mpp.y*=largestScale;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ }
+
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt tempCenter;
+
+ double x = 1.0/largestScale;
+ double y = x;
+ ivat->scale(x,y);
+ }
+ }
+ m_centerPoint = saveCenter;
+ setViewToChains();
+
+ m_scrollView->zoomAnnotation();
+ }
+
+ ImageScrollView* ImageViewManipulator::getImageScrollView()
+ {
+ return m_scrollView;
+ }
+
+ void ImageViewManipulator::resizeEvent(QResizeEvent* /*event*/)
+ {
+
+ }
+
+ void ImageViewManipulator::scrollContentsBy( int /*dx*/, int /*dy*/ )
+ {
+ if(m_scrollView)
+ {
+ setCommonCenter();
+ }
+ }
+
+ void ImageViewManipulator::keyPressEvent(QKeyEvent* /*event*/,
+ bool& consumeEvent)
+ {
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::keyReleaseEvent ( QKeyEvent * event,
+ bool& consumeEvent )
+ {
+ switch(event->key())
+ {
+ case Qt::Key_Plus:
+ {
+ zoomIn();
+ break;
+ }
+ case Qt::Key_Minus:
+ {
+ zoomOut();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::mouseDoubleClickEvent ( QMouseEvent * /*event*/,
+ bool& consumeEvent )
+ {
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::mouseMoveEvent ( QMouseEvent * event,
+ bool& consumeEvent )
+ {
+ QPointF pt = m_scrollView->mapToScene(event->pos());
+ if(m_leftButtonPressed)
+ {
+ m_scrollView->emitTracking(ossimDpt(pt.x(), pt.y()));
+ }
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::mousePressEvent (QMouseEvent* event,
+ bool& consumeEvent)
+ {
+ m_leftButtonPressed = false;
+ if(event->buttons() & Qt::LeftButton)
+ {
+ m_leftButtonPressed = true;
+ }
+ consumeEvent = false;
+ if(m_leftButtonPressed)
+ {
+ QPointF p = m_scrollView->mapToScene(event->pos());
+ m_scrollView->emitTracking(ossimDpt(p.x(), p.y()));
+ }
+
+ }
+
+ void ImageViewManipulator::mouseReleaseEvent (QMouseEvent* event,
+ bool& consumeEvent )
+ {
+
+ QPointF pt = m_scrollView->mapToScene(event->pos());
+
+ if(m_scrollView && m_leftButtonPressed)
+ {
+ if(event->modifiers()&Qt::ShiftModifier)
+ {
+ m_centerPoint = sceneToLocal(ossimDpt(pt.x(), pt.y()));
+ m_scrollView->centerOn(pt);
+ }
+ m_leftButtonPressed = false;
+ m_scrollView->emitTracking(ossimDpt(pt.x(), pt.y()));
+
+ }
+
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::resizeEvent (QResizeEvent * /*event*/,
+ bool& consumeEvent )
+ {
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::wheelEvent (QWheelEvent * event,
+ bool& consumeEvent )
+ {
+ consumeEvent = false;
+
+ switch(event->modifiers())
+ {
+ case Qt::ShiftModifier:
+ {
+ double factor = 1.0 + fabs(event->delta()/500.0);
+
+ if(event->delta() > 0)
+ {
+ zoomIn(factor);
+ }
+ else
+ {
+ zoomOut(factor);
+ }
+ consumeEvent = true;
+ break;
+ }
+ default:
+ {
+ consumeEvent = false;
+ break;
+ }
+ }
+ QPointF p = m_scrollView->mapToScene(event->pos());
+ m_scrollView->emitTracking(ossimDpt(p.x(), p.y()));
+ }
+
+ void ImageViewManipulator::enterEvent ( QEvent * /*event*/,
+ bool& consumeEvent )
+ {
+ m_scrollView->setShowTrackCursor(false);
+ consumeEvent = false;
+ }
+
+ void ImageViewManipulator::leaveEvent ( QEvent * /*event*/,
+ bool& consumeEvent )
+ {
+ m_scrollView->setShowTrackCursor(true);
+ consumeEvent = false;
+ }
+
+ ossimImageGeometry* ImageViewManipulator::asGeometry()
+ {
+ ossimImageViewProjectionTransform* ivpt = getObjectAs<ossimImageViewProjectionTransform>();
+ if(ivpt)
+ {
+ return dynamic_cast<ossimImageGeometry*>(ivpt->getView());
+ }
+
+ return getObjectAs<ossimImageGeometry>();
+ }
+
+ void ImageViewManipulator::setViewToChains()
+ {
+ if(m_scrollView&&m_scrollView->connectableObject())
+ {
+ ossimDpt center;
+
+ ossimImageGeometry* geom = asGeometry();
+ if(geom)
+ {
+ geom->worldToLocal(ossimGpt(m_centerPoint.lat, m_centerPoint.lon), center);
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ if(!m_centerPoint.hasNans())
+ {
+ ivat->imageToView(m_centerPoint,center);
+ }
+ }
+ }
+ SetViewVisitor viewVisitor(m_obj.get());
+ viewVisitor.setViewPoint(center);
+ m_scrollView->connectableObject()->accept(viewVisitor);
+
+ // just in case if an update causes a change in center let's keep our locked
+ // center point for zooming in and out.
+ ossimDpt saveCenter = m_centerPoint;
+ viewVisitor.setView();
+ m_centerPoint = saveCenter;
+
+ m_scrollView->emitViewChanged();
+ }
+ }
+
+ void ImageViewManipulator::setCommonCenter()
+ {
+ ossimDpt center = m_scrollView->viewportBoundsInSceneSpace().midPoint();
+
+ m_centerPoint = sceneToLocal(center);
+ }
+
+ ossimDpt ImageViewManipulator::sceneToLocal(const ossimDpt& scenePoint)
+ {
+ ossimDpt result;
+ result.makeNan();
+ ossimImageGeometry* geom = asGeometry();
+ if(geom)
+ {
+ ossimGpt wpt;
+ geom->localToWorld(scenePoint, wpt);
+ result = wpt;
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ if(!scenePoint.hasNans())
+ {
+ ivat->viewToImage(scenePoint, result);
+ }
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/ossimGui/src/ossimGui/ImageWidget.cpp b/ossimGui/src/ossimGui/ImageWidget.cpp
new file mode 100644
index 0000000..c652327
--- /dev/null
+++ b/ossimGui/src/ossimGui/ImageWidget.cpp
@@ -0,0 +1,1013 @@
+#include <QtGui/QMdiArea>
+#include <QtGui/QScrollBar>
+#include <QtGui/QLayout>
+#include <QtGui/QPainter>
+#include <QtGui/QGraphicsView>
+#include <QtGui/QGraphicsScene>
+#include <QtGui/QGraphicsRectItem>
+#include <QtCore/QTime>
+#include <ossim/imaging/ossimScalarRemapper.h>
+#include <ossim/imaging/ossimCacheTileSource.h>
+#include <ossimGui/ImageWidget.h>
+#include <ossimGui/Image.h>
+#include <ossimGui/DisplayTimerJobQueue.h>
+#include <ossimGui/GatherImageViewProjTransVisitor.h>
+#include <ossimGui/RegistrationOverlay.h>
+
+ossimGui::ImageWidgetJob::ImageWidgetJob()
+{
+ m_maxProcessingTime = 20;
+}
+
+void ossimGui::ImageWidgetJob::start()
+{
+ if(m_inputSource.valid())
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_imageWidgetJobMutex);
+ QTime start = QTime::currentTime();
+ ossimDrect cacheRect(m_tileCache->getRect());
+ // ossimDpt ulCachePt = cacheRect.ul();
+ ossimIrect rect;
+ ossimDpt ul;
+ // Because the cache rect is a sub rect of the scroll we need the upper left which starts at offset 0,0 in scroll space
+ m_cacheToView.map(0.0, 0.0, &ul.x, &ul.y);
+ while(m_tileCache->nextInvalidTile(rect) && (!isCanceled()))
+ {
+ // shift to zero based rectangle and then set back for opying purposes.
+ ossimRefPtr<ossimImageData> data =m_inputSource->getTile(rect+ul);
+ data->setImageRectangle(rect);
+
+ ossimGui::Image img(data.get());
+ if(data.valid())
+ {
+ m_tileCache->addTile(ossimGui::Image(data.get(), true));
+ }
+ else
+ {
+ img = QImage(rect.width(), rect.height(), QImage::Format_RGB32);
+ img.fill(0);
+ img.setOffset(QPoint(rect.ul().x, rect.ul().y));
+
+ m_tileCache->addTile(img);
+ }
+
+ QTime end = QTime::currentTime();
+ if(start.msecsTo(end) >= m_maxProcessingTime)
+ {
+ break;
+ }
+ }
+ }
+}
+
+ossimGui::ImageScrollWidget::ImageScrollWidget(QWidget* parent)
+:QScrollArea(parent),
+m_listener(new ConnectionListener(this)),
+m_jobQueue(new DisplayTimerJobQueue())
+{
+ m_trackPoint.makeNan();
+ m_oldTrackPoint.makeNan();
+ m_trackingFlag = true;
+ m_mouseInsideFlag = false;
+
+ m_layers = new Layers();
+ //m_connector->addListener(m_listener);
+ m_widget = new ImageWidget(this, viewport());
+ //m_widget->setAttribute(Qt::WA_StaticContents);
+ m_widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
+ // setWidget(m_widget);
+ setWidgetResizable(false);
+ m_widget->show();
+ m_trackingFlag = true;
+ m_scrollOrigin = ossimDpt(0.0,0.0);
+ m_tileSize = ossimIpt(64,64);
+ //m_widget->setTileCache(new StaticTileImageCache(m_tileSize));
+ m_timerId = -1;
+ viewport()->setCursor(Qt::CrossCursor);
+ m_imageWidgetJob = new ImageWidgetJob();//this);
+ m_imageWidgetJob->setCallback(new Callback(this));
+
+ // m_multiLayerAlgorithm = HORIZONTAL_SWIPE_ALGORITHM;
+ // m_multiLayerAlgorithm = VERTICAL_SWIPE_ALGORITHM;
+ // m_multiLayerAlgorithm = BOX_SWIPE_ALGORITHM;
+ m_multiLayerAlgorithm = CIRCLE_SWIPE_ALGORITHM;
+
+
+ // Initialize drawing control
+ m_drawPts = false;
+ // m_regOverlay = new RegistrationOverlay();
+
+ ///????????????
+ // m_scene = new QGraphicsScene(0,0,500,400,this);
+ // m_view = new QGraphicsView(this);
+ // m_view->setScene(m_scene);
+ // m_view->setStyleSheet("background: transparent");
+
+ // QGraphicsRectItem* rect = m_scene->addRect(50,40,100,200);
+ // rect->setFlags(QGraphicsItem::ItemIsMovable);
+ // rect->setBrush(QBrush(Qt::blue));
+ // rect->setOpacity(0.3);
+
+ // QGraphicsItem* item = m_scene->addText("QGraphicsTextItem");
+ // item->setFlags(QGraphicsItem::ItemIsMovable);
+
+ // m_view->show();
+
+}
+
+ossimGui::ImageScrollWidget::~ImageScrollWidget()
+{
+ m_imageWidgetJob->cancel();
+
+ if(m_connectableObject.get()&&m_listener)
+ {
+ if(m_listener)
+ {
+ m_connectableObject->removeListener(m_listener);
+ }
+ m_connectableObject->disconnect();
+ }
+ if(m_listener)
+ {
+ delete m_listener;
+ m_listener = 0;
+ }
+ m_connectableObject = 0;
+ m_layers = 0;
+}
+
+ossimGui::ConnectableImageObject* ossimGui::ImageScrollWidget::connectableObject()
+{
+ return m_connectableObject.get();
+}
+
+void ossimGui::ImageScrollWidget::setConnectableObject(ConnectableImageObject* c)
+{
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->removeListener(m_listener);
+ }
+ m_connectableObject = c;
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->addListener(m_listener);
+ }
+ if(m_connectableObject.valid()) inputConnected();
+}
+
+
+void ossimGui::ImageScrollWidget::inputConnected(ossim_int32 /* idx */)
+{
+
+ m_layers->adjustLayers(m_connectableObject.get());
+
+ // m_scalarRemapperChain->connectMyInputTo(0, m_connectableObject->getInput());
+
+ m_inputBounds = m_connectableObject->getBounds();
+
+// setCacheRect();
+ if(!m_inputBounds.hasNans())
+ {
+ updateScrollBars();
+ }
+
+ updateTransforms();
+ setCacheRect();
+
+ // QPoint localPt(50,50);
+ // QPoint viewPoint = m_localToView.map(localPt);
+
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready();
+ m_jobQueue->add(m_imageWidgetJob.get());
+ }
+}
+
+void ossimGui::ImageScrollWidget::inputDisconnected(ossim_int32 /* idx */)
+{
+ m_layers->adjustLayers(m_connectableObject.get());
+
+ m_inputBounds = m_connectableObject->getBounds();
+
+
+// setCacheRect();
+ if(!m_inputBounds.hasNans())
+ {
+ updateScrollBars();
+ }
+
+ updateTransforms();
+ setCacheRect();
+
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready();
+ m_jobQueue->add(m_imageWidgetJob.get());
+ }
+}
+
+ossimDrect ossimGui::ImageScrollWidget::viewportBoundsInViewSpace()const
+{
+ QSize size = viewport()->size();
+ QRectF out = m_localToView.mapRect(QRectF(0,0,size.width(), size.height()));
+ return ossimDrect(out.x(), out.y(),out.x()+(out.width()-1), out.y() + (out.height()-1));
+}
+
+void ossimGui::ImageScrollWidget::setJobQueue(ossimJobQueue* jobQueue)
+{
+ m_jobQueue = jobQueue;
+}
+
+void ossimGui::ImageScrollWidget::refreshDisplay()
+{
+ m_layers->flushDisplayCaches();
+ m_inputBounds = m_connectableObject->getBounds();
+
+
+// setCacheRect();
+ if(!m_inputBounds.hasNans())
+ {
+ updateScrollBars();
+ }
+
+ updateTransforms();
+ setCacheRect();
+
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready();
+
+ m_jobQueue->add(m_imageWidgetJob.get());
+ }
+}
+
+void ossimGui::ImageScrollWidget::updateTransforms()
+{
+ if(!m_inputBounds.hasNans())
+ {
+ m_viewToScroll = QTransform(1.0, 0.0, 0.0, 1.0, -m_inputBounds.ul().x, -m_inputBounds.ul().y);
+ m_scrollToView = m_viewToScroll.inverted();
+ m_scrollToLocal = QTransform(1.0,0.0,0.0,1.0, - m_scrollOrigin.x, -m_scrollOrigin.y);
+ m_localToScroll = m_scrollToLocal.inverted();
+
+ m_viewToLocal = m_scrollToLocal*m_viewToScroll;
+ m_localToView = m_viewToLocal.inverted();
+ }
+ else
+ {
+ m_viewToScroll = m_scrollToView = m_scrollToLocal = m_localToScroll = m_viewToLocal = m_localToView =QTransform();
+ }
+
+ //m_imageWidgetJob->setCacheToViewTransform(scrollToView());
+ //m_imageWidgetJob->setViewToCacheTransform(viewToScroll());
+
+}
+
+void ossimGui::ImageScrollWidget::resizeEvent(QResizeEvent* event)
+{
+ QAbstractScrollArea::resizeEvent(event);
+ m_widget->resize(size());
+ updateScrollBars();
+
+ m_scrollOrigin.x = horizontalScrollBar()->value();
+ m_scrollOrigin.y = verticalScrollBar()->value();
+
+
+ updateTransforms();
+
+ setCacheRect();
+ if(m_layers->findFirstDirtyLayer())
+ {
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready();
+ m_jobQueue->add(m_imageWidgetJob.get());
+ }
+ }
+
+ // This would be useful only for HUD??
+ //m_regOverlay->resize(event->size());
+ // event->accept(); //???
+}
+
+void ossimGui::ImageScrollWidget::scrollContentsBy( int dx, int dy )
+{
+ QScrollArea::scrollContentsBy( dx,dy );
+ m_scrollOrigin.x = horizontalScrollBar()->value();
+ m_scrollOrigin.y = verticalScrollBar()->value();
+
+ updateTransforms();
+
+ setCacheRect();
+ m_widget->update();
+ if(m_layers->findFirstDirtyLayer())
+ {
+ if(m_jobQueue.valid())
+ {
+ if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready();
+ m_jobQueue->add(m_imageWidgetJob.get());
+ }
+ }
+}
+void ossimGui::ImageScrollWidget::setCacheRect()
+{
+ /*
+ ossimIpt ul(m_scrollOrigin);
+ ossimIpt lr(m_scrollOrigin.x + size().width()-1,
+ m_scrollOrigin.y + size().height()-1);
+ ossimIrect rect(ul.x, ul.y, lr.x, lr.y);
+ m_layers->setCacheRect(rect);
+ */
+
+ QRectF rect = m_localToScroll.mapRect(QRectF(0,0,size().width(), size().height()));
+ m_layers->setCacheRect(ossimDrect(rect.x(), rect.y(),
+ rect.x() + rect.width()-1,
+ rect.y() + rect.height()-1));
+}
+
+void ossimGui::ImageScrollWidget::updateScrollBars()
+{
+ if(!m_inputBounds.hasNans())
+ {
+ if(m_inputBounds.width() > viewport()->size().width())
+ {
+ horizontalScrollBar()->setRange(0,m_inputBounds.width()-viewport()->size().width());
+ horizontalScrollBar()->show();
+ }
+ else
+ {
+ horizontalScrollBar()->setRange(0,0);//,viewport()->size().width());
+ horizontalScrollBar()->setVisible(false);
+ horizontalScrollBar()->setValue(0);
+ }
+ if(m_inputBounds.height() > viewport()->size().height())
+ {
+ verticalScrollBar()->setRange(0,m_inputBounds.height()-viewport()->size().height());
+ verticalScrollBar()->show();
+ }
+ else
+ {
+ verticalScrollBar()->setRange(0,0);//viewport()->size().height());
+ verticalScrollBar()->setVisible(false);
+ verticalScrollBar()->setValue(0);
+ }
+ m_scrollOrigin = ossimIpt(horizontalScrollBar()->value(), verticalScrollBar()->value());
+ }
+}
+
+void ossimGui::ImageScrollWidget::setPositionGivenView(const ossimDpt& position)
+{
+ QSize size = viewport()->size();
+ ossimDpt adjusted = (position - m_inputBounds.ul()) - ossimDpt(size.width()*.5, size.height()*.5);
+ setPositionGivenLocal(adjusted);
+}
+
+void ossimGui::ImageScrollWidget::setPositionGivenLocal(const ossimDpt& position)
+{
+ QSize size = viewport()->size();
+ ossimIpt scrollPosition(position);
+
+ if(scrollPosition.x < 0) scrollPosition.x = 0;
+ if(scrollPosition.y < 0) scrollPosition.y = 0;
+
+ if(size.width() > m_inputBounds.width()) scrollPosition.x = 0;
+ if(size.height() > m_inputBounds.height()) scrollPosition.y = 0;
+
+ if(scrollPosition.x > m_inputBounds.width()) scrollPosition.x = m_inputBounds.width()-1;
+ if(scrollPosition.y > m_inputBounds.height()) scrollPosition.y = m_inputBounds.height()-1;
+
+ if(horizontalScrollBar()->value() != scrollPosition.x)
+ {
+ horizontalScrollBar()->setValue(scrollPosition.x);
+ }
+ if(verticalScrollBar()->value() != scrollPosition.y)
+ {
+ verticalScrollBar()->setValue(scrollPosition.y);
+ }
+}
+
+void ossimGui::ImageScrollWidget::mouseDoubleClickEvent ( QMouseEvent * e )
+{
+ QScrollArea::mouseDoubleClickEvent(e);
+
+
+ if(!m_inputBounds.hasNans())
+ {
+ ossimIpt origin = m_inputBounds.ul();
+ ossimIpt localPoint(m_scrollOrigin.x +e->x(), m_scrollOrigin.y+e->y());
+ ossimIpt viewPoint(localPoint.x+origin.x,
+ localPoint.y+origin.y);
+
+ ossimDrect rect = viewportBoundsInViewSpace();
+
+ emit mouseDoubleClick(e, rect, viewPoint);//viewportPoint, localPoint, viewPoint);
+ }
+
+}
+
+void ossimGui::ImageScrollWidget::mouseMoveEvent ( QMouseEvent * e )
+{
+ QScrollArea::mouseMoveEvent(e);
+
+ if(e->buttons() & Qt::LeftButton)
+ {
+ m_activePointEnd = e->pos();
+ if(m_layers->numberOfLayers() > 1)
+ {
+ m_widget->update();
+ }
+ }
+ if(!m_inputBounds.hasNans())
+ {
+ ossimIpt origin = m_inputBounds.ul();
+ ossimIpt localPoint(m_scrollOrigin.x +e->x(), m_scrollOrigin.y+e->y());
+ ossimIpt viewPoint(localPoint.x+origin.x,
+ localPoint.y+origin.y);
+
+ ossimDrect rect = viewportBoundsInViewSpace();
+
+ emit mouseMove(e, rect, viewPoint);//viewportPoint, localPoint, viewPoint);
+ }
+}
+
+void ossimGui::ImageScrollWidget::mousePressEvent ( QMouseEvent * e )
+{
+ QScrollArea::mousePressEvent(e);
+
+ m_activePointStart = e->pos();
+ m_activePointEnd = e->pos();
+ if(!m_inputBounds.hasNans())
+ {
+ ossimIpt origin = m_inputBounds.ul();
+ ossimIpt localPoint(m_scrollOrigin.x +e->x(), m_scrollOrigin.y+e->y());
+ ossimIpt viewPoint(localPoint.x+origin.x,
+ localPoint.y+origin.y);
+
+ ossimDrect rect = viewportBoundsInViewSpace();
+
+ // Save the measured point position
+ // (viewPoint = view<-scroll<-local)
+ ossim_uint32 idxLayer = 0;
+ ossimImageSource* src = m_layers->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ // Transform to true image coordinates and save
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ivtg->viewToImage(viewPoint, m_measImgPoint);
+ }
+ }
+
+ m_measPoint = viewPoint;
+ m_drawPts = true;
+ update();
+
+ // m_regOverlay->setMeasPoint(m_measPoint);
+
+// cout << "\n ImageScrollWidget::mousePressEvent ("
+// << viewPoint.x << ", "<< viewPoint.y << ") ("
+// << m_measImgPoint.x << ", "<< m_measImgPoint.y << ")"
+// << endl;
+
+ emit mousePress(e, rect, viewPoint);//viewportPoint, localPoint, viewPoint);
+ }
+}
+
+void ossimGui::ImageScrollWidget::mouseReleaseEvent ( QMouseEvent * e )
+{
+ QScrollArea::mouseReleaseEvent(e);
+
+ m_activePointEnd = e->pos();
+
+ if(!m_inputBounds.hasNans())
+ {
+ ossimIpt origin = m_inputBounds.ul();
+ ossimIpt localPoint(m_scrollOrigin.x +e->x(), m_scrollOrigin.y+e->y());
+ ossimIpt viewPoint(localPoint.x+origin.x,
+ localPoint.y+origin.y);
+
+ ossimDrect rect = viewportBoundsInViewSpace();
+
+
+ emit mouseRelease(e, rect, viewPoint);//viewportPoint, localPoint, viewPoint);
+ }
+}
+
+void ossimGui::ImageScrollWidget::wheelEvent ( QWheelEvent * e )
+{
+ //QScrollArea::wheelEvent(e);
+ if(!m_inputBounds.hasNans())
+ {
+ ossimIpt origin = m_inputBounds.ul();
+ ossimIpt localPoint(m_scrollOrigin.x +e->x(), m_scrollOrigin.y+e->y());
+ ossimIpt viewPoint(localPoint.x+origin.x,
+ localPoint.y+origin.y);
+
+ ossimDrect rect = viewportBoundsInViewSpace();
+
+
+ emit wheel(e, rect, viewPoint);//viewportPoint, localPoint, viewPoint);
+ }
+}
+void ossimGui::ImageScrollWidget::enterEvent ( QEvent * )
+{
+ m_mouseInsideFlag = true;
+ m_widget->update();
+}
+
+void ossimGui::ImageScrollWidget::leaveEvent ( QEvent * )
+{
+ m_mouseInsideFlag = false;
+ m_widget->update();
+}
+
+ossimImageGeometry* ossimGui::ImageScrollWidget::getGeometry()
+{
+ ossimImageSource* is = dynamic_cast<ossimImageSource*>(m_connectableObject->getInput());
+ if(is)
+ {
+ return is->getImageGeometry().get();
+ }
+ return 0;
+}
+
+void ossimGui::ImageScrollWidget::setTrackPoint(const ossimDpt& position)
+{
+ if(position.hasNans())
+ {
+ m_trackPoint.makeNan();
+ }
+ else
+ {
+ ossimDpt pt;
+ m_viewToScroll.map(position.x, position.y, &pt.x, &pt.y);
+ m_scrollToLocal.map(pt.x, pt.y, &m_trackPoint.x, &m_trackPoint.y);
+ m_widget->update();
+ }
+}
+
+ossimGui::ImageScrollWidget::Layer::Layer(ossimConnectableObject* obj)
+{
+ m_inputObject = obj;
+ m_tileCache = new StaticTileImageCache();
+ m_scalarRemapperChain = new ossimImageChain();
+ m_scalarRemapperChain->addFirst(new ossimScalarRemapper());
+ m_scalarRemapperChain->addFirst(new ossimCacheTileSource());
+ if(obj) m_scalarRemapperChain->connectMyInputTo(0, obj);
+}
+
+ossimGui::ImageScrollWidget::Layer::~Layer()
+{
+ clear();
+}
+
+ossimGui::ImageScrollWidget::Layers::Layers()
+{
+}
+
+ossimGui::ImageScrollWidget::Layers::~Layers()
+{
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ m_layers[idx]->clear();
+ m_layers[idx] = 0;
+ }
+ m_layers.clear();
+}
+
+ossimGui::ImageScrollWidget::Layer* ossimGui::ImageScrollWidget::Layers::layer(ossim_uint32 idx)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return layerNoMutex(idx);
+}
+
+ossimGui::ImageScrollWidget::Layer* ossimGui::ImageScrollWidget::Layers::layer(ossimConnectableObject* input)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return layerNoMutex(input);
+}
+
+void ossimGui::ImageScrollWidget::Layers::setCacheRect(const ossimDrect& rect)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ m_layers[idx]->tileCache()->setRect(rect);
+ }
+}
+
+ossimGui::ImageScrollWidget::Layer* ossimGui::ImageScrollWidget::Layers::layerNoMutex(ossim_uint32 idx)
+{
+ Layer* result = 0;
+ if(idx < m_layers.size())
+ {
+ return m_layers[idx].get();
+ }
+
+ return result;
+}
+
+
+ossimGui::ImageScrollWidget::Layer* ossimGui::ImageScrollWidget::Layers::layerNoMutex(ossimConnectableObject* input)
+{
+ Layer* result = 0;
+ LayerListType::iterator iter = std::find_if(m_layers.begin(), m_layers.end(), FindConnectable(input));
+ if(iter != m_layers.end())
+ {
+ result = (*iter).get();
+ }
+
+ return result;
+}
+
+ossimGui::ImageScrollWidget::Layer* ossimGui::ImageScrollWidget::Layers::findFirstDirtyLayer()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size();++idx)
+ {
+ if(m_layers[idx]->tileCache()->hasInvalidTiles())
+ {
+ return m_layers[idx].get();
+ }
+ }
+
+ return 0;
+
+}
+
+bool ossimGui::ImageScrollWidget::Layers::isEmpty()const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return m_layers.empty();
+}
+
+void ossimGui::ImageScrollWidget::Layers::adjustLayers(ossimConnectableObject* connectable)
+{
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ LayerListType layers;
+ ossim_uint32 nInputs = connectable->getNumberOfInputs();
+ for(ossim_uint32 inputIdx = 0; inputIdx<nInputs;++inputIdx)
+ {
+ ossimRefPtr<ossimConnectableObject> inputObj = connectable->getInput(inputIdx);
+ ossimRefPtr<Layer> tempLayer = layerNoMutex(inputObj.get());
+ if(tempLayer.valid())
+ {
+ layers.push_back(tempLayer.get());
+ }
+ else // allocate a new display layer
+ {
+ tempLayer = new Layer(inputObj.get());
+ layers.push_back(tempLayer.get());
+ }
+ }
+ // Now any old layers that were removed lets fully remove
+ //
+ LayerListType::iterator iter = m_layers.begin();
+ while(iter!=m_layers.end())
+ {
+ if(std::find(layers.begin(), layers.end(), (*iter).get())==layers.end())
+ {
+ (*iter)->clear();
+ }
+ ++iter;
+ }
+
+ m_layers = layers;
+ // ossim_uint32 idx = 0;
+ }
+}
+
+void ossimGui::ImageScrollWidget::Layers::flushDisplayCaches()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_layers.size(); ++idx)
+ {
+ if(m_layers[idx]->tileCache()) m_layers[idx]->tileCache()->flush();
+ }
+}
+
+
+void ossimGui::ImageScrollWidget::paintWidget(QPainter& painter)
+{
+ if((m_layers->numberOfLayers() > 1)&&(m_multiLayerAlgorithm!=NO_ALGORITHM))
+ {
+ paintMultiLayer(painter);
+ }
+ else
+ {
+ ossimRefPtr<Layer> topLayer = m_layers->layer((ossim_uint32)0);
+ if(topLayer.valid())
+ {
+ ossimRefPtr<StaticTileImageCache> topTileCache = topLayer->tileCache();
+ if(topTileCache.valid())
+ {
+ ossimIrect rect = topTileCache->getRect();
+ QRectF rectF = m_scrollToLocal.mapRect(QRectF(rect.ul().x, rect.ul().y, rect.width(), rect.height()));
+
+ ossimIpt topOriginOffset = ossimDpt(rectF.x(), rectF.y());
+ painter.drawImage(topOriginOffset.x, topOriginOffset.y, topTileCache->getCache());
+ }
+ }
+ }
+ if(!m_trackPoint.hasNans()&&m_trackingFlag&&!m_mouseInsideFlag)
+ {
+ drawCursor(painter);
+ }
+
+
+ // Temporary marker control
+ // if (m_drawPts == true)
+ // {
+ // m_regOverlay->drawMeas(painter, m_viewToLocal);
+ // }
+ // m_regOverlay->drawProj(painter, m_viewToLocal);
+
+}
+
+void ossimGui::ImageScrollWidget::paintMultiLayer(QPainter& painter)
+{
+ if(m_multiLayerAlgorithm != ANIMATION_ALGORITHM)
+ {
+ ossimRefPtr<Layer> topLayer = m_layers->layer((ossim_uint32)0);
+ ossimRefPtr<Layer> bottomLayer = m_layers->layer((ossim_uint32)1);
+ if(topLayer.valid()&&bottomLayer.valid())
+ {
+ ossimRefPtr<StaticTileImageCache> topTileCache = topLayer->tileCache();
+ ossimRefPtr<StaticTileImageCache> bottomTileCache = bottomLayer->tileCache();
+
+ if(topTileCache.valid()&&bottomTileCache.valid())
+ {
+ ossimIrect rect = topTileCache->getRect();
+ QRectF rectF = m_scrollToLocal.mapRect(QRectF(rect.ul().x, rect.ul().y, rect.width(), rect.height()));
+ ossimIpt topOriginOffset = ossimDpt(rectF.x(), rectF.y());
+ // for scrolling we need to offset from the tile location to the actual rect indicated by the viewport.
+ //
+ ossim_uint32 w = rect.width();
+ ossim_uint32 h = rect.height();
+ switch(m_multiLayerAlgorithm)
+ {
+ case HORIZONTAL_SWIPE_ALGORITHM:
+ {
+ ossim_int64 topLayerx = topOriginOffset.x;
+ ossim_int64 bottomLayerx = m_activePointEnd.x();
+ ossim_int64 topLayerWidth = bottomLayerx - topLayerx;
+ painter.drawImage(topLayerx, topOriginOffset.y, topTileCache->getCache(), 0,0,topLayerWidth,h);
+ painter.drawImage(topLayerx+topLayerWidth, topOriginOffset.y, bottomTileCache->getCache(), topLayerWidth, 0);
+ break;
+ }
+ case VERTICAL_SWIPE_ALGORITHM:
+ {
+ ossim_int64 topLayery = topOriginOffset.y;
+ ossim_int64 bottomLayery = m_activePointEnd.y();
+ ossim_int64 topLayerHeight = bottomLayery - topLayery;
+ painter.drawImage(topOriginOffset.x, topLayery, topTileCache->getCache(), 0, 0, w, topLayerHeight);
+ painter.drawImage(topOriginOffset.x, topLayery+topLayerHeight, bottomTileCache->getCache(), 0, topLayerHeight);
+ break;
+ }
+ case BOX_SWIPE_ALGORITHM:
+ {
+ painter.drawImage(topOriginOffset.x, topOriginOffset.y, topTileCache->getCache());
+ ossim_int64 minx = ossim::min(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_int64 maxx = ossim::max(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_int64 miny = ossim::min(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_int64 maxy = ossim::max(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_int64 w = maxx-minx;
+ ossim_int64 h = maxy-miny;
+ ossim_int64 x = minx;
+ ossim_int64 y = miny;
+ QPointF scrollPoint = m_localToScroll.map(QPointF(x,y));
+ ossimDrect cacheRect = bottomTileCache->getRect();
+ ossimDpt delta = ossimDpt(scrollPoint.x(), scrollPoint.y()) - cacheRect.ul();
+
+ painter.drawImage(x, y, bottomTileCache->getCache(), delta.x, delta.y, w, h);
+ break;
+ }
+ case CIRCLE_SWIPE_ALGORITHM:
+ {
+ // QImage& cahceImage = topTileCache->getCache();
+ // draw top and then overlay the bottom
+ ossim_int64 minx = ossim::min(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_int64 maxx = ossim::max(m_activePointStart.x(), m_activePointEnd.x());
+ ossim_int64 miny = ossim::min(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_int64 maxy = ossim::max(m_activePointStart.y(), m_activePointEnd.y());
+ ossim_int64 w = maxx-minx;
+ ossim_int64 h = maxy-miny;
+ ossim_int64 x = minx;
+ ossim_int64 y = miny;
+
+ // QPointF scrollPoint = m_localToScroll.map(QPointF(x,y));
+ // ossimDpt cachePt = ossimDpt(scrollPoint.x(), scrollPoint.y()) - topTileCache->getRect().ul();
+ painter.save();
+ painter.drawImage(topOriginOffset.x, topOriginOffset.y, topTileCache->getCache());
+ painter.setBrush(QBrush(bottomTileCache->getCache()));
+ painter.setPen(Qt::NoPen);
+
+ // this part is a little tricky but for the texturing to be placed in the ellipse properly
+ // I had to add a translation for the painter because the cache might extend past the current scroll region because it
+ // is on tile boundaries
+ //
+ // Because we shift for texturing with the QBrush we must undo the shift when drawing the ellipse so it lines up with
+ // the mouse draws. The topOriginOffset holds the shift.
+ //
+ painter.translate(topOriginOffset.x, topOriginOffset.y);
+ painter.drawEllipse(x-topOriginOffset.x,y-topOriginOffset.y,w,h);
+ painter.restore();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ }
+
+}
+
+void ossimGui::ImageScrollWidget::drawCursor(QPainter& painter)
+{
+ if(!m_trackPoint.hasNans())
+ {
+ ossimIpt roundedPoint(m_trackPoint);
+ bool hasClipping = painter.hasClipping();
+ painter.setClipping(false);
+ painter.setPen(QColor(255, 255, 255));
+
+ ossimIrect rect(0,0,size().width()-1, size().height()-1);
+ // ossimIpt ul = rect.ul();
+ // ossimIpt lr = rect.lr();
+ int left = rect.ul().x;
+ int right = rect.lr().x;
+ int top = rect.ul().y;
+ int bottom = rect.lr().y;
+ if(rect.pointWithin(roundedPoint))
+ {
+ // draw horizontal
+ //
+ int x1 = left;
+ int x2 = right;
+ int y1 = roundedPoint.y;
+ int y2 = y1;
+ painter.drawLine(x1, y1, x2, y2);
+
+ // draw vertical
+ x1 = roundedPoint.x;
+ x2 = x1;
+ y1 = top;
+ y2 = bottom;
+ painter.drawLine(x1, y1, x2, y2);
+ }
+ painter.setClipping(hasClipping);
+ }
+ m_oldTrackPoint = m_trackPoint;
+}
+
+
+void ossimGui::ImageScrollWidget::updateAnnotation()
+{
+ ossim_uint32 idxLayer = 0;
+ ossimImageSource* src = m_layers->layer(idxLayer)->chain();
+ ossimGui::GatherImageViewProjTransVisitor visitor;
+ src->accept(visitor);
+ if (visitor.getTransformList().size() == 1)
+ {
+ ossimRefPtr<IvtGeomTransform> ivtg = visitor.getTransformList()[0].get();
+ if (ivtg.valid())
+ {
+ ivtg->imageToView(m_measImgPoint, m_measPoint);
+ ivtg->imageToView(m_markImgPoint, m_markPoint);
+
+ // m_regOverlay->setMeasPoint(m_measPoint);
+ // m_regOverlay->setProjPoint(m_markPoint);
+ }
+ }
+ update();
+}
+
+void ossimGui::ImageScrollWidget::setMarkPointPosition(const ossimDpt& setViewPoint, const ossimDpt& setImagePoint)
+{
+ m_markPoint = setViewPoint;
+ m_markImgPoint = setImagePoint;
+ // m_regOverlay->setProjPoint(m_markPoint);
+}
+
+void ossimGui::ImageScrollWidget::storeCurrentPosition(const ossimString& /* id */)
+{
+ // m_regOverlay->addPoint(id, m_measImgPoint);
+}
+
+bool ossimGui::ImageScrollWidget::getPoint(const ossimString& /* id */, ossimDpt& imgPt)
+{
+ // bool foundPt = m_regOverlay->getPoint(id, imgPt);
+
+ // return foundPt;
+ return true;
+}
+
+ossimGui::ImageScrollWidget::ImageWidget::ImageWidget(ImageScrollWidget* scrollWidget, QWidget* parent)
+:QFrame(parent), m_scrollWidget(scrollWidget)
+{
+ // m_scene = new QGraphicsScene(0,0,500,400,this);
+ // m_view = new QGraphicsView(this);
+ // m_view->setScene(m_scene);
+ // m_view->setStyleSheet("background: transparent");
+
+ // QGraphicsRectItem* rect = m_scene->addRect(50,40,100,200);
+ // rect->setFlags(QGraphicsItem::ItemIsMovable);
+ // rect->setBrush(QBrush(Qt::blue));
+ // rect->setOpacity(0.3);
+
+ // QGraphicsItem* item = m_scene->addText("QGraphicsTextItem");
+ // item->setFlags(QGraphicsItem::ItemIsMovable);
+
+ // m_view->show();
+}
+
+
+void ossimGui::ImageScrollWidget::ImageWidget::paintEvent(QPaintEvent* /* event */ )
+{
+ QPainter painter(this);
+ m_scrollWidget->paintWidget(painter);
+
+#if 0
+ // for scrolling we need to offset from the tile location to the actual rect indicated by the viewport.
+ //
+ ossimIpt originOffset = m_tileCache->getRect().ul() - m_tileCache->getActualRect().ul();
+ painter.drawImage(originOffset.x, originOffset.y, m_tileCache->getCache());
+
+
+ //eraseCursor(painter);
+ if(!m_trackPoint.hasNans()&&m_trackingFlag&&!m_mouseInsideFlag)
+ {
+ drawCursor(painter);
+ }
+#endif
+}
+
+#if 0
+
+void ossimGui::ImageWidget::eraseCursor(QPainter& painter)
+{
+ if(!m_oldTrackPoint.hasNans())
+ {
+ ossimIpt originOffset = m_tileCache->getActualRect().ul();
+ ossimIpt roundedPoint(m_oldTrackPoint);
+ QImage& cacheImage = m_tileCache->getCache();
+ ossimIrect rect(0,0,size().width()-1, size().height()-1);
+ if(rect.pointWithin(roundedPoint))
+ {
+ // erase horizontal line
+ painter.drawImage(0,
+ roundedPoint.y,
+ cacheImage,
+ originOffset.x+rect.ul().x,
+ originOffset.y+roundedPoint.y,
+ (int)rect.width(),
+ (int)1);
+
+ // erase vertical line
+
+ painter.drawImage(roundedPoint.x,
+ 0,
+ cacheImage,
+ originOffset.x + roundedPoint.x,
+ originOffset.y + rect.ul().y ,
+ (int)1,
+ (int)rect.height());
+ }
+ m_oldTrackPoint.makeNan();
+ }
+}
+
+
+
+void ossimGui::ImageWidget::setTrackPoint(const ossimDpt& position)
+{
+ m_trackPoint = position;
+}
+
+
+//void ossimGui::ImageWidget::setTrackingFlag(bool flag)
+//{
+// m_trackingFlag = flag;
+//}
+
+void ossimGui::ImageWidget::setMouseInsideFlag(bool flag)
+{
+ m_mouseInsideFlag = flag;
+}
+
+#endif
diff --git a/ossimGui/src/ossimGui/ImageWriterJob.cpp b/ossimGui/src/ossimGui/ImageWriterJob.cpp
new file mode 100644
index 0000000..f3cf45f
--- /dev/null
+++ b/ossimGui/src/ossimGui/ImageWriterJob.cpp
@@ -0,0 +1,31 @@
+#include <ossimGui/ImageWriterJob.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/base/ossimVisitor.h>
+
+namespace ossimGui
+{
+ void ImageWriterJob::start()
+ {
+ if(isCanceled()) return;
+
+ m_processInterfaceMutex.lock();
+ m_containerObj = ossimObjectFactoryRegistry::instance()->createObject(m_kwl);
+ if(m_containerObj.valid())
+ {
+ ossimTypeNameVisitor typeVisitor("ossimImageFileWriter");
+ m_containerObj->accept(typeVisitor);
+ m_obj = typeVisitor.getObject();
+ m_processInterface = 0;
+ m_processInterfaceMutex.unlock();
+ typeVisitor.reset();
+ if(m_obj.valid())
+ {
+ ProcessInterfaceJob::start();
+ }
+ }
+ else
+ {
+ m_processInterfaceMutex.unlock();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/IvtGeomTransform.cpp b/ossimGui/src/ossimGui/IvtGeomTransform.cpp
new file mode 100644
index 0000000..7da3cba
--- /dev/null
+++ b/ossimGui/src/ossimGui/IvtGeomTransform.cpp
@@ -0,0 +1,60 @@
+#include <ossimGui/IvtGeomTransform.h>
+
+
+void ossimGui::IvtGeomTransform::viewToImage(const ossimDpt& viewPt, ossimDpt& ipt)
+{
+ ipt.makeNan();
+ if(m_ivt.valid())
+ {
+ m_ivt->viewToImage(viewPt, ipt);
+ }
+}
+
+void ossimGui::IvtGeomTransform::imageToView(const ossimDpt& ipt, ossimDpt& viewPt)
+{
+ viewPt.makeNan();
+ if(m_ivt.valid())
+ {
+ m_ivt->imageToView(ipt, viewPt);
+ }
+}
+void ossimGui::IvtGeomTransform::imageToGround(const ossimDpt& ipt, ossimGpt& gpt)
+{
+ gpt.makeNan();
+ if(m_geom.valid())
+ {
+ m_geom->localToWorld(ipt, gpt);
+ }
+}
+void ossimGui::IvtGeomTransform::groundToImage(const ossimGpt& gpt, ossimDpt& ipt)
+{
+ ipt.makeNan();
+ if(m_geom.valid())
+ {
+ m_geom->worldToLocal(gpt, ipt);
+ }
+}
+
+void ossimGui::IvtGeomTransform::viewToGround(const ossimDpt& viewPt, ossimGpt& gpt)
+{
+ ossimDpt ipt;
+ gpt.makeNan();
+ viewToImage(viewPt, ipt);
+ if(!ipt.hasNans())
+ {
+ imageToGround(ipt, gpt);
+ }
+}
+
+void ossimGui::IvtGeomTransform::groundToView(const ossimGpt& gpt, ossimDpt& viewPt)
+{
+ ossimDpt ipt;
+ viewPt.makeNan();
+
+ groundToImage(gpt, ipt);
+ if(!ipt.hasNans())
+ {
+ imageToView(ipt, viewPt);
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/MainWindow.cpp b/ossimGui/src/ossimGui/MainWindow.cpp
new file mode 100644
index 0000000..4f20913
--- /dev/null
+++ b/ossimGui/src/ossimGui/MainWindow.cpp
@@ -0,0 +1,519 @@
+#include <ossimGui/MainWindow.h>
+#include <ossimGui/ImageWidget.h>
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/DataManager.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossimGui/Event.h>
+#include <ossimGui/About.h>
+#include <QtGui/QMdiArea>
+#include <QtGui/QMdiSubWindow>
+#include <QtGui/QFileDialog>
+#include <QtGui/QToolBar>
+#include <QtGui/QInputDialog>
+#include <QtGui/QMessageBox>
+#include <QtCore/QMimeData>
+#include <QtCore/QUrl>
+
+#include <ossim/ossimVersion.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
+#include <ossim/imaging/ossimImageSource.h>
+#include <ossimGui/Common.h>
+#include <ossimGui/OpenImageUrlJob.h>
+
+class ossimImageOpenJobCallback : public ossimJobCallback
+{
+public:
+ virtual void finished(ossimJob* job)
+ {
+ ossimGui::ImageOpenEvent* imageOpenEvent = new ossimGui::ImageOpenEvent();
+ ossimGui::OpenImageUrlJob* imageOpenJob = dynamic_cast<ossimGui::OpenImageUrlJob*> (job);
+ if(imageOpenJob)
+ {
+ ossimGui::HandlerList& handlerList =imageOpenJob->handlerList();
+ ossim_uint32 idx = 0;
+ ossim_uint32 nImages = handlerList.size();
+ for(idx = 0; idx < nImages; ++idx)
+ {
+ imageOpenEvent->handlerList().push_back(handlerList[idx]);
+ }
+ }
+ if(!imageOpenEvent->handlerList().empty())
+ {
+ QCoreApplication::postEvent(m_object, imageOpenEvent);
+ }
+ else
+ {
+ delete imageOpenEvent;
+ imageOpenEvent=0;
+ }
+ }
+
+ QObject* m_object;
+};
+
+ossimGui::MainWindow::MainWindow(QWidget* parent)
+:QMainWindow(parent)
+{
+ setupUi(this);
+ setWindowTitle("OSSIM Main Window");
+ createAndSetMenuBar();
+ statusBar()->showMessage(tr("Ready"));
+ QToolBar* toolbar = addToolBar("Main Tool Bar");
+ toolbar->setObjectName("mainToolbar");
+ setAcceptDrops(true);
+ m_stagerQueue = new ossimJobMultiThreadQueue(new ossimJobQueue(), 4);
+ m_displayQueue = new DisplayTimerJobQueue();
+ m_dataManagerWidget->setDisplayQueue(m_displayQueue.get());
+ m_dataManager = m_dataManagerWidget->dataManager();
+ m_dataManager->setMdiArea(m_mdiArea);
+ m_dataManagerWidget->setJobQueue(m_stagerQueue->getJobQueue());
+ // createModeSelector(toolbar);
+}
+
+bool ossimGui::MainWindow::event ( QEvent * e )
+{
+ if ( e )
+ {
+ ossimGui::EventId id = (ossimGui::EventId)(e->type());
+ switch(id)
+ {
+ case IMAGE_OPEN_EVENT_ID:
+ {
+ ImageOpenEvent* ioEvent = dynamic_cast<ImageOpenEvent*> (e);
+ if(ioEvent)
+ {
+ ossim_uint32 idx = 0;
+ ossim_uint32 nImages = ioEvent->handlerList().size();
+ for(idx = 0; idx<nImages;++idx)
+ {
+ ossimRefPtr<ossimGui::DataManager::Node> result = m_dataManager->addSource(ioEvent->handlerList()[idx].get());
+ if(result.valid())
+ {
+ result = m_dataManager->createDefaultImageChain(result.get());
+ }
+ showNode(result.get());
+ }
+ }
+ e->accept();
+ break;
+ }
+ case DATA_MANAGER_EVENT_ID:
+ {
+ DataManagerEvent* dmEvent = dynamic_cast<DataManagerEvent*> (e);
+ if(dmEvent)
+ {
+ switch(dmEvent->command())
+ {
+ case DataManagerEvent::COMMAND_DISPLAY_NODE:
+ {
+ DataManager::NodeListType& nodes = dmEvent->nodeList();
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nodes.size();++idx)
+ {
+ showNode(nodes[idx].get());
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ e->accept();
+ }
+ break;
+ }
+ default:
+ {
+ // pass all user events to the data manager widget
+ if(e->type()>=QEvent::User)
+ {
+ QObject* baseObject = static_cast<QObject*>(m_dataManagerWidget);
+
+ return baseObject->event(e);
+ }
+ break;
+ }
+ }
+ }
+ return QMainWindow::event(e);
+}
+
+void ossimGui::MainWindow::dropEvent( QDropEvent * event )
+{
+ const QMimeData* data = event->mimeData();
+ if(data)
+ {
+ if(data->hasUrls())
+ {
+#if 0
+ // test to see if we dropped a geocell project on the canvas
+ //
+ if(m_url.scheme().toLower() == "file")
+ {
+ ossimFilename file = m_url.toLocalFile().toAscii().data();
+ ossimString ext = file.ext().downcase();
+
+ if(ext == "gcl" || ext == "geocell")
+ {
+ //std::cout << "GEOCELL PROJECT DROPPED\n";
+ if(!m_dataManagerWidget->openDataManager(fileName))
+ {
+
+ }
+ }
+ }
+#endif
+
+ QList<QUrl> urls = data->urls();
+ QList<QUrl>::iterator iter = urls.begin();
+ while(iter != urls.end())
+ {
+ QString input = iter->toString();
+ QString scheme = iter->scheme();
+ ossimFilename projectFile = (*iter).toLocalFile().toAscii().data();
+ ossimString ext = projectFile.ext().downcase();
+ if((ext == "gcl" || ext=="geocell")&&projectFile.exists())
+ {
+ m_dataManagerWidget->openDataManager(projectFile);
+ }
+ else
+ {
+ OpenImageUrlJob* job = new OpenImageUrlJob(*iter);
+ job->setName("Open " + ossimString((*iter).toString().toAscii().data()));
+ ossimImageOpenJobCallback* callback = new ossimImageOpenJobCallback();
+ callback->m_object = this;
+ job->setCallback(callback);
+ m_stagerQueue->getJobQueue()->add(job);
+ }
+
+ ++iter;
+ }
+ }
+ //PlanetMdiSubWindow* w = new PlanetMdiSubWindow();
+ // m_mdiArea->addSubWindow(w);
+ // w->show();
+
+ }
+}
+
+void ossimGui::MainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+ event->acceptProposedAction();
+}
+
+QMenuBar* ossimGui::MainWindow::createAndSetMenuBar()
+{
+ if(m_menubar)
+ {
+ setMenuBar(0);
+ delete m_menubar;
+ }
+ m_menubar = new QMenuBar(0);
+ m_menubar->setObjectName(QString::fromUtf8("mainmenubar"));
+ QMenu* menuFile = new QMenu("File", m_menubar);
+ QMenu* menuWindow = new QMenu("Window", m_menubar);
+ QMenu* menuHelp = new QMenu("Help", m_menubar);
+ menuWindow->setObjectName("windowMenu");
+ menuFile->setObjectName("fileMenu");
+ menuHelp->setObjectName("helpMenu");
+ QAction* aboutAction = menuHelp->addAction("About");
+ m_menubar->addAction(menuFile->menuAction());
+ m_menubar->addAction(menuWindow->menuAction());
+ m_menubar->addAction(menuHelp->menuAction());
+
+ QAction* openImageAction = menuFile->addAction("Open Image");
+ connect(openImageAction, SIGNAL(triggered(bool)),m_dataManagerWidget, SLOT(openLocalImage()));
+// connect(openImageAction, SIGNAL(triggered(bool)),this, SLOT(openImage()));
+
+ QAction* openImageInteractiveAction = menuFile->addAction("Open Image Interactive");
+ connect(openImageInteractiveAction, SIGNAL(triggered(bool)),
+ m_dataManagerWidget, SLOT(openLocalImageInteractive()));
+
+ QAction* openJpipAction = menuFile->addAction("Open JPIP");
+ connect(openJpipAction, SIGNAL(triggered(bool)),this, SLOT(openJpip(bool)));
+ menuFile->addSeparator();
+
+ // SETUP FILE MENU
+ QAction* saveProjectAction = menuFile->addAction("Save Project");
+ QAction* saveProjectAsAction = menuFile->addAction("Save Project As");
+ QAction* openProjectAction = menuFile->addAction("Open Project");
+ connect(saveProjectAsAction, SIGNAL(triggered(bool)),this, SLOT(saveProjectAs(bool)));
+ connect(saveProjectAction, SIGNAL(triggered(bool)),this, SLOT(saveProject(bool)));
+ connect(openProjectAction, SIGNAL(triggered(bool)),this, SLOT(openProject(bool)));
+ menuFile->addSeparator();
+
+
+ QAction *exitAction = new QAction("Exit", menuFile);
+ menuFile->addAction(exitAction);
+ connect(exitAction, SIGNAL(triggered(bool)), this, SLOT(close()));
+
+
+ //SETUP WINDOW MENU
+ QAction* windowTabAction = menuWindow->addAction("Tab");
+ connect(windowTabAction, SIGNAL(triggered(bool)),this, SLOT(tabWindows(bool)));
+
+ QAction* windowCascadeAction = menuWindow->addAction("Cascade");
+ connect(windowCascadeAction, SIGNAL(triggered(bool)),this, SLOT(cascadeWindows(bool)));
+ QAction* windowTileAction = menuWindow->addAction("Tile");
+ connect(windowTileAction, SIGNAL(triggered(bool)),this, SLOT(tileWindows(bool)));
+ QAction* closeAll = menuWindow->addAction("Close All");
+ connect(closeAll, SIGNAL(triggered(bool)),this, SLOT(closeAllWindows(bool)));
+
+ connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about(bool)));
+ menuWindow->addAction("Minimize All");
+ menuWindow->addAction("Restore All");
+ menuWindow->addAction("Maximize");
+ menuWindow->addAction("Minimize");
+
+ setMenuBar(m_menubar);
+
+ return m_menubar;
+}
+
+void ossimGui::MainWindow::showNode(DataManager::Node* node)
+{
+ if(node)
+ {
+ ossimRefPtr<DataManager::Node> n = node;
+ // bool needToConnect = false;
+ ConnectableDisplayObject* d =node->getObjectAs<ConnectableDisplayObject>();
+ // check if we need to create a new display
+ if(!d)
+ {
+ // needToConnect = true;
+ n = m_dataManager->createDefault2dImageDisplay(node);
+ d = n->getObjectAs<ConnectableDisplayObject>();
+ if(d)
+ {
+ MdiSubWindowBase* child = d->display();
+ child->setJobQueue(m_displayQueue.get());
+ child->show();
+ }
+ }
+ else
+ {
+ MdiSubWindowBase* display = d->display();
+ if(!display)
+ {
+ display = new ImageMdiSubWindow();
+ display->setWindowTitle(n->name());
+ display->setJobQueue(m_displayQueue.get());
+ if(display->connectableObject() != d)
+ {
+ display->setConnectableObject(d);
+ }
+ m_mdiArea->addSubWindow(display);
+ display->show();
+ }
+ else if(!display->parent())
+ {
+ display->setWindowTitle(n->name());
+ display->setJobQueue(m_displayQueue.get());
+ if(display->connectableObject() != d)
+ {
+ display->setConnectableObject(d);
+ }
+ m_mdiArea->addSubWindow(display);
+ display->show();
+ }
+ else
+ {
+ display->setJobQueue(m_displayQueue.get());
+ display->show();
+ }
+
+ }
+ }
+}
+
+void ossimGui::MainWindow::saveProject(bool /*checked*/)
+{
+ QString fileName = QFileDialog::getSaveFileName(this);
+ if(fileName != "")
+ {
+ ossimFilename file = fileName.toAscii().data();
+ file.setExtension("gcl");
+ ossimKeywordlist kwl;
+ m_dataManager->saveState(kwl, "dataManager.");
+ kwl.write(file);
+ }
+}
+
+void ossimGui::MainWindow::saveProjectAs(bool /*checked*/)
+{
+ QString fileName = QFileDialog::getSaveFileName(this);
+ if(fileName != "")
+ {
+ ossimFilename file = fileName.toAscii().data();
+ file.setExtension("gcl");
+ ossimKeywordlist kwl;
+
+ m_dataManager->saveState(kwl, "dataManager.");
+ kwl.write(file);
+ }
+}
+
+void ossimGui::MainWindow::openProject(bool /*checked*/)
+{
+ QString file = QFileDialog::getOpenFileName(this);
+ if(file != "")
+ {
+ ossimFilename fileName(file.toAscii().data());
+ if(!m_dataManagerWidget->openDataManager(fileName))
+ {
+
+ }
+ }
+}
+
+void ossimGui::MainWindow::openImage( bool /*checked*/ )
+{
+ QStringList fileNames = QFileDialog::getOpenFileNames(this);
+ if (fileNames.size() > 0)
+ {
+ // std::cout << "SIZE: " << << std::endl;
+ for (int i = 0; i < fileNames.size(); ++i)
+ {
+ QUrl url(QUrl::fromLocalFile(fileNames.at(i)));
+ OpenImageUrlJob* job = new OpenImageUrlJob(url);
+ ossimImageOpenJobCallback* callback = new ossimImageOpenJobCallback();
+ callback->m_object = this;
+ job->setCallback(callback);
+ m_stagerQueue->getJobQueue()->add(job);
+ }
+ }
+}
+
+void ossimGui::MainWindow::openJpip( bool /*checked*/ )
+{
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("JPIP stream of the form jpip://<url>/path"),
+ tr("Url:"), QLineEdit::Normal,
+ QDir::home().dirName(), &ok);
+ if (ok && !text.isEmpty())
+ {
+ QUrl jpip(text);
+ if(jpip.scheme() == "jpip")
+ {
+ OpenImageUrlJob* job = new OpenImageUrlJob(jpip);
+ ossimImageOpenJobCallback* callback = new ossimImageOpenJobCallback();
+ callback->m_object = this;
+ job->setCallback(callback);
+ m_stagerQueue->getJobQueue()->add(job);
+ }
+ }
+}
+
+void ossimGui::MainWindow::cascadeWindows( bool /*checked*/ )
+{
+ if(m_mdiArea)
+ {
+ m_mdiArea->setViewMode(QMdiArea::SubWindowView);
+
+ m_mdiArea->cascadeSubWindows();
+ }
+}
+void ossimGui::MainWindow::tileWindows( bool /*checked*/ )
+{
+ if(m_mdiArea)
+ {
+ m_mdiArea->setViewMode(QMdiArea::SubWindowView);
+ m_mdiArea->tileSubWindows();
+ }
+}
+
+void ossimGui::MainWindow::tabWindows(bool /* checked */)
+{
+ m_mdiArea->setViewMode(QMdiArea::TabbedView);
+}
+
+void ossimGui::MainWindow::closeAllWindows( bool /*checked*/ )
+{
+ QList<QMdiSubWindow *> subList = m_mdiArea->subWindowList();
+ QList<QMdiSubWindow*>::iterator iter = subList.begin();
+ while(iter != subList.end())
+ {
+ (*iter)->close();
+ ++iter;
+ }
+}
+
+bool ossimGui::MainWindow::loadProjectFile(const ossimString& projFile)
+{
+ bool loadOK = true;
+ ossimFilename fileName(projFile);
+ if(!m_dataManagerWidget->openDataManager(fileName))
+ {
+ loadOK = false;
+ }
+ return loadOK;
+}
+
+bool ossimGui::MainWindow::loadImageFileList(std::vector<ossimString>& ilist)
+{
+ bool loadOK = true;
+ QStringList fileNames;
+ for (ossim_uint32 j = 0; j < ilist.size(); ++j)
+ {
+ fileNames.append(ilist[j].c_str());
+ }
+
+ if (fileNames.size() > 0)
+ {
+ for (int i = 0; i < fileNames.size(); ++i)
+ {
+ QUrl url(QUrl::fromLocalFile(fileNames.at(i)));
+ OpenImageUrlJob* job = new OpenImageUrlJob(url);
+ ossimImageOpenJobCallback* callback = new ossimImageOpenJobCallback();
+ callback->m_object = this;
+ job->setCallback(callback);
+ m_stagerQueue->getJobQueue()->add(job);
+ }
+ }
+ return loadOK;
+}
+
+void ossimGui::MainWindow::createModeSelector(QToolBar* bar)
+{
+ m_exploitationOptions = bar->findChild<QComboBox*>("exploitationOptions");
+ if(!m_exploitationOptions)
+ {
+ m_exploitationOptions = new QComboBox();
+ m_exploitationOptions->setObjectName("exploitationOptions");
+ m_exploitationOptions->addItem("<Select Exploitation Mode>");
+ m_exploitationOptions->addItem("Registration");
+ m_exploitationOptions->addItem("Geopositioning");
+ m_exploitationOptions->addItem("Mensuration");
+ bar->addWidget(m_exploitationOptions);
+ }
+ else
+ {
+ m_exploitationOptions->setEnabled(true);
+ }
+
+ connect(m_exploitationOptions, SIGNAL(activated(int)), this, SLOT(exploitationModeChanged(int)));
+ connect(m_dataManagerWidget, SIGNAL(resetMode()), this, SLOT(resetExploitationMode()));
+}
+
+void ossimGui::MainWindow::exploitationModeChanged(int idx)
+{
+ m_dataManager->setExploitationMode(idx);
+ m_dataManagerWidget->miDialog(idx);
+}
+
+void ossimGui::MainWindow::resetExploitationMode()
+{
+ m_exploitationOptions->setCurrentIndex(0);
+}
+
+void ossimGui::MainWindow::about(bool)
+{
+ About* window = new About(this);
+
+ QString version(OSSIM_VERSION);
+ QString buildDate(OSSIM_BUILD_DATE);
+
+ window->m_aboutText->setText(QString("OSSIM GeoCell\nVersion: " + version + " Date: " + buildDate));
+ window->exec();
+}
diff --git a/ossimGui/src/ossimGui/MarkPoint.cpp b/ossimGui/src/ossimGui/MarkPoint.cpp
new file mode 100644
index 0000000..a24de95
--- /dev/null
+++ b/ossimGui/src/ossimGui/MarkPoint.cpp
@@ -0,0 +1,72 @@
+#include <ossimGui/MarkPoint.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <QtGui/QToolTip>
+#include <iostream>
+
+
+ossimGui::MarkPoint::MarkPoint(const ossimDpt& scenePos,
+ const ossimDpt& imgPos,
+ const ossimString& overlayId,
+ const ossimString& id)
+:
+AnnotationItem(overlayId, id),
+m_imgPos(imgPos),
+m_len(12.0)
+{
+ setAcceptHoverEvents(true);
+
+ setPos(scenePos.x, scenePos.y);
+
+ // Set end points
+ qreal xmin = -m_len/2;
+ qreal xmax = m_len/2;
+ qreal ymin = -m_len/2;
+ qreal ymax = m_len/2;
+
+ // Construct symbol
+ m_ver.setLine(0.0, ymax, 0.0, ymin);
+ m_hor.setLine(xmin, 0.0, xmax, 0.0);
+ m_rect.setRect(xmin+2, ymin+2, m_len-4, m_len-4);
+
+ m_pen.setColor(Qt::green);
+ m_pen.setCapStyle(Qt::RoundCap);
+ m_pen.setWidth(0);
+
+ // QGraphicsItem::data
+ setData(DATA_ITEM_ID, m_id.c_str());
+ setData(DATA_OVERLAY_ID, m_overlayId.c_str());
+}
+
+void ossimGui::MarkPoint::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
+{
+ m_savedPen = m_pen;
+ m_pen.setColor(Qt::cyan);
+ update();
+}
+
+void ossimGui::MarkPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
+{
+ m_pen = m_savedPen;
+ update();
+}
+
+QRectF ossimGui::MarkPoint::boundingRect() const
+{
+ return QRectF(-m_len/2-1, -m_len/2-1, m_len+2, m_len+2);
+}
+
+void ossimGui::MarkPoint::paint(QPainter* painter,
+ const QStyleOptionGraphicsItem* option,
+ QWidget* widget)
+{
+ painter->setPen(m_pen);
+ painter->drawLine(m_ver);
+ painter->drawLine(m_hor);
+
+ painter->setPen(m_annPen);
+ painter->drawRect(m_rect);
+
+ painter->setPen(m_pen);
+}
diff --git a/ossimGui/src/ossimGui/MdiSubWindowBase.cpp b/ossimGui/src/ossimGui/MdiSubWindowBase.cpp
new file mode 100644
index 0000000..46e533c
--- /dev/null
+++ b/ossimGui/src/ossimGui/MdiSubWindowBase.cpp
@@ -0,0 +1,41 @@
+#include <ossimGui/MdiSubWindowBase.h>
+#include <QtGui/QMdiArea>
+#include <QtGui/QMainWindow>
+
+namespace ossimGui {
+ MdiSubWindowBase::MdiSubWindowBase( QWidget * parent, Qt::WindowFlags flags)
+ :QMdiSubWindow(parent, flags)
+ {
+ }
+ MdiSubWindowBase::~MdiSubWindowBase()
+ {
+ if(m_connectableObject.valid()) m_connectableObject->disconnect();
+ m_connectableObject = 0;
+ }
+
+ QMainWindow* MdiSubWindowBase::mainWindow()
+ {
+ QMainWindow* result = 0;
+ QMdiArea* area = mdiArea();
+
+ if(area)
+ {
+ QWidget* parent = area->parentWidget();
+ while(parent && ! result)
+ {
+ result = dynamic_cast<QMainWindow*>(parent);
+ parent = parent->parentWidget();
+ }
+ }
+
+ return result;
+ }
+
+ void MdiSubWindowBase::setConnectableObject(ConnectableObject* connectable)
+ {
+ m_connectableObject = connectable;
+ ConnectableDisplayObject* connectableDisplay = dynamic_cast<ConnectableDisplayObject*> (connectable);
+ if(connectableDisplay) connectableDisplay->setDisplay(this);
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/MetricOverlay.cpp b/ossimGui/src/ossimGui/MetricOverlay.cpp
new file mode 100644
index 0000000..9ef1da0
--- /dev/null
+++ b/ossimGui/src/ossimGui/MetricOverlay.cpp
@@ -0,0 +1,147 @@
+#include <ossimGui/MetricOverlay.h>
+#include <ossimGui/MarkPoint.h>
+#include <ossimGui/IvtGeomTransform.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <QtGui/QGraphicsItem>
+#include <iostream>
+
+
+ossimGui::MetricOverlay::MetricOverlay(const ossimString& overlayId, QGraphicsScene* scene)
+: OverlayBase(overlayId, scene),
+ m_currentId("NS")
+{}
+
+void ossimGui::MetricOverlay::reset()
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ m_scene->removeItem(items[i]);
+ }
+
+ m_isActive = false;
+ m_currentId = "NS";
+}
+
+ossim_uint32 ossimGui::MetricOverlay::getNumPoints()const
+{
+ return m_scene->items().size();
+}
+
+void ossimGui::MetricOverlay::addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt)
+{
+ addPoint(scenePt, imagePt, m_currentId);
+}
+
+void ossimGui::MetricOverlay::addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id)
+{
+ // Check for duplicate (changing position of point already added)
+ removePoint(id);
+
+ // Add point to scene
+ ossimGui::MarkPoint* pt = new ossimGui::MarkPoint(scenePt, imagePt, m_overlayId, id);
+ m_scene->addItem(pt);
+
+ // Notify MultiImageDialog
+ emit pointActivated(id);
+}
+
+// TODO not really needed for this class
+void ossimGui::MetricOverlay::togglePointActive(const ossimString& id)
+{
+ ossimGui::MarkPoint* point = getMarkPoint(id);
+ bool currentlyActive = false;
+
+ if (point != 0)
+ {
+ // Toggle point in layer map
+ currentlyActive = point->isUsable();
+ point->setUsable(!currentlyActive);
+ }
+
+ // Notify MultiImageDialog
+ if (currentlyActive)
+ emit pointDeactivated(id);
+ else
+ emit pointActivated(id);
+
+}
+
+
+void ossimGui::MetricOverlay::removePoint(const ossimString& id)
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ ossimString idFromScene = items[i]->data(AnnotationItem::DATA_ITEM_ID).toString().toUtf8().constData();
+ ossimString ovidFromScene = items[i]->data(AnnotationItem::DATA_OVERLAY_ID).toString().toUtf8().constData();
+ if (id == idFromScene && ovidFromScene == m_overlayId)
+ {
+ m_scene->removeItem(items[i]);
+ }
+ }
+
+ emit pointRemoved(id);
+}
+
+
+bool ossimGui::MetricOverlay::getImgPoint(const ossimString& id,
+ ossimDpt& imgPt,
+ bool& isActive)
+{
+ bool isFound = false;
+
+ ossimGui::MarkPoint* point = getMarkPoint(id);
+
+ if (point != 0)
+ {
+ imgPt = point->getImgPos();
+ isActive = point->isUsable();
+ isFound = true;
+ }
+
+ return isFound;
+}
+
+
+ossimGui::MarkPoint* ossimGui::MetricOverlay::getMarkPoint(const ossimString& id)
+{
+ ossimGui::MarkPoint* point = 0;
+
+ QGraphicsItem* item = getItem(id);
+ if (item != 0)
+ {
+ point = dynamic_cast<ossimGui::MarkPoint*>(item);
+ }
+
+ return point;
+}
+
+
+void ossimGui::MetricOverlay::setVisible(const bool& visible)
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ items[i]->setVisible(visible);
+ }
+}
+
+
+void ossimGui::MetricOverlay::setView(ossimRefPtr<IvtGeomTransform> ivtg)
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ ossimGui::MarkPoint* thisPoint = dynamic_cast<ossimGui::MarkPoint*>(items[i]);
+ if (thisPoint)
+ {
+ ossimDpt imgPos = thisPoint->getImgPos();
+ ossimDpt viewPos;
+ ivtg->imageToView(imgPos, viewPos);
+ thisPoint->setPos(viewPos.x, viewPos.y);
+ }
+ }
+}
diff --git a/ossimGui/src/ossimGui/MultiImageDialog.cpp b/ossimGui/src/ossimGui/MultiImageDialog.cpp
new file mode 100644
index 0000000..a71ea84
--- /dev/null
+++ b/ossimGui/src/ossimGui/MultiImageDialog.cpp
@@ -0,0 +1,720 @@
+#include <ossimGui/MainWindow.h>
+#include <ossimGui/MultiImageDialog.h>
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/MetricOverlay.h>
+#include <ossimGui/RegPoint.h>
+#include <ossimGui/ImageMdiSubWindow.h>
+#include <ossimGui/ImageScrollView.h>
+#include <QtGui/QMenu>
+#include <QtGui/QMainWindow>
+#include <QtGui/QApplication>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+#include <ossimGui/Event.h>
+#include <ossimGui/Util.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/imaging/ossimImageHandler.h>
+
+
+ossimGui::MultiImageDialog::MultiImageDialog(QWidget* parent)
+: QDialog(parent),
+ m_isActive(false),
+ m_currentIdCounter(0)
+{
+ initDialog();
+ this->setAttribute(Qt::WA_DeleteOnClose);
+}
+
+
+void ossimGui::MultiImageDialog::initDialog()
+{
+ setupUi(this);
+
+ // Set primary connections
+ connect(m_resetModeButton, SIGNAL(clicked()), this, SLOT(resetContent()));
+ connect(m_hideButton, SIGNAL(clicked()), this, SLOT(resetContent()));
+ connect(m_addPointButton, SIGNAL(clicked()), this, SLOT(addObsPoint()));
+ connect(m_autoMeasButton, SIGNAL(clicked()), this, SLOT(autoMeas()));
+ connect(m_registerButton, SIGNAL(clicked()), this, SLOT(registerImages()));
+ connect(m_dropButton, SIGNAL(clicked()), this, SLOT(dropPoint()));
+ connect(m_clearPointButton, SIGNAL(clicked()), this, SLOT(clearPoint()));
+ connect(m_acceptRegButton, SIGNAL(clicked()), this, SLOT(acceptReg()));
+ connect(m_resetRegButton, SIGNAL(clicked()), this, SLOT(resetReg()));
+
+ // Point table
+ connect(m_pointTable, SIGNAL(cellClicked(int, int)), this, SLOT(setPointCellClicked(int, int)));
+ connect(m_pointTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(setPointRowClicked(int)));
+ connect(m_pointTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(setPointColClicked(int)));
+ m_pointTable->verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(m_pointTable->verticalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPointTableContextMenuRow(QPoint)));
+ m_pointTable->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(m_pointTable->horizontalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPointTableContextMenuCol(QPoint)));
+
+ // Turn off row/col resizing
+ m_pointTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+ m_pointTable->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+ m_imageTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+
+ // Turn off selection
+ m_pointTable->setSelectionMode(QAbstractItemView::NoSelection);
+ m_imageTable->setSelectionMode(QAbstractItemView::NoSelection);
+
+ // Image table right-click context menu
+ m_imageTable->verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(m_imageTable->verticalHeader(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayImageTableContextMenu(QPoint)));
+
+ // Load tooltips
+ m_currentPointID->setToolTip("Active point ID");
+ m_imageTable->verticalHeader()->setToolTip("Right click for context menu");
+ m_pointTable->verticalHeader()->setToolTip("Right click for context menu");
+ m_pointTable->horizontalHeader()->setToolTip("Left click to sync on point\nRight click for context menu");
+ m_hideButton->setToolTip("Hide window (press 's' key to show)");
+ m_resetModeButton->setToolTip("Reset exploitation mode");
+}
+void ossimGui::MultiImageDialog::displayClosing(QObject* obj)
+{
+ ImageMdiSubWindow* subWindow = (ImageMdiSubWindow*)(obj);
+ if(subWindow)
+ {
+
+ RegistrationOverlay* regOverlay = subWindow->scrollWidget()->regOverlay();
+ MetricOverlay* metOverlay = subWindow->scrollWidget()->metOverlay();
+ std::vector<ossimGui::MetricOverlay*>::iterator metIter = std::find(m_overlaysMet.begin(),
+ m_overlaysMet.end(),
+ metOverlay);
+ if(metIter != m_overlaysMet.end())
+ {
+ m_overlaysMet.erase(metIter);
+ }
+ std::vector<ossimGui::RegistrationOverlay*>::iterator regIter = std::find(m_overlaysReg.begin(),
+ m_overlaysReg.end(),
+ regOverlay);
+ if(regIter != m_overlaysReg.end())
+ {
+ m_overlaysReg.erase(regIter);
+ }
+ DataManager::NodeListType::iterator iter = m_nodeList.begin();
+ while(iter != m_nodeList.end())
+ {
+ ConnectableDisplayObject* displayObj = (*iter)->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ if((subWindow == obj) || (subWindow == 0))
+ {
+ iter = m_nodeList.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+ }
+
+}
+
+void ossimGui::MultiImageDialog::initContent(DataManager::NodeListType& nodeList,
+ const bool& amDialogAvailable)
+{
+
+ // Load overlays & set image point connections
+ for(ossim_uint32 idx = 0; idx < nodeList.size(); ++idx)
+ {
+ ConnectableDisplayObject* displayObj = nodeList[idx]->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ RegistrationOverlay* regOverlay = subWindow->scrollWidget()->regOverlay();
+ m_overlaysReg.push_back(regOverlay);
+ MetricOverlay* metOverlay = subWindow->scrollWidget()->metOverlay();
+ m_overlaysMet.push_back(metOverlay);
+ connect(m_overlaysReg[idx], SIGNAL(pointActivated(const ossimString&)), this, SLOT(setImagePointActive(const ossimString&)));
+ connect(m_overlaysReg[idx], SIGNAL(pointDeactivated(const ossimString&)), this, SLOT(setImagePointInactive(const ossimString&)));
+ connect(m_overlaysReg[idx], SIGNAL(pointRemoved(const ossimString&)), this, SLOT(setImagePointRemoved(const ossimString&)));
+
+ // if a display closes make sure we clean up
+ connect(subWindow, SIGNAL(destroyed(QObject*)), this, SLOT(displayClosing(QObject*)));
+ }
+
+ // Activate registration overlays
+ for(ossim_uint32 idx = 0; idx < m_overlaysReg.size(); ++idx)
+ {
+ m_overlaysReg[idx]->setActive(true);
+ }
+
+ // Load image list
+ std::vector<ossimString> ilist;
+ std::vector<ossimString> tlist;
+ for(ossim_uint32 idx = 0; idx < m_overlaysReg.size(); ++idx)
+ {
+ ossimConnectableObject* connectable = nodeList[idx]->getObjectAs<ossimConnectableObject>();
+ ossimTypeNameVisitor visitor("ossimImageHandler");
+ connectable->accept(visitor);
+ ossimRefPtr<ossimImageHandler> input = dynamic_cast<ossimImageHandler*> (visitor.getObjects()[0].get());
+
+ if(input.valid())
+ {
+ ossimRefPtr<ossimImageGeometry> geom = input->getImageGeometry();
+ if(geom.valid())
+ {
+ ossimRefPtr<ossimProjection> proj = geom->getProjection();
+ if(proj.valid())
+ {
+ tlist.push_back(proj->getShortName());
+ }
+ else
+ {
+ tlist.push_back("UNKNOWN");
+ }
+ }
+ ilist.push_back(input->getFilename());
+
+ // Check for control image based on presence of AdjustableParameterInterface
+ ossimAdjustableParameterInterface* iface =
+ input->getImageGeometry()->getAdjustableParameterInterface();
+ if (iface != NULL)
+ {
+ m_overlaysReg[idx]->setHasAdjParInterface(true);
+ }
+ else
+ {
+ m_overlaysReg[idx]->setAsControl(true);
+ }
+ }
+ }
+
+ // Populate dialog
+ setImgList(ilist, tlist);
+ setPtTable(m_currentIdCounter);
+
+ // Save node list
+ m_nodeList = nodeList;
+
+ // If auto measurement is available, activate the button
+ if (amDialogAvailable)
+ m_autoMeasButton->setEnabled(true);
+ else
+ m_autoMeasButton->setEnabled(false);
+
+
+ m_isActive = true;
+}
+
+
+void ossimGui::MultiImageDialog::resetContent()
+{
+ // Signal to DataManagerWidget
+ emit resetModeExecuted(m_nodeList);
+ //std::cout << "ossimGui::MultiImageDialog::resetContent(): ...........After emit!!!\n";
+
+ for(ossim_uint32 idx = 0; idx < m_overlaysReg.size(); ++idx)
+ {
+ disconnect(m_overlaysReg[idx], SIGNAL(pointActivated(const ossimString&)), this, SLOT(setImagePointActive(const ossimString&)));
+ disconnect(m_overlaysReg[idx], SIGNAL(pointDeactivated(const ossimString&)), this, SLOT(setImagePointInactive(const ossimString&)));
+ disconnect(m_overlaysReg[idx], SIGNAL(pointRemoved(const ossimString&)), this, SLOT(setImagePointRemoved(const ossimString&)));
+ m_overlaysReg[idx]->reset();
+ }
+ m_overlaysReg.clear();
+ m_overlaysMet.clear();
+
+ m_currentIdCounter = 0;
+ setPtTable(m_currentIdCounter);
+
+ m_regResultsBrowser->setText("Mode Reset");
+ m_pointPositionBrowser->setText("Mode Reset");
+
+ m_nodeList.clear();
+
+ updateCurrentIdField();
+
+ m_isActive = false;
+ close();
+}
+
+
+void ossimGui::MultiImageDialog::setMode(const int& expMode)
+{
+ m_exploitationMode = static_cast<DataManager::ExploitationModeType> (expMode);
+
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE)
+ {
+ m_tabWidget->setTabEnabled(4, false); //m_mensurationTab
+ m_tabWidget->setTabEnabled(3, false); //m_pointPositionTab
+ m_tabWidget->setTabEnabled(2, true); //m_RegistrationTab
+ m_tabWidget->setTabEnabled(1, true); //m_pointEditorTab
+ m_acceptRegButton->setEnabled(false);
+ }
+ else if (m_exploitationMode == DataManager::GEOPOSITIONING_MODE)
+ {
+ m_tabWidget->setTabEnabled(4, false); //m_mensurationTab
+ m_tabWidget->setTabEnabled(3, true); //m_pointPositionTab
+ m_tabWidget->setTabEnabled(2, false); //m_RegistrationTab
+ m_tabWidget->setTabEnabled(1, false); //m_pointEditorTab
+ }
+ else if (m_exploitationMode == DataManager::MENSURATION_MODE)
+ {
+ m_tabWidget->setTabEnabled(4, true); //m_mensurationTab
+ m_tabWidget->setTabEnabled(3, false); //m_pointPositionTab
+ m_tabWidget->setTabEnabled(2, false); //m_RegistrationTab
+ m_tabWidget->setTabEnabled(1, false); //m_pointEditorTab
+ }
+ else
+ {
+ resetContent();
+ }
+}
+
+
+void ossimGui::MultiImageDialog::registerImages()
+{
+ // Signal to DataManagerWidget
+ emit registrationExecuted(m_nodeList);
+ m_acceptRegButton->setEnabled(true);
+}
+
+void ossimGui::MultiImageDialog::dropPoint()
+{
+ // Signal to DataManagerWidget
+ emit pointDropExecuted(m_nodeList);
+}
+
+void ossimGui::MultiImageDialog::clearPoint()
+{
+ // Signal to DataManagerWidget
+ emit clearPointExecuted(m_nodeList);
+ m_pointPositionBrowser->setText("Current measurements cleared");
+}
+
+void ossimGui::MultiImageDialog::acceptReg()
+{
+ // Signal to DataManagerWidget
+ emit acceptRegExecuted(m_nodeList);
+ m_acceptRegButton->setEnabled(false);
+}
+
+void ossimGui::MultiImageDialog::resetReg()
+{
+ QMessageBox confBox;
+ confBox.setText("Confirm solution clear...");
+ confBox.setWindowFlags(Qt::WindowStaysOnTopHint);
+ confBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+ confBox.setDefaultButton(QMessageBox::Cancel);
+ int ret = confBox.exec();
+ switch (ret) {
+ case QMessageBox::Cancel:
+ break;
+ case QMessageBox::Ok:
+ // Signal to DataManagerWidget
+ emit resetRegExecuted(m_nodeList);
+ m_acceptRegButton->setEnabled(false);
+ m_regResultsBrowser->setText("Registration solution cleared...");
+ break;
+ default:
+ break;
+ }
+}
+
+// Initiate auto measurement
+void ossimGui::MultiImageDialog::autoMeas()
+{
+ // Signal to DataManagerWidget
+ emit autoMeasInitiated(m_nodeList);
+}
+
+// Add new point observation slot (column)
+void ossimGui::MultiImageDialog::addObsPoint()
+{
+ int col = m_pointTable->columnCount();
+ m_pointTable->insertColumn(col);
+
+ m_currentIdCounter = col + 1;
+
+ ossimString hdr = ossimString::toString(m_currentIdCounter);
+ QTableWidgetItem *tblCol = new QTableWidgetItem(hdr.data());
+ tblCol->setBackground(Qt::white);
+ m_pointTable->setHorizontalHeaderItem(col, tblCol);
+
+ for(ossim_int32 row = 0; row<m_pointTable->rowCount(); ++row)
+ {
+ QTableWidgetItem *cellItem = new QTableWidgetItem();
+ cellItem->setBackgroundColor(Qt::lightGray);
+ cellItem->setToolTip("Left click to toggle active/inactive");
+ m_pointTable->setItem(row, col, cellItem);
+ }
+ m_pointTable->resizeColumnsToContents();
+
+ for (ossim_uint32 i=0; i<m_overlaysReg.size(); ++i)
+ {
+ m_overlaysReg[i]->setCurrentId(getCurrentId());
+ }
+
+ updateCurrentIdField();
+}
+
+// Clicked row
+void ossimGui::MultiImageDialog::setPointRowClicked(int /* row */)
+{
+}
+
+// Clicked column syncs on selected point
+void ossimGui::MultiImageDialog::setPointColClicked(int col)
+{
+ m_currentIdCounter = col + 1;
+ ossimString id = getCurrentId();
+
+ bool synced = false;
+
+ for (ossim_uint32 i=0; i<m_overlaysReg.size(); ++i)
+ {
+ m_overlaysReg[i]->setCurrentId(id);
+
+ ossimDpt imgPt;
+ bool isActive;
+ if (m_overlaysReg[i]->getImgPoint(id, imgPt, isActive))
+ {
+ if (!synced && isActive)
+ {
+ ossimGui::RegPoint* syncPt = m_overlaysReg[i]->getRegPoint(id);
+
+ // Signal to DataManagerWidget
+ emit syncExecuted(syncPt, m_nodeList[i]);
+ synced = true;
+ }
+ }
+ }
+
+ updateCurrentIdField();
+}
+
+// Clicked cell
+void ossimGui::MultiImageDialog::setPointCellClicked(int row, int col)
+{
+ QTableWidgetItem *cellItem = new QTableWidgetItem();
+ cellItem->setBackgroundColor(Qt::red);
+ m_pointTable->setItem(row, col, cellItem);
+
+ ossimString id = getIdByIndex(col);
+ m_overlaysReg[row]->togglePointActive(id);
+}
+
+// Activate measured image point
+void ossimGui::MultiImageDialog::setImagePointActive(const ossimString& id)
+{
+ ossimGui::RegistrationOverlay* ov = (ossimGui::RegistrationOverlay*)sender();
+
+ ossim_uint32 row;
+ ossim_uint32 col;
+ if (getRowColMeasPoint(id, ov, row, col))
+ {
+ QTableWidgetItem *cellItem = new QTableWidgetItem();
+ cellItem->setBackgroundColor(Qt::yellow);
+ m_pointTable->setItem(row, col, cellItem);
+ }
+}
+
+// Deactivate measured image point
+void ossimGui::MultiImageDialog::setImagePointInactive(const ossimString& id)
+{
+ ossimGui::RegistrationOverlay* ov = (ossimGui::RegistrationOverlay*)sender();
+
+ ossim_uint32 row;
+ ossim_uint32 col;
+ if (getRowColMeasPoint(id, ov, row, col))
+ {
+ QTableWidgetItem *cellItem = new QTableWidgetItem();
+ cellItem->setBackgroundColor(Qt::red);
+ m_pointTable->setItem(row, col, cellItem);
+ }
+}
+
+// Remove measured image point
+void ossimGui::MultiImageDialog::setImagePointRemoved(const ossimString& id)
+{
+ ossimGui::RegistrationOverlay* ov = (ossimGui::RegistrationOverlay*)sender();
+
+ ossim_uint32 row;
+ ossim_uint32 col;
+ if (getRowColMeasPoint(id, ov, row, col))
+ {
+ QTableWidgetItem *cellItem = new QTableWidgetItem();
+ cellItem->setBackgroundColor(Qt::lightGray);
+ m_pointTable->setItem(row, col, cellItem);
+ }
+}
+
+// Load registration text browser
+void ossimGui::MultiImageDialog::setRegistrationReportContent(const ossimString& report)
+{
+ QFont f( "courier", 12 );
+ m_regResultsBrowser->setFont(f);
+ m_regResultsBrowser->setLineWrapMode(QTextEdit::NoWrap);
+ m_regResultsBrowser->setText(report.data());
+}
+
+// Load point drop results
+void ossimGui::MultiImageDialog::setPointPositionContent(const ossimString& report)
+{
+ QFont f( "courier", 12 );
+ m_pointPositionBrowser->setFont(f);
+ m_pointPositionBrowser->setLineWrapMode(QTextEdit::NoWrap);
+ m_pointPositionBrowser->setText(report.data());
+}
+
+void ossimGui::MultiImageDialog::setImgList(const vector<ossimString>& ilist,
+ const vector<ossimString>& tlist)
+{
+ ossim_uint32 nImgs = ilist.size();
+
+ m_imageTable->setRowCount(nImgs);
+ m_imageTable->setColumnCount(2);
+
+ m_imageTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Image Source"));
+ m_imageTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Type"));
+
+ m_imageTable->setColumnWidth( 0, m_imageTable->width()-210 );
+ m_imageTable->setColumnWidth( 1, 200 );
+
+ QStringList labels;
+ for(ossim_uint32 row = 0; row<nImgs; ++row)
+ {
+ QTableWidgetItem* cellItemImg = new QTableWidgetItem();
+ cellItemImg->setText(ilist[row].data());
+ m_imageTable->setItem(row, 0, cellItemImg);
+
+ QTableWidgetItem* cellItemTyp = new QTableWidgetItem();
+ cellItemTyp->setText(tlist[row].data());
+ m_imageTable->setItem(row, 1, cellItemTyp);
+
+ ossimString hdr = ossimString::toString(row+1);
+ if (m_overlaysReg[row]->isControlImage())
+ {
+ hdr += "C";
+ }
+ labels << hdr.data();
+ }
+
+ m_imageTable->setVerticalHeaderLabels(labels);
+}
+
+void ossimGui::MultiImageDialog::setPtTable(const int& nPts)
+{
+ ossim_int32 nImgs = m_imageTable->rowCount();
+
+ m_pointTable->setRowCount(nImgs);
+ m_pointTable->setColumnCount(nPts);
+
+ QStringList labels;
+ for(ossim_int32 row = 0; row<nImgs; ++row)
+ {
+ for(ossim_int32 col = 0; col<nPts; ++col)
+ {
+ QTableWidgetItem *item = new QTableWidgetItem();
+
+ // Load cell
+ m_pointTable->setItem(row, col, item);
+
+ }
+ // Check for control indicator
+ ossimString hdr = ossimString::toString(row+1);
+ if (m_overlaysReg[row]->isControlImage())
+ {
+ hdr += "C";
+ }
+ labels << hdr.data();
+ }
+ m_pointTable->resizeColumnsToContents();
+ m_pointTable->setVerticalHeaderLabels(labels);
+
+ // Set tab 0 to front
+ m_tabWidget->setCurrentWidget(m_imageSummaryTab);
+ }
+
+
+// Determine row,col of image measurement point
+bool ossimGui::MultiImageDialog::getRowColMeasPoint(const ossimString& id,
+ ossimGui::RegistrationOverlay* ov,
+ ossim_uint32& row,
+ ossim_uint32& col)
+{
+ bool ptFound = false;
+ bool overlayFound = false;
+
+ for (ossim_uint32 idx=0; idx<m_overlaysReg.size(); ++idx)
+ {
+ if (ov == m_overlaysReg[idx])
+ {
+ row = idx;
+ overlayFound = true;
+ }
+ }
+
+ if (overlayFound)
+ {
+ for (int idx=0; idx<m_pointTable->columnCount(); ++idx)
+ {
+ if (id == getIdByIndex(idx))
+ {
+ col = idx;
+ ptFound = true;
+ }
+ }
+ }
+
+ return ptFound;
+}
+
+void ossimGui::MultiImageDialog::displayPointTableContextMenuRow(QPoint pos)
+{
+ QPoint posV = m_pointTable->verticalHeader()->viewport()->mapToGlobal(pos);
+
+ ossim_uint32 ht = m_pointTable->rowHeight(0);
+ ossim_int32 row = pos.y()/ht;
+
+ QAction* toggleActive = 0;
+ QAction* choice2 = 0;
+ QAction* mexec = 0;
+
+ if (row < m_pointTable->rowCount())
+ {
+ QMenu menu(this);
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE)
+ {
+ toggleActive = menu.addAction("Toggle all points status");
+ // choice2 = menu.addAction("C 2");
+ }
+
+ mexec = menu.exec(posV);
+
+ if (toggleActive == mexec)
+ {
+ for (int col=0; col<m_pointTable->columnCount(); ++col)
+ {
+ setPointCellClicked(row, col);
+ }
+ }
+ else if (choice2 == mexec)
+ {
+ }
+ }
+}
+
+void ossimGui::MultiImageDialog::displayPointTableContextMenuCol(QPoint pos)
+{
+ QPoint posH = m_pointTable->horizontalHeader()->viewport()->mapToGlobal(pos);
+
+ ossim_uint32 wid = m_pointTable->columnWidth(0);
+ ossim_int32 col = pos.x()/wid;
+
+ QAction* toggleActive = 0;
+ QAction* choice2 = 0;
+ QAction* mexec = 0;
+
+ if (col < m_pointTable->columnCount())
+ {
+ QMenu menu(this);
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE)
+ {
+ toggleActive = menu.addAction("Toggle point status");
+ // choice2 = menu.addAction("C 2");
+ }
+
+ mexec = menu.exec(posH);
+
+ if (toggleActive == mexec)
+ {
+ for (int row=0; row<m_pointTable->rowCount(); ++row)
+ {
+ setPointCellClicked(row, col);
+ }
+ }
+ else if (choice2 == mexec)
+ {
+ }
+ }
+}
+
+void ossimGui::MultiImageDialog::displayImageTableContextMenu(QPoint pos)
+{
+ QPoint posG = m_imageTable->verticalHeader()->viewport()->mapToGlobal(pos);
+ ossim_uint32 ht = m_imageTable->rowHeight(0);
+ ossim_int32 row = pos.y()/ht;
+
+ QAction* toggleControl = 0;
+ QAction* viewAdjPar = 0;
+ QAction* mexec = 0;
+
+ if (row < m_imageTable->rowCount())
+ {
+ QMenu menu(this);
+ if (m_overlaysReg[row]->hasAdjParInterface())
+ {
+ if (m_exploitationMode == DataManager::REGISTRATION_MODE)
+ {
+ toggleControl = menu.addAction("Toggle control image");
+ }
+ viewAdjPar = menu.addAction("View adjustable parameters");
+ }
+
+ mexec = menu.exec(posG);
+
+ if (toggleControl == mexec)
+ {
+ QStringList labels;
+
+ for (ossim_int32 i=0; i<m_imageTable->rowCount(); ++i)
+ {
+ ossimString hdr = ossimString::toString(i+1);
+ if (m_overlaysReg[i]->hasAdjParInterface())
+ {
+ if (i==row)
+ {
+ bool isCurrentlyControl = m_overlaysReg[i]->isControlImage();
+ m_overlaysReg[i]->setAsControl(!isCurrentlyControl);
+ if (m_overlaysReg[i]->isControlImage())
+ {
+ hdr += "C";
+ }
+ }
+ else
+ {
+ m_overlaysReg[i]->setAsControl(false);
+ }
+ }
+ else
+ {
+ hdr += "C";
+ }
+ labels << hdr.data();
+ }
+
+ m_pointTable->setVerticalHeaderLabels(labels);
+ m_imageTable->setVerticalHeaderLabels(labels);
+ }
+ else if (viewAdjPar == mexec)
+ {
+ ConnectableDisplayObject* displayObj = m_nodeList[row]->getObjectAs<ConnectableDisplayObject>();
+ ImageMdiSubWindow* subWindow = dynamic_cast<ImageMdiSubWindow*>(displayObj->display());
+ subWindow->activateWindow();
+ subWindow->setFocus();
+ subWindow->getImageActions()->editGeometryAdjustments();
+ }
+ }
+}
+
+ossimString ossimGui::MultiImageDialog::getIdByIndex(const ossim_uint32& index)
+{
+ ossimString id = m_pointTable->horizontalHeaderItem(index)->text().toStdString();
+ return id;
+}
+
+void ossimGui::MultiImageDialog::updateCurrentIdField()
+{
+ ossimString id;
+
+ if (m_currentIdCounter == 0)
+ {
+ id = "-";
+ }
+ else
+ {
+ id = ossimString::toString(m_currentIdCounter);
+ }
+
+ m_currentPointID->setText(id.data());
+}
diff --git a/ossimGui/src/ossimGui/OpenImageDialog.cpp b/ossimGui/src/ossimGui/OpenImageDialog.cpp
new file mode 100644
index 0000000..6daa8fa
--- /dev/null
+++ b/ossimGui/src/ossimGui/OpenImageDialog.cpp
@@ -0,0 +1,175 @@
+//----------------------------------------------------------------------------
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Author: David Burken
+//
+// Description: Open image dialog for handling multiple entry images.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#include <ossimGui/OpenImageDialog.h>
+#include <ossimGui/Common.h>
+
+#include <QButtonGroup>
+#include <QDialogButtonBox>
+#include <QGroupBox>
+#include <QTextEdit>
+#include <QString>
+#include <QVBoxLayout>
+#include <QCheckBox>
+
+#include <vector>
+
+ossimGui::OpenImageDialog::OpenImageDialog(ossimImageHandler* ih,
+ QWidget* parent,
+ Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ m_entryButtonGroup(0),
+ m_ih(0)
+{
+ if ( ih )
+ {
+ // Capture image handler pointer.
+ m_ih = ih;
+
+ // set title in Polygon Remapper Dialog
+
+ this->setWindowTitle( ih->getFilename().c_str() );
+
+ // Make modal. User must respond.
+ this->setModal( true );
+
+ // Top level vertical layout:
+ QVBoxLayout* mainVbox = new QVBoxLayout();
+
+ // Group box for entry check boxes.
+ QGroupBox* entryGroupBox = new QGroupBox(tr("Image Entry Selection:"));
+
+ // Vertical layout for entries:
+ QVBoxLayout* entryVbox = new QVBoxLayout();
+
+ // Button group to hold/manage check boxes.
+ m_entryButtonGroup = new QButtonGroup( this );
+
+ // Not exclusive, i.e. can select any number of entries.
+ m_entryButtonGroup->setExclusive( false );
+
+ // Add the "all button":
+ std::string name = "all entries";
+ QString qs = name.c_str();
+ QCheckBox* cb = new QCheckBox( qs );
+ m_entryButtonGroup->addButton( cb, 0 );
+ entryVbox->addWidget( cb );
+ connect( cb, SIGNAL(stateChanged(int)), this, SLOT(allStateChanged(int)) );
+
+ ossim_int32 nEntries = (ossim_int32)ih->getNumberOfEntries();
+ for ( ossim_int32 entry = 0; entry < nEntries; ++entry )
+ {
+ ih->getEntryName( entry, name );
+ if ( name.empty() )
+ {
+ name = "entry ";
+ name += ossimString::toString(entry).string();
+ }
+ qs = name.c_str();
+
+ // Create:
+ cb = new QCheckBox( qs );
+
+ // Mark checked:
+ // cb->setCheckState(Qt::Checked);
+
+ // Add to button group. Note +1 to compensate for "all" button.
+ m_entryButtonGroup->addButton( cb, (entry+1) );
+
+ // Add to vertical box:
+ entryVbox->addWidget( cb );
+ }
+
+ entryGroupBox->setLayout( entryVbox );
+
+ mainVbox->addWidget( entryGroupBox );
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(
+ QDialogButtonBox::Open|QDialogButtonBox::Cancel, Qt::Horizontal);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ mainVbox->addWidget( buttonBox );
+
+ setLayout( mainVbox );
+ }
+
+} // End: ossimGui::OpenImageDialog::OpenImageDialog(...)
+
+void ossimGui::OpenImageDialog::handlerList( ossimGui::HandlerList& handlers )
+{
+ if ( m_ih.valid() )
+ {
+ // Note, start at one as the "all" button is 0.
+ QList<QAbstractButton*> buttons = m_entryButtonGroup->buttons();
+ for ( ossim_int32 i = 1; i < buttons.length(); ++i )
+ {
+ QAbstractButton* button = buttons.at( i );
+ if ( button )
+ {
+ if ( button->isChecked() )
+ {
+ ossimRefPtr<ossimImageHandler> ih =
+ static_cast<ossimImageHandler*>( m_ih->dup() );
+
+ // Note, subtract one, "all" button again.
+ if ( ih->setCurrentEntry( (ossim_uint32)(i-1) ) )
+ {
+ handlers.push_back( ih.get() );
+ }
+ }
+ }
+ }
+ }
+}
+
+// Slot connect
+void ossimGui::OpenImageDialog::reject()
+{
+ // Uncheck all the buttons:
+ if ( m_entryButtonGroup )
+ {
+ QList<QAbstractButton*> buttons = m_entryButtonGroup->buttons();
+ for ( ossim_int32 i = 0; i < buttons.length(); ++i )
+ {
+ QAbstractButton* button = buttons.at( i );
+ if ( button )
+ {
+ button->setChecked( false );
+ }
+ }
+ }
+ QDialog::reject();
+}
+
+void ossimGui::OpenImageDialog::allStateChanged( int state )
+{
+ // Uncheck all the buttons:
+ if ( m_entryButtonGroup )
+ {
+ QList<QAbstractButton*> buttons = m_entryButtonGroup->buttons();
+ for ( ossim_int32 i = 1; i < buttons.length(); ++i )
+ {
+ QAbstractButton* button = buttons.at( i );
+ if ( button )
+ {
+ QCheckBox* cb = dynamic_cast<QCheckBox*>( button );
+ if ( cb )
+ {
+ cb->setCheckState( (Qt::CheckState)state );
+ }
+ }
+ }
+ }
+}
+
diff --git a/ossimGui/src/ossimGui/OpenImageUrlJob.cpp b/ossimGui/src/ossimGui/OpenImageUrlJob.cpp
new file mode 100644
index 0000000..e677f26
--- /dev/null
+++ b/ossimGui/src/ossimGui/OpenImageUrlJob.cpp
@@ -0,0 +1,38 @@
+#include <ossimGui/OpenImageUrlJob.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
+void ossimGui::OpenImageUrlJob::start()
+{
+ ossimFilename file = m_url.toString().toAscii().data();
+
+ //test if uri is local file
+ if(m_url.scheme().toLower() == "file")
+ {
+ file = m_url.toLocalFile().toAscii().data();
+ if(!file.exists()) return;
+ }
+ ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(file);
+ if(ih.valid())
+ {
+ m_handlers.push_back(ih.get());
+ ossim_uint32 nEntries = ih->getNumberOfEntries();
+ if(nEntries > 1)
+ {
+ m_handlers.push_back(ih.get());
+ ossim_uint32 idx=0;
+ do
+ {
+ ++idx;
+ ih = static_cast<ossimImageHandler*>(ih->dup());
+ if(ih->setCurrentEntry(idx))
+ {
+ m_handlers.push_back(ih.get());
+ }
+ }while(((idx+1) < nEntries)&&!isCanceled());
+ }
+ }
+
+ if(isCanceled())
+ {
+ m_handlers.clear();
+ }
+}
diff --git a/ossimGui/src/ossimGui/OssimObjectFactory.cpp b/ossimGui/src/ossimGui/OssimObjectFactory.cpp
new file mode 100644
index 0000000..989df5e
--- /dev/null
+++ b/ossimGui/src/ossimGui/OssimObjectFactory.cpp
@@ -0,0 +1,54 @@
+#include <ossimGui/OssimObjectFactory.h>
+#include <ossimGui/ConnectableDisplayObject.h>
+
+ossimGui::OssimObjectFactory* ossimGui::OssimObjectFactory::m_instance = 0;
+ossimGui::OssimObjectFactory::OssimObjectFactory()
+{
+ m_instance = this;
+}
+
+ossimGui::OssimObjectFactory* ossimGui::OssimObjectFactory::instance()
+{
+ if(!m_instance)
+ {
+ m_instance = new OssimObjectFactory();
+ }
+
+ return m_instance;
+}
+
+ossimObject* ossimGui::OssimObjectFactory::createObject(const ossimString& typeName)const
+{
+ ossimObject* result = 0;
+ if(typeName == "ConnectableDisplayObject")
+ {
+ result = new ConnectableDisplayObject();
+ }
+
+ return result;
+}
+
+ossimObject* ossimGui::OssimObjectFactory::createObject(const ossimKeywordlist& kwl,
+ const char* prefix)const
+{
+ ossimRefPtr<ossimObject> result = 0;
+ ossimString type = kwl.find(prefix, "type");
+ if(!type.empty())
+ {
+ result = createObject(type);
+ if(result.valid())
+ {
+ if(!result->loadState(kwl, prefix))
+ {
+ result = 0;
+ }
+ }
+ }
+
+ return result.release();
+}
+
+void ossimGui::OssimObjectFactory::getTypeNameList(std::vector<ossimString>& typeList)const
+{
+ typeList.push_back("ConnectableDisplayObject");
+}
diff --git a/ossimGui/src/ossimGui/OverlayBase.cpp b/ossimGui/src/ossimGui/OverlayBase.cpp
new file mode 100644
index 0000000..1bb85e8
--- /dev/null
+++ b/ossimGui/src/ossimGui/OverlayBase.cpp
@@ -0,0 +1,31 @@
+#include <ossimGui/OverlayBase.h>
+#include <ossimGui/AnnotationItem.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <iostream>
+
+
+ossimGui::OverlayBase::OverlayBase(const ossimString& overlayId, QGraphicsScene* scene)
+: m_scene(scene),
+ m_isActive(false),
+ m_overlayId(overlayId)
+{}
+
+QGraphicsItem* ossimGui::OverlayBase::getItem(const ossimString& id)
+{
+ QGraphicsItem* foundItem = 0;
+
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ ossimString idFromScene = items[i]->data(AnnotationItem::DATA_ITEM_ID).toString().toUtf8().constData();
+ ossimString ovidFromScene = items[i]->data(AnnotationItem::DATA_OVERLAY_ID).toString().toUtf8().constData();
+ if (id == idFromScene && ovidFromScene == m_overlayId)
+ {
+ foundItem = items[i];
+ }
+ }
+
+ return foundItem;
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/PlanetMdiSubWindow.cpp b/ossimGui/src/ossimGui/PlanetMdiSubWindow.cpp
new file mode 100644
index 0000000..91b9425
--- /dev/null
+++ b/ossimGui/src/ossimGui/PlanetMdiSubWindow.cpp
@@ -0,0 +1,908 @@
+#include <ossimGui/PlanetMdiSubWindow.h>
+#include <iostream>
+#include <QtGui/QMenuBar>
+#include <QtGui/QPushButton>
+#include <QtGui/QToolBar>
+#include <QtGui/QToolButton>
+#include <QtGui/QMenu>
+#include <QtGui/QComboBox>
+#include <QtGui/QMdiArea>
+#include <QtGui/QLabel>
+#include <QtGui/QMainWindow>
+#include <QtGui/QStatusBar>
+#include <QtGui/QApplication>
+#include <ossimGui/ImageWidget.h>
+#include <ossimGui/Event.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/imaging/ossimImageRenderer.h>
+#include <ossim/imaging/ossimFilterResampler.h>
+#include <ossim/projection/ossimImageViewTransform.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <ossim/projection/ossimImageViewAffineTransform.h>
+#include <ossim/projection/ossimMapProjection.h>
+#include <ossim/base/ossimAdjustableParameterInterface.h>
+#include <ossim/base/ossimGeoidManager.h>
+#include <ossim/base/ossimEcefPoint.h>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossimGui/BandSelectorEditor.h>
+#include <ossimGui/BrightnessContrastEditor.h>
+#include <ossimGui/HsiRemapperEditor.h>
+#include <ossimGui/HistogramRemapperEditor.h>
+#include <ossimGui/AdjustableParameterEditor.h>
+#include <ossimGui/ExportImageDialog.h>
+#include <ossimPlanet/ossimPlanetGrid.h>
+#include <osgGA/KeySwitchMatrixManipulator>
+#include <ossimPlanet/ossimPlanetLatLonHud.h>
+#include <QtOpenGL/QGLFormat>
+#include <list>
+
+#include <ossim/projection/ossimLlxyProjection.h>
+
+class OSSIMGUI_DLL ossimPlanetChainSetViewVisitor : public ossimTypeNameVisitor
+{
+public:
+ ossimPlanetChainSetViewVisitor(ossimObject* view=0,
+ int visitorType =(VISIT_INPUTS|VISIT_CHILDREN))
+ :ossimTypeNameVisitor("ossimViewInterface", false,visitorType),
+ m_obj(view)
+ {
+ }
+ ossimPlanetChainSetViewVisitor(const ossimPlanetChainSetViewVisitor& src)
+ :ossimTypeNameVisitor(src),
+ m_obj(src.m_obj)
+ {
+ }
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new ossimPlanetChainSetViewVisitor(*this);}
+
+ void setView()
+ {
+ int refreshType = ossimRefreshEvent::REFRESH_NONE;
+ ossim_uint32 nObjects = m_collection.size();
+ bool viewChanged = false;
+ ossim_uint32 collectionIdx = 0;
+
+ if(m_obj.valid())
+ {
+ for(collectionIdx = 0; collectionIdx < nObjects; ++collectionIdx)
+ {
+ ossimViewInterface* viewInterface = getObjectAs<ossimViewInterface>(collectionIdx);
+ ossimPropertyInterface* propertyInterface = getObjectAs<ossimPropertyInterface>(collectionIdx);
+ if(viewInterface)
+ {
+ ossimObject* input = dynamic_cast<ossimObject*>(viewInterface->getView());
+ if(input)
+ {
+ if(!input->isEqualTo(*(m_obj.get())))
+ {
+ refreshType |= ossimRefreshEvent::REFRESH_GEOMETRY;
+ viewInterface->setView(m_obj->dup());
+ }
+ }
+ }
+ if(!m_resamplerType.empty()&&propertyInterface)
+ {
+ if(propertyInterface->getPropertyValueAsString("filter_type") != m_resamplerType)
+ {
+ refreshType |= ossimRefreshEvent::REFRESH_PIXELS;
+ propertyInterface->setProperty("filter_type", m_resamplerType);
+ }
+ }
+ }
+ }
+ if(refreshType!=ossimRefreshEvent::REFRESH_NONE)
+ {
+ ossimRefreshEvent* event = new ossimRefreshEvent();
+
+ if(m_obj.valid())
+ {
+ event->setRefreshType(refreshType);
+ }
+
+ ossimEventVisitor eventVisitor(event);
+
+ for(collectionIdx = 0; collectionIdx < nObjects; ++collectionIdx)
+ {
+ eventVisitor.reset();
+ m_collection[collectionIdx]->accept(eventVisitor);
+ }
+ }
+ }
+ void setGeometry(ossimImageGeometry* obj){m_obj = obj;}
+ void setResamplerType(const ossimString& value){m_resamplerType = value;}
+protected:
+ ossimRefPtr<ossimObject> m_obj;
+ ossimString m_resamplerType;
+
+};
+
+
+class ossimPlanetChainTextureLayer : public ossimPlanetTextureLayer
+{
+public:
+ ossimPlanetChainTextureLayer(ossimImageChain* chain=0)
+ {
+ m_mapProj = new ossimLlxyProjection();
+ m_mapProj->setMetersPerPixel(ossimDpt(20.0,20.0));
+ m_geom = new ossimImageGeometry(0, m_mapProj.get());
+ setChain(chain);
+ }
+ ossimPlanetChainTextureLayer(const ossimPlanetChainTextureLayer& src)
+ {
+
+ }
+ virtual ossimPlanetTextureLayer* dup()const
+ {
+ return new ossimPlanetChainTextureLayer(*this);
+ }
+ virtual ossimPlanetTextureLayer* dupType()const
+ {
+ return new ossimPlanetChainTextureLayer();
+ }
+ virtual ossimString getClassName()const
+ {
+ return "ossimPlanetChainTextureLayer";
+ }
+ virtual ossimPlanetTextureLayerStateCode updateExtents()
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ clearState(ossimPlanetTextureLayerStateCode(ossimPlanetTextureLayer_NO_OVERVIEWS |
+ ossimPlanetTextureLayer_NO_GEOM |
+ ossimPlanetTextureLayer_NO_SOURCE_DATA));
+ theDirtyExtentsFlag = false;
+ ossimTypeNameVisitor visitor("ossimViewInterface");
+ if(m_chain.valid())
+ {
+ m_chain->accept(visitor);
+ ossimVisitor::ListRef& objList= visitor.getObjects();
+ if(!objList.empty())
+ {
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < objList.size();++idx)
+ {
+ ossimConnectableObject* connectable = dynamic_cast<ossimConnectableObject*>(objList[idx].get());
+ if(connectable)
+ {
+ ossimImageSource* isrc = dynamic_cast<ossimImageSource*>(connectable->getInput());
+ if(isrc)
+ {
+ ossim_uint32 levels = isrc->getNumberOfDecimationLevels();
+
+ ossimRefPtr<ossimImageGeometry> geom = isrc->getImageGeometry();
+ if(geom.valid())
+ {
+ ossimDpt metersPerPixel = geom->getMetersPerPixel();
+ ossim_uint32 levels = isrc->getNumberOfDecimationLevels();
+ ossim_uint32 stopLevels = levels;
+ ossim_uint32 levelIdx = 0;
+#if 1
+ for(levelIdx = 0; levelIdx < levels; ++levelIdx)
+ {
+ ossimIrect rect = isrc->getBoundingRect(levelIdx);
+ if((rect.width()>16)||(rect.height()>16))
+ {
+ ++stopLevels;
+ }
+ else
+ {
+ break;
+ }
+ }
+#endif
+
+ ossimGpt ul, ur, lr, ll;
+ geom->getCornerGpts(ul, ur, lr, ll);
+ double minLat = ossim::min(ul.latd(), ossim::min(ur.latd(), ossim::min(lr.latd(), ll.latd())));
+ double minLon = ossim::min(ul.lond(), ossim::min(ur.lond(), ossim::min(lr.lond(), ll.lond())));
+ double maxLat = ossim::max(ul.latd(), ossim::max(ur.latd(), ossim::max(lr.latd(), ll.latd())));
+ double maxLon = ossim::max(ul.lond(), ossim::max(ur.lond(), ossim::max(lr.lond(), ll.lond())));
+ if(idx == 0)
+ {
+ theExtents = new ossimPlanetExtents();
+ theExtents->setMinMaxLatLon(minLat, minLon, maxLat, maxLon);
+ theExtents->setMinMaxScale(metersPerPixel.y,
+ metersPerPixel.y*std::pow(2.0, (double)(stopLevels)));// clamp the zoom out though
+ }
+ else
+ {
+ theExtents->combineMinMaxLatLon(minLat, minLon, maxLat, maxLon);
+ theExtents->combineScale(metersPerPixel.y,
+ metersPerPixel.y*std::pow(2.0, (double)(stopLevels)));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return theStateCode;
+ }
+ virtual void updateStats()const
+ {
+ }
+ virtual void resetStats()const
+ {
+ }
+ ossimScalarType scalarType()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ if(m_chain.valid())
+ {
+ return m_chain->getOutputScalarType();
+ }
+
+ return OSSIM_SCALAR_UNKNOWN;
+ }
+ virtual bool hasTexture(ossim_uint32 width,
+ ossim_uint32 height,
+ const ossimPlanetTerrainTileId& tileId,
+ const ossimPlanetGrid& grid)
+ {
+ if(!getEnableFlag())
+ {
+ return false;
+ }
+ if(theDirtyExtentsFlag)
+ {
+ updateExtents();
+ }
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+
+ osg::Vec2d metersPerPixel;
+ grid.getUnitsPerPixel(metersPerPixel, tileId, width, height, OSSIM_METERS);
+ ossimDpt metersGsd(metersPerPixel[0], metersPerPixel[1]);
+ if(theExtents.valid())
+ {
+ osg::ref_ptr<ossimPlanetExtents> extents = new ossimPlanetExtents;
+ if(grid.convertToGeographicExtents(tileId, *extents, width, height))
+ {
+ if(theExtents->intersectsLatLon(*extents)&&
+ theExtents->intersectsScale(*extents))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ virtual osg::ref_ptr<ossimPlanetImage> getTexture(ossim_uint32 width,
+ ossim_uint32 height,
+ const ossimPlanetTerrainTileId& tileId,
+ const ossimPlanetGrid& grid,
+ ossim_int32 padding=0)
+ {
+ if(theDirtyExtentsFlag)
+ {
+ updateExtents();
+ }
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ osg::ref_ptr<ossimPlanetImage> result;
+ osg::ref_ptr<ossimPlanetExtents> tileExtents = new ossimPlanetExtents;
+ if(m_chain.valid())
+ {
+ if(grid.convertToGeographicExtents(tileId, *tileExtents, width, height))
+ {
+ if(theExtents.valid())
+ {
+ if(!theExtents->intersectsLatLon(*tileExtents))
+ {
+ return 0;
+ }
+ }
+ }
+ }
+ else
+ {
+ return result;
+ }
+ osg::Vec2d unitsPerPixel;
+ osg::Vec2d metersPerPixel;
+ grid.getUnitsPerPixel(unitsPerPixel, tileId, width, height, OSSIM_DEGREES);
+ grid.getUnitsPerPixel(metersPerPixel, tileId, width, height, OSSIM_METERS);
+ ossimDpt gsd(unitsPerPixel[0], unitsPerPixel[1]);
+ ossimDpt metersGsd(metersPerPixel[0], metersPerPixel[1]);
+ osg::Vec2d deltaXY;
+ grid.widthHeightInModelSpace(tileId, deltaXY);
+
+
+ if(metersGsd.y < theExtents->getMaxScale())
+ {
+ if(!grid.isPolar(tileId))
+ {
+ // ossimDpt ul;
+ // m_mapProj->worldToLineSample(ossimGpt(tileExtents->getMaxLat(), tileExtents->getMinLon()), ul);
+ // ossimDrect requestRect(ul.x, ul.y,
+ // ul.x+width-1,
+ // ul.y+height-1);
+ ossimIrect requestRect(0,
+ 0,
+ width-1,
+ height-1);
+ // theProjection->setDecimalDegreesPerPixel(ossimDpt(deltaLon,
+ // deltaLat));
+ m_mapProj->setDecimalDegreesPerPixel(ossimDpt(gsd.x,gsd.y));
+ m_mapProj->setUlTiePoints(ossimGpt(tileExtents->getMaxLat()-(gsd.y*.5),
+ tileExtents->getMinLon()+(gsd.x*.5)));
+ m_mapProj->update();
+ ossimPlanetChainSetViewVisitor visitor(m_geom.get());
+ visitor.setResamplerType(getFilterTypeAsString());
+ m_chain->accept(visitor);
+ visitor.setView();
+ ossimRefPtr<ossimImageData> data;
+ data = m_chain->getTile(requestRect);
+
+ if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus()!=OSSIM_EMPTY))
+ {
+ result = new ossimPlanetImage(tileId);
+ convertToOsg(data.get(), result.get());
+ result->flipVertical();
+ }
+ }
+ else
+ {
+ // std::cout << "________________________" << std::endl;
+ ossimPlanetGrid::ModelPoints modelPoints;
+ grid.createModelPoints(tileId,
+ width,
+ height,
+ modelPoints);
+
+ //std::cout << "NEW WAY" << std::endl;
+ std::vector<osg::Vec2d> minMaxPairs;
+ grid.getInternationalDateLineCrossings(tileId, minMaxPairs);
+ ossim_uint32 size = minMaxPairs.size();
+ ossim_uint32 idx = 0;
+ double maxLon=0.0, minLon=0.0, maxLat=tileExtents->getMaxLat(), minLat=tileExtents->getMinLat();
+ for(idx = 0; idx < size; ++idx)
+ {
+ minLon = minMaxPairs[idx][0];
+ maxLon = minMaxPairs[idx][1];
+
+ ossim_uint32 dx = (ossim_uint32)(((maxLon-minLon)/gsd.x));//+.5);
+ ossim_uint32 dy = (ossim_uint32)(((maxLat-minLat)/gsd.y));//+.5);
+ ossimIrect requestRect(0,
+ 0,
+ dx-1,
+ dy-1);
+ ossimRefPtr<ossimImageData> data;
+
+ ossim_float32 tiles = (double)requestRect.width()/(double)width;
+ ossim_uint32 nTiles = floor((double)requestRect.width()/(double)width);
+ ossim_float32 residualTile = tiles - nTiles;
+ ossim_uint32 tileX = 0;
+ m_mapProj->setDecimalDegreesPerPixel(gsd);
+ m_mapProj->update();
+#if 0
+ theProjection->setUlTiePoints(ossimGpt(maxLat-(gsd.y*.5),
+ minLon+(gsd.x*.5)));
+ ossimPlanetChainSetViewVisitor visitor(m_geom.get());
+ visitor.setResamplerType(getFilterTypeAsString());
+ m_chain->accept(visitor);
+ visitor.setView();
+ data = m_chain->getTile(requestRect);
+ theChain->initialize();
+ if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus()!=OSSIM_EMPTY))
+ {
+ addBytesTransferredStat(data->getSizeInBytes());
+ if(!texture.valid())
+ {
+ texture = new ossimPlanetImage(tileId);
+ }
+
+ convertToOsg(data.get(),
+ texture.get(),
+ osg::Vec2d(minLon,
+ maxLat),
+ osg::Vec2d(maxLon,//deltaLon,
+ maxLat),
+ osg::Vec2d(maxLon,//deltaLon,
+ minLat),//deltaLat),
+ osg::Vec2d(minLon,
+ minLat),//deltaLat),
+ modelPoints,
+ width,
+ height);
+
+ }
+#else
+ for(tileX = 0; tileX < nTiles; ++tileX)
+ {
+ ossimIpt origin(tileX*width, 0);
+ ossimIrect tempRect(0, 0, width - 1, dy-1);
+
+ double tempMinLon = minLon + gsd.x*(origin.x);
+ double tempMaxLon = tempMinLon + gsd.x*width;
+ m_mapProj->setUlTiePoints(ossimGpt(maxLat-(gsd.y*.5),
+ tempMinLon+(gsd.x*.5)));
+ ossimPlanetChainSetViewVisitor visitor(m_geom.get());
+ visitor.setResamplerType(getFilterTypeAsString());
+ m_chain->accept(visitor);
+ visitor.setView();
+ data = m_chain->getTile(tempRect);
+ if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus()!=OSSIM_EMPTY))
+ {
+ if(!result.valid())
+ {
+ result = new ossimPlanetImage(tileId);
+ }
+
+ convertToOsg(data.get(),
+ result.get(),
+ osg::Vec2d(tempMinLon,
+ maxLat),
+ osg::Vec2d(tempMaxLon,//deltaLon,
+ maxLat),
+ osg::Vec2d(tempMaxLon,//deltaLon,
+ minLat),//deltaLat),
+ osg::Vec2d(tempMinLon,
+ minLat),//deltaLat),
+ modelPoints,
+ width,
+ height);
+
+ }
+ data = 0;
+ }
+ if(residualTile > FLT_EPSILON)
+ {
+ ossim_uint32 w = (residualTile*width);
+ ossimIpt origin(nTiles*width, 0);
+ ossimIrect tempRect(0, 0, w - 1, dy-1);
+ double tempMinLon = minLon + gsd.x*(origin.x);
+ double tempMaxLon = maxLon;
+ m_mapProj->setUlTiePoints(ossimGpt(maxLat,//-(deltaLat*.5),
+ tempMinLon));//+(deltaLon*.5)));
+ ossimPlanetChainSetViewVisitor visitor(m_geom.get());
+ visitor.setResamplerType(getFilterTypeAsString());
+ m_chain->accept(visitor);
+ visitor.setView();
+ data = m_chain->getTile(tempRect);
+ if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus()!=OSSIM_EMPTY))
+ {
+ if(!result.valid())
+ {
+ result = new ossimPlanetImage(tileId);
+ if(result->data())
+ {
+ memset(result->data(), '\0', result->getWidth()*result->getHeight()*4);
+ }
+ }
+
+ convertToOsg(data.get(),
+ result.get(),
+ osg::Vec2d(tempMinLon,
+ maxLat),
+ osg::Vec2d(tempMaxLon,//deltaLon,
+ maxLat),
+ osg::Vec2d(tempMaxLon,//deltaLon,
+ minLat),//deltaLat),
+ osg::Vec2d(tempMinLon,
+ minLat),//deltaLat),
+ modelPoints,
+ width,
+ height);
+
+ }
+ data = 0;
+ }
+#endif
+ }
+ }
+ }
+
+ return result;
+ }
+ virtual osg::ref_ptr<ossimPlanetImage> getTexture(ossim_uint32 level,
+ ossim_uint64 row,
+ ossim_uint64 col,
+ const ossimPlanetGridUtility& utility)
+ {
+ osg::ref_ptr<ossimPlanetImage> result;
+ return result;
+ }
+ bool setChain(ossimImageChain* connectable)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ m_chain = connectable;
+ if(m_chain.valid())
+ {
+ ossimPlanetChainSetViewVisitor visitor(m_geom.get());
+ m_chain->accept(visitor);
+ visitor.setView();
+
+ dirtyExtents();
+ }
+ return true;
+ }
+
+ ossimImageChain* chain(){return m_chain.get();}
+ const ossimImageChain* chain()const{return m_chain.get();}
+
+ virtual double getApproximateHypotneusLength()const
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ ossimGpt p1(theExtents->getMinLat(), theExtents->getMinLon());
+ ossimGpt p2(theExtents->getMaxLat(), theExtents->getMaxLon());
+ ossimEcefPoint ep1(p1);
+ ossimEcefPoint ep2(p2);
+
+ return (ep2-ep1).length();
+ }
+ virtual void getCenterLatLonLength(double& centerLat,
+ double& centerLon,
+ double& length)const
+ {
+ centerLat = ossim::nan();
+ centerLon = ossim::nan();
+ length = ossim::nan();
+ }
+ void setFilterType(const ossimString& filterType)
+ {
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_chainTextureLayerMutex);
+ if(m_chain.valid())
+ {
+ ossimPlanetChainSetViewVisitor visitor;
+ ossimPlanetTextureLayer::setFilterType(filterType);
+ visitor.setResamplerType(filterType);
+ if(m_chain.valid())
+ {
+ m_chain->accept(visitor);
+ visitor.setView();
+ }
+ }
+ }
+
+protected:
+ ossimRefPtr<ossimImageChain> m_chain;
+ ossimRefPtr<ossimMapProjection> m_mapProj;
+ ossimRefPtr<ossimImageGeometry> m_geom;
+
+ mutable OpenThreads::Mutex m_chainTextureLayerMutex;
+};
+
+
+class ossimPlanetCopyToChainVisitor : public ossimVisitor
+{
+public:
+ typedef std::vector<ossimConnectableObject* > ListType;
+ ossimPlanetCopyToChainVisitor():ossimVisitor(ossimVisitor::VISIT_INPUTS)
+ {
+ }
+ ossimPlanetCopyToChainVisitor(const ossimPlanetCopyToChainVisitor& src)
+ :m_list(src.m_list)
+ {
+
+ }
+ virtual ossimRefPtr<ossimVisitor> dup()const{return new ossimPlanetCopyToChainVisitor(*this);}
+ void reset()
+ {
+ m_list.clear();
+ }
+ virtual void visit(ossimConnectableObject* obj)
+ {
+ if(!hasVisited(obj))
+ {
+ ossimVisitor::visit(obj);
+ m_list.push_back(obj);
+ }
+ }
+ ListType& list(){return m_list;}
+ const ListType& list()const{return m_list;}
+
+ ossimImageChain* copyToChain()const
+ {
+ ossimRefPtr<ossimImageChain> result;
+ ListType l = m_list;
+ if(!l.empty())
+ {
+ ossimString prefix;
+ ossim_uint32 objIdx = 0;
+ ossimKeywordlist kwl;
+ kwl.add("type", "ossimImageChain");
+
+ ossimRefPtr<ossimScalarRemapper> scalarRemapper = new ossimScalarRemapper();
+ while(!l.empty())
+ {
+ prefix = "object" + ossimString::toString(objIdx) + ".";
+ ossimRefPtr<ossimConnectableObject> obj = l.back();
+ l.pop_back();
+ obj->saveState(kwl, prefix);
+ ++objIdx;
+ }
+ scalarRemapper->connectMyInputTo(m_list[0]);
+ prefix = "object" + ossimString::toString(objIdx) + ".";
+ scalarRemapper->saveState(kwl, prefix.c_str());
+ result = new ossimImageChain();
+ // std::cout << kwl << std::endl;
+ if(!result->loadState(kwl))
+ {
+ result = 0;
+ }
+ else
+ {
+ result->initialize();
+ }
+ }
+
+ return result.release();
+ }
+
+protected:
+ mutable ListType m_list;
+};
+
+namespace ossimGui
+{
+ PlanetMdiSubWindow::PlanetMdiSubWindow( QWidget * parent, Qt::WindowFlags flags)
+ :MdiSubWindowBase(parent, flags)
+ {
+ m_inputListener = new InputListener(this);
+ m_connectableObject = new ConnectableDisplayObject(this);
+ m_connectableObject->addListener(m_inputListener);
+ setGeometry(0,0,512,512);
+ setMinimumSize(QSize(64,64));
+
+ QGLFormat format;
+#if (defined(Q_WS_MAC) || defined(Q_WS_WIN))
+ format.setSwapInterval(1);
+#else
+ if(format.swapInterval() >= 0)
+ {
+ format.setSwapInterval(1);
+ }
+#endif
+ format.setOverlay(false);
+
+#if 1
+ m_planetViewer = new GlViewer(format, this);
+ //m_builder = new ossimPlanetViewMatrixBuilder();
+ //m_builder->setLookAxis(ossimPlanetViewMatrixBuilder::LOOK_AXIS_NEGATIVE_Z);
+ // m_builder->setLookAxis(ossimPlanetViewMatrixBuilder::LOOK_AXIS_NEGATIVE_Y);
+ //m_imageScrollWidget->setConnectableObject(static_cast<ConnectableImageObject*>(m_connectableObject.get()));
+ setWidget(m_planetViewer);
+ ossimPlanetViewer* viewer = new ossimPlanetViewer;
+ viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
+ m_planetViewer->setViewer(viewer);
+ m_planetViewer->setFocusPolicy(Qt::StrongFocus);
+ m_planetViewer->setMouseTracking(true);
+ ossimRefPtr<ossimPlanet> planet = new ossimPlanet;
+ ossimRefPtr<ossimPlanetTerrain> terrain = new ossimPlanetTerrain();
+ terrain->initElevation();
+ osg::ref_ptr<ossimPlanetGrid> grid = new ossimPlanetAdjustableCubeGrid(ossimPlanetAdjustableCubeGrid::MEDIUM_CAP);
+ terrain->setGrid(grid.get());
+ terrain->setElevationDensityType(ossimPlanetTerrain::MEDIUM_LOW_ELEVATION_DENSITY);
+ m_textureLayers = new ossimPlanetTextureLayerGroup();
+ m_textureLayers->setBackgroundColor(osg::Vec4f(1.0,1.0,1.0,1.0));
+ m_textureLayers->setFillNullOrEmptyTileMaxLevel(0);
+ m_textureLayers->setFillTranslucentPixelsWithBackground(true);
+ terrain->setTextureLayer(0,m_textureLayers.get());
+ ossimRefPtr<ossimPlanetMemoryImageCache> cache = new ossimPlanetMemoryImageCache;
+ cache->setMinMaxCacheSizeInMegaBytes(16, 20);
+ terrain->setElevationMemoryCache(cache.get());
+ ossimRefPtr<ossimPlanetLatLonHud> hudLayer = new ossimPlanetLatLonHud;
+
+ planet->addChild(terrain.get());
+ planet->addChild(hudLayer.get());
+
+ m_manipulator = new ossimPlanetManipulator();
+ m_planetViewer->viewer()->setCameraManipulator(m_manipulator.get());
+ // osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
+ //keyswitchManipulator->addMatrixManipulator( '1', "Standard", m_manipulator.get() );
+ //m_planetViewer->viewer()->setCameraManipulator(keyswitchManipulator.get());
+ m_planetViewer->viewer()->addEventHandler( new osgGA::StateSetManipulator(m_planetViewer->viewer()->getCamera()->getOrCreateStateSet()) );
+ m_planetViewer->viewer()->addEventHandler(new osgViewer::StatsHandler);
+
+ m_planetViewer->viewer()->setSceneData(planet.get());
+ //m_builder->setGeoRefModel(m_planetViewer->viewer()->planet()->model().get());
+#if 0
+ m_planetViewer->setMouseTracking(true);
+ // tabWidget->setContentsMargins(0, 0, 0, 0);
+ m_planetViewer->setFocusPolicy(Qt::StrongFocus);
+ ossimRefPtr<ossimPlanet> planet = new ossimPlanet;
+ //thePlanet->setupDefaults();
+
+ ossimRefPtr<ossimPlanetLatLonHud> hudLayer = new ossimPlanetLatLonHud;
+ hudLayer->setAutoUpdateFlag(true);
+
+ ossimRefPtr<ossimPlanetSousaLayer> sousaLayer = new ossimPlanetSousaLayer;
+ ossimRefPtr<ossimPlanetAnnotationLayer> annotationLayer = new ossimPlanetAnnotationLayer;
+
+
+
+ ossimRefPtr<ossimPlanetTerrain> terrain = new ossimPlanetTerrain();
+ terrain->initElevation();
+ osg::ref_ptr<ossimPlanetGrid> grid = new ossimPlanetAdjustableCubeGrid(ossimPlanetAdjustableCubeGrid::MEDIUM_CAP);
+ terrain->setGrid(grid.get());
+ terrain->setElevationDensityType(ossimPlanetTerrain::MEDIUM_LOW_ELEVATION_DENSITY);
+ ossimRefPtr<ossimPlanetMemoryImageCache> cache = new ossimPlanetMemoryImageCache;
+ cache->setMinMaxCacheSizeInMegaBytes(16, 20);
+ terrain->setElevationMemoryCache(cache.get());
+ planet->addChild(terrain.get());
+ planet->addChild(annotationLayer.get());
+ planet->addChild(sousaLayer.get());
+ planet->addChild(hudLayer.get());
+
+ ossimRefPtr<ossimPlanetManipulator> manipulator = new ossimPlanetManipulator();
+ m_manipulator->viewMatrixBuilder()->setLookAxis(ossimPlanetViewMatrixBuilder::LOOK_AXIS_Z);
+
+ //osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
+ // keyswitchManipulator->addMatrixManipulator( '1', "Standard", manipulator.get() );
+ // keyswitchManipulator->addMatrixManipulator( '2', "Trackball", new osgGA::TrackballManipulator() );
+ // keyswitchManipulator->addMatrixManipulator( '3', "Flight", new osgGA::FlightManipulator() );
+ // keyswitchManipulator->addMatrixManipulator( '4', "Drive", new osgGA::DriveManipulator() );
+ // keyswitchManipulator->addMatrixManipulator( '5', "Terrain", new osgGA::TerrainManipulator() );
+ m_planetViewer->viewer()->setCameraManipulator(m_planetViewer.get());
+ m_planetViewer->viewer()->addEventHandler( new osgGA::StateSetManipulator(m_planetViewer->viewer()->getCamera()->getOrCreateStateSet()) );
+ m_planetViewer->viewer()->addEventHandler(new osgViewer::StatsHandler);
+ m_planetViewer->viewer()->removeEphemeris();
+
+ m_planetViewer->viewer()->setSceneData(planet.get());
+ // m_planetViewer->viewer()->addCallback(theViewerCallback.get());
+
+ m_planetViewer->viewer()->terrainLayer()->setNumberOfTextureLayers(1);
+#endif
+#endif
+ //setAttribute(Qt::WA_DeleteOnClose);
+ connect(this, SIGNAL(windowStateChanged ( Qt::WindowStates , Qt::WindowStates )),this, SLOT(stateChanged(Qt::WindowStates , Qt::WindowStates)));
+ }
+
+ PlanetMdiSubWindow::~PlanetMdiSubWindow()
+ {
+ // std::cout << "PlanetMdiSubWindow::~PlanetMdiSubWindow()" << std::endl;
+ m_planetViewer->viewer()->setSceneData(0);
+ if(m_inputListener)
+ {
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->removeListener(m_inputListener);
+ }
+ delete m_inputListener;
+ m_inputListener = 0;
+ }
+ }
+
+ void PlanetMdiSubWindow::setConnectableObject(ConnectableObject* connectable)
+ {
+ if(m_connectableObject.valid())
+ {
+ m_connectableObject->removeListener(m_inputListener);
+ }
+ m_connectableObject = connectable;
+ }
+
+ void PlanetMdiSubWindow::stateChanged( Qt::WindowStates oldState, Qt::WindowStates newState)
+ {
+ if((oldState == Qt::WindowNoState) && (newState & Qt::WindowActive))
+ {
+ }
+ else if(newState == Qt::WindowNoState)
+ {
+ }
+ }
+
+ void PlanetMdiSubWindow::syncView(View& viewInfo)
+ {
+ // std::cout << "ossimGui::PlanetMdiSubWindow::syncView(View& viewInfo)" << std::endl;
+ }
+
+
+ void PlanetMdiSubWindow::sync(View& view)
+ {
+ // std::cout << "ossimGui::PlanetMdiSubWindow::sync" << std::endl;
+ ossimGpt oldCenter;
+
+ oldCenter.makeNan();
+
+ ossimRefPtr<ossimImageGeometry> geom = view.geometry();
+ int syncType = view.syncType();
+
+ if((syncType&View::SYNC_TYPE_POSITION)||
+ (syncType&View::SYNC_TYPE_GEOM))
+ {
+ ossimGpt referencePosition = view.lookPositionAsGpt();
+ if(!referencePosition.isLatNan()&&
+ !referencePosition.isLonNan())
+ {
+ const ossimPlanetLookAt* lookAt = m_planetViewer->viewer()->currentLookAt();
+ if(lookAt)
+ {
+ referencePosition.height( ossimElevManager::instance()->getHeightAboveEllipsoid(referencePosition));
+ if(referencePosition.isHgtNan()) referencePosition.height(0.0);
+ osg::ref_ptr<ossimPlanetLookAt> lookAtTarget = new ossimPlanetLookAt(referencePosition.latd(),
+ referencePosition.lond(),
+ referencePosition.height(),
+ lookAt->heading(),
+ lookAt->pitch(),
+ 0.0,
+ lookAt->range(),
+ ossimPlanetAltitudeMode_ABSOLUTE);
+ m_manipulator->navigator()->gotoLookAt(*lookAtTarget.get(), false);
+
+ m_planetViewer->viewer()->requestRedraw();
+ }
+
+ }
+ }
+ }
+
+
+ //void ossimGui::PlanetMdiSubWindow::ContainerListener::containerEvent(ossimContainerEvent& /* event */)
+ //{
+ // QApplication::postEvent(m_window, new QEvent((QEvent::Type)ossimGui::WINDOW_REFRESH_ACTIONS_EVENT_ID));
+ //}
+ void PlanetMdiSubWindow::closeEvent ( QCloseEvent * event )
+ {
+ event->accept();
+ }
+
+ bool PlanetMdiSubWindow::event(QEvent* evt)
+ {
+ switch(evt->type())
+ {
+ case ossimGui::WINDOW_REFRESH_ACTIONS_EVENT_ID:
+ {
+ if(windowState()&Qt::WindowActive)
+ {
+ }
+ return true;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ return MdiSubWindowBase::event(evt);
+ }
+
+
+
+ void PlanetMdiSubWindow::InputListener::disconnectInputEvent(ossimConnectionEvent& event )
+ {
+ ossim_uint32 nObjects = event.getNumberOfOldObjects();
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nObjects; ++idx)
+ {
+ ossimRefPtr<ossimConnectableObject> connectable = event.getOldObject(idx);
+ PlanetMdiSubWindow::ChainToTextureType::iterator iter = m_window->m_chainToTextureMap.find(connectable.get());
+ if(iter!= m_window->m_chainToTextureMap.end())
+ {
+ m_window->m_textureLayers->removeLayer(iter->second);
+ m_window->m_chainToTextureMap.erase(iter);
+ }
+ }
+ }
+
+ void PlanetMdiSubWindow::InputListener::connectInputEvent(ossimConnectionEvent& event)
+ {
+
+ ossim_uint32 nObjects = event.getNumberOfNewObjects();
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < nObjects; ++idx)
+ {
+ ossimRefPtr<ossimConnectableObject> connectable = event.getNewObject(idx);
+ if(connectable.valid())
+ {
+ ossim_int32 inputIdx = m_window->connectableObject()->findInputIndex(connectable.get());
+ bool alreadyAdded = m_window->m_chainToTextureMap.find(connectable.get())!=m_window->m_chainToTextureMap.end();
+ if((inputIdx >= 0)&&(!alreadyAdded))
+ {
+ ossimPlanetCopyToChainVisitor copyVisitor;
+ connectable->accept(copyVisitor);
+
+ ossimRefPtr<ossimImageChain> chain = copyVisitor.copyToChain();
+ if(chain.valid())
+ {
+ ossimPlanetChainTextureLayer* textureLayer = new ossimPlanetChainTextureLayer(chain.get());
+
+ m_window->m_textureLayers->addAfterIdx(inputIdx-1, textureLayer);
+
+ m_window->m_chainToTextureMap.insert(std::make_pair(connectable.get(), textureLayer));
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/ossimGui/src/ossimGui/PolygonRemapperDialog.cpp b/ossimGui/src/ossimGui/PolygonRemapperDialog.cpp
new file mode 100644
index 0000000..7000032
--- /dev/null
+++ b/ossimGui/src/ossimGui/PolygonRemapperDialog.cpp
@@ -0,0 +1,375 @@
+//----------------------------------------------------------------------------
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for simple text data, e.g. position information.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#include <ossimGui/PolygonRemapperDialog.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossim/base/ossimCommon.h>
+#include <ossim/base/ossimDms.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimDrect.h>
+#include <ossim/base/ossimEllipsoid.h>
+#include <ossim/base/ossimEllipsoidFactory.h>
+#include <ossim/base/ossimGeoidManager.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimUsgsQuad.h>
+#include <ossim/base/ossimVisitor.h>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossim/imaging/ossimImageRenderer.h>
+#include <ossim/imaging/ossimGeoPolyCutter.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <ossim/projection/ossimMgrs.h>
+#include <ossim/projection/ossimUtmProjection.h>
+
+#include <QMessageBox>
+#include <QString>
+#include <QTextEdit>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QCheckBox>
+#include <QTableWidget>
+#include <QStringList>
+#include <QHeaderView>
+#include <QListWidget>
+#include <QWidget>
+#include <QApplication>
+#include <QMouseEvent>
+#include <QLineEdit>
+#include <QLabel>
+
+#include <cstring>
+#include <iomanip>
+#include <sstream>
+#include <vector>
+
+ossimGui::PolygonRemapperDialog::PolygonRemapperDialog(QWidget* parent, Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ m_textEdit( new QTextEdit() ),
+ m_widget(0),
+ m_polyCutter(0),
+ m_addPolygonBt(0),
+ m_enableDisableCb(0),
+ m_toggleCutTypeCb(0),
+ m_fillValueLe(0),
+ m_setfillBt(0),
+ m_polygon(0),
+ m_mode(ossimGui::PolygonRemapperDialog::UNKNOWN)
+{
+ // set title in Polygon Remapper Dialog
+ this->setWindowTitle("Polygon Remapper");
+
+ // setup vertical layout
+ QVBoxLayout* vbox = new QVBoxLayout();
+ QHBoxLayout* hbox = new QHBoxLayout();
+
+ // setup button for adding polygons
+ m_addPolygonBt = new QPushButton("Add Polygon", this);
+ vbox->addWidget(m_addPolygonBt);
+ vbox->addSpacing(10);
+ connect(m_addPolygonBt, SIGNAL(clicked(bool)), this, SLOT(getPolyPoint()));
+
+ // setup checkbox for enabling / disabling polycutter
+ m_enableDisableCb = new QCheckBox("Enable/Disable Polycutter", this);
+ m_enableDisableCb->setCheckState(Qt::Checked);
+ vbox->addWidget(m_enableDisableCb);
+ vbox->addSpacing(10);
+ connect(m_enableDisableCb, SIGNAL(clicked(bool)), this, SLOT(toggleEnableDisable()));
+
+ // setup checkbox for nulling inside / outside polygon
+ m_toggleCutTypeCb = new QCheckBox("Null Inside Polygon", this);
+ m_toggleCutTypeCb->setCheckState(Qt::Checked);
+ m_toggleCutTypeCb->setEnabled(false);
+ vbox->addWidget(m_toggleCutTypeCb);
+ vbox->addSpacing(10);
+ connect(m_toggleCutTypeCb, SIGNAL(clicked(bool)), this, SLOT(toggleCutType()));
+
+ // setup fill value polycutter
+ QLabel *m_fillValueLb = new QLabel(tr("Fill Value:"));
+ m_fillValueLe = new QLineEdit(this);
+ m_fillValueLe->setFixedSize(60, 20);
+ m_setfillBt = new QPushButton("Set Fill", this);
+ hbox->addWidget(m_fillValueLb);
+ hbox->addWidget(m_fillValueLe);
+ hbox->addWidget(m_setfillBt);
+ vbox->addLayout(hbox);
+ connect(m_setfillBt, SIGNAL(clicked(bool)), this, SLOT(setFillType()));
+
+ setLayout(vbox);
+}
+
+void ossimGui::PolygonRemapperDialog::setFillType()
+{
+ // set the fill type here
+}
+
+void ossimGui::PolygonRemapperDialog::toggleEnableDisable()
+{
+ if ( m_polyCutter.valid() && m_enableDisableCb )
+ {
+ bool oldState = m_polyCutter->getEnableFlag();
+ bool newState = m_enableDisableCb->isChecked();
+ if ( oldState != newState )
+ {
+ m_polyCutter->setEnableFlag( newState );
+ fireRefreshEvent();
+ }
+ }
+}
+
+void ossimGui::PolygonRemapperDialog::toggleCutType()
+{
+ if ( m_polyCutter.valid() && m_toggleCutTypeCb )
+ {
+ ossimGeoPolyCutter::ossimPolyCutterCutType oldType = m_polyCutter->getCutType();
+
+ // Checked == inside:
+ ossimGeoPolyCutter::ossimPolyCutterCutType newType =
+ ( m_toggleCutTypeCb->isChecked() ? ossimGeoPolyCutter::OSSIM_POLY_NULL_INSIDE :
+ ossimGeoPolyCutter::OSSIM_POLY_NULL_OUTSIDE );
+
+ if ( oldType != newType )
+ {
+ m_polyCutter->setCutType( newType );
+ fireRefreshEvent();
+ }
+ }
+}
+
+void ossimGui::PolygonRemapperDialog::getPolyPoint( )
+{
+ m_addPolygonBt->setEnabled(false);
+ m_toggleCutTypeCb->setEnabled(true);
+
+ m_polygon.clear();
+ m_mode = ossimGui::PolygonRemapperDialog::ACCEPTING_POINTS;
+
+
+ QString caption("Usage:");
+ QString text = "Left click to drop points, right click on final point.";
+ QMessageBox::warning( this,
+ caption,
+ text,
+ QMessageBox::Ok,
+ Qt::NoButton);
+
+}
+
+void ossimGui::PolygonRemapperDialog::mousePress(QMouseEvent* e, const ossimDpt& scenePt)
+{
+ if( e && (m_mode == ACCEPTING_POINTS) )
+ {
+ ossimRefPtr<ossimImageGeometry> geom = m_widget->getGeometry();
+ if( geom.valid() && geom->getProjection() )
+ {
+ ossimGpt worldPt;
+ geom->localToWorld( scenePt, worldPt );
+
+ if( e->buttons() & Qt::LeftButton )
+ {
+ m_polygon.push_back (worldPt);
+ }
+ else if(e->buttons() & Qt::RightButton)
+ //if(e->modifiers() == Qt::ShiftModifier)
+ {
+ m_polygon.push_back( worldPt );
+ m_polygon.push_back( m_polygon[0] );
+
+ if(m_polyCutter.valid())
+ {
+ m_polyCutter->addPolygon(m_polygon);
+ m_addPolygonBt->setEnabled(true);
+ m_polygon.clear();
+ m_mode = ossimGui::PolygonRemapperDialog::UNKNOWN;
+ fireRefreshEvent();
+ }
+ }
+ }
+ }
+
+} // End: PolygonRemapperDialog::mousePress(...)
+
+void ossimGui::PolygonRemapperDialog::setPolyCutter( ossimGeoPolyCutter* polygon )
+{
+ m_polyCutter = polygon;
+}
+
+void ossimGui::PolygonRemapperDialog::setWidget(ossimGui::ImageScrollView* widget)
+{
+ m_widget = widget;
+}
+
+void ossimGui::PolygonRemapperDialog::track( const ossimDpt& /* scenePt */ )
+{
+#if 0
+ std::ostringstream os;
+ os << setiosflags(ios::fixed) << setiosflags(ios::left)
+ << setw(12) << "scene:";
+ scenePt.print(os, 2);
+
+ if ( m_widget )
+ {
+ ossimDpt imagePt;
+ sceneToImage( scenePt, imagePt );
+ ConnectableImageObject* inputConnection = m_widget->connectableObject();
+ if ( !imagePt.hasNans() )
+ {
+ os << setw(12) << "\nimage:";
+ imagePt.print(os, 2);
+ }
+
+ ossimRefPtr<ossimImageGeometry> geom = m_widget->getGeometry();
+ if ( geom.valid() )
+ {
+ if ( geom->getProjection() )
+ {
+ ossimGpt worldPt;
+ geom->localToWorld( scenePt, worldPt );
+
+ ossimDms latDms( worldPt.latd() );
+ ossimDms lonDms( worldPt.lond(), false );
+
+ os << setw(12) << "\nLat:"
+ << latDms.toString("dd at mm'ss.ssss\" C").c_str()
+ << setw(12) << "\nLon:"
+ << lonDms.toString("ddd at mm'ss.ssss\" C").c_str()
+ << setprecision(15) << setw(12)
+ << "\nLat:" << worldPt.latd()
+ << setw(12)
+ << "\nLon:" << worldPt.lond();
+
+ ossimUtmProjection utm( *ossimEllipsoidFactory::instance()->wgs84(),
+ worldPt );
+ long zone = utm.getZone();
+ char hemisphere = utm.getHemisphere();
+ ossimDpt eastingNorthing = utm.forward( worldPt );
+
+ os << setiosflags(ios::left) << setw(12)
+ << "\nUTM zone:" << utm.getZone();
+
+ if(!eastingNorthing.hasNans())
+ {
+ os << setprecision(3) << setw(12)
+ << "\nEasting:"
+ << eastingNorthing.x
+ << setw(12)
+ << "\nNorthing:"
+ << eastingNorthing.y;
+
+ char mgrsString[64];
+ std::memset( mgrsString, 0, 64 );
+
+ if ( Convert_UTM_To_OSSIM_MGRS ( zone,
+ hemisphere,
+ eastingNorthing.x,
+ eastingNorthing.y,
+ 5, // precision,
+ mgrsString ) == OSSIM_MGRS_NO_ERROR )
+ {
+ os << setw(12) << "\nMGRS:" << mgrsString;
+ }
+ }
+
+
+ // ossimUsgsQuad quadName(worldPt);
+
+ // os << "\nUSGS Q.Q. name: " << quadName.quarterQuadSegName();
+
+ // os << setiosflags(ios::left) << setw(20) << "x, y:"
+ // << rawImgPt.toString() << std::endl;
+
+ ossim_float64 hgtAboveMsl =
+ ossimElevManager::instance()->getHeightAboveMSL(worldPt);
+ ossim_float64 hgtAboveEllipsoid =
+ ossimElevManager::instance()->getHeightAboveEllipsoid(worldPt);
+ ossim_float64 geoidOffset =
+ ossimGeoidManager::instance()->offsetFromEllipsoid(worldPt);
+
+ os << setw(20) << "\nHeight MSL:";
+ if ( ossim::isnan( hgtAboveMsl ) )
+ {
+ os << "nan";
+ }
+ else
+ {
+ os << hgtAboveMsl;
+ }
+
+ os << setw(20) << "\nHeight above ellipsoid:";
+ if ( ossim::isnan( hgtAboveEllipsoid ) )
+ {
+ os << "nan";
+ }
+ else
+ {
+ os << hgtAboveEllipsoid;
+ }
+
+ os << setw(20) << "\nGeoid offset: ";
+ if ( ossim::isnan( geoidOffset ) )
+ {
+ os << "nan";
+ }
+ else
+ {
+ os << geoidOffset;
+ }
+ }
+ }
+ }
+
+ m_textEdit->setText( QString( os.str().c_str() ) );
+#endif
+}
+
+void ossimGui::PolygonRemapperDialog::sceneToImage(
+ const ossimDpt& scenePt, ossimDpt& imagePt ) const
+{
+ imagePt.makeNan();
+
+ ConnectableImageObject* inputConnection = m_widget->connectableObject();
+ if ( inputConnection )
+ {
+ ossimTypeNameVisitor visitor(ossimString("ossimImageRenderer"),
+ true,
+ ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
+
+ inputConnection->accept(visitor);
+
+ // If there are multiple renderers, e.g. a mosaic do not use.
+ if ( visitor.getObjects().size() == 1 )
+ {
+ ossimRefPtr<ossimImageRenderer> renderer =
+ visitor.getObjectAs<ossimImageRenderer>( 0 );
+
+ if ( renderer.valid() )
+ {
+ ossimRefPtr<ossimImageViewProjectionTransform> trans =
+ PTR_CAST(ossimImageViewProjectionTransform,
+ renderer->getImageViewTransform());
+ if( trans.valid() )
+ {
+ trans->viewToImage(scenePt, imagePt);
+ }
+ }
+ }
+ }
+}
+
+void ossimGui::PolygonRemapperDialog::fireRefreshEvent()
+{
+ if(m_polyCutter.valid())
+ {
+ ossimRefPtr<ossimRefreshEvent> refreshEvent =
+ new ossimRefreshEvent(ossimRefreshEvent::REFRESH_PIXELS);
+ ossimEventVisitor visitor(refreshEvent.get());
+ m_polyCutter->accept(visitor);
+ }
+}
diff --git a/ossimGui/src/ossimGui/PositionInformationDialog.cpp b/ossimGui/src/ossimGui/PositionInformationDialog.cpp
new file mode 100644
index 0000000..3a39214
--- /dev/null
+++ b/ossimGui/src/ossimGui/PositionInformationDialog.cpp
@@ -0,0 +1,235 @@
+//----------------------------------------------------------------------------
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for simple text data, e.g. position information.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#include <ossimGui/PositionInformationDialog.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossim/base/ossimCommon.h>
+#include <ossim/base/ossimDms.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimEllipsoid.h>
+#include <ossim/base/ossimEllipsoidFactory.h>
+#include <ossim/base/ossimGeoidManager.h>
+#include <ossim/base/ossimUsgsQuad.h>
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossim/imaging/ossimImageRenderer.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+#include <ossim/projection/ossimMgrs.h>
+#include <ossim/projection/ossimUtmProjection.h>
+#include <QString>
+#include <QTextEdit>
+#include <QVBoxLayout>
+
+#include <cstring>
+#include <iomanip>
+#include <sstream>
+
+
+ossimGui::PositionInformationDialog::PositionInformationDialog(QWidget* parent, Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ m_textEdit( new QTextEdit() ),
+ m_widget(0)
+{
+ QVBoxLayout* layout = new QVBoxLayout();
+ layout->addWidget( m_textEdit );
+ setLayout( layout );
+
+ // Set defaults:
+ setModal( false ); // non blocking
+ m_textEdit->setReadOnly(true);
+ resize(300,400);
+}
+
+void ossimGui::PositionInformationDialog::setWidget(ossimGui::ImageScrollView* widget)
+{
+ m_widget = widget;
+}
+
+void ossimGui::PositionInformationDialog::track( const ossimDpt& scenePt )
+{
+ std::ostringstream os;
+ os << setiosflags(ios::fixed) << setiosflags(ios::left)
+ << setw(12) << "scene:";
+ scenePt.print(os, 2);
+
+ if ( m_widget )
+ {
+ ossimDpt imagePt;
+ sceneToImage( scenePt, imagePt );
+ if ( !imagePt.hasNans() )
+ {
+ os << setw(12) << "\nimage:";
+ imagePt.print(os, 2);
+ }
+
+ ossimRefPtr<ossimImageGeometry> geom = m_widget->getGeometry();
+ if ( geom.valid() )
+ {
+ if ( geom->getProjection() )
+ {
+ ossimGpt worldPt;
+ geom->localToWorld( scenePt, worldPt );
+
+ ossimDms latDms( worldPt.latd() );
+ ossimDms lonDms( worldPt.lond(), false );
+
+ os << setw(12) << "\nLat:"
+ << latDms.toString("dd at mm'ss.ssss\" C").c_str()
+ << setw(12) << "\nLon:"
+ << lonDms.toString("ddd at mm'ss.ssss\" C").c_str()
+ << setprecision(15) << setw(12)
+ << "\nLat:" << worldPt.latd()
+ << setw(12)
+ << "\nLon:" << worldPt.lond();
+
+ ossimUtmProjection utm( *ossimEllipsoidFactory::instance()->wgs84(),
+ worldPt );
+ long zone = utm.getZone();
+ char hemisphere = utm.getHemisphere();
+ ossimDpt eastingNorthing = utm.forward( worldPt );
+
+ os << setiosflags(ios::left) << setw(12)
+ << "\nUTM zone:" << utm.getZone();
+
+ if(!eastingNorthing.hasNans())
+ {
+ os << setprecision(3) << setw(12)
+ << "\nEasting:"
+ << eastingNorthing.x
+ << setw(12)
+ << "\nNorthing:"
+ << eastingNorthing.y;
+
+ char mgrsString[64];
+ std::memset( mgrsString, 0, 64 );
+
+ if ( Convert_UTM_To_OSSIM_MGRS ( zone,
+ hemisphere,
+ eastingNorthing.x,
+ eastingNorthing.y,
+ 5, // precision,
+ mgrsString ) == OSSIM_MGRS_NO_ERROR )
+ {
+ os << setw(12) << "\nMGRS:" << mgrsString;
+ }
+ }
+
+
+ // ossimUsgsQuad quadName(worldPt);
+
+ // os << "\nUSGS Q.Q. name: " << quadName.quarterQuadSegName();
+
+ // os << setiosflags(ios::left) << setw(20) << "x, y:"
+ // << rawImgPt.toString() << std::endl;
+
+ ossim_float64 hgtAboveMsl =
+ ossimElevManager::instance()->getHeightAboveMSL(worldPt);
+ ossim_float64 hgtAboveEllipsoid =
+ ossimElevManager::instance()->getHeightAboveEllipsoid(worldPt);
+ ossim_float64 geoidOffset =
+ ossimGeoidManager::instance()->offsetFromEllipsoid(worldPt);
+
+ os << setw(20) << "\nHeight MSL:";
+ if ( ossim::isnan( hgtAboveMsl ) )
+ {
+ os << "nan";
+ }
+ else
+ {
+ os << hgtAboveMsl;
+ }
+
+ os << setw(20) << "\nHeight above ellipsoid:";
+ if ( ossim::isnan( hgtAboveEllipsoid ) )
+ {
+ os << "nan";
+ }
+ else
+ {
+ os << hgtAboveEllipsoid;
+ }
+
+ os << setw(20) << "\nGeoid offset: ";
+ if ( ossim::isnan( geoidOffset ) )
+ {
+ os << "nan\n";
+ }
+ else
+ {
+ os << geoidOffset << "\n";
+ }
+ }
+
+ } // Matches: if ( geom.valid() )
+
+ // Get the rbg pixel values sent to the viewport:
+ ossim_uint8 r=0;
+ ossim_uint8 g=0;
+ ossim_uint8 b=0;
+ m_widget->getRgb( ossimIpt(scenePt), r, g, b );
+ os << "rgb( " << int(r) << ", " << int(g) << ", " << int(b) << " )\n";
+
+ //---
+ // Get the raw pixels values from the image. Note this will only work if
+ // a single image chain.
+ //---
+ std::vector<ossim_float64> values;
+ m_widget->getRaw( ossimIpt(imagePt), values );
+ if ( values.size() )
+ {
+ const ossim_uint32 BANDS = values.size();
+ const ossim_uint32 MAX_BANDS_DISPLAYED = ossim::min<ossim_uint32>(BANDS, 16);
+ for ( ossim_uint32 band = 0; band < MAX_BANDS_DISPLAYED; ++band )
+ {
+ os << "raw_image_pixel_value[ " << band << "]: " << values[band] << "\n";
+ }
+ if ( BANDS > MAX_BANDS_DISPLAYED )
+ {
+ os << "raw pixel output clamped to " << MAX_BANDS_DISPLAYED << " bands.\n";
+ }
+ }
+ }
+
+ m_textEdit->setText( QString( os.str().c_str() ) );
+}
+
+
+void ossimGui::PositionInformationDialog::sceneToImage(
+ const ossimDpt& scenePt, ossimDpt& imagePt ) const
+{
+ imagePt.makeNan();
+
+ ConnectableImageObject* inputConnection = m_widget->connectableObject();
+ if ( inputConnection )
+ {
+ ossimTypeNameVisitor visitor(ossimString("ossimImageRenderer"),
+ true,
+ ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
+
+ inputConnection->accept(visitor);
+
+ // If there are multiple renderers, e.g. a mosaic do not use.
+ if ( visitor.getObjects().size() == 1 )
+ {
+ ossimRefPtr<ossimImageRenderer> renderer =
+ visitor.getObjectAs<ossimImageRenderer>( 0 );
+
+ if ( renderer.valid() )
+ {
+ ossimRefPtr<ossimImageViewProjectionTransform> trans =
+ PTR_CAST(ossimImageViewProjectionTransform,
+ renderer->getImageViewTransform());
+ if( trans.valid() )
+ {
+ trans->viewToImage(scenePt, imagePt);
+ }
+ }
+ }
+ }
+}
diff --git a/ossimGui/src/ossimGui/ProcessInterfaceJob.cpp b/ossimGui/src/ossimGui/ProcessInterfaceJob.cpp
new file mode 100644
index 0000000..7fe3546
--- /dev/null
+++ b/ossimGui/src/ossimGui/ProcessInterfaceJob.cpp
@@ -0,0 +1,59 @@
+#include <ossimGui/ProcessInterfaceJob.h>
+#include <ossim/base/ossimListenerManager.h>
+#include <ossim/base/ossimConnectableObject.h>
+
+namespace ossimGui
+{
+ void ProcessInterfaceJob::ProgressListener::processProgressEvent(ossimProcessProgressEvent& event)
+ {
+ if(m_job) m_job->setPercentComplete(event.getPercentComplete());
+ }
+
+ void ProcessInterfaceJob::setState(int value, bool on)
+ {
+ m_processInterfaceMutex.lock();
+ if(value&ossimJob::ossimJob_CANCEL)
+ {
+ if(m_processInterface) m_processInterface->abort();
+ }
+ m_processInterfaceMutex.unlock();
+ ossimJob::setState(value, on);
+ }
+
+ void ProcessInterfaceJob::start()
+ {
+ m_processInterfaceMutex.lock();
+ m_processInterface = dynamic_cast<ossimProcessInterface*> (m_obj.get());
+ if(m_processInterface)
+ {
+ m_processInterfaceMutex.unlock();
+ ProgressListener* listener = new ProgressListener(this);
+ ossimConnectableObject* obj = dynamic_cast<ossimConnectableObject*> (m_obj.get());
+ if(obj)
+ {
+ obj->addListener(listener);
+ }
+ m_processInterface->execute();
+ if(obj)
+ {
+ obj->removeListener(listener);
+ }
+ delete listener; listener = 0;
+ }
+ else
+ {
+ m_processInterfaceMutex.unlock();
+ }
+ }
+ void ProcessInterfaceJob::setPercentComplete(double value)
+ {
+ m_processInterfaceMutex.lock();
+ ossimRefPtr<ossimJobCallback> c = callback();
+ m_processInterfaceMutex.unlock();
+
+ if(c.valid())
+ {
+ c->percentCompleteChanged(value, this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/ProgressDialog.cpp b/ossimGui/src/ossimGui/ProgressDialog.cpp
new file mode 100644
index 0000000..7560f83
--- /dev/null
+++ b/ossimGui/src/ossimGui/ProgressDialog.cpp
@@ -0,0 +1,55 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Description: Dialog box for ProgressWidget.
+//
+//---
+// $Id$
+
+#include <ossimGui/ProgressDialog.h>
+#include <ossimGui/ProgressWidget.h>
+#include <ossim/base/ossimTrace.h>
+
+#include <QVBoxLayout>
+#include <QWidget>
+
+#include <cstring>
+#include <iomanip>
+#include <sstream>
+#include <vector>
+
+static ossimTrace traceDebug("ProgressDialog:debug");
+
+ossimGui::ProgressDialog::ProgressDialog(QWidget* parent, Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ m_widget(0)
+{
+ m_widget = new ossimGui::ProgressWidget(this);
+ m_widget->setValue(0);
+
+ // setup vertical layout
+ QVBoxLayout* vbox0 = new QVBoxLayout();
+
+ vbox0->addWidget( m_widget );
+
+ setLayout( vbox0 );
+}
+
+ossimGui::ProgressDialog::~ProgressDialog()
+{
+ // m_annotator.removeListener((ossimROIEventListener*)this);
+
+ // Pretty sure the widget is parented to "this" and will be deleted in the
+ // QT code. Need to verify...
+
+ // delete m_widget;
+ // m_widget = 0;
+}
+
+ossimGui::ProgressWidget* ossimGui::ProgressDialog::progressWidget()
+{
+ return m_widget;
+}
+
diff --git a/ossimGui/src/ossimGui/ProgressWidget.cpp b/ossimGui/src/ossimGui/ProgressWidget.cpp
new file mode 100644
index 0000000..139c1b9
--- /dev/null
+++ b/ossimGui/src/ossimGui/ProgressWidget.cpp
@@ -0,0 +1,78 @@
+#include <ossimGui/ProgressWidget.h>
+#include <ossimGui/Event.h>
+#include <ossim/base/ossimListenerManager.h>
+#include <QtCore/QEvent>
+#include <QtGui/QApplication>
+
+namespace ossimGui
+{
+ ProgressWidget::ProgressWidget(QWidget* parent)
+ :QProgressBar(parent)
+ {
+ m_listener = new Listener(this);
+ setMaximum(100);
+ setMinimum(0);
+ }
+
+ ProgressWidget::~ProgressWidget()
+ {
+ // cout << "ProgressWidget::~ProgressWidget entered..." << endl;
+ if(m_listener)
+ {
+ removeListener();
+ delete m_listener;
+ m_listener = 0;
+ }
+ }
+
+ void ProgressWidget::setObject(ossimObject* obj)
+ {
+ removeListener();
+ reset();
+ m_object = obj;
+ addListener();
+ }
+
+ void ProgressWidget::removeListener()
+ {
+ ossimListenerManager* manager = dynamic_cast<ossimListenerManager*> (m_object.get());
+ if(manager)
+ {
+ manager->removeListener(m_listener);
+ }
+ }
+ void ProgressWidget::addListener()
+ {
+ ossimListenerManager* manager = dynamic_cast<ossimListenerManager*> (m_object.get());
+ if(manager)
+ {
+ manager->addListener(m_listener);
+ }
+ }
+ bool ProgressWidget::event(QEvent * e )
+ {
+ bool result = false;
+
+ if ( e->type() == (QEvent::Type)PROGRESS_EVENT_ID )
+ {
+ ProgressEvent* evt = dynamic_cast<ProgressEvent*>(e);
+ if(evt)
+ {
+ setValue(static_cast<int>(evt->percentComplete()));
+ e->accept();
+ result = true;
+ }
+ }
+ if ( !result )
+ {
+ result = QProgressBar::event(e);
+ }
+ return result;
+ }
+
+ void ProgressWidget::Listener::processProgressEvent(ossimProcessProgressEvent& event)
+ {
+ QApplication::postEvent(m_widget, new ProgressEvent(event.getPercentComplete()));
+ QApplication::processEvents();
+ }
+}
diff --git a/ossimGui/src/ossimGui/PropertyEditorDialog.cpp b/ossimGui/src/ossimGui/PropertyEditorDialog.cpp
new file mode 100644
index 0000000..0dc7fee
--- /dev/null
+++ b/ossimGui/src/ossimGui/PropertyEditorDialog.cpp
@@ -0,0 +1,64 @@
+//---
+//
+// License: See top level LICENSE.txt file.
+//
+// Description: Dialog box for property editor.
+//
+//---
+// $Id$
+
+#include <ossimGui/PropertyEditorDialog.h>
+#include "ossimGui/DataManagerPropertyView.h"
+
+#include <QApplication>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QWidget>
+
+ossimGui::PropertyEditorDialog::PropertyEditorDialog(QWidget* parent, Qt::WFlags f)
+ :
+ QDialog( parent, f ),
+ m_propertyView(0)
+{
+ // set title in Polygon Remapper Dialog
+ this->setWindowTitle( tr("Property Editor") );
+
+ this->setModal( false );
+
+ // setup vertical layout
+ QVBoxLayout* vbox0 = new QVBoxLayout();
+
+ // Row 1: property editor:
+ QGroupBox* propertyEditorGroupBox = new QGroupBox(tr("properties"));
+ QHBoxLayout* hboxR1 = new QHBoxLayout();
+ m_propertyView = new ossimGui::DataManagerPropertyView();
+ hboxR1->addWidget( m_propertyView );
+ propertyEditorGroupBox->setLayout( hboxR1 );
+ vbox0->addWidget(propertyEditorGroupBox);
+
+ // Row 2:
+ QHBoxLayout* hboxR2 = new QHBoxLayout();
+
+ // close:
+ QPushButton* closePushButton = new QPushButton( tr("close") );
+ hboxR2->addWidget( closePushButton );
+
+ vbox0->addLayout(hboxR2);
+
+ setLayout(vbox0);
+
+ // Signals and slots connections:
+ connect(closePushButton, SIGNAL(clicked()),
+ this, SLOT(close()));
+}
+
+
+void ossimGui::PropertyEditorDialog::setObject( ossimObject* object )
+{
+ if ( m_propertyView )
+ {
+ m_propertyView->setObject( object );
+ }
+}
diff --git a/ossimGui/src/ossimGui/RegPoint.cpp b/ossimGui/src/ossimGui/RegPoint.cpp
new file mode 100644
index 0000000..6d46c20
--- /dev/null
+++ b/ossimGui/src/ossimGui/RegPoint.cpp
@@ -0,0 +1,86 @@
+#include <ossimGui/RegPoint.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <QtGui/QToolTip>
+#include <iostream>
+
+
+ossimGui::RegPoint::RegPoint(const ossimDpt& scenePos,
+ const ossimDpt& imgPos,
+ const ossimString& overlayId,
+ const ossimString& id)
+:
+AnnotationItem(overlayId, id),
+m_imgPos(imgPos),
+m_len(12.0)
+{
+ setAcceptHoverEvents(true);
+
+ setPos(scenePos.x, scenePos.y);
+
+ // Set end points
+ qreal xmin = -m_len/2;
+ qreal xmax = m_len/2;
+ qreal ymin = -m_len/2;
+ qreal ymax = m_len/2;
+
+ // Construct cross
+ m_ver.setLine(0.0, ymax, 0.0, ymin);
+ m_hor.setLine(xmin, 0.0, xmax, 0.0);
+
+ m_pen.setColor(Qt::yellow);
+ m_pen.setCapStyle(Qt::RoundCap);
+ m_pen.setWidth(1);
+ m_savedPen = m_pen;
+
+ // QGraphicsItem::data
+ setData(DATA_ITEM_ID, m_id.c_str());
+ setData(DATA_OVERLAY_ID, m_overlayId.c_str());
+}
+
+
+void ossimGui::RegPoint::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
+{
+ QToolTip::showText(event->screenPos(), QString(this->m_id.data()));
+ m_savedPen = m_pen;
+ m_pen.setColor(Qt::cyan);
+ update();
+}
+
+void ossimGui::RegPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
+{
+ QToolTip::hideText();
+ m_pen = m_savedPen;
+ update();
+}
+
+void ossimGui::RegPoint::setUsable(const bool& enable)
+{
+ m_isEnabled = enable;
+
+ if (m_isEnabled)
+ {
+ m_pen.setColor(Qt::yellow);
+ }
+ else
+ {
+ m_pen.setColor(Qt::red);
+ }
+
+ update();
+}
+
+QRectF ossimGui::RegPoint::boundingRect() const
+{
+ return QRectF(-m_len/2-1, -m_len/2-1, m_len+2, m_len+2);
+}
+
+void ossimGui::RegPoint::paint(QPainter* painter,
+ const QStyleOptionGraphicsItem* option,
+ QWidget* widget)
+{
+ painter->setPen(m_pen);
+ painter->drawLine(m_ver);
+ painter->drawLine(m_hor);
+}
diff --git a/ossimGui/src/ossimGui/RegistrationOverlay.cpp b/ossimGui/src/ossimGui/RegistrationOverlay.cpp
new file mode 100644
index 0000000..d6143eb
--- /dev/null
+++ b/ossimGui/src/ossimGui/RegistrationOverlay.cpp
@@ -0,0 +1,228 @@
+#include <ossimGui/RegistrationOverlay.h>
+#include <ossimGui/RegPoint.h>
+#include <ossimGui/RoiSelection.h>
+#include <ossimGui/IvtGeomTransform.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <iostream>
+
+
+ossimGui::RegistrationOverlay::RegistrationOverlay(const ossimString& overlayId, QGraphicsScene* scene)
+: OverlayBase(overlayId, scene),
+ m_currentId("NS"),
+ m_isControlImage(false),
+ m_hasAdjParInterface(false)
+{}
+
+void ossimGui::RegistrationOverlay::reset()
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ m_scene->removeItem(items[i]);
+ }
+
+ m_isActive = false;
+ m_currentId = "NS";
+}
+
+ossim_uint32 ossimGui::RegistrationOverlay::getNumPoints()const
+{
+ return m_scene->items().size();
+}
+
+void ossimGui::RegistrationOverlay::addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt)
+{
+ addPoint(scenePt, imagePt, m_currentId);
+}
+
+void ossimGui::RegistrationOverlay::addPoint(const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id)
+{
+ if (id != "NS")
+ {
+ // Check for duplicate (changing position of point already added)
+ removePoint(id);
+
+ // Add point to scene
+ ossimGui::RegPoint* pt = new ossimGui::RegPoint(scenePt, imagePt, m_overlayId, id);
+ m_scene->addItem(pt);
+
+ // Notify MultiImageDialog
+ emit pointActivated(id);
+ }
+}
+
+void ossimGui::RegistrationOverlay::addRoi(
+ const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimDpt& widHgt, const ossimString& id)
+{
+ // Add rect to scene
+ ossimGui::RoiSelection* rect = new ossimGui::RoiSelection(scenePt, imagePt, widHgt, m_overlayId, id);
+ m_scene->addItem(rect);
+}
+
+
+void ossimGui::RegistrationOverlay::dragRoi(
+ const ossimDpt& scenePt, const ossimDpt& imagePt, const ossimString& id)
+{
+ ossimGui::RoiSelection* rect = 0;
+
+ QGraphicsItem* item = getItem(id);
+ if (item != 0)
+ {
+ rect = dynamic_cast<ossimGui::RoiSelection*>(item);
+ rect->drag(scenePt, imagePt);
+ }
+}
+
+
+void ossimGui::RegistrationOverlay::removeRoi(const ossimString& id)
+{
+ QGraphicsItem* item = getItem(id);
+
+ if (item != 0)
+ {
+ m_scene->removeItem(item);
+ }
+}
+
+
+ossimGui::RoiSelection* ossimGui::RegistrationOverlay::getRoiSelection(const ossimString& id)
+{
+ ossimGui::RoiSelection* roi = 0;
+
+ QGraphicsItem* item = getItem(id);
+ if (item != 0)
+ {
+ roi = dynamic_cast<ossimGui::RoiSelection*>(item);
+ }
+
+ return roi;
+}
+
+
+void ossimGui::RegistrationOverlay::togglePointActive(const ossimString& id)
+{
+ ossimGui::RegPoint* point = getRegPoint(id);
+ bool currentlyActive;
+
+ if (point != 0)
+ {
+ // Toggle point in layer map
+ currentlyActive = point->isUsable();
+ point->setUsable(!currentlyActive);
+ }
+
+ // Notify MultiImageDialog
+ if (currentlyActive)
+ emit pointDeactivated(id);
+ else
+ emit pointActivated(id);
+
+}
+
+
+void ossimGui::RegistrationOverlay::removePoint(const ossimString& id)
+{
+ QGraphicsItem* item = getItem(id);
+
+ if (item != 0)
+ {
+ m_scene->removeItem(item);
+ emit pointRemoved(id);
+ }
+}
+
+
+bool ossimGui::RegistrationOverlay::getImgPoint(const ossimString& id,
+ ossimDpt& imgPt,
+ bool& isActive)
+{
+ bool isFound = false;
+
+ ossimGui::RegPoint* point = getRegPoint(id);
+
+ if (point != 0)
+ {
+ imgPt = point->getImgPos();
+ isActive = point->isUsable();
+ isFound = true;
+ }
+
+ return isFound;
+}
+
+
+ossimGui::RegPoint* ossimGui::RegistrationOverlay::getRegPoint(const ossimString& id)
+{
+ ossimGui::RegPoint* point = 0;
+
+ QGraphicsItem* item = getItem(id);
+ if (item != 0)
+ {
+ point = dynamic_cast<ossimGui::RegPoint*>(item);
+ }
+
+ return point;
+}
+
+
+void ossimGui::RegistrationOverlay::setVisible(const bool& visible)
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ items[i]->setVisible(visible);
+ }
+}
+
+
+void ossimGui::RegistrationOverlay::setAsControl(const bool& controlImage)
+{
+ m_isControlImage = controlImage;
+
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ ossimGui::RegPoint* thisPoint = dynamic_cast<ossimGui::RegPoint*>(items[i]);
+ thisPoint->setAsControlPoint(controlImage);
+ }
+}
+
+
+void ossimGui::RegistrationOverlay::setHasAdjParInterface(const bool& hasAdjIface)
+{
+ m_hasAdjParInterface = hasAdjIface;
+}
+
+
+void ossimGui::RegistrationOverlay::setView(ossimRefPtr<IvtGeomTransform> ivtg)
+{
+ QList<QGraphicsItem*> items = m_scene->items();
+ for (int i=0; i<items.size(); ++i)
+ {
+ ossimGui::RegPoint* thisPoint = dynamic_cast<ossimGui::RegPoint*>(items[i]);
+ if (thisPoint)
+ {
+ ossimDpt imgPos = thisPoint->getImgPos();
+ ossimDpt viewPos;
+ ivtg->imageToView(imgPos, viewPos);
+ thisPoint->setPos(viewPos.x, viewPos.y);
+ }
+ else
+ {
+ ossimGui::RoiSelection* thisRoi = dynamic_cast<ossimGui::RoiSelection*>(items[i]);
+ if (thisRoi)
+ {
+ ossimIrect imgRect = thisRoi->getRectImg();
+ ossimDpt imgPos[2];
+ ossimDpt viewPos[2];
+ imgPos[0] = imgRect.ul();
+ imgPos[1] = imgRect.lr();
+ ivtg->imageToView(imgPos[0], viewPos[0]);
+ ivtg->imageToView(imgPos[1], viewPos[1]);
+ thisRoi->redefine(viewPos, imgPos);
+ }
+ }
+ }
+}
diff --git a/ossimGui/src/ossimGui/RoiRectAnnotator.cpp b/ossimGui/src/ossimGui/RoiRectAnnotator.cpp
new file mode 100644
index 0000000..5897249
--- /dev/null
+++ b/ossimGui/src/ossimGui/RoiRectAnnotator.cpp
@@ -0,0 +1,322 @@
+//----------------------------------------------------------------------------
+//
+// License: MIT
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+// Author: David Burken
+//
+// Description: Region Of Interest (ROI) rectangle annotator object.
+//
+// $Id$
+//----------------------------------------------------------------------------
+
+#include <ossimGui/RoiRectAnnotator.h>
+#include <ossimGui/ImageScrollView.h>
+#include <ossim/base/ossimROIEvent.h>
+#include <ossim/base/ossimIrect.h>
+#include <QtGui/QPainter>
+#include <QtCore/QEvent>
+#include <QPoint>
+#include <QRect>
+#include <QRectF>
+
+ossimGui::RoiRectAnnotator::RoiRectAnnotator()
+ : ossimListenerManager(),
+ m_widget(0),
+ m_enableFlag(true),
+ m_roiLeftPressedFlag(false),
+ m_roiMiddlePresedFlag(false),
+ m_roiPressStart(0,0),
+ m_penColor(Qt::white),
+ m_points(2)
+{
+}
+
+ossimGui::RoiRectAnnotator::~RoiRectAnnotator()
+{
+ // cout << "~RoiRectAnnotator() entered..." << endl;
+}
+
+void ossimGui::RoiRectAnnotator::setImageWidget(ossimGui::ImageScrollView* widget)
+{
+ if (m_widget)
+ {
+ disconnect(m_widget, 0, 0, 0);
+ }
+ m_widget = widget;
+
+ // Connect the widget's paintYourGraphics signal to our paint slot.
+ connect(widget, SIGNAL( paintYourGraphics(QPainter*, const QRectF&) ),
+ this, SLOT( paint(QPainter*, const QRectF&) ) );
+
+ connect( m_widget, SIGNAL( mousePress(QMouseEvent*) ),
+ this, SLOT( mousePress(QMouseEvent*) ) );
+
+ connect( m_widget, SIGNAL( mouseMove(QMouseEvent*) ),
+ this, SLOT( mouseMove(QMouseEvent*) ) );
+
+ connect( m_widget, SIGNAL( mouseRelease(QMouseEvent*) ),
+ this, SLOT( mouseRelease(QMouseEvent*) ) );
+}
+
+void ossimGui::RoiRectAnnotator::paint(QPainter* p, const QRectF & rect)
+{
+ if (m_enableFlag)
+ {
+ // Pass it on to the derived class.
+ paintAnnotation(p, rect);
+ }
+}
+
+void ossimGui::RoiRectAnnotator::enablePaint()
+{
+ m_enableFlag = true;
+}
+
+void ossimGui::RoiRectAnnotator::disablePaint()
+{
+ m_enableFlag = false;
+}
+
+void ossimGui::RoiRectAnnotator::setRoiRect(const ossimIrect& rect)
+{
+ if (m_points.size() != 2)
+ {
+ m_points.resize(2);
+ }
+
+ m_points[0] = rect.ul();
+ m_points[1] = rect.lr();
+ refresh();
+}
+
+ossimIrect ossimGui::RoiRectAnnotator::getRoiRect() const
+{
+ if (m_points.size() == 2 && m_widget)
+ {
+ // Sort the points.
+ ossim_int32 ulx = (m_points[0].x < m_points[1].x) ?
+ m_points[0].x : m_points[1].x;
+
+ ossim_int32 uly = (m_points[0].y < m_points[1].y) ?
+ m_points[0].y : m_points[1].y;
+
+ ossim_int32 lrx = (m_points[1].x > m_points[0].x) ?
+ m_points[1].x : m_points[0].x;
+
+ ossim_int32 lry = (m_points[1].y > m_points[0].y) ?
+ m_points[1].y : m_points[0].y;
+
+ return ossimIrect(ulx, uly, lrx, lry);
+ }
+
+ return ossimIrect(0,0,0,0);
+}
+
+void ossimGui::RoiRectAnnotator::mousePress(QMouseEvent* e)
+{
+ //---
+ // On left click:
+ // - start rectangle
+ //
+ // On middle click:
+ // - change rectangle color to green
+ //---
+
+ if ( e )
+ {
+ Qt::MouseButton button = e->button();
+
+ if (button == Qt::LeftButton)
+ {
+ qPtToIpt( e->pos(), m_roiPressStart );
+ m_roiLeftPressedFlag = true;
+ // m_points[0] = m_roiPressStart;
+ }
+ else if (button == Qt::MidButton)
+ {
+ // Change the color from white to green.
+ m_penColor = Qt::green;
+ qPtToIpt( e->pos(), m_roiPressStart );
+ m_roiMiddlePresedFlag = true;
+ }
+ // cout << "m_roiPressStart: " << m_roiPressStart << endl;
+ }
+
+} // End: mousePress( ... )
+
+void ossimGui::RoiRectAnnotator::mouseMove(QMouseEvent* e)
+{
+ //---
+ // On left move:
+ // - grow rectangle
+ //
+ // On middle move:
+ // - shift existing rectangle by the movement.
+ //---
+
+ if ( e )
+ {
+ // Qt::MouseButton button = e->button();
+
+ if (m_roiLeftPressedFlag)
+ {
+ // Check for some travel to avoid resizing roi on a simple click.
+ ossimIpt ipt;
+ qPtToIpt(e->pos(), ipt );
+ ossim_int32 x_delta = abs(m_roiPressStart.x - ipt.x);
+ ossim_int32 y_delta = abs(m_roiPressStart.y - ipt.y);
+ if (x_delta > 4 || y_delta > 4)
+ {
+ if (m_points[0] != m_roiPressStart)
+ {
+ m_points[0] = m_roiPressStart;
+ }
+ qPtToIpt( e->pos(), m_points[1]);
+ refresh();
+ }
+ }
+ else if (m_roiMiddlePresedFlag)
+ {
+ // move the existing rectangle.
+ ossimIpt pt;
+ qPtToIpt( e->pos(), pt );
+ ossimIpt shift = (pt - m_roiPressStart);
+ m_points[0] += shift;
+ m_points[1] += shift;
+ m_roiPressStart = pt; // evt->pos();
+ refresh();
+ }
+ }
+
+} // End: mouseMove( ... )
+
+void ossimGui::RoiRectAnnotator::mouseRelease(QMouseEvent* e)
+{
+ //--
+ // On middle release:
+ // - change rectangle color back to white
+ //---
+
+ if ( e )
+ {
+ Qt::MouseButton button = e->button();
+
+ ossimROIEvent roiEvent;
+ roiEvent.setEventType(ossimROIEvent::OSSIM_RECTANGLE_ROI);
+
+ if (button == Qt::LeftButton)
+ {
+ // Check for some travel to avoid resizing roi on a simple click.
+ ossimIpt ipt;
+ qPtToIpt(e->pos(), ipt );
+ ossim_int32 x_delta = abs(m_roiPressStart.x - ipt.x);
+ ossim_int32 y_delta = abs(m_roiPressStart.y - ipt.y);
+ if (x_delta > 4 || y_delta > 4)
+ {
+ qPtToIpt( e->pos(), m_points[1] ); // = evt->getPoint();
+ refresh();
+ }
+ else
+ {
+ m_points[1] = m_points[0];
+ }
+ m_roiLeftPressedFlag = false;
+ }
+ else if (button == Qt::MidButton)
+ {
+ // Change the color from green to white.
+ m_penColor = Qt::white;
+
+ // move the existing rectangle.
+ ossimIpt ipt;
+ qPtToIpt( e->pos(), ipt );
+ ossimIpt shift = ( ipt - m_roiPressStart );
+ m_points[0] += shift;
+ m_points[1] += shift;
+ m_roiMiddlePresedFlag = false;
+ refresh();
+
+ // Set the moving flag in the event.
+ roiEvent.setMovingFlag(true);
+ }
+
+ ossimIrect r(m_points[0], m_points[1]);
+ roiEvent.setRect(r);
+ fireEvent(roiEvent);
+ }
+}
+
+void ossimGui::RoiRectAnnotator::paintAnnotation( QPainter* p, const QRectF& rect )
+{
+ if ( p && (m_points.size() >= 2) )
+ {
+ QRect r = rect.toRect();
+
+ ossimIrect clipRect(r.x(), r.y(), r.x() + r.width() - 1, r.y() + r.height() - 1);
+ if (clipRect.intersects(getRoiRect()))
+ {
+ p->save();
+
+ QRect r;
+ r.setCoords(m_points[0].x, m_points[0].y,
+ m_points[1].x, m_points[1].y);
+ p->setPen(m_penColor);
+ p->drawRect(r);
+
+ p->restore(); // Every QPainter::save must have corresponding restore.
+ }
+ }
+}
+
+void ossimGui::RoiRectAnnotator::setPoints(const std::vector<ossimIpt>& pts)
+{
+ m_points = pts;
+}
+
+void ossimGui::RoiRectAnnotator::clear()
+{
+ m_points.clear();
+}
+
+void ossimGui::RoiRectAnnotator::getPoints(std::vector<ossimIpt>& pts) const
+{
+ pts = m_points;
+}
+
+void ossimGui::RoiRectAnnotator::refresh()
+{
+ if ( m_widget )
+ {
+ QWidget* viewport = m_widget->viewport();
+ if ( viewport )
+ {
+ viewport->update();
+ }
+ }
+}
+
+void ossimGui::RoiRectAnnotator::qPtToIpt( const QPoint& qpt, ossimIpt& ipt ) const
+{
+ if ( m_widget )
+ {
+ QPointF scene = m_widget->mapToScene(qpt);
+ ipt.x = scene.x();
+ ipt.y = scene.y();
+ }
+}
+
+// Hidden from use.
+ossimGui::RoiRectAnnotator::RoiRectAnnotator(
+ const ossimGui::RoiRectAnnotator&)
+ : ossimListenerManager()
+{}
+
+// Hidden from use.
+ossimGui::RoiRectAnnotator& ossimGui::RoiRectAnnotator::operator=(
+ const ossimGui::RoiRectAnnotator&)
+{
+ return *this;
+}
+
diff --git a/ossimGui/src/ossimGui/RoiSelection.cpp b/ossimGui/src/ossimGui/RoiSelection.cpp
new file mode 100644
index 0000000..da4bb61
--- /dev/null
+++ b/ossimGui/src/ossimGui/RoiSelection.cpp
@@ -0,0 +1,131 @@
+#include <ossimGui/RoiSelection.h>
+#include <QtGui/QPainter>
+#include <QtGui/QPen>
+#include <QtGui/QtGui>
+#include <QtGui/QToolTip>
+#include <iostream>
+
+
+ossimGui::RoiSelection::RoiSelection(const ossimDpt& scenePos,
+ const ossimDpt& imagePos,
+ const ossimDpt& widHgt,
+ const ossimString& overlayId,
+ const ossimString& rid)
+:
+AnnotationItem(overlayId, rid)
+{
+ setAcceptHoverEvents(true);
+
+ m_scnPos[0] = scenePos;
+ m_imgPos[0] = imagePos;
+
+ // Construct rectangle
+ m_rect.setRect(scenePos.x, scenePos.y, widHgt.x, widHgt.y);
+
+ m_pen.setColor(Qt::green);
+ m_pen.setCapStyle(Qt::RoundCap);
+ m_pen.setWidth(1);
+
+ // QGraphicsItem::data
+ setData(DATA_ITEM_ID, m_id.c_str());
+ setData(DATA_OVERLAY_ID, m_overlayId.c_str());
+}
+
+void ossimGui::RoiSelection::drag(const ossimDpt& scenePos, const ossimDpt& imagePos)
+{
+ if (scenePos.y > m_scnPos[0].y)
+ m_rect.setBottom(scenePos.y);
+ else
+ m_rect.setTop(scenePos.y);
+
+ if (scenePos.x > m_scnPos[0].x)
+ m_rect.setRight(scenePos.x);
+ else
+ m_rect.setLeft(scenePos.x);
+
+ m_scnPos[1] = scenePos;
+ m_imgPos[1] = imagePos;
+
+ prepareGeometryChange();
+ update();
+}
+
+
+void ossimGui::RoiSelection::redefine(ossimDpt* scenePos, ossimDpt* imagePos)
+{
+ if (scenePos[0].y > scenePos[1].y)
+ {
+ m_rect.setBottom(scenePos[0].y);
+ m_rect.setTop(scenePos[1].y);
+ }
+ else
+ {
+ m_rect.setBottom(scenePos[1].y);
+ m_rect.setTop(scenePos[0].y);
+ }
+
+ if (scenePos[0].x > scenePos[1].x)
+ {
+ m_rect.setRight(scenePos[0].x);
+ m_rect.setLeft(scenePos[1].x);
+ }
+ else
+ {
+ m_rect.setRight(scenePos[1].x);
+ m_rect.setLeft(scenePos[0].x);
+ }
+
+ m_scnPos[0] = scenePos[0];
+ m_scnPos[1] = scenePos[1];
+ m_imgPos[0] = imagePos[0];
+ m_imgPos[1] = imagePos[1];
+
+ prepareGeometryChange();
+ update();
+}
+
+
+ossimIrect ossimGui::RoiSelection::getRectImg() const
+{
+ // Sort points
+ ossim_int32 ulx = (m_imgPos[0].x < m_imgPos[1].x) ?
+ m_imgPos[0].x : m_imgPos[1].x;
+
+ ossim_int32 uly = (m_imgPos[0].y < m_imgPos[1].y) ?
+ m_imgPos[0].y : m_imgPos[1].y;
+
+ ossim_int32 lrx = (m_imgPos[1].x > m_imgPos[0].x) ?
+ m_imgPos[1].x : m_imgPos[0].x;
+
+ ossim_int32 lry = (m_imgPos[1].y > m_imgPos[0].y) ?
+ m_imgPos[1].y : m_imgPos[0].y;
+
+ return ossimIrect(ulx, uly, lrx, lry);
+}
+
+
+void ossimGui::RoiSelection::hoverEnterEvent( QGraphicsSceneHoverEvent* /* event */ )
+{
+ m_savedPen = m_pen;
+ m_pen.setColor(Qt::cyan);
+ update();
+}
+
+void ossimGui::RoiSelection::hoverLeaveEvent( QGraphicsSceneHoverEvent* /* event */ )
+{
+ m_pen = m_savedPen;
+ update();
+}
+
+QRectF ossimGui::RoiSelection::boundingRect() const
+{
+ return m_rect;
+}
+
+void ossimGui::RoiSelection::paint(QPainter* painter,
+ const QStyleOptionGraphicsItem* /* option */,
+ QWidget* /* widget */)
+{
+ painter->setPen(m_pen);
+ painter->drawRect(m_rect);
+}
diff --git a/ossimGui/src/ossimGui/SetViewVisitor.cpp b/ossimGui/src/ossimGui/SetViewVisitor.cpp
new file mode 100644
index 0000000..0ab83f0
--- /dev/null
+++ b/ossimGui/src/ossimGui/SetViewVisitor.cpp
@@ -0,0 +1,66 @@
+#include <ossimGui/SetViewVisitor.h>
+#include <ossim/base/ossimPropertyInterface.h>
+#include <ossim/base/ossimRefreshEvent.h>
+#include <ossim/base/ossimViewInterface.h>
+
+namespace ossimGui
+{
+ void SetViewVisitor::setView()
+ {
+ int refreshType = ossimRefreshEvent::REFRESH_NONE;
+ ossim_uint32 nObjects = m_collection.size();
+ // bool viewChanged = false;
+ ossim_uint32 collectionIdx = 0;
+
+ if(m_obj.valid())
+ {
+ for(collectionIdx = 0; collectionIdx < nObjects; ++collectionIdx)
+ {
+ ossimViewInterface* viewInterface = getObjectAs<ossimViewInterface>(collectionIdx);
+ ossimPropertyInterface* propertyInterface = getObjectAs<ossimPropertyInterface>(collectionIdx);
+ if(viewInterface)
+ {
+ ossimObject* input = dynamic_cast<ossimObject*>(viewInterface->getView());
+ if(input)
+ {
+ if(!input->isEqualTo(*(m_obj.get())))
+ {
+ refreshType |= ossimRefreshEvent::REFRESH_GEOMETRY;
+ viewInterface->setView(m_obj->dup());
+ }
+ }
+ }
+ if(!m_resamplerType.empty()&&propertyInterface)
+ {
+ if(propertyInterface->getPropertyValueAsString("filter_type") != m_resamplerType)
+ {
+ refreshType |= ossimRefreshEvent::REFRESH_PIXELS;
+ propertyInterface->setProperty("filter_type", m_resamplerType);
+ }
+ }
+ }
+ }
+ if(!m_viewPoint.hasNans())
+ {
+ refreshType|=ossimRefreshEvent::REFRESH_POSITION;
+ }
+ if(refreshType!=ossimRefreshEvent::REFRESH_NONE)
+ {
+ ossimRefreshEvent* event = new ossimRefreshEvent();
+
+ if(m_obj.valid())
+ {
+ event->setRefreshType(refreshType);
+ }
+ event->setPosition(m_viewPoint);
+
+ ossimEventVisitor eventVisitor(event);
+
+ for(collectionIdx = 0; collectionIdx < nObjects; ++collectionIdx)
+ {
+ m_collection[collectionIdx]->accept(eventVisitor);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ossimGui/src/ossimGui/StaticTileImageCache.cpp b/ossimGui/src/ossimGui/StaticTileImageCache.cpp
new file mode 100644
index 0000000..75cb850
--- /dev/null
+++ b/ossimGui/src/ossimGui/StaticTileImageCache.cpp
@@ -0,0 +1,486 @@
+//*******************************************************************
+//
+//
+//
+// Author: Garrett Potts
+//
+//*************************************************************************
+// $Id$
+#include <ossimGui/StaticTileImageCache.h>
+#include <QtGui/QImage>
+#include <OpenThreads/ScopedLock>
+
+ossimGui::StaticTileImageCache::StaticTileImageCache(const ossimIpt& tileSize)
+ :m_tileSize(tileSize)
+{
+ if(m_tileSize.x <=0)
+ {
+ m_tileSize.x = 64;
+ }
+ if(m_tileSize.y <=0)
+ {
+ m_tileSize.y = 64;
+ }
+ m_cache = new QImage(m_tileSize.x,
+ m_tileSize.y,
+ QImage::Format_RGB32);
+ m_validTileArray.resize(1);
+ m_cache->fill(0);
+ m_actualRect = ossimIrect(0,0,m_tileSize.x-1, m_tileSize.y-1);
+ m_cacheRect = m_actualRect;
+ m_numberOfTiles.x = 1;
+ m_numberOfTiles.y = 1;
+ m_validTileArray[0] = false;
+}
+ossimGui::StaticTileImageCache::~StaticTileImageCache()
+{
+ if(m_cache)
+ {
+ delete m_cache;
+ m_cache = 0;
+ }
+}
+
+QImage& ossimGui::StaticTileImageCache::getCache()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return *m_cache;
+}
+
+const QImage& ossimGui::StaticTileImageCache::getCache()const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return *m_cache;
+}
+
+void ossimGui::StaticTileImageCache::flush()
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ std::fill(m_validTileArray.begin(),
+ m_validTileArray.end(),
+ false);
+}
+
+void ossimGui::StaticTileImageCache::flush(const ossimIpt& pt)
+{
+ flush(ossimIrect(pt.x,
+ pt.y,
+ pt.x,
+ pt.y));
+}
+
+
+void ossimGui::StaticTileImageCache::flush(const ossimIrect& rect)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ if(rect == getRect())
+ {
+ std::fill(m_validTileArray.begin(),
+ m_validTileArray.end(),
+ false);
+ }
+ else
+ {
+ int x = 0;
+ int y = 0;
+ int upperX = 0;
+ int upperY = 0;
+ ossimIrect tempRect = rect;
+ tempRect.stretchToTileBoundary(m_tileSize);
+
+ upperX = tempRect.lr().x;
+ upperY = tempRect.lr().y;
+ for(y = tempRect.ul().y; y < upperY; y+=m_tileSize.y)
+ {
+ for(x = tempRect.ul().x; x < upperX; x+=m_tileSize.x)
+ {
+ ossim_int32 idx = getTileIndex(m_cacheRect, m_numberOfTiles, x, y);
+ if(idx >= 0)
+ {
+ m_validTileArray[idx] = false;
+ }
+ }
+ }
+ }
+}
+
+const ossimIrect& ossimGui::StaticTileImageCache::getRect()const
+{
+ /*
+ QPoint pt = m_cache->offset();
+
+ return ossimIrect( pt.x(),
+ pt.y(),
+ pt.x() + m_cache->width() - 1,
+ pt.y() + m_cache->height() - 1);
+ */
+
+ return m_cacheRect;
+}
+
+const ossimIrect& ossimGui::StaticTileImageCache::getActualRect()const
+{
+ return m_actualRect;
+}
+
+void ossimGui::StaticTileImageCache::setRect(const ossimIrect& newRect)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossimIrect tempRect = newRect;
+ m_actualRect = newRect;
+ tempRect.stretchToTileBoundary(m_tileSize);
+
+ ossimIrect currentRect = m_cacheRect;
+
+ m_cacheRect = tempRect;
+ if(currentRect != tempRect)
+ {
+ if(!currentRect.intersects(tempRect))
+ {
+ if((currentRect.width() != tempRect.width()) ||
+ (currentRect.height() != tempRect.height()))
+ {
+ delete m_cache;
+ m_cache = new QImage(tempRect.width(),
+ tempRect.height(),
+ QImage::Format_RGB32);
+ }
+ m_cache->fill(0);
+ m_cache->setOffset(QPoint(tempRect.ul().x,
+ tempRect.ul().y));
+ currentRect = m_cacheRect;
+ m_numberOfTiles.x = currentRect.width()/m_tileSize.x;
+ m_numberOfTiles.y = currentRect.height()/m_tileSize.y;
+ m_validTileArray.resize(m_numberOfTiles.x*m_numberOfTiles.y);
+ std::fill(m_validTileArray.begin(),
+ m_validTileArray.end(),
+ false);
+ }
+ else
+ {
+ ossimIrect intersectionRect = currentRect.clipToRect(tempRect);
+ ossimIpt offset = tempRect.ul() - currentRect.ul();
+
+ ossimIpt oldNumberOfTiles = m_numberOfTiles;
+ std::vector<bool> oldValidTileArray = m_validTileArray;
+ ossimIrect oldRect = currentRect;
+
+ *m_cache = m_cache->copy(offset.x,
+ offset.y,
+ tempRect.width(),
+ tempRect.height());
+
+ m_cache->setOffset(QPoint(tempRect.ul().x,
+ tempRect.ul().y));
+
+ currentRect = m_cacheRect;
+ m_numberOfTiles.x = currentRect.width()/m_tileSize.x;
+ m_numberOfTiles.y = currentRect.height()/m_tileSize.y;
+
+
+ m_validTileArray.resize(m_numberOfTiles.x*m_numberOfTiles.y);
+
+ std::fill(m_validTileArray.begin(),
+ m_validTileArray.end(),
+ false);
+
+ int x = 0;
+ int y = 0;
+ int urX = intersectionRect.ur().x;
+ int lrY = intersectionRect.lr().y;
+
+ for(x = intersectionRect.ul().x; x <= urX; x+=m_tileSize.x)
+ {
+ for(y = intersectionRect.ul().y; y <= lrY; y+=m_tileSize.y)
+ {
+ ossim_int32 idx = getTileIndex(m_cacheRect, m_numberOfTiles, x, y);
+ ossim_int32 oldIdx = getTileIndex(oldRect,
+ oldNumberOfTiles,
+ x,
+ y);
+ if(idx > -1)
+ {
+ if(oldIdx > -1)
+ {
+ m_validTileArray[idx] = oldValidTileArray[oldIdx];
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+bool ossimGui::StaticTileImageCache::isValid(const ossimIpt& pt)const
+{
+ ossim_int32 idx = getTileIndex(pt);
+
+ if(idx >= 0)
+ {
+ return m_validTileArray[idx];
+ }
+
+ return false;
+}
+
+ossim_int32 ossimGui::StaticTileImageCache::getTileIndex(const ossimIpt& origin)const
+{
+ return getTileIndex(origin.x,
+ origin.y);
+}
+
+ossim_int32 ossimGui::StaticTileImageCache::getTileIndex(ossim_int32 x,
+ ossim_int32 y)const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ return getTileIndex(m_cacheRect, m_numberOfTiles, x, y);
+}
+
+bool ossimGui::StaticTileImageCache::getTile(const ossimIpt& pt,
+ QImage& image)const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ bool result = false;
+ ossimIpt tileOrigin = getTileOrigin(pt);
+ ossimIrect cacheRect = getRect();
+
+ if((image.width() != m_tileSize.x)||
+ (image.height() != m_tileSize.y))
+ {
+ image = QImage(m_tileSize.x,
+ m_tileSize.y,
+ QImage::Format_RGB32);
+ }
+ if(cacheRect.pointWithin(tileOrigin))
+ {
+ ossimIpt delta(tileOrigin.x - cacheRect.ul().x,
+ tileOrigin.y - cacheRect.ul().y);
+
+ if((delta.x >= 0)&&(delta.y >= 0))
+ {
+ image = m_cache->copy(tileOrigin.x - cacheRect.ul().x,
+ tileOrigin.y - cacheRect.ul().y,
+ m_tileSize.x,
+ m_tileSize.y);
+ ossim_int32 idx = getTileIndex(m_cacheRect, m_numberOfTiles, pt);
+ if(idx >=0)
+ {
+ result = m_validTileArray[idx];
+ }
+ }
+ else
+ {
+ image.fill(0);
+ }
+ }
+ else
+ {
+ image.fill(0);
+ }
+
+ return result;
+}
+
+ossimIpt ossimGui::StaticTileImageCache::getTileOrigin(const ossimIpt& pt)const
+{
+ ossimIpt tempPt;
+
+ if(pt.x < 0)
+ {
+ tempPt.x = pt.x - (m_tileSize.x-1);
+ }
+ else
+ {
+ tempPt.x = pt.x + (m_tileSize.x-1);
+ }
+ if(pt.y < 0)
+ {
+ tempPt.y = pt.y - (m_tileSize.y-1);
+ }
+ else
+ {
+ tempPt.y = pt.y + (m_tileSize.y-1);
+ }
+
+ return ossimIpt((tempPt.x/m_tileSize.x)*m_tileSize.x,
+ (tempPt.y/m_tileSize.y)*m_tileSize.y);
+}
+
+void ossimGui::StaticTileImageCache::getSubImage(QImage& image)const
+{
+ QPoint ulSubImage(image.offset().x(),
+ image.offset().y());
+
+ QPoint ulCache(m_cache->offset().x(),
+ m_cache->offset().y());
+
+ image = m_cache->copy(ulSubImage.x() - ulCache.x(),
+ ulSubImage.y() - ulCache.y(),
+ image.width(),
+ image.height());
+}
+
+void ossimGui::StaticTileImageCache::setTileSize(const ossimIpt& tileSize)
+{
+ flush();
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ m_tileSize = tileSize;
+ ossimIrect currentRect = m_cacheRect;
+ m_numberOfTiles.x = currentRect.width()/m_tileSize.x;
+ m_numberOfTiles.y = currentRect.height()/m_tileSize.y;
+}
+
+const ossimIpt& ossimGui::StaticTileImageCache::getTileSize()const
+{
+ return m_tileSize;
+}
+
+bool ossimGui::StaticTileImageCache::addTile(const QImage& image)
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ bool result = false;
+
+ ossimIrect tileRect(image.offset().x(),
+ image.offset().y(),
+ image.offset().x() + (image.width()-1),
+ image.offset().y() + (image.height()-1));
+ ossimIrect cacheRect = m_cacheRect;
+
+ if(tileRect.intersects(cacheRect))
+ {
+ ossimIrect clipRect = tileRect.clipToRect(cacheRect);
+
+ // now fill the clipped rect
+ ossim_uint32 srcY = clipRect.ul().y-tileRect.ul().y;
+ ossim_uint32 srcX = clipRect.ul().x-tileRect.ul().x;
+ ossim_uint32 destY = clipRect.ul().y-cacheRect.ul().y;
+ ossim_uint32 destX = clipRect.ul().x-cacheRect.ul().x;
+ ossimIpt offset = tileRect.ul() - cacheRect.ul();
+ ossim_uint32 x,y;
+ for(y = 0; y < clipRect.height(); ++y)
+ {
+ ossim_uint32* cachePtr = ((ossim_uint32*)m_cache->scanLine(y+destY))+destX;
+ ossim_uint32* tilePtr = ((ossim_uint32*)image.scanLine(y+srcY))+srcX;
+ for(x = 0; x < clipRect.width(); ++x)
+ {
+ *cachePtr = *tilePtr;
+ ++cachePtr;
+ ++tilePtr;
+ }
+ }
+ ossimIpt tilePoint(tileRect.ul());
+
+ for(y = 0; y < tileRect.height(); y+=m_tileSize.y)
+ {
+ tilePoint.x = tileRect.ul().x;
+ for(x = 0; x < tileRect.width(); x+=m_tileSize.x)
+ {
+ ossim_int32 idx = getTileIndex(m_cacheRect, m_numberOfTiles, tilePoint);
+ if(idx>=0)
+ {
+ m_validTileArray[idx] = true;
+ }
+ tilePoint.x+= m_tileSize.x;
+ }
+ tilePoint.y+=m_tileSize.y;
+ }
+ result = true;
+ }
+
+ return result;
+}
+
+void ossimGui::StaticTileImageCache::paintTiles(QPainter* /*p*/)
+{
+
+}
+
+ossim_int32 ossimGui::StaticTileImageCache::getTileIndex(const ossimIrect& rect,
+ const ossimIpt& numberOfTiles,
+ const ossimIpt& origin)const
+{
+ return getTileIndex(rect,
+ numberOfTiles,
+ origin.x,
+ origin.y);
+}
+
+ossim_int32 ossimGui::StaticTileImageCache::getTileIndex(const ossimIrect& rect,
+ const ossimIpt& numberOfTiles,
+ ossim_int32 x,
+ ossim_int32 y)const
+{
+ ossimIpt ul = rect.ul();
+ ossimIpt delta = ossimIpt(x,y) - ul;
+
+ if((delta.x < 0) ||
+ (delta.y < 0) ||
+ (delta.x >= (int)rect.width())||
+ (delta.y >= (int)rect.height()))
+ {
+ return -1;
+ }
+ delta.x /= m_tileSize.x;
+ delta.y /= m_tileSize.y;
+
+ return delta.y*numberOfTiles.x + delta.x;
+}
+
+ossim_int32 ossimGui::StaticTileImageCache::computeTileId(const ossimIpt& origin,
+ const ossimIrect& tileBounderyRect,
+ const ossimIpt& tileSize)
+{
+ ossim_uint32 numberOfTilesX = tileBounderyRect.width()/tileSize.x;
+
+ ossimIpt ul = tileBounderyRect.ul();
+ ossimIpt delta = origin - ul;
+
+ if((delta.x < 0) ||
+ (delta.y < 0) ||
+ (delta.x >= (int)tileBounderyRect.width())||
+ (delta.y >= (int)tileBounderyRect.height()))
+ {
+ return -1;
+ }
+ delta.x /= tileSize.x;
+ delta.y /= tileSize.y;
+
+ return delta.y*numberOfTilesX + delta.x;
+}
+
+bool ossimGui::StaticTileImageCache::nextInvalidTile(ossimIrect& rect)const
+{
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex);
+ ossim_uint32 idx = 0;
+ ossimIpt origin = m_cacheRect.ul();
+ for(idx = 0; idx < m_validTileArray.size(); ++idx)
+ {
+ if(!m_validTileArray[idx])
+ {
+ ossim_uint32 yOffset = idx/m_numberOfTiles.x;
+ ossim_uint32 xOffset = idx%m_numberOfTiles.x;
+
+ ossimIpt ul(origin.x + xOffset*m_tileSize.x, origin.y + yOffset*m_tileSize.y);
+ rect = ossimIrect(ul.x, ul.y, ul.x + m_tileSize.x-1, ul.y + m_tileSize.y -1);
+
+ return true;
+ }
+ }
+ return false;
+}
+
+bool ossimGui::StaticTileImageCache::hasInvalidTiles()const
+{
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < m_validTileArray.size(); ++idx)
+ {
+ if(!m_validTileArray[idx])
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
diff --git a/ossimGui/src/ossimGui/Util.cpp b/ossimGui/src/ossimGui/Util.cpp
new file mode 100644
index 0000000..ea7b342
--- /dev/null
+++ b/ossimGui/src/ossimGui/Util.cpp
@@ -0,0 +1,24 @@
+#include <ossimGui/Util.h>
+#include <ossim/imaging/ossimImageWriterFactoryRegistry.h>
+
+namespace ossimGui
+{
+ void Util::imageWriterTypes(QStringList& result)
+ {
+ std::vector<ossimString> writers;
+ imageWriterTypes(writers);
+ if(!writers.empty())
+ {
+ ossim_uint32 idx = 0;
+ for(idx = 0; idx < writers.size(); ++idx)
+ {
+ result.push_back(writers[idx].c_str());
+ }
+ }
+ }
+
+ void Util::imageWriterTypes(std::vector<ossimString>& result)
+ {
+ ossimImageWriterFactoryRegistry::instance()->getTypeNameList(result);
+ }
+}
diff --git a/ossimGui/src/ossimGui/View.cpp b/ossimGui/src/ossimGui/View.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/ossimGui/src/ossimGui/ViewManipulator.cpp b/ossimGui/src/ossimGui/ViewManipulator.cpp
new file mode 100644
index 0000000..09e1095
--- /dev/null
+++ b/ossimGui/src/ossimGui/ViewManipulator.cpp
@@ -0,0 +1,217 @@
+#include <ossimGui/ViewManipulator.h>
+#include <ossim/projection/ossimMapProjection.h>
+#include <ossim/projection/ossimImageViewAffineTransform.h>
+#include <ossim/projection/ossimImageViewProjectionTransform.h>
+ossimGui::ViewManipulator::ViewManipulator()
+:m_fullResolutionScale(1.0,1.0)
+{
+}
+
+ossimGui::ViewManipulator::ViewManipulator(ossimObject* geom)
+{
+ setObject(geom);
+}
+
+void ossimGui::ViewManipulator::setObject(ossimObject* obj)
+{
+ m_obj = obj;
+ ossimImageViewTransform* ivt = getObjectAs<ossimImageViewTransform>();
+ if(ivt)
+ {
+ m_fullResolutionScale = ivt->getInputMetersPerPixel();
+ }
+ if(m_fullResolutionScale.hasNans())
+ {
+ m_fullResolutionScale = ossimDpt(1.0,1.0);
+ }
+}
+
+void ossimGui::ViewManipulator::setFullResScale(const ossimDpt& scale)
+{
+ m_fullResolutionScale = scale;
+}
+
+void ossimGui::ViewManipulator::fullRes(ossimDpt& center)
+{
+ ossimImageGeometry* geom = asGeometry();
+
+ if(geom)
+ {
+ ossimGpt tempCenter;
+ if(!center.hasNans())
+ {
+ geom->localToWorld(center, tempCenter);
+ }
+ if(geom->getProjection())
+ {
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(m_fullResolutionScale);
+ }
+ }
+ if(!center.hasNans())
+ {
+ geom->worldToLocal(tempCenter, center);
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt tempCenter;
+ if(!center.hasNans())
+ {
+ ivat->viewToImage(center, tempCenter);
+ }
+ ivat->scale(m_fullResolutionScale.x, m_fullResolutionScale.y);
+ if(!center.hasNans())
+ {
+ ivat->imageToView(tempCenter,center );
+ }
+ }
+ }
+}
+
+void ossimGui::ViewManipulator::fit(const ossimDrect& inputRect,
+ const ossimDrect& targetRect)
+{
+ ossimImageGeometry* geom = asGeometry();
+ double scaleX = inputRect.width()/static_cast<double>(targetRect.width());
+ double scaleY = inputRect.height()/static_cast<double>(targetRect.height());
+ double largestScale = ossim::max(scaleX, scaleY);
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+
+
+ mpp.x*=largestScale;
+ mpp.y*=largestScale;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ double x = 1.0/largestScale;
+ double y = x;
+ ivat->scale(x,y);
+ }
+ }
+
+}
+
+void ossimGui::ViewManipulator::zoomIn(ossimDpt& center, double factor)
+{
+ ossimImageGeometry* geom = asGeometry();
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimGpt tempCenter;
+ if(!center.hasNans())
+ {
+ geom->localToWorld(center, tempCenter);
+ }
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+ mpp.x/=factor;
+ mpp.y/=factor;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ }
+ if(!center.hasNans())
+ {
+ geom->worldToLocal(tempCenter, center);
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt scale = ivat->getScale();
+ ossimDpt tempCenter;
+ if(!center.hasNans())
+ {
+ ivat->viewToImage(center, tempCenter);
+ }
+
+ ivat->scale(scale.x*factor,scale.y*factor);
+ if(!center.hasNans())
+ {
+ ivat->imageToView(tempCenter,center);
+ }
+ }
+ }
+}
+
+void ossimGui::ViewManipulator::zoomOut(ossimDpt& center, double factor)
+{
+ ossimImageGeometry* geom = asGeometry();
+ if(geom)
+ {
+ if(geom->getProjection())
+ {
+ ossimGpt tempCenter;
+ if(!center.hasNans())
+ {
+ geom->localToWorld(center, tempCenter);
+ }
+ ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
+ mpp.x*=factor;
+ mpp.y*=factor;
+ ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
+ if(mapProj)
+ {
+ mapProj->setMetersPerPixel(mpp);
+ }
+ if(!center.hasNans())
+ {
+ geom->worldToLocal(tempCenter, center);
+ }
+ }
+ }
+ else
+ {
+ ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
+ if(ivat)
+ {
+ ossimDpt scale = ivat->getScale();
+ ossimDpt tempCenter;
+ if(!center.hasNans())
+ {
+ ivat->viewToImage(center, tempCenter);
+ }
+
+ ivat->scale(scale.x/factor,scale.y/factor);
+ if(!center.hasNans())
+ {
+ ivat->imageToView(tempCenter,center);
+ }
+ }
+ }
+}
+
+ossimImageGeometry* ossimGui::ViewManipulator::asGeometry()
+{
+ ossimImageViewProjectionTransform* ivpt = getObjectAs<ossimImageViewProjectionTransform>();
+ if(ivpt)
+ {
+ return dynamic_cast<ossimImageGeometry*>(ivpt->getView());
+ }
+
+ return getObjectAs<ossimImageGeometry>();
+
+}
diff --git a/ossimGui/src/ossimGui/ui/About.ui b/ossimGui/src/ossimGui/ui/About.ui
new file mode 100644
index 0000000..ceba3d2
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/About.ui
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>About</class>
+ <widget class="QDialog" name="About">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>505</width>
+ <height>304</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>About GeoCell</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="m_aboutText">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::AutoText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>121</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="m_sponsors">
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ </font>
+ </property>
+ <property name="title">
+ <string>Support</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="m_logo">
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_okButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/AdjustableParameterEditor.ui b/ossimGui/src/ossimGui/ui/AdjustableParameterEditor.ui
new file mode 100644
index 0000000..d1d512f
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/AdjustableParameterEditor.ui
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AdjustableParameterEditor</class>
+ <widget class="QDialog" name="AdjustableParameterEditor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>730</width>
+ <height>427</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Parameter Adjustments</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QWidget" name="" native="true">
+ <layout class="QGridLayout">
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="m_adjustmentDescriptionInput"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_adjustmentSelectionLabel">
+ <property name="text">
+ <string>Adjustment Selection:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="m_adjustmentSelectionBox"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="m_adjustmentDescriptionLabel">
+ <property name="text">
+ <string>Adjustment description:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Image Source</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QLabel" name="m_imageSourceLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTableWidget" name="m_adjustableParameterTable">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Sigma</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Param</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Param adjust</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line1">
+ <property name="frameShape">
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QPushButton" name="m_keepAdjustmentButton">
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_copyAdjustmentButton">
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_deleteAdjustmentButton">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_resetButton">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_saveButton">
+ <property name="text">
+ <string>Save...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_closeButton">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/AutoMeasurementDialog.ui b/ossimGui/src/ossimGui/ui/AutoMeasurementDialog.ui
new file mode 100644
index 0000000..14dbcab
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/AutoMeasurementDialog.ui
@@ -0,0 +1,633 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AutoMeasurementDialog</class>
+ <widget class="QDialog" name="AutoMeasurementDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>769</width>
+ <height>359</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Auto Measurement</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTabWidget" name="m_tabWidget">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="tabPosition">
+ <enum>QTabWidget::North</enum>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Configuration</string>
+ </attribute>
+ <widget class="QFrame" name="frame_2">
+ <property name="geometry">
+ <rect>
+ <x>260</x>
+ <y>73</y>
+ <width>461</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="m_xGridSpinBox">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>140</y>
+ <width>53</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="m_yGridSpinBox">
+ <property name="geometry">
+ <rect>
+ <x>73</x>
+ <y>140</y>
+ <width>53</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>542</x>
+ <y>83</y>
+ <width>171</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_detName">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="m_extName">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="m_matName">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>475</x>
+ <y>83</y>
+ <width>64</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <italic>false</italic>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Detector</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <italic>false</italic>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Extractor</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <italic>false</italic>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Matcher</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QSpinBox" name="m_maxMatchSpinBox">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>85</y>
+ <width>51</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_5">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>90</y>
+ <width>141</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Max Matches / Patch</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_6">
+ <property name="geometry">
+ <rect>
+ <x>133</x>
+ <y>145</y>
+ <width>71</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Grid Layout</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame_3">
+ <property name="geometry">
+ <rect>
+ <x>162</x>
+ <y>10</y>
+ <width>411</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>2</number>
+ </property>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>0</y>
+ <width>391</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>15</pointsize>
+ <weight>75</weight>
+ <italic>true</italic>
+ <bold>true</bold>
+ <underline>false</underline>
+ </font>
+ </property>
+ <property name="text">
+ <string>Left button/drag to select bounding box for collection</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QFrame" name="frame_4">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>73</y>
+ <width>221</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QCheckBox" name="m_cbUseGrid">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>42</y>
+ <width>188</width>
+ <height>18</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Use Grid Adapted Detection</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLabel" name="m_detName_2">
+ <property name="geometry">
+ <rect>
+ <x>420</x>
+ <y>55</y>
+ <width>141</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>OpenCV Configuration</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="m_detName_3">
+ <property name="geometry">
+ <rect>
+ <x>45</x>
+ <y>55</y>
+ <width>151</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Collection Configuration</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame_5">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>54</y>
+ <width>221</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame_6">
+ <property name="geometry">
+ <rect>
+ <x>260</x>
+ <y>54</y>
+ <width>461</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="m_matComboBox">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>140</y>
+ <width>191</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="m_extComboBox">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>110</y>
+ <width>191</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="m_detComboBox">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>80</y>
+ <width>191</width>
+ <height>26</height>
+ </rect>
+ </property>
+ </widget>
+ <zorder>frame_2</zorder>
+ <zorder>frame_5</zorder>
+ <zorder>frame_3</zorder>
+ <zorder>frame_4</zorder>
+ <zorder>layoutWidget</zorder>
+ <zorder>layoutWidget</zorder>
+ <zorder>m_xGridSpinBox</zorder>
+ <zorder>m_yGridSpinBox</zorder>
+ <zorder>m_maxMatchSpinBox</zorder>
+ <zorder>label_5</zorder>
+ <zorder>label_6</zorder>
+ <zorder>m_detName_2</zorder>
+ <zorder>m_detName_3</zorder>
+ <zorder>frame_6</zorder>
+ <zorder>m_matComboBox</zorder>
+ <zorder>m_extComboBox</zorder>
+ <zorder>m_detComboBox</zorder>
+ </widget>
+ <widget class="QWidget" name="m_pointPositionTab">
+ <attribute name="title">
+ <string>Collection</string>
+ </attribute>
+ <widget class="QPushButton" name="m_execMeasButton">
+ <property name="geometry">
+ <rect>
+ <x>533</x>
+ <y>10</y>
+ <width>114</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Execute</string>
+ </property>
+ </widget>
+ <widget class="QTextBrowser" name="m_measResultsBrowser">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>0</y>
+ <width>450</width>
+ <height>242</height>
+ </rect>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_acceptMeasButton">
+ <property name="geometry">
+ <rect>
+ <x>533</x>
+ <y>50</y>
+ <width>114</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Accept</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame">
+ <property name="geometry">
+ <rect>
+ <x>530</x>
+ <y>6</y>
+ <width>120</width>
+ <height>80</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ <zorder>frame</zorder>
+ <zorder>m_execMeasButton</zorder>
+ <zorder>m_measResultsBrowser</zorder>
+ <zorder>m_acceptMeasButton</zorder>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="m_botPanel">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QPushButton" name="m_resetMeasButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_1">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_dismissButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Dismiss</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/BandSelectorEditor.ui b/ossimGui/src/ossimGui/ui/BandSelectorEditor.ui
new file mode 100644
index 0000000..ff26481
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/BandSelectorEditor.ui
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BandSelectorEditor</class>
+ <widget class="QDialog" name="BandSelectorEditor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>425</width>
+ <height>386</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="m_outputBandGroup">
+ <property name="title">
+ <string>Output Bands</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QRadioButton" name="m_oneBandButton">
+ <property name="text">
+ <string>1-Band</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_threeBandButton">
+ <property name="text">
+ <string>3-Band</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_nBandButton">
+ <property name="text">
+ <string>N-Band</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="m_bandInputLayout">
+ <item>
+ <widget class="QLabel" name="m_bandsLabel">
+ <property name="text">
+ <string>Bands:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="m_bandInput">
+ <property name="maxLength">
+ <number>32767</number>
+ </property>
+ <property name="readOnly">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_clearBandInputButton">
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="m_bandSelectionGroup">
+ <property name="title">
+ <string>Input Band Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="m_inputBandList"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="m_buttonLayout">
+ <item>
+ <widget class="QCheckBox" name="m_enableButton">
+ <property name="text">
+ <string>Enable</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_resetButton">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_okButton">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/BrightnessContrastEditor.ui b/ossimGui/src/ossimGui/ui/BrightnessContrastEditor.ui
new file mode 100644
index 0000000..567285f
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/BrightnessContrastEditor.ui
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BrightnessContrastEditor</class>
+ <widget class="QDialog" name="BrightnessContrastEditor">
+ <property name="windowModality">
+ <enum>Qt::NonModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>717</width>
+ <height>124</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="m_brightnessLabel">
+ <property name="text">
+ <string>Brightness:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_contrastLabel">
+ <property name="text">
+ <string>Contrast:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QSlider" name="m_brightnessSlider">
+ <property name="minimum">
+ <number>-100</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_contrastSlider">
+ <property name="minimum">
+ <number>-100</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLineEdit" name="m_brightnessEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="m_contrastEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="m_enabled">
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_okButton">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/ExportImageDialog.ui b/ossimGui/src/ossimGui/ui/ExportImageDialog.ui
new file mode 100644
index 0000000..2b40ed0
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/ExportImageDialog.ui
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ExportImageDialog</class>
+ <widget class="QDialog" name="ExportImageDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>681</width>
+ <height>557</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Export Image</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="m_generalInformationBox">
+ <property name="title">
+ <string>General Export Info</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_widthLabel">
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="m_width">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="m_heightLabel">
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="m_height">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_scalarTypeLabel">
+ <property name="text">
+ <string>Scalar Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" rowspan="2">
+ <widget class="QLineEdit" name="m_scalarType">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" rowspan="2">
+ <widget class="QLabel" name="m_bandsLabel">
+ <property name="text">
+ <string>Bands:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="m_bands">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="m_sizeLabel">
+ <property name="text">
+ <string>Approximate Uncompressed Size:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="m_size">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="m_fileLayout">
+ <item>
+ <widget class="QComboBox" name="m_fileTypes"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_fileButton">
+ <property name="text">
+ <string>File</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="m_propertiesGroupBox">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="title">
+ <string>Writer Properties</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="ossimGui::DataManagerPropertyView" name="m_propertyView">
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="ossimGui::ProgressWidget" name="m_progressBar">
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="m_leftHorizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="m_exportInBackground">
+ <property name="text">
+ <string>Export in Background</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_exportAbortButton">
+ <property name="text">
+ <string>Export</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_closeButton">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="m_rightHorizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ossimGui::DataManagerPropertyView</class>
+ <extends>QTreeView</extends>
+ <header>ossimGui/DataManagerPropertyView.h</header>
+ </customwidget>
+ <customwidget>
+ <class>ossimGui::ProgressWidget</class>
+ <extends>QProgressBar</extends>
+ <header>ossimGui/ProgressWidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/HistogramRemapperEditor.ui b/ossimGui/src/ossimGui/ui/HistogramRemapperEditor.ui
new file mode 100644
index 0000000..98e5c76
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/HistogramRemapperEditor.ui
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>HistogramRemapperEditor</class>
+ <widget class="QDialog" name="HistogramRemapperEditor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>498</width>
+ <height>342</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QComboBox" name="m_stretchModeComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="m_bandComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>master</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="ossimGui::HistogramWidget" name="m_histogramWidget">
+ <property name="minimumSize">
+ <size>
+ <width>258</width>
+ <height>138</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>999999</width>
+ <height>999999</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="m_lowClipPercentLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_lowClipPercentLineEditLabel">
+ <property name="text">
+ <string>low clip percent</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer11_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLineEdit" name="m_highClipPercentLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_highClipPercentLineEditLabel">
+ <property name="text">
+ <string>high clip percent</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer12_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLineEdit" name="m_lowClipValueLineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_lowClipValueLineEditLabel">
+ <property name="text">
+ <string>low clip value</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer13_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLineEdit" name="m_highClipValueLineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_highClipValueLineEditLabel">
+ <property name="text">
+ <string>high clip value</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer14_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLineEdit" name="m_midPointLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_midPointLineEditLabel">
+ <property name="text">
+ <string>mid point</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer15_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLineEdit" name="m_outputMinValue">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_outputMinValueLabel">
+ <property name="text">
+ <string>output min value</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer16_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLineEdit" name="m_outputMaxValue">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="textLabel10_2">
+ <property name="text">
+ <string>output max value</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer17_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <item>
+ <widget class="QLabel" name="m_histogramFileLineEditLabel">
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>histogram file:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="m_histogramFileLineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>220</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_histogramFilePushButton">
+ <property name="text">
+ <string>set histogram file</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="m_enableButton">
+ <property name="text">
+ <string>Enable</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_resetButton">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_okButton">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ossimGui::HistogramWidget</class>
+ <extends>QFrame</extends>
+ <header>ossimGui/HistogramWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/HsiRemapperEditor.ui b/ossimGui/src/ossimGui/ui/HsiRemapperEditor.ui
new file mode 100644
index 0000000..ea0dc7e
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/HsiRemapperEditor.ui
@@ -0,0 +1,780 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>HsiRemapperEditor</class>
+ <widget class="QDialog" name="HsiRemapperEditor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>507</width>
+ <height>429</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HSI Remapper Property Editor</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="m_redButton">
+ <property name="text">
+ <string>red</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_yellowButton">
+ <property name="text">
+ <string>yellow</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_greenButton">
+ <property name="text">
+ <string>green</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_cyanButton">
+ <property name="text">
+ <string>cyan</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_blueButton">
+ <property name="text">
+ <string>blue</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_magentaButton">
+ <property name="text">
+ <string>magenta</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="m_allButton">
+ <property name="text">
+ <string>all</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>8</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_hueOffsetLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>hue offset:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_hueOffsetSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>-180</number>
+ </property>
+ <property name="maximum">
+ <number>180</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>60</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_hueOffsetValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_hueLowRangeLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>hue low range:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_hueLowRangeSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>-30</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_hueLowRangeValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_hueHighRangeLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>hue high range:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_hueHighRangeSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>-30</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_hueHighRangeValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_hueBlendRangeLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>hue blend range:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_hueBlendRangeSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>15</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_hueBlendRangeValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_saturationOffsetLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>saturation offset:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_saturationOffsetSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>-200</number>
+ </property>
+ <property name="maximum">
+ <number>200</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>40</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_saturationOffsetValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_intensityOffsetLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>intensity offset</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_intensityOffsetSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>-100</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>40</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_intensityOffsetValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_lowIntensityClipLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>low intensity clip:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_lowIntensityClipSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>40</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_lowIntensityClipValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_highIntensityClipLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>high intensity clip:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_highIntensityClipSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>400</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>40</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_highIntensityClipValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="m_whiteObjectClipLabel">
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>white object clip</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_whiteObjectClipSlider">
+ <property name="minimumSize">
+ <size>
+ <width>290</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>320</number>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>400</number>
+ </property>
+ <property name="tracking">
+ <bool>false</bool>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_whiteObjectClipValueLabel">
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line1">
+ <property name="frameShape">
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="m_enableButton">
+ <property name="text">
+ <string>enable</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_resetGroupButton">
+ <property name="text">
+ <string>reset group</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_resetAllButton">
+ <property name="text">
+ <string>reset all</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_okButton">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/MainWindow.ui b/ossimGui/src/ossimGui/ui/MainWindow.ui
new file mode 100644
index 0000000..6ea72cc
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/MainWindow.ui
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ossimGuiMainWindow</class>
+ <widget class="QMainWindow" name="ossimGuiMainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1255</width>
+ <height>876</height>
+ </rect>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="windowTitle">
+ <string>OSSIM Main WIndow</string>
+ </property>
+ <widget class="QWidget" name="m_centralWidget">
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QSplitter" name="m_splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="ossimGui::DataManagerWidget" name="m_dataManagerWidget">
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <column>
+ <property name="text">
+ <string>Data Manager</string>
+ </property>
+ </column>
+ </widget>
+ <widget class="QMdiArea" name="m_mdiArea">
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="viewMode">
+ <enum>QMdiArea::SubWindowView</enum>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="m_menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1255</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="m_statusbar"/>
+ <action name="actionSubwindow_View">
+ <property name="text">
+ <string>Subwindow View</string>
+ </property>
+ </action>
+ <action name="m_actionWindowTabbedView">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Tabbed View</string>
+ </property>
+ </action>
+ <action name="m_actionCloseProject">
+ <property name="text">
+ <string>Close Project</string>
+ </property>
+ </action>
+ <action name="m_actionNewProject">
+ <property name="text">
+ <string>New Project</string>
+ </property>
+ </action>
+ <action name="m_actionSaveSessionAs">
+ <property name="text">
+ <string>Save Project As</string>
+ </property>
+ </action>
+ <action name="m_actionSaveSession">
+ <property name="text">
+ <string>Save Project</string>
+ </property>
+ </action>
+ <action name="m_actionDatumConverter">
+ <property name="text">
+ <string>Datum Converter</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ossimGui::DataManagerWidget</class>
+ <extends>QTreeWidget</extends>
+ <header>ossimGui/DataManagerWidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ossimGui/src/ossimGui/ui/MultiImageDialog.ui b/ossimGui/src/ossimGui/ui/MultiImageDialog.ui
new file mode 100644
index 0000000..863790e
--- /dev/null
+++ b/ossimGui/src/ossimGui/ui/MultiImageDialog.ui
@@ -0,0 +1,515 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MultiImageDialog</class>
+ <widget class="QDialog" name="MultiImageDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>710</width>
+ <height>359</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Metric Exploitation</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTabWidget" name="m_tabWidget">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="tabPosition">
+ <enum>QTabWidget::North</enum>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="m_imageSummaryTab">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <attribute name="title">
+ <string>Image Summary</string>
+ </attribute>
+ <widget class="QTableWidget" name="m_imageTable">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>640</width>
+ <height>220</height>
+ </rect>
+ </property>
+ <property name="cursor" stdset="0">
+ <cursorShape>ArrowCursor</cursorShape>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>false</bool>
+ </property>
+ <property name="showDropIndicator" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="dragDropOverwriteMode">
+ <bool>false</bool>
+ </property>
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="horizontalScrollMode">
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="m_pointEditorTab">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <attribute name="title">
+ <string>Point Editor</string>
+ </attribute>
+ <widget class="QTableWidget" name="m_pointTable">
+ <property name="geometry">
+ <rect>
+ <x>23</x>
+ <y>30</y>
+ <width>551</width>
+ <height>211</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>false</bool>
+ </property>
+ <property name="showDropIndicator" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="dragDropOverwriteMode">
+ <bool>false</bool>
+ </property>
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_addPointButton">
+ <property name="geometry">
+ <rect>
+ <x>576</x>
+ <y>32</y>
+ <width>91</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>New Point</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>2</x>
+ <y>95</y>
+ <width>16</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>I
+m
+a
+g
+e</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_5">
+ <property name="geometry">
+ <rect>
+ <x>273</x>
+ <y>10</y>
+ <width>51</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>P o i n t</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="m_currentPointID">
+ <property name="geometry">
+ <rect>
+ <x>590</x>
+ <y>78</y>
+ <width>62</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame_2">
+ <property name="geometry">
+ <rect>
+ <x>590</x>
+ <y>70</y>
+ <width>61</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_autoMeasButton">
+ <property name="geometry">
+ <rect>
+ <x>587</x>
+ <y>170</y>
+ <width>70</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Auto</string>
+ </property>
+ </widget>
+ <zorder>frame_2</zorder>
+ <zorder>m_pointTable</zorder>
+ <zorder>m_addPointButton</zorder>
+ <zorder>label_4</zorder>
+ <zorder>label_5</zorder>
+ <zorder>m_currentPointID</zorder>
+ <zorder>m_autoMeasButton</zorder>
+ </widget>
+ <widget class="QWidget" name="m_RegistrationTab">
+ <attribute name="title">
+ <string>Registration</string>
+ </attribute>
+ <widget class="QPushButton" name="m_registerButton">
+ <property name="geometry">
+ <rect>
+ <x>568</x>
+ <y>21</y>
+ <width>94</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Register</string>
+ </property>
+ </widget>
+ <widget class="QTextBrowser" name="m_regResultsBrowser">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>551</width>
+ <height>231</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame_3">
+ <property name="geometry">
+ <rect>
+ <x>575</x>
+ <y>60</y>
+ <width>80</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="Line" name="line">
+ <property name="geometry">
+ <rect>
+ <x>-20</x>
+ <y>40</y>
+ <width>118</width>
+ <height>3</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_resetRegButton">
+ <property name="geometry">
+ <rect>
+ <x>5</x>
+ <y>46</y>
+ <width>70</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_acceptRegButton">
+ <property name="geometry">
+ <rect>
+ <x>5</x>
+ <y>6</y>
+ <width>70</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Accept</string>
+ </property>
+ </widget>
+ </widget>
+ <zorder>frame_3</zorder>
+ <zorder>m_registerButton</zorder>
+ <zorder>m_regResultsBrowser</zorder>
+ </widget>
+ <widget class="QWidget" name="m_pointPositionTab">
+ <attribute name="title">
+ <string>Point Position</string>
+ </attribute>
+ <widget class="QPushButton" name="m_dropButton">
+ <property name="geometry">
+ <rect>
+ <x>550</x>
+ <y>10</y>
+ <width>114</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Drop Point</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="m_notCertified">
+ <property name="geometry">
+ <rect>
+ <x>198</x>
+ <y>206</y>
+ <width>281</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>18</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string><html><head/><body><p><span style=" font-style:italic; color:#0000ff;">NOT CERTIFIED FOR TARGETING</span></p></body></html></string>
+ </property>
+ </widget>
+ <widget class="QTextBrowser" name="m_pointPositionBrowser">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>0</y>
+ <width>521</width>
+ <height>192</height>
+ </rect>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="m_clearPointButton">
+ <property name="geometry">
+ <rect>
+ <x>550</x>
+ <y>60</y>
+ <width>114</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <italic>false</italic>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Clear Current</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="m_mensurationTab">
+ <attribute name="title">
+ <string>Mensuration</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="m_botPanel">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QPushButton" name="m_resetModeButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Reset Mode</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_1">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_hideButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Dismiss</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/ossim-gui.git
More information about the Pkg-grass-devel
mailing list