Commit af789d82 authored by allens's avatar allens

removed old framework

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22813 18c085ea-50e0-402c-830e-de6fd14e8384
parent 7beeb780
#*****************************************************************************
#
# Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
# Produced at the Lawrence Livermore National Laboratory
# LLNL-CODE-442911
# All rights reserved.
#
# This file is part of VisIt. For details, see https://visit.llnl.gov/. The
# full copyright notice is contained in the file COPYRIGHT located at the root
# of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the disclaimer below.
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the disclaimer (as noted below) in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of the LLNS/LLNL nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
# Modifications:
# Kathleen Bonnell, Wed Jan 05 10:25:13 PST 2010
# Add FOLDER property.
#
#****************************************************************************/
SET(SOURCES
CommandParser.C
SyntheticDiagnosticApp.C
Synchronizer.C
main.C
)
# If the viewer is static then we need some static symbol lookup functions
IF(VISIT_STATIC)
SET(STATIC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../viewer/main/ViewerStaticSymbolLocator.C)
ENDIF(VISIT_STATIC)
# The subset of the sources that have Q_OBJECT in their header.
SET(MOC_SOURCES
CommandParser.h
SyntheticDiagnosticApp.h
Synchronizer.h
)
QT_WRAP_CPP(synthetic_diagnostic SOURCES ${MOC_SOURCES})
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${VISIT_COMMON_INCLUDES}
${VISIT_SOURCE_DIR}/avt/DBAtts/MetaData
${VISIT_SOURCE_DIR}/avt/DBAtts/SIL
${VISIT_SOURCE_DIR}/engine/proxy
${VISIT_SOURCE_DIR}/engine/rpc
${VISIT_SOURCE_DIR}/mdserver/proxy
${VISIT_SOURCE_DIR}/mdserver/rpc
${VISIT_SOURCE_DIR}/viewer/main
${VISIT_SOURCE_DIR}/viewer/proxy
${VISIT_SOURCE_DIR}/viewer/rpc
${VISIT_SOURCE_DIR}/vtkqt
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${QT_QTOPENGL_INCLUDE_DIR}
${QT_QTNETWORK_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
)
LINK_DIRECTORIES(${LIBRARY_OUTPUT_DIRECTORY} ${QT_LIBRARY_DIR} ${MESA_LIBRARY_DIR} ${GLEW_LIBRARY_DIR} ${VTK_LIBRARY_DIRS})
IF(NOT APPLE)
ADD_EXECUTABLE(synthetic_diagnostic ${SOURCES} ${STATIC_SOURCES})
ELSE(NOT APPLE)
SET(GUI_ICON_FILE VisItIcon.icns)
SET_SOURCE_FILES_PROPERTIES(${VISIT_SOURCE_DIR}/common/icons/${GUI_ICON_FILE} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
ADD_EXECUTABLE(synthetic_diagnostic MACOSX_BUNDLE ${SOURCES} ${STATIC_SOURCES} ${VISIT_SOURCE_DIR}/common/icons/${GUI_ICON_FILE})
SET(MACOSX_BUNDLE_BUNDLE_NAME "Synthetic Diagnostic ${VISIT_VERSION}")
SET(MACOSX_BUNDLE_INFO_STRING "Synthetic Diagnostic")
SET(MACOSX_BUNDLE_ICON_FILE ${GUI_ICON_FILE})
SET(MACOSX_BUNDLE_GUI_IDENTIFIER VISI)
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "Synthetic Diagnostic version ${VISIT_VERSION}")
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "Synthetic Diagnostic ${VISIT_VERSION}")
SET(MACOSX_BUNDLE_BUNDLE_VERSION ${VISIT_VERSION})
SET(MACOSX_BUNDLE_COPYRIGHT "Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC")
ENDIF(NOT APPLE)
SET(VIEWER_QT_LIBS
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTCORE_LIBRARY}
)
IF(VISIT_STATIC)
MAC_NIB_INSTALL(synthetic_diagnostic)
SET(VIEWER_QT_LIBS
${VIEWER_QT_LIBS}
${QT_QTGUI_LIB_DEPENDENCIES}
${QT_QTOPENGL_LIB_DEPENDENCIES}
${QT_QTNETWORK_LIB_DEPENDENCIES}
${QT_QTCORE_LIB_DEPENDENCIES}
)
ENDIF(VISIT_STATIC)
TARGET_LINK_LIBRARIES(synthetic_diagnostic
${viewer_exe_IOperator}
${viewer_exe_VOperator}
${viewer_exe_IPlot}
${viewer_exe_VPlot}
avtdatabase_ser
avtdbatts
avtfilters_ser
avtmath
avtmir_ser
avtpipeline_ser
avtplotter_ser
avtqtviswindow
avtview
avtviswindow_ser
avtwriter_ser
engineproxy
enginerpc
lightweight_visit_vtk
mdserverproxy
mdserverrpc
vclproxy
vclrpc
viewer
viewerrpc
visit_verdict
visit_vtk
vtkqt
${VIEWER_QT_LIBS}
)
IF(APPLE)
SET_TARGET_PROPERTIES(synthetic_diagnostic
PROPERTIES
LINK_FLAGS "-framework Carbon"
)
ENDIF(APPLE)
# If we're building statically then the viewer can't be linked until the plugin
# sources are built
IF(VISIT_STATIC)
ADD_DEPENDENCIES(synthetic_diagnostic
${viewer_exe_IOperator}
${viewer_exe_VOperator}
${viewer_exe_IPlot}
${viewer_exe_VPlot}
)
ENDIF(VISIT_STATIC)
VISIT_TOOLS_ADD_FOLDER(synthetic_diagnostic)
#include <QFile>
#include <QTextStream>
#include "CommandParser.h"
CommandParser::CommandParser(VisItViewer *v) : QObject(), viewer(v)
{
// This is called after VisItViewer::Setup. This is CRITICAL!
sync = new Synchronizer(
v->State()->GetSyncAttributes(), // The object that we observe
v->DelayedState()->GetSyncAttributes() // The object that we use to post syncs
);
}
CommandParser::~CommandParser()
{
}
void CommandParser::ProcessCommands(const QString &filename)
{
commands.clear();
QFile f(filename);
if(f.open(QIODevice::ReadOnly))
{
QTextStream s(&f);
while(!s.atEnd())
commands.push_back(s.readLine());
}
if(commands.size() > 0)
{
connect(sync, SIGNAL(synchronized()),
this, SLOT(ProcessOneCommand()));
sync->PostSynchronize();
}
}
void CommandParser::ProcessOneCommand()
{
if(commands.empty())
{
disconnect(sync, SIGNAL(synchronized()),
this, SLOT(ProcessOneCommand()));
return;
}
QString cmd = commands.front();
commands.pop_front();
// translate the command into viewer calls
if(cmd.left(8) == "openFile")
{
qDebug("Executing command: %s", cmd.toStdString().c_str());
std::string var = cmd.right(cmd.size()-8-1).toStdString();
emit openFile(QString(var.c_str()));
}
else if(cmd.left(14) == "changeVariable")
{
qDebug("Executing command: %s", cmd.toStdString().c_str());
std::string var = cmd.right(cmd.size()-14-1).toStdString();
emit changeVariable(QString(var.c_str()));
}
else if(cmd.left(14) == "changePlotType")
{
qDebug("Executing command: %s", cmd.toStdString().c_str());
QString pt = cmd.right(cmd.size()-14-1);
emit changePlotType(pt.toInt());
}
else if(cmd.left(12) == "setNContours")
{
qDebug("Executing command: %s", cmd.toStdString().c_str());
QString nc = cmd.right(cmd.size()-12-1);
emit setNContours(nc.toInt());
}
else if(cmd == "saveWindow")
{
qDebug("Executing command: %s", cmd.toStdString().c_str());
emit saveWindow();
}
// issue a synchronize. We'll get back to this method when
// the synchronizer issues its signal.
sync->PostSynchronize();
}
#ifndef COMMAND_PARSER_H
#define COMMAND_PARSER_H
#include <QObject>
#include <QStringList>
#include <VisItViewer.h>
#include "Synchronizer.h"
class CommandParser : public QObject
{
Q_OBJECT
public:
CommandParser(VisItViewer *v);
virtual ~CommandParser();
void ProcessCommands(const QString &filename);
signals:
void openFile(const QString &);
void changeVariable(const QString &);
void changePlotType(int);
void setNContours(int);
void saveWindow();
private slots:
void ProcessOneCommand();
private:
VisItViewer *viewer;
QStringList commands;
Synchronizer *sync;
};
#endif
#include "Synchronizer.h"
Synchronizer::Synchronizer(Subject *s, Subject *ds) : QObject(), Observer(s)
{
syncCount = 100;
sync = (SyncAttributes *)s;
delayedSync = (SyncAttributes *)ds;
}
Synchronizer::~Synchronizer()
{
}
void
Synchronizer::PostSynchronize()
{
delayedSync->SetSyncTag(syncCount++);
delayedSync->Notify();
}
void Synchronizer::Update(Subject *)
{
emit synchronized();
}
#ifndef SYNCHRONIZER_H
#define SYNCHRONIZER_H
#include <QObject>
#include <Observer.h>
#include <SyncAttributes.h>
class Synchronizer : public QObject, public Observer
{
Q_OBJECT
public:
Synchronizer(Subject *s, Subject *ds);
virtual ~Synchronizer();
void PostSynchronize();
signals:
void synchronized();
private:
virtual void Update(Subject *s);
int syncCount;
SyncAttributes *sync, *delayedSync;
};
#endif
This diff is collapsed.
#ifndef MULTI_WINDOW_VIS_APP_H
#define MULTI_WINDOW_VIS_APP_H
#include <QMainWindow>
class VisItViewer;
class QListWidget;
class vtkQtRenderWindow;
class QLabel;
class QCheckBox;
class QLineEdit;
class QSpinBox;
class QVBox;
class QButtonGroup;
class QvisColorTableButton;
class QvisOpacitySlider;
class QvisColorButton;
class QvisLineStyleWidget;
class QvisLineWidthWidget;
class QvisVariableButton;
class QGridLayout;
#define NWINDOWS 3
#define WINDOW_3D 1
#define WINDOW_2D 2
#define WINDOW_1D 3
class SyntheticDiagnosticApp : public QMainWindow
{
Q_OBJECT
public:
SyntheticDiagnosticApp(VisItViewer *v);
virtual ~SyntheticDiagnosticApp();
// Window creation callback. Returns the vis window pointers to VisIt.
static vtkQtRenderWindow *ReturnVisWin(void *data);
public slots:
virtual void show();
private slots:
void selectFile();
void openFile(const QString &);
void onSelectDiagnostic(const QString &var);
void resetWindow();
void openGUI();
void showTheWindow();
private:
bool windowsAdded;
QString activeFile;
VisItViewer *viewer;
QListWidget *diagnostics;
int currentWindow;
vtkQtRenderWindow *viswindows[NWINDOWS+1];
QWidget *coordinateSystem;
QButtonGroup *coordinateSystemButtonGroup;
QWidget *beamShape;
QButtonGroup *beamShapeButtonGroup;
QLineEdit *radius;
QLineEdit *divergence;
QWidget *beamProjection;
QButtonGroup *beamProjectionButtonGroup;
QLineEdit *nBeams;
QLineEdit *offset;
QLineEdit *angle;
QLineEdit *origin;
QWidget *beamAxis;
QButtonGroup *beamAxisButtonGroup;
QLineEdit *poloialAngle;
QLineEdit *poloialRTilt;
QLineEdit *poloialZTilt;
QLineEdit *toroialAngle;
QWidget *viewDimension;
QButtonGroup *viewDimensionButtonGroup;
QWidget *beamType;
QButtonGroup *beamTypeButtonGroup;
QLineEdit *standardDeviation;
QLineEdit *sampleDistance;
QLineEdit *sampleArc;
QLabel *coordinateSystemLabel;
QLabel *beamShapeLabel;
QLabel *radiusLabel;
QLabel *divergenceLabel;
QLabel *beamProjectionLabel;
QLabel *nBeamsLabel;
QLabel *offsetLabel;
QLabel *angleLabel;
QLabel *originLabel;
QLabel *beamAxisLabel;
QLabel *poloialAngleLabel;
QLabel *poloialRTiltLabel;
QLabel *poloialZTiltLabel;
QLabel *toroialAngleLabel;
QLabel *viewDimensionLabel;
QLabel *beamTypeLabel;
QLabel *standardDeviationLabel;
QLabel *sampleDistanceLabel;
QLabel *sampleArcLabel;
void CreateSimulationGUI(QWidget *parent, QGridLayout *layout);
};
#endif
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#include <qapplication.h>
#include <qdir.h>
#include <visitstream.h>
#include <VisItViewer.h>
#include <VisItException.h>
#include <SyntheticDiagnosticApp.h>
// ****************************************************************************
// Method: main
//
// Purpose:
// The embedded viewer main program.
//
// Arguments:
// argc The number of command line arguments.
// argv The command line arguments.
//
// Progammer: Dave Pugmire
// Creation: Wed Nov 24 08:12:25 EST 2010
//
// Modifications:
//
// ****************************************************************************
int
main(int argc, char *argv[])
{
int retval = 0;
//
// Do basic initialization. This is only done once to initialize the
// viewer library.
//
VisItViewer::Initialize(&argc, &argv);
TRY
{
//
// Create the viewer.
//
VisItViewer viewer;
// Go up the dierctory structures until we find the "src" directory,
// which is what we'll use for VISITHOME so it finds our development
// version of VisIt.
#ifndef _WIN32
#ifdef Q_WS_MACX
QDir d(argv[0]);
#else
QDir d;
#endif
bool okay = true;
while(okay && !d.absolutePath().endsWith("src"))
okay = d.cdUp();
std::string visithome(d.absolutePath().toStdString());
qDebug("Setting VISITHOME to %s", visithome.c_str());
viewer.SetVISITHOME(visithome);
#endif
//
// Process the command line arguments first since some may be removed
// by QApplication::QApplication.
//
viewer.ProcessCommandLine(argc, argv);
//
// Create the QApplication. This sets the qApp pointer.
//
QApplication *mainApp = new QApplication(argc, argv);
//
// Create our visualization app. We have to do it before the call to Setup()
// since we're embedding vis windows.
//
SyntheticDiagnosticApp *visapp = new SyntheticDiagnosticApp(&viewer);
//
// Now that we've created the QApplication, let's call the viewer's
// setup routine.
//
viewer.Setup();
//
// Show our app's main window
//
visapp->show();
visapp->raise();
//
// Execute the viewer.
//
retval = mainApp->exec();
}
CATCH2(VisItException, e)
{
cerr << "VisIt's viewer encountered the following fatal "
"initialization error: " << endl
<< e.Message().c_str() << endl;
retval = -1;
}
ENDTRY
// Finalize the viewer library.
VisItViewer::Finalize();
return retval;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment