Commit f6095fca authored by hrchilds's avatar hrchilds

Update from June 25, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@21 18c085ea-50e0-402c-830e-de6fd14e8384
parent 76dd65dc
......@@ -43,6 +43,23 @@ avtActor::avtActor()
}
// ****************************************************************************
// Method: avtActor destructor
//
// Programmer: Hank Childs
// Creation: June 25, 2003
//
// ****************************************************************************
avtActor::~avtActor()
{
if (transparencyActor != NULL && transparencyIndex >= 0)
{
transparencyActor->RemoveInput(transparencyIndex);
}
}
// ****************************************************************************
// Method: avtActor::SetBehavior
//
......
......@@ -66,7 +66,7 @@ class PLOTTER_API avtActor
{
public:
avtActor();
virtual ~avtActor() {;};
virtual ~avtActor();
void SetBehavior(avtBehavior_p);
avtBehavior_p GetBehavior(void) { return behavior; };
......
......@@ -271,6 +271,42 @@ avtTransparencyActor::ReplaceInput(int ind, vector<vtkDataSet *> &d,
}
// ****************************************************************************
// Method: avtTransparencyActor::RemoveInput
//
// Purpose:
// Removes the i'th input. This means it will free up any memory
// associated with the index.
//
// Arguments:
// ind The index of the VTK constructs.
//
// Programmer: Hank Childs
// Creation: June 25, 2003
//
// ****************************************************************************
void
avtTransparencyActor::RemoveInput(int ind)
{
if (ind >= useActor.size() || ind < 0)
{
EXCEPTION2(BadIndexException, ind, useActor.size());
}
for (int i = 0 ; i < preparedDataset[ind].size() ; i++)
{
if (preparedDataset[ind][i] != NULL)
{
preparedDataset[ind][i]->Delete();
preparedDataset[ind][i] = NULL;
}
}
useActor[ind] = false;
}
// ****************************************************************************
// Method: avtTransparencyActor::TurnOffInput
//
......
......@@ -65,6 +65,7 @@ class PLOTTER_API avtTransparencyActor
void TurnOffInput(int);
void TurnOnInput(int);
void RemoveInput(int);
void InputWasModified(int);
void SetVisibility(int, bool);
void VisibilityOff(void);
......
......@@ -651,6 +651,9 @@ VisWinRendering::Realize(void)
// Stop using window-to-image filter, since it does not play well with
// the new camera modifications.
//
// Hank Childs, Wed Jun 25 09:30:59 PDT 2003
// Fix memory leak.
//
// ****************************************************************************
avtImage_p
......@@ -706,6 +709,7 @@ VisWinRendering::ScreenCapture(bool doCanvasZBufferToo)
// disable external render requests
//
avtSourceFromImage screenCaptureSource(image, zb);
image->Delete();
avtImage_p img = screenCaptureSource.GetTypedOutput();
img->Update(screenCaptureSource.GetGeneralPipelineSpecification());
img->SetSource(NULL);
......
This diff is collapsed.
......@@ -18,7 +18,9 @@ class QTimer;
// Creation: Wed Mar 5 15:45:14 PST 2003
//
// Modifications:
//
// Brad Whitlock, Mon Jun 23 16:49:01 PST 2003
// I added a 2d interaction mode.
//
// ****************************************************************************
class QvisReflectWidget : public QWidget
......@@ -30,6 +32,8 @@ public:
virtual QSize sizeHint() const;
virtual QSizePolicy sizePolicy() const;
void setMode2D(bool val);
bool getMode2D() const;
signals:
void octantChanged(int);
void valueChanged(bool *octants);
......@@ -39,23 +43,29 @@ public slots:
protected slots:
void handleTimer();
protected:
void drawOnOffActors(int n, float scale);
void deleteBackingPixmap();
void redrawScene(QPainter *painter);
void redrawScene2D(QPainter *painter);
void redrawScene3D(QPainter *painter);
void setupAndDraw(QPainter *p);
void setupCamera();
void createSharedElements();
void initializeAxes();
void initializeAxes2D();
void initializeArrow();
void initializeSphere(m3d_complex_element &, int nx, int ny, float rad,
float r, float g, float b);
void initializeCube(m3d_complex_element &, int nx, int ny,
float s, float r, float g, float b);
void TranslateFromOriginToOctant(int octant);
void ScaleTranslateFromOriginToOctant(int octant, float s);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void paintEvent(QPaintEvent *e);
virtual void resizeEvent(QResizeEvent *e);
bool mode2D;
QPixmap *pixmap;
m3d_renderer renderer;
bool rendererCreated;
......@@ -70,6 +80,7 @@ protected:
static bool sharedElementsCreated;
static m3d_complex_element axes;
static m3d_complex_element axes2D;
static m3d_complex_element onCube;
static m3d_complex_element offCube;
static m3d_complex_element onSphere;
......
......@@ -33,6 +33,9 @@ static const int operator2WidgetOctants[] = {0, 1, 3, 2, 4, 5, 7, 6};
// Brad Whitlock, Thu Mar 6 11:31:12 PDT 2003
// I added stretch and initialized some widgets that have no parents.
//
// Brad Whitlock, Wed Jun 25 09:24:38 PDT 2003
// I initialized modeButtons, userSetMode, and mode2D.
//
// ****************************************************************************
QvisReflectWindow::QvisReflectWindow(const int type,
......@@ -44,6 +47,10 @@ QvisReflectWindow::QvisReflectWindow(const int type,
{
atts = subj;
userSetMode = false;
mode2D = true;
modeButtons = 0;
xBound = 0;
yBound = 0;
zBound = 0;
......@@ -63,6 +70,7 @@ QvisReflectWindow::QvisReflectWindow(const int type,
QvisReflectWindow::~QvisReflectWindow()
{
delete modeButtons;
delete xBound;
delete yBound;
delete zBound;
......@@ -81,30 +89,45 @@ QvisReflectWindow::~QvisReflectWindow()
// Brad Whitlock, Mon Mar 3 11:42:37 PDT 2003
// I made it use a QvisReflectWidget.
//
// Brad Whitlock, Wed Jun 25 09:25:32 PDT 2003
// I added code that lets us have a 2D input mode.
//
// ****************************************************************************
void
QvisReflectWindow::CreateWindowContents()
{
QVBoxLayout *mainLayout = new QVBoxLayout(topLayout, 10, "mainLayout");
// Add the controls to select the input mode.
QGridLayout *octantLayout = new QGridLayout(mainLayout, 2, 3);
modeButtons = new QButtonGroup(0, "modeButtons");
octantLayout->addWidget(new QLabel("Input mode", central, "inputModeLabel"),
0, 0);
QRadioButton *rb = new QRadioButton("2D", central, "mode2D");
modeButtons->insert(rb);
octantLayout->addWidget(rb, 0, 1);
rb = new QRadioButton("3D", central, "mode3D");
modeButtons->insert(rb);
modeButtons->setButton(0);
connect(modeButtons, SIGNAL(clicked(int)),
this, SLOT(selectMode(int)));
octantLayout->addWidget(rb, 0, 2);
// Octant
QHBoxLayout *octantLayout = new QHBoxLayout(mainLayout);
octantLayout->addWidget(new QLabel("Original data is in octant", central, "octantLayout"));
originalDataLabel = new QLabel("Original data quadrant", central,
"originalDataLabel");
octantLayout->addWidget(originalDataLabel, 1, 0);
octant = new QComboBox(false, central, "octant");
octant->insertItem("+X +Y +Z");
octant->insertItem("-X +Y +Z");
octant->insertItem("+X -Y +Z");
octant->insertItem("-X -Y +Z");
octant->insertItem("+X +Y -Z");
octant->insertItem("-X +Y -Z");
octant->insertItem("+X -Y -Z");
octant->insertItem("-X -Y -Z");
octantLayout->addWidget(octant);
octantLayout->addMultiCellWidget(octant, 1, 1, 1, 2);
// Reflection widget
reflect = new QvisReflectWidget(central, "reflect");
reflect->setMode2D(mode2D);
connect(reflect, SIGNAL(valueChanged(bool*)),
this, SLOT(selectOctants(bool*)));
mainLayout->addWidget(new QLabel(reflect, "Reflection octants", central));
reflectionLabel = new QLabel(reflect, "Reflection quadrants", central);
mainLayout->addWidget(reflectionLabel);
mainLayout->addWidget(reflect, 100);
// Limits
......@@ -174,12 +197,20 @@ QvisReflectWindow::CreateWindowContents()
// Brad Whitlock, Wed Mar 5 15:49:22 PST 2003
// I made it use a QvisReflectWidget widget.
//
// Brad Whitlock, Wed Jun 25 10:11:14 PDT 2003
// I added a 2D input mode.
//
// ****************************************************************************
void
QvisReflectWindow::UpdateWindow(bool doAll)
{
QString temp;
bool setOctant = false;
bool originIs3D = (operator2WidgetOctants[atts->GetOctant()] > 3);
bool reflection3D = false;
reflect->blockSignals(true);
for(int i = 0; i < atts->NumAttributes(); ++i)
{
......@@ -193,13 +224,8 @@ QvisReflectWindow::UpdateWindow(bool doAll)
switch(i)
{
case 0: //octant
octant->blockSignals(true);
octant->setCurrentItem(atts->GetOctant());
octant->blockSignals(false);
reflect->blockSignals(true);
reflect->setOriginalOctant(operator2WidgetOctants[atts->GetOctant()]);
reflect->blockSignals(false);
case 0: // octant
setOctant = true;
break;
case 1: //xBound
xUseData->setText((atts->GetOctant()&0x01) ? "Use dataset max" : "Use dataset min");
......@@ -236,15 +262,82 @@ QvisReflectWindow::UpdateWindow(bool doAll)
{
int b = i ^ atts->GetOctant();
octants[operator2WidgetOctants[i]] = (r[b] > 0);
reflection3D |= (octants[operator2WidgetOctants[i]] && operator2WidgetOctants[i] > 3);
}
reflect->blockSignals(true);
reflect->setValues(octants);
reflect->blockSignals(false);
}
break;
}
}
if(originIs3D || reflection3D)
{
bool newMode2D = !originIs3D && !reflection3D;
if(newMode2D != mode2D)
{
mode2D = newMode2D;
modeButtons->blockSignals(true);
modeButtons->setButton(mode2D ? 0 : 1);
modeButtons->blockSignals(false);
reflect->setMode2D(mode2D);
UpdateOctantMenuContents();
}
}
else if(!userSetMode)
{
mode2D = true;
modeButtons->blockSignals(true);
modeButtons->setButton(0);
modeButtons->blockSignals(false);
reflect->setMode2D(mode2D);
UpdateOctantMenuContents();
}
if(setOctant)
{
octant->blockSignals(true);
octant->setCurrentItem(atts->GetOctant());
octant->blockSignals(false);
reflect->setOriginalOctant(operator2WidgetOctants[atts->GetOctant()]);
}
reflect->blockSignals(false);
}
// ****************************************************************************
// Method: QvisReflectWindow::UpdateOctantMenuContents
//
// Purpose:
// Updates the octant menu's contents so it shows the appropriate choices.
//
// Programmer: Brad Whitlock
// Creation: Wed Jun 25 09:34:50 PDT 2003
//
// Modifications:
//
// ****************************************************************************
void
QvisReflectWindow::UpdateOctantMenuContents()
{
octant->clear();
octant->insertItem("+X +Y +Z");
octant->insertItem("-X +Y +Z");
octant->insertItem("+X -Y +Z");
octant->insertItem("-X -Y +Z");
if(mode2D)
{
reflectionLabel->setText("Reflection quadrants");
originalDataLabel->setText("Original data quadrant");
return;
}
octant->insertItem("+X +Y -Z");
octant->insertItem("-X +Y -Z");
octant->insertItem("+X -Y -Z");
octant->insertItem("-X -Y -Z");
reflectionLabel->setText("Reflection octants");
originalDataLabel->setText("Original data octant");
}
// ****************************************************************************
......@@ -473,3 +566,68 @@ QvisReflectWindow::specifiedZProcessText()
GetCurrentValues(6);
Apply();
}
// ****************************************************************************
// Method: QvisReflectWindow::selectMode
//
// Purpose:
// Selects the input mode.
//
// Arguments:
// mode : The new input mode.
//
// Programmer: Brad Whitlock
// Creation: Wed Jun 25 12:44:20 PDT 2003
//
// Modifications:
//
// ****************************************************************************
void
QvisReflectWindow::selectMode(int mode)
{
if(mode == 0)
{
bool originIs3D = (operator2WidgetOctants[atts->GetOctant()] > 3);
bool reflection3D = false;
int *r = atts->GetReflections();
bool octants[8];
for (int i=0; i<8; i++)
{
int b = i ^ atts->GetOctant();
octants[operator2WidgetOctants[i]] = (r[b] > 0);
reflection3D |= (octants[operator2WidgetOctants[i]] && operator2WidgetOctants[i] > 3);
}
if(originIs3D || reflection3D)
{
Error("The reflection attributes require the 3D input mode because "
"the original data octant or one or more of the reflection "
"octants has a negative Z value. The input mode will remain 3D.");
mode2D = false;
modeButtons->blockSignals(true);
modeButtons->setButton(1);
modeButtons->blockSignals(false);
}
else
{
if(!mode2D)
{
mode2D = true;
reflect->setMode2D(mode2D);
UpdateOctantMenuContents();
}
}
}
else
{
if(mode2D)
{
mode2D = false;
reflect->setMode2D(mode2D);
UpdateOctantMenuContents();
}
userSetMode = true;
}
}
......@@ -30,6 +30,9 @@ class QvisReflectWidget;
// Brad Whitlock, Mon Mar 3 11:40:37 PDT 2003
// I spruced up the window.
//
// Brad Whitlock, Wed Jun 25 09:22:58 PDT 2003
// I added a 2D view of the window.
//
// ****************************************************************************
class QvisReflectWindow : public QvisOperatorWindow
......@@ -46,6 +49,7 @@ class QvisReflectWindow : public QvisOperatorWindow
protected:
void UpdateWindow(bool doAll);
virtual void GetCurrentValues(int which_widget);
void UpdateOctantMenuContents();
private slots:
void octantChanged(int val);
void xBoundaryChanged(int val);
......@@ -55,21 +59,28 @@ class QvisReflectWindow : public QvisOperatorWindow
void specifiedYProcessText();
void specifiedZProcessText();
void selectOctants(bool *octants);
void selectMode(int);
private:
QComboBox *octant;
bool userSetMode;
bool mode2D;
QButtonGroup *modeButtons;
QLabel *originalDataLabel;
QComboBox *octant;
QLabel *reflectionLabel;
QvisReflectWidget *reflect;
QButtonGroup *xBound;
QRadioButton *xUseData;
QRadioButton *xSpecify;
QLineEdit *specifiedX;
QButtonGroup *yBound;
QRadioButton *yUseData;
QRadioButton *ySpecify;
QLineEdit *specifiedY;
QButtonGroup *zBound;
QRadioButton *zUseData;
QRadioButton *zSpecify;
QLineEdit *specifiedZ;
QButtonGroup *xBound;
QRadioButton *xUseData;
QRadioButton *xSpecify;
QLineEdit *specifiedX;
QButtonGroup *yBound;
QRadioButton *yUseData;
QRadioButton *ySpecify;
QLineEdit *specifiedY;
QButtonGroup *zBound;
QRadioButton *zUseData;
QRadioButton *zSpecify;
QLineEdit *specifiedZ;
ReflectAttributes *atts;
};
......
......@@ -124,6 +124,9 @@ avtReflectFilter::Equivalent(const AttributeGroup *a)
// Hank Childs, Mon Feb 24 17:19:42 PST 2003
// Better checking of when we need to calculate extents in parallel.
//
// Hank Childs, Wed Jun 25 09:30:59 PDT 2003
// Fix stupid cut-n-paste bug.
//
// ****************************************************************************
void
......@@ -153,7 +156,7 @@ avtReflectFilter::PreExecute(void)
}
bool needX = reflectX && atts.GetUseXBoundary();
bool needY = reflectY && atts.GetUseYBoundary();
bool needZ = reflectY && atts.GetUseZBoundary();
bool needZ = reflectZ && atts.GetUseZBoundary();
if (needX || needY || needZ)
{
GetSpatialExtents(extents);
......
......@@ -8,11 +8,17 @@
# Programmer: Hank Childs
# Creation: April 24, 2003
#
# Modifications:
#
# Hank Childs, Wed Jun 25 09:30:59 PDT 2003
# Previously referring to different versions of wave.visit. Now only refer
# to one.
#
# *****************************************************************************
import os
import sys
if(not os.path.isfile("../../data/wave.visit")):
if(not os.path.isfile("/usr/gapps/visit/data/wave.visit")):
print "This script requires the file wave.visit to be built in the data directory"
sys.exit()
......
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