Commit 8a50fd1a authored by hrchilds's avatar hrchilds
Browse files

Update from August 30, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@311 18c085ea-50e0-402c-830e-de6fd14e8384
parent 568ceb67
......@@ -267,6 +267,12 @@ avtLocateNodeQuery::DeterminePickedNode(vtkDataSet *ds, int foundCell, float *pp
// Kathleen Bonnell, Tue Aug 10 09:06:54 PDT 2004
// Set id when validOrigNodes size is 1.
//
// Kathleen Bonnell, Mon Aug 30 18:20:50 PDT 2004
// Revamped: FindClosestNPoints orders the points in increasing distance
// from the isect point, so don't need to recalculate distances. Simply
// keep the first node that has a valid OrigNode associated with it AND is
// part of the isectedCell.
//
// ****************************************************************************
int
......@@ -295,62 +301,25 @@ avtLocateNodeQuery::FindClosestPoint(vtkDataSet *ds, const int isectedCell,
ds->GetPointData()->GetArray("avtOriginalNodeNumbers"));
if (origNodes)
{
// some close nodes are same distance, find the one
// that belongs to the isected cell.
vtkIdList *cellPts = vtkIdList::New();
ds->GetCellPoints(isectedCell, cellPts);
int comp = origNodes->GetNumberOfComponents()-1;
int oNode = -1;
float dist, minDist = FLT_MAX;
intVector validOrigNodes;
intVector validClosestPoints;
vtkPoints *pts = vtkVisItUtility::GetPoints(ds);
for (int i = 0; i < ncp; i++)
for (int i = 0; i < ncp && oNode == -1; i++)
{
id = closestPoints->GetId(i);
oNode = (int)origNodes->GetComponent(id, comp);
if (oNode != -1)
{
dist = vtkMath::Distance2BetweenPoints(isect, pts->GetPoint(id));
if (dist <= minDist)
{
validOrigNodes.push_back(oNode);
validClosestPoints.push_back(id);
minDist = dist;
}
}
}
if (validOrigNodes.size() > 0)
{
if (validOrigNodes.size() == 1)
{
origNode = validOrigNodes[0];
id = validClosestPoints[0];
}
else
if (oNode != -1 && (cellPts->IsId(id) == -1))
{
//
// We only want to consider nodes that are part of
// the isected cell.
//
oNode = -1;
id = -1;
// some close nodes are same distance, find the one
// that belongs to the isected cell.
vtkIdList *cellPts = vtkIdList::New();
ds->GetCellPoints(isectedCell, cellPts);
for (int j = 0; j < validOrigNodes.size(), oNode == -1; j++)
{
if (cellPts->IsId(validClosestPoints[j]) != -1)
{
oNode = validOrigNodes[j];
id = validClosestPoints[j];
}
}
cellPts->Delete();
if (oNode != -1)
origNode = oNode;
else
origNode = closestPoints->GetId(0);
}
}
else
{
id = closestPoints->GetId(0);
}
}
else
{
......
......@@ -73,13 +73,20 @@ avtNodePickQuery::~avtNodePickQuery()
// Handle case when pickatts.domain has not yet been set. (e.g. when
// picking 2d contour or boundary plots.)
//
// Kathleen Bonnell, Mon Aug 30 17:53:58 PDT 2004
// Modified early-return test -- split into two, and use new flag
// skippedLocate.
//
// ****************************************************************************
void
avtNodePickQuery::Execute(vtkDataSet *ds, const int dom)
{
if (ds == NULL || pickAtts.GetFulfilled() ||
(pickAtts.GetDomain() != -1 && dom != pickAtts.GetDomain()))
if (ds == NULL || pickAtts.GetFulfilled())
{
return;
}
if (dom != pickAtts.GetDomain() && !skippedLocate)
{
return;
}
......
......@@ -49,6 +49,9 @@ using std::string;
// Kathleen Bonnell, Thu Jul 29 17:10:48 PDT 2004
// Initialize eef and src.
//
// Kathleen Bonnell, Mon Aug 30 17:56:29 PDT 2004
// Initialize skippedLocate.
//
// ****************************************************************************
avtPickQuery::avtPickQuery()
......@@ -60,6 +63,7 @@ avtPickQuery::avtPickQuery()
singleDomain = false;
eef = new avtExpressionEvaluatorFilter;
src = NULL;
skippedLocate = false;
}
......
......@@ -54,7 +54,7 @@ class avtExpressionEvaluatorFilter;
// Kathleen Bonnell, Thu Apr 1 09:21:22 PST 2004
// Inherit from avtVariableQuery, moved common methods to parent class
// (RetrieveNodes, RetrieveZones, RetrieveVarInfo).
//
//
// Kathleen Bonnell, Thu Jul 29 17:10:48 PDT 2004
// No longer inherit from avtVariableQuery, moved common methods back to
// this class: (RetrieveNodes, RetrieveZones, RetrieveVarInfo).
......@@ -63,6 +63,9 @@ class avtExpressionEvaluatorFilter;
// Added RetrieveVarInfo method with extra args. Added two
// GetCurrentZoneForOriginal methods.
//
// Kathleen Bonnell, Mon Aug 30 17:56:29 PDT 2004
// Added skippedLocate flag, and Set method.
//
// ****************************************************************************
class QUERY_API avtPickQuery : public avtDatasetQuery
......@@ -85,6 +88,8 @@ class QUERY_API avtPickQuery : public avtDatasetQuery
virtual void SetInvTransform(const avtMatrix *m){};
void SetNeedTransform(const bool b)
{ needTransform = b; };
void SetSkippedLocate(const bool s)
{ skippedLocate = s; };
protected:
int cellOrigin;
......@@ -93,6 +98,7 @@ class QUERY_API avtPickQuery : public avtDatasetQuery
const avtMatrix *transform;
bool singleDomain;
bool needTransform;
bool skippedLocate;
// Query-specific code that needs to be defined.
virtual void VerifyInput(void);
......
......@@ -86,13 +86,20 @@ avtZonePickQuery::SetInvTransform(const avtMatrix *m)
// Handle case when pickatts.domain has not yet been set. (e.g. when
// picking 2d contour or boundary plots.)
//
// Kathleen Bonnell, Mon Aug 30 17:53:58 PDT 2004
// Modified early-return test -- split into two, and use new flag
// skippedLocate.
//
// ****************************************************************************
void
avtZonePickQuery::Execute(vtkDataSet *ds, const int dom)
{
if (ds == NULL || pickAtts.GetFulfilled() ||
(pickAtts.GetDomain() != -1 && dom != pickAtts.GetDomain()))
if (ds == NULL || pickAtts.GetFulfilled())
{
return;
}
if (dom != pickAtts.GetDomain() && !skippedLocate)
{
return;
}
......
......@@ -2027,6 +2027,9 @@ NetworkManager::StopPickMode(void)
// Kathleen Bonnell, Thu Aug 26 11:18:47 PDT 2004
// Skip LocateQuery if picking on 2d boundary or contour plots.
//
// Kathleen Bonnell, Mon Aug 30 17:51:56 PDT 2004
// Send SkipLocate flag to pick query.
//
// ****************************************************************************
void
......@@ -2140,6 +2143,7 @@ NetworkManager::Pick(const int id, PickAttributes *pa)
pQ->SetInput(networkCache[id]->GetNetDB()->GetOutput());
pQ->SetPickAtts(pa);
pQ->SetSkippedLocate(skipLocate);
pQ->PerformQuery(&qa);
*pa = *(pQ->GetPickAtts());
......
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