Commit f047c249 authored by js9's avatar js9

Porting clip case editor to Qt4 and adding CMake build.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@18708 18c085ea-50e0-402c-830e-de6fd14e8384
parent 38ea8e29
......@@ -77,6 +77,7 @@ ELSE(VISIT_DBIO_ONLY OR VISIT_ENGINE_ONLY OR VISIT_SERVER_COMPONENTS_ONLY)
ENDIF(MILI_FOUND AND NOT WIN32)
IF(NOT WIN32)
ADD_SUBDIRECTORY(mcurvit)
ADD_SUBDIRECTORY(clipeditor)
ENDIF(NOT WIN32)
ADD_SUBDIRECTORY(mpeg2encode)
IF(SILO_FOUND)
......@@ -105,7 +106,6 @@ ENDIF(VISIT_DBIO_ONLY OR VISIT_ENGINE_ONLY OR VISIT_SERVER_COMPONENTS_ONLY)
# avt_do_add
# avtprep
# clidriver
# clipeditor
# curv3dprep
# doxygenate
# escan
......
#*****************************************************************************
#
# Copyright (c) 2000 - 2012, 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:
#
#****************************************************************************/
SET(CLIPEDITOR_SOURCES
ClipEditor.C
DataSet.C
Font.C
main.C
Matrix.C
Shape.C
Transforms.C
Vector.C
Viewer.C
)
ADD_EXECUTABLE(genhexcases genhexcases.C)
ADD_EXECUTABLE(gentetcases gentetcases.C)
ADD_EXECUTABLE(genvoxcases genvoxcases.C)
SET(CLIPEDITOR_MOC_SOURCES
ClipEditor.h
Viewer.h
)
QT_WRAP_CPP(clipeditor CLIPEDITOR_SOURCES ${CLIPEDITOR_MOC_SOURCES})
INCLUDE_DIRECTORIES(
../../visit_vtk/lightweight
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${QT_QTOPENGL_INCLUDE_DIR}
)
LINK_DIRECTORIES(${LIBRARY_OUTPUT_DIRECTORY} ${QT_LIBRARY_DIR})
ADD_EXECUTABLE(clipeditor ${VISIT_APPLICATION_STYLE} ${CLIPEDITOR_SOURCES})
TARGET_LINK_LIBRARIES(clipeditor
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
${QT_QTCORE_LIBRARY}
-lGL
)
......@@ -65,7 +65,11 @@
#include "Viewer.h"
#include <stdlib.h>
#include <visitstream.h>
#include <iostream>
#include <fstream>
#include <QKeyEvent>
using namespace std;
std::string copyright_str =
"/*****************************************************************************\n"
......@@ -246,8 +250,8 @@ inline char StrToNodeWithConversion(const char *c)
}
ClipEditor::ClipEditor(const QString &st,
QWidget *parent, const QString &name) :
QMainWindow(parent, name)
QWidget *parent) :
QMainWindow(parent)
{
if (st.left(3) == "hex")
{
......@@ -306,7 +310,7 @@ ClipEditor::ClipEditor(const QString &st,
}
viewer = new Viewer(this, "Viewer Widget");
viewer = new Viewer(this);
setCentralWidget(viewer);
textMode = TM_MAIN;
defaultcolor = 0;
......@@ -399,7 +403,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
cerr << endl;
}
}
else if (kev->key() == Qt::Key_Prior)
else if (kev->key() == Qt::Key_PageUp)
{
int oldindex = caseindex;
caseindex--;
......@@ -423,7 +427,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
cerr << "No previous unique cases\n";
}
}
else if (kev->key() == Qt::Key_Next)
else if (kev->key() == Qt::Key_PageDown)
{
int oldindex = caseindex;
caseindex++;
......@@ -451,7 +455,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -463,7 +467,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -481,7 +485,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -499,7 +503,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -540,7 +544,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -555,7 +559,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -569,7 +573,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
{
if (datasets[caseindex]->copyOfDataset)
{
cerr << "Read-only case!\n";
cerr << "This case is not unique; it is a copy and thus cannot be modified.\n";
}
else
{
......@@ -671,7 +675,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
}
else
{
cerr << "Invalid shape type " << kev->text() << endl;
cerr << "Invalid shape type " << kev->text().toStdString() << endl;
}
}
else if (addedpoints == -1)
......@@ -721,7 +725,7 @@ ClipEditor::keyPressEvent(QKeyEvent *kev)
}
else
{
cerr << "Invalid key " << kev->text() << endl;
cerr << "Invalid key " << kev->text().toStdString() << endl;
}
if (addedpoints == npts)
......
......@@ -46,7 +46,7 @@
#ifndef CLIP_EDITOR_H
#define CLIP_EDITOR_H
#include <qmainwindow.h>
#include <QMainWindow>
#include <vector>
#include <string>
#include "DataSet.h"
......@@ -57,7 +57,7 @@ class ClipEditor : public QMainWindow
{
Q_OBJECT
public:
ClipEditor(const QString &shape, QWidget *parent, const QString &name);
ClipEditor(const QString &shape, QWidget *parent);
virtual void keyPressEvent(QKeyEvent *kev);
......
......@@ -47,7 +47,7 @@
#include "Vector.h"
#include "Shape.h"
#include <visitstream.h>
#include <iostream>
DataSet::DataSet(ShapeType st, int sc)
{
......
......@@ -39,7 +39,6 @@
#include "Matrix.h"
#include "Vector.h"
#include <math.h>
#include <visitstream.h>
#define MAX(a,b) ((a)>(b) ? (a) : (a))
#define MIN(a,b) ((a)>(b) ? (b) : (a))
......@@ -361,7 +360,7 @@ Matrix::CreateTrackball(float p1x,float p1y, float p2x, float p2y)
}
ostream &operator<<(ostream& out, const Matrix &r)
std::ostream &operator<<(std::ostream& out, const Matrix &r)
{
out << r.m[0][0] << "," << r.m[0][1] << "," << r.m[0][2] << "," << r.m[0][3] << "\n";
out << r.m[1][0] << "," << r.m[1][1] << "," << r.m[1][2] << "," << r.m[1][3] << "\n";
......
......@@ -47,7 +47,7 @@
#define MATRIX_H
class Vector;
#include <visitstream.h>
#include <iostream>
// ****************************************************************************
// Class: Matrix
......@@ -96,7 +96,7 @@ class Matrix
float* GetOpenGLMatrix();
// friends
friend ostream& operator<<(ostream&,const Matrix&);
friend std::ostream& operator<<(std::ostream&,const Matrix&);
};
#endif
......@@ -62,14 +62,16 @@
#include "Shape.h"
#include "Vector.h"
#include <qgl.h>
#include <QGLWidget>
#include "Font.h"
#include "Transforms.h"
#include "../../visit_vtk/lightweight/vtkTriangulationTables.C"
#include "vtkTriangulationTables.C"
#include "DataSet.h"
using std::vector;
using std::cerr;
using std::endl;
using std::swap;
int Shape::duplicateFacesRemoval = 0;
......
......@@ -41,7 +41,7 @@
#include <stdio.h>
ostream &operator<<(ostream& out, const Vector &r)
std::ostream &operator<<(std::ostream& out, const Vector &r)
{
out << "<" << r.x << "," << r.y << "," << r.z << ">";
return out;
......
......@@ -39,7 +39,7 @@
#ifndef VECTOR_H
#define VECTOR_H
#include <visitstream.h>
#include <iostream>
// ****************************************************************************
// Class: Vector
......@@ -88,7 +88,7 @@ class Vector
Vector normalized() const;
// friends
friend ostream& operator<<(ostream&,const Vector&);
friend std::ostream& operator<<(std::ostream&,const Vector&);
// input/output
const char *getAsText();
......@@ -98,7 +98,6 @@ class Vector
};
#include <math.h>
#include <visitstream.h>
inline
Vector::Vector()
......
/*****************************************************************************
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
......@@ -47,10 +47,10 @@
#include "Matrix.h"
#include "Shape.h"
#include <qevent.h>
#include <QEvent>
Viewer::Viewer(QWidget *parent, const char *name)
: QGLWidget(parent, name)
Viewer::Viewer(QWidget *parent)
: QGLWidget(parent)
{
mousedown = false;
M.CreateIdentity();
......@@ -199,7 +199,7 @@ Viewer::mouseMoveEvent(QMouseEvent *mev)
float x2 = ((float( x *2)/float(width())) - 1.0);
float y2 = -((float( y *2)/float(height())) - 1.0);
if (mev->state() == LeftButton)
if (mev->buttons() == Qt::LeftButton)
{
Matrix R1;
R1.CreateTrackball(-x1,-y1, -x2,-y2);
......@@ -226,14 +226,14 @@ Viewer::mouseMoveEvent(QMouseEvent *mev)
up = MM^up;
V.CreateView(from,at,up);
}
else if (mev->state() == MidButton)
else if (mev->buttons() == Qt::MidButton)
{
Vector view_dir((at-from).normalized());
at += view_dir*(y2-y1)*ds_size;
from += view_dir*(y2-y1)*ds_size;
V.CreateView(from,at,up);
}
else if (mev->state() & RightButton)
else if (mev->buttons() & Qt::RightButton)
{
Vector view_dir(at-from);
Vector right(up % view_dir);
......
......@@ -46,7 +46,8 @@
#ifndef VIEWER_H
#define VIEWER_H
#include <qgl.h>
#include <QGLWidget>
#include <QMouseEvent>
#include "Vector.h"
#include "Matrix.h"
......@@ -56,7 +57,7 @@ class Viewer : public QGLWidget
{
Q_OBJECT
public:
Viewer(QWidget *parent=NULL, const char *name=NULL);
Viewer(QWidget *parent=NULL);
~Viewer();
void initializeGL();
......
......@@ -36,7 +36,8 @@
*
*****************************************************************************/
#include <visitstream.h>
#include <iostream>
using namespace std;
// ****************************************************************************
// File: genhexcases.cpp
......
......@@ -36,7 +36,8 @@
*
*****************************************************************************/
#include <visitstream.h>
#include <iostream>
using namespace std;
// ****************************************************************************
// File: gentetcases.cpp
......
......@@ -36,7 +36,8 @@
*
*****************************************************************************/
#include <visitstream.h>
#include <iostream>
using namespace std;
// ****************************************************************************
// File: genvoxcases.cpp
......
......@@ -47,15 +47,17 @@
//
// ----------------------------------------------------------------------------
#include <qapplication.h>
#include <QtGui/QApplication>
#include <qmainwindow.h>
#include <QMainWindow>
#include <visitstream.h>
#include <iostream>
#include <stdlib.h>
#include "ClipEditor.h"
using namespace std;
int main(int argc, char *argv[])
{
QApplication::setColorSpec( QApplication::ManyColor );
......@@ -64,7 +66,7 @@ int main(int argc, char *argv[])
if (argc != 2)
{
cerr << "Usage: " << argv[0] << " <shape>\n";
cerr << " where <shape> = { hex, wedge, pyramid, tet }\n";
cerr << " where <shape> = { hex, wdg, pyr, tet, qua, pix, tri, lin, vtx }\n";
exit(1);
}
......@@ -119,9 +121,7 @@ int main(int argc, char *argv[])
cerr << "\n";
cerr << "\n";
ClipEditor *editor = new ClipEditor(argv[1], NULL, "Viewer");
a->setMainWidget(editor);
ClipEditor *editor = new ClipEditor(argv[1], NULL);
editor->show();
......
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