Commit 67f9e775 authored by js9's avatar js9

adding/fixing full frame support for point, line tools


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11426 18c085ea-50e0-402c-830e-de6fd14e8384
parent fb72fc8c
......@@ -429,6 +429,8 @@ VisitLineTool::UpdateView()
// Kathleen Bonnell, Fri Jun 6 15:36:24 PDT 2003
// Added support for full-frame mode.
//
// Jeremy Meredith, Wed May 19 11:42:11 EDT 2010
// Added full frame support.
// ****************************************************************************
void
......@@ -631,6 +633,9 @@ VisitLineTool::RemoveText()
// Kathleen Bonnell, Fri Dec 13 16:41:12 PST 2002
// Replace mapper with actor.
//
// Jeremy Meredith, Wed May 19 11:42:11 EDT 2010
// Added full frame support.
//
// ****************************************************************************
void
......@@ -641,8 +646,26 @@ VisitLineTool::UpdateText()
for(int i = 0; i < 2; ++i)
{
char str[100];
sprintf(str, "%s <%1.3g %1.3g %1.3g>", prefix[i],
hotPoints[i].pt.x, hotPoints[i].pt.y, hotPoints[i].pt.z);
if (proxy.GetFullFrameMode())
{
double scale;
int type;
proxy.GetScaleFactorAndType(scale, type);
if (type == 0 ) // x_axis
sprintf(str, "%s <%1.3g %1.3g %1.3g>", prefix[i],
hotPoints[i].pt.x/scale, hotPoints[i].pt.y,
hotPoints[i].pt.z);
else // y_axis
sprintf(str, "%s <%1.3g %1.3g %1.3g>", prefix[i],
hotPoints[i].pt.x, hotPoints[i].pt.y/scale,
hotPoints[i].pt.z);
}
else
{
sprintf(str, "%s <%1.3g %1.3g %1.3g>", prefix[i],
hotPoints[i].pt.x, hotPoints[i].pt.y, hotPoints[i].pt.z);
}
pointTextActor[i]->SetInput(str);
avtVector originScreen = ComputeWorldToDisplay(hotPoints[i].pt);
double pt[3] = {originScreen.x, originScreen.y, 0.};
......
......@@ -367,6 +367,9 @@ VisitPointTool::UpdateView()
// Brad Whitlock, Fri Apr 3 14:23:26 PDT 2009
// I added UpdateSphere().
//
// Jeremy Meredith, Wed May 19 11:42:11 EDT 2010
// Added full frame support.
//
// ****************************************************************************
void
......@@ -374,6 +377,21 @@ VisitPointTool::UpdateTool()
{
hotPoints[0].pt = avtVector((double*)Interface.GetPoint());
if (proxy.GetFullFrameMode())
{
//
// Translate the hotPoints so they appear in the correct position
// in full-frame mode.
//
double scale;
int type;
proxy.GetScaleFactorAndType(scale, type);
if (type == 0 ) // x_axis
hotPoints[0].pt.x *= scale;
else // x_axis
hotPoints[0].pt.y *= scale;
}
UpdateSphere();
UpdateText();
}
......@@ -464,14 +482,33 @@ VisitPointTool::RemoveText()
// Programmer: Akira Haddox
// Creation: Mon Jun 9 09:21:40 PDT 2003
//
// Modifications:
// Jeremy Meredith, Wed May 19 11:42:11 EDT 2010
// Added full frame support.
//
// ****************************************************************************
void
VisitPointTool::UpdateText()
{
char str[100];
sprintf(str, "XYZ<%1.3g %1.3g %1.3g>",
hotPoints[0].pt.x, hotPoints[0].pt.y, hotPoints[0].pt.z);
if (proxy.GetFullFrameMode())
{
double scale;
int type;
proxy.GetScaleFactorAndType(scale, type);
if (type == 0 ) // x_axis
sprintf(str, "XYZ<%1.3g %1.3g %1.3g>",
hotPoints[0].pt.x/scale, hotPoints[0].pt.y, hotPoints[0].pt.z);
else // y_axis
sprintf(str, "XYZ<%1.3g %1.3g %1.3g>",
hotPoints[0].pt.x, hotPoints[0].pt.y/scale, hotPoints[0].pt.z);
}
else
{
sprintf(str, "XYZ<%1.3g %1.3g %1.3g>",
hotPoints[0].pt.x, hotPoints[0].pt.y, hotPoints[0].pt.z);
}
pointTextActor->SetInput(str);
avtVector originScreen = ComputeWorldToDisplay(hotPoints[0].pt);
double pt[3] = {originScreen.x, originScreen.y, 0.};
......@@ -1150,3 +1187,52 @@ VisitPointTool::TranslateCallback(VisitInteractiveTool *it, CB_ENUM e,
VisitPointTool *lt = (VisitPointTool *)it;
lt->Translate(e, ctrl, shift, x, y, 0);
}
// ****************************************************************************
// Method: VisitPointTool::FullFrameOn
//
// Purpose: Updates the tool.
//
// Arguments:
// <unused> The axis scale factor.
// <unused> The axis scale type.
//
// Programmer: Jeremy Meredith
// Creation: May 19, 2010
//
// Modifications:
//
// ****************************************************************************
void
VisitPointTool::FullFrameOn(const double, const int)
{
if(IsEnabled())
{
UpdateTool();
}
}
// ****************************************************************************
// Method: VisitPointTool::FullFrameOn
//
// Purpose: Updates the tool.
//
// Programmer: Jeremy Meredith
// Creation: May 19, 2010
//
// Modifications:
//
// ****************************************************************************
void
VisitPointTool::FullFrameOff()
{
if(IsEnabled())
{
UpdateTool();
}
}
......@@ -70,6 +70,9 @@ class vtkTextActor;
// Jeremy Meredith, Fri Feb 1 18:07:16 EST 2008
// Added new value to callback used to pass the hotpoint's "data" field.
//
// Jeremy Meredith, Wed May 19 11:40:07 EDT 2010
// Added full frame support.
//
// ****************************************************************************
class VISWINDOW_API VisitPointTool : public VisitInteractiveTool
......@@ -94,6 +97,9 @@ class VISWINDOW_API VisitPointTool : public VisitInteractiveTool
virtual void UpdateView();
virtual void UpdateTool();
virtual void FullFrameOn(const double, const int);
virtual void FullFrameOff(void);
protected:
// Callback functions for the tool's hot points.
static void TranslateCallback(VisitInteractiveTool *, CB_ENUM,
......
......@@ -38,6 +38,7 @@
#include <avtPointToolInterface.h>
#include <PointAttributes.h>
#include <VisWindow.h>
avtPointToolInterface::avtPointToolInterface(const VisWindow *v) :
avtToolInterface(v)
......@@ -55,6 +56,20 @@ avtPointToolInterface::SetPoint(double x, double y, double z)
{
PointAttributes *p = (PointAttributes *)atts;
double d[3] = {x, y, z};
if (const_cast<VisWindow*>(visWindow)->GetFullFrameMode())
{
//
// If in full-frame mode, the point was computed in the scaled
// full-frame space. Reverse the scaling to get the correct point.
//
double scale;
int type;
const_cast<VisWindow*>(visWindow)->GetScaleFactorAndType(scale, type);
if ( type == 0 && scale > 0.)
d[0] /= scale;
else if ( type == 1 && scale > 0.)
d[1] /= scale;
}
p->SetPoint(d);
}
......
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