Commit 878197db authored by Jeff Baumes's avatar Jeff Baumes

ENH: More representation changes

 - Removing vtkSelectionLink in favor of vtkAnnotationLink.

 - vtkAnnotationLayers now has a special "current" annotation.
   This annotation is used to store the current selection.

 - Updating lots of places that used the selection link to now
   use the annotation link.

 - Removing obsolete classes vtkGeoLineRepresentation (replaced by
   vtkRenderedSurfaceRepresentation) vtkTreeLayoutView (all functionality
   is in vtkGraphLayoutView) vtkSurfaceRepresentation (replaced by
   vtkRenderedSurfaceRepresentation).

 - The cache in the representation is now cleared when the ReleaseData
   flag is set in the pipeline.

 - Fixed warnings when selecting in empty graph view.

 - Fixed texture unit warnings in geoview.

 - Move selection type from view to representation.

 - Fixing geoview bug where nothing is rendered on the first render.
   We need to render once to initialize the graphics context, then
   'really' render the first time.

 - Need Render() to create render window in examples.
parent 9cd3b7b8
......@@ -51,11 +51,9 @@ int main(int argc, char* argv[])
view->SetEdgeLabelFontSize(18);
view->VertexLabelVisibilityOn();
vtkSmartPointer<vtkRenderWindow> window = vtkSmartPointer<vtkRenderWindow>::New();
window->SetSize(600, 600);
view->SetupRenderWindow(window);
view->GetRenderer()->ResetCamera();
window->GetInteractor()->Start();
view->GetRenderWindow()->SetSize(600, 600);
view->ResetCamera();
view->GetInteractor()->Start();
return 0;
}
......
......@@ -11,6 +11,7 @@
#include "ui_ChartView.h"
#include "ChartView.h"
#include <vtkAnnotationLink.h>
#include <vtkCorrelativeStatistics.h>
#include <vtkDataRepresentation.h>
#include <vtkDescriptiveStatistics.h>
......@@ -23,7 +24,6 @@
#include <vtkQtTableView.h>
#include <vtkRowQueryToTable.h>
#include <vtkSelection.h>
#include <vtkSelectionLink.h>
#include <vtkSmartPointer.h>
#include <vtkSQLDatabase.h>
#include <vtkSQLQuery.h>
......@@ -95,16 +95,16 @@ ChartView::ChartView()
void ChartView::SetupSelectionLink()
{
// Create a selection link and have all the views use it
VTK_CREATE(vtkSelectionLink,selectionLink);
this->TableView0->GetRepresentation()->SetSelectionLink(selectionLink);
this->TableView1->GetRepresentation()->SetSelectionLink(selectionLink);
this->TableView2->GetRepresentation()->SetSelectionLink(selectionLink);
this->TableView3->GetRepresentation()->SetSelectionLink(selectionLink);
this->TableView4->GetRepresentation()->SetSelectionLink(selectionLink);
this->BarChart->GetRepresentation()->SetSelectionLink(selectionLink);
this->LineChart->GetRepresentation()->SetSelectionLink(selectionLink);
this->StackedChart->GetRepresentation()->SetSelectionLink(selectionLink);
this->BoxChart->GetRepresentation()->SetSelectionLink(selectionLink);
VTK_CREATE(vtkAnnotationLink,annLink);
this->TableView0->GetRepresentation()->SetAnnotationLink(annLink);
this->TableView1->GetRepresentation()->SetAnnotationLink(annLink);
this->TableView2->GetRepresentation()->SetAnnotationLink(annLink);
this->TableView3->GetRepresentation()->SetAnnotationLink(annLink);
this->TableView4->GetRepresentation()->SetAnnotationLink(annLink);
this->BarChart->GetRepresentation()->SetAnnotationLink(annLink);
this->LineChart->GetRepresentation()->SetAnnotationLink(annLink);
this->StackedChart->GetRepresentation()->SetAnnotationLink(annLink);
this->BoxChart->GetRepresentation()->SetAnnotationLink(annLink);
VTK_CREATE(vtkViewUpdater,updater);
updater->AddView(this->TableView0);
......
......@@ -61,16 +61,13 @@ int main(int, char*[])
view->SetVertexLabelArrayName("Label");
view->SetVertexLabelVisibility(true);
vtkRenderWindow* window = vtkRenderWindow::New();
view->SetupRenderWindow(window);
view->GetRenderer()->ResetCamera();
window->GetInteractor()->Start();
view->ResetCamera();
view->GetInteractor()->Start();
graph->Delete();
labels->Delete();
tree->Delete();
view->Delete();
window->Delete();
return 0;
}
......@@ -8,7 +8,7 @@
#include "ui_EasyView.h"
#include "EasyView.h"
#include <vtkAnnotationLink.h>
#include <vtkDataObjectToTable.h>
#include <vtkDataRepresentation.h>
#include <vtkGraphLayoutView.h>
......@@ -17,7 +17,6 @@
#include <vtkQtTreeView.h>
#include <vtkRenderer.h>
#include <vtkSelection.h>
#include <vtkSelectionLink.h>
#include <vtkTable.h>
#include <vtkTableToGraph.h>
#include <vtkTreeLayoutStrategy.h>
......@@ -53,7 +52,7 @@ EasyView::EasyView()
this->ui->columnFrame->layout()->addWidget(this->ColumnView->GetWidget());
// Graph View needs to get my render window
this->GraphView->SetupRenderWindow(this->ui->vtkGraphViewWidget->GetRenderWindow());
this->ui->vtkGraphViewWidget->SetRenderWindow(this->GraphView->GetRenderWindow());
// Set up the theme on the graph view :)
vtkViewTheme* theme = vtkViewTheme::CreateMellowTheme();
......@@ -72,11 +71,11 @@ EasyView::EasyView()
void EasyView::SetupSelectionLink()
{
// Create a selection link and have all the views use it
VTK_CREATE(vtkSelectionLink,selectionLink);
this->TreeView->GetRepresentation()->SetSelectionLink(selectionLink);
this->TableView->GetRepresentation()->SetSelectionLink(selectionLink);
this->ColumnView->GetRepresentation()->SetSelectionLink(selectionLink);
this->GraphView->GetRepresentation()->SetSelectionLink(selectionLink);
VTK_CREATE(vtkAnnotationLink,annLink);
this->TreeView->GetRepresentation()->SetAnnotationLink(annLink);
this->TableView->GetRepresentation()->SetAnnotationLink(annLink);
this->ColumnView->GetRepresentation()->SetAnnotationLink(annLink);
this->GraphView->GetRepresentation()->SetAnnotationLink(annLink);
VTK_CREATE(vtkViewUpdater,updater);
updater->AddView(this->TreeView);
......@@ -133,11 +132,10 @@ void EasyView::slotOpenXMLFile()
// Set the input to the graph view
this->GraphView->SetRepresentationFromInputConnection(this->XMLReader->GetOutputPort());
// Okay now do an explicit update so that
// Okay now do an explicit reset camera so that
// the user doesn't have to move the mouse
// in the window to see the resulting graph
this->GraphView->Update();
this->GraphView->GetRenderer()->ResetCamera();
this->GraphView->ResetCamera();
// Now hand off tree to the tree view
this->TreeView->SetRepresentationFromInputConnection(this->XMLReader->GetOutputPort());
......
......@@ -29,13 +29,12 @@ int main(int, char*[])
view->SetRepresentationFromInputConnection(
source->GetOutputPort());
vtkRenderWindow* window = vtkRenderWindow::New();
view->SetupRenderWindow(window);
window->GetInteractor()->Start();
view->ResetCamera();
view->Render();
view->GetInteractor()->Start();
source->Delete();
view->Delete();
window->Delete();
return 0;
}
......@@ -16,7 +16,7 @@
// This example...
//
#include "vtkAnnotationLink.h"
#include "vtkCommand.h"
#include "vtkDataRepresentation.h"
#include "vtkDataSetAttributes.h"
......@@ -25,10 +25,8 @@
#include "vtkRandomGraphSource.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSelectionLink.h"
#include "vtkStringArray.h"
#include "vtkTree.h"
#include "vtkTreeLayoutView.h"
#include "vtkViewTheme.h"
#include <vtksys/stl/vector>
......@@ -90,35 +88,33 @@ int main(int, char*[])
view->SetColorVertices(true);
view->SetVertexLabelArrayName("Label");
view->SetVertexLabelVisibility(true);
vtkRenderWindow* window = vtkRenderWindow::New();
view->SetupRenderWindow(window);
vtkTreeLayoutView* view2 = vtkTreeLayoutView::New();
vtkGraphLayoutView* view2 = vtkGraphLayoutView::New();
vtkDataRepresentation* rep2 =
view2->SetRepresentationFromInput(tree);
view2->SetLabelArrayName("Label");
view2->SetLabelVisibility(true);
vtkRenderWindow* window2 = vtkRenderWindow::New();
view2->SetupRenderWindow(window2);
view2->SetVertexLabelArrayName("Label");
view2->SetVertexLabelVisibility(true);
vtkSelectionLink* link = vtkSelectionLink::New();
rep->SetSelectionLink(link);
rep2->SetSelectionLink(link);
vtkAnnotationLink* link = vtkAnnotationLink::New();
rep->SetAnnotationLink(link);
rep2->SetAnnotationLink(link);
ViewUpdater* update = ViewUpdater::New();
update->AddView(view);
update->AddView(view2);
window->GetInteractor()->Start();
view->ResetCamera();
view2->ResetCamera();
view->Render();
view2->Render();
view->GetInteractor()->Start();
graph->Delete();
labels->Delete();
tree->Delete();
view->Delete();
theme->Delete();
window->Delete();
view2->Delete();
window2->Delete();
link->Delete();
update->Delete();
......
......@@ -29,7 +29,6 @@
#include <vtkQtTableView.h>
#include <vtkRenderer.h>
#include <vtkSelection.h>
#include <vtkSelectionLink.h>
#include <vtkTable.h>
#include <vtkViewTheme.h>
#include <vtkViewUpdater.h>
......
......@@ -39,13 +39,12 @@ int main(int, char*[])
view->SetVertexLabelArrayName("VertexDegree");
view->SetVertexLabelVisibility(true);
vtkRenderWindow* window = vtkRenderWindow::New();
view->SetupRenderWindow(window);
window->GetInteractor()->Start();
view->ResetCamera();
view->Render();
view->GetInteractor()->Start();
source->Delete();
view->Delete();
window->Delete();
return 0;
}
......@@ -22,16 +22,18 @@
#include "vtkAnnotationLayers.h"
#include "vtkAnnotation.h"
#include "vtkIdTypeArray.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkSelection.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include <vtkstd/algorithm>
#include <vtkstd/vector>
vtkCxxRevisionMacro(vtkAnnotationLayers, "1.5");
vtkCxxRevisionMacro(vtkAnnotationLayers, "1.6");
vtkStandardNewMacro(vtkAnnotationLayers);
vtkCxxSetObjectMacro(vtkAnnotationLayers, CurrentAnnotation, vtkAnnotation);
......@@ -45,8 +47,17 @@ vtkAnnotationLayers::vtkAnnotationLayers() :
Implementation(new Internals())
{
this->CurrentAnnotation = vtkAnnotation::New();
// Start with an empty index selection
vtkSmartPointer<vtkSelection> sel =
vtkSmartPointer<vtkSelection>::New();
vtkSmartPointer<vtkSelectionNode> node =
vtkSmartPointer<vtkSelectionNode>::New();
node->SetContentType(vtkSelectionNode::INDICES);
vtkSmartPointer<vtkIdTypeArray> ids =
vtkSmartPointer<vtkIdTypeArray>::New();
node->SetSelectionList(ids);
sel->AddNode(node);
this->CurrentAnnotation->SetSelection(sel);
}
......@@ -71,7 +82,7 @@ vtkSelection* vtkAnnotationLayers::GetCurrentSelection()
{
if (this->CurrentAnnotation)
{
this->CurrentAnnotation->GetSelection();
return this->CurrentAnnotation->GetSelection();
}
return 0;
}
......@@ -125,6 +136,7 @@ void vtkAnnotationLayers::ShallowCopy(vtkDataObject* other)
vtkAnnotation* ann = obj->GetAnnotation(a);
this->AddAnnotation(ann);
}
this->SetCurrentAnnotation(obj->GetCurrentAnnotation());
}
void vtkAnnotationLayers::DeepCopy(vtkDataObject* other)
......
......@@ -41,7 +41,6 @@
#include "vtkObjectFactory.h"
#include "vtkQtAnnotationLayersModelAdapter.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTable.h"
......@@ -49,7 +48,7 @@
#include <vtkstd/set>
vtkCxxRevisionMacro(vtkQtAnnotationView, "1.3");
vtkCxxRevisionMacro(vtkQtAnnotationView, "1.4");
vtkStandardNewMacro(vtkQtAnnotationView);
//----------------------------------------------------------------------------
......
......@@ -25,6 +25,7 @@
#include "vtkAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAnnotationLink.h"
#include "vtkConvertSelection.h"
#include "vtkDataRepresentation.h"
#include "vtkIdTypeArray.h"
......@@ -32,12 +33,11 @@
#include "vtkObjectFactory.h"
#include "vtkQtTreeModelAdapter.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTree.h"
vtkCxxRevisionMacro(vtkQtColumnView, "1.4");
vtkCxxRevisionMacro(vtkQtColumnView, "1.5");
vtkStandardNewMacro(vtkQtColumnView);
......@@ -128,13 +128,14 @@ void vtkQtColumnView::slotQtSelectionChanged(const QItemSelection& vtkNotUsed(s1
vtkSelection *VTKIndexSelectList = this->TreeAdapter->QModelIndexListToVTKIndexSelection(qmil);
// Convert to the correct type of selection
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject* data = this->TreeAdapter->GetVTKDataObject();
vtkSmartPointer<vtkSelection> converted;
converted.TakeReference(vtkConvertSelection::ToSelectionType(
VTKIndexSelectList, data, this->SelectionType, this->SelectionArrayNames));
VTKIndexSelectList, data, rep->GetSelectionType(), rep->GetSelectionArrayNames()));
// Call select on the representation
this->GetRepresentation()->Select(this, converted);
rep->Select(this, converted);
this->Selecting = false;
......@@ -155,7 +156,7 @@ void vtkQtColumnView::SetVTKSelection()
// See if the selection has changed in any way
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject *d = this->TreeAdapter->GetVTKDataObject();
vtkSelection* s = rep->GetSelectionLink()->GetSelection();
vtkSelection* s = rep->GetAnnotationLink()->GetCurrentSelection();
if (s->GetMTime() != this->CurrentSelectionMTime)
{
this->CurrentSelectionMTime = s->GetMTime();
......
......@@ -25,6 +25,7 @@
#include "vtkAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAnnotationLink.h"
#include "vtkConvertSelection.h"
#include "vtkDataRepresentation.h"
#include "vtkIdTypeArray.h"
......@@ -32,12 +33,11 @@
#include "vtkObjectFactory.h"
#include "vtkQtTableModelAdapter.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTable.h"
vtkCxxRevisionMacro(vtkQtListView, "1.6");
vtkCxxRevisionMacro(vtkQtListView, "1.7");
vtkStandardNewMacro(vtkQtListView);
......@@ -128,13 +128,14 @@ void vtkQtListView::slotQtSelectionChanged(const QItemSelection& vtkNotUsed(s1),
vtkSelection *VTKIndexSelectList = this->ListAdapter->QModelIndexListToVTKIndexSelection(qmil);
// Convert to the correct type of selection
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject* data = this->ListAdapter->GetVTKDataObject();
vtkSmartPointer<vtkSelection> converted;
converted.TakeReference(vtkConvertSelection::ToSelectionType(
VTKIndexSelectList, data, this->SelectionType, this->SelectionArrayNames));
VTKIndexSelectList, data, rep->GetSelectionType(), rep->GetSelectionArrayNames()));
// Call select on the representation
this->GetRepresentation()->Select(this, converted);
rep->Select(this, converted);
this->Selecting = false;
}
......@@ -152,7 +153,7 @@ void vtkQtListView::SetVTKSelection()
// See if the selection has changed in any way
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject *d = this->ListAdapter->GetVTKDataObject();
vtkSelection* s = rep->GetSelectionLink()->GetSelection();
vtkSelection* s = rep->GetAnnotationLink()->GetCurrentSelection();
if (s->GetMTime() != this->CurrentSelectionMTime)
{
this->CurrentSelectionMTime = s->GetMTime();
......
......@@ -24,6 +24,7 @@
#include "vtkAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAnnotationLink.h"
#include "vtkCommand.h"
#include "vtkConvertSelection.h"
#include "vtkDataObjectToTable.h"
......@@ -32,12 +33,11 @@
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTable.h"
vtkCxxRevisionMacro(vtkQtRecordView, "1.6");
vtkCxxRevisionMacro(vtkQtRecordView, "1.7");
vtkStandardNewMacro(vtkQtRecordView);
//----------------------------------------------------------------------------
......@@ -108,7 +108,8 @@ void vtkQtRecordView::Update()
}
vtkSmartPointer<vtkSelection> cs;
cs.TakeReference(vtkConvertSelection::ToSelectionType(rep->GetSelectionLink()->GetSelection(),
cs.TakeReference(vtkConvertSelection::ToSelectionType(
rep->GetAnnotationLink()->GetCurrentSelection(),
table, vtkSelectionNode::INDICES, 0, vtkSelectionNode::ROW));
vtkSelectionNode *node = cs->GetNode(0);
const vtkIdType column_count = table->GetNumberOfColumns();
......
......@@ -35,7 +35,7 @@
#include <assert.h>
// ----------------------------------------------------------------------
vtkCxxRevisionMacro(vtkQtTableRepresentation, "1.9");
vtkCxxRevisionMacro(vtkQtTableRepresentation, "1.10");
// ----------------------------------------------------------------------
vtkCxxSetObjectMacro(vtkQtTableRepresentation, ColorTable, vtkLookupTable);
......@@ -80,10 +80,13 @@ vtkQtTableRepresentation::~vtkQtTableRepresentation()
// ----------------------------------------------------------------------
void
vtkQtTableRepresentation::PrepareInputConnections()
int
vtkQtTableRepresentation::RequestData(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*)
{
this->UpdateTable();
return 1;
}
// ----------------------------------------------------------------------
......
......@@ -109,7 +109,9 @@ public:
// Description:
// Prepare the input connections to this representation.
virtual void PrepareInputConnections();
virtual int RequestData(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
virtual void ResetModel();
virtual void CreateSeriesColors();
......
......@@ -28,6 +28,7 @@
#include "vtkAddMembershipArray.h"
#include "vtkAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAnnotationLink.h"
#include "vtkConvertSelection.h"
#include "vtkDataObjectToTable.h"
#include "vtkDataRepresentation.h"
......@@ -36,15 +37,14 @@
#include "vtkIdTypeArray.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include <vtkOutEdgeIterator.h>
#include "vtkOutEdgeIterator.h"
#include "vtkQtTableModelAdapter.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTable.h"
vtkCxxRevisionMacro(vtkQtTableView, "1.13");
vtkCxxRevisionMacro(vtkQtTableView, "1.14");
vtkStandardNewMacro(vtkQtTableView);
//----------------------------------------------------------------------------
......@@ -196,13 +196,14 @@ void vtkQtTableView::slotQtSelectionChanged(const QItemSelection& s1,
this->TableAdapter->QModelIndexListToVTKIndexSelection(sortedSel.indexes());
// Convert to the correct type of selection
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject* data = this->TableAdapter->GetVTKDataObject();
vtkSmartPointer<vtkSelection> converted;
converted.TakeReference(vtkConvertSelection::ToSelectionType(
VTKIndexSelectList, data, this->SelectionType, this->SelectionArrayNames, this->FieldType));
VTKIndexSelectList, data, rep->GetSelectionType(), rep->GetSelectionArrayNames(), this->FieldType));
// Call select on the representation
this->GetRepresentation()->Select(this, converted);
rep->Select(this, converted);
this->Selecting = false;
}
......@@ -220,7 +221,7 @@ void vtkQtTableView::SetVTKSelection()
// See if the selection has changed in any way
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject *d = this->TableAdapter->GetVTKDataObject();
vtkSelection* s = rep->GetSelectionLink()->GetSelection();
vtkSelection* s = rep->GetAnnotationLink()->GetCurrentSelection();
//vtkSelection *s = vtkSelection::SafeDownCast(
// this->GetRepresentation()->GetSelectionConnection()->GetProducer()->GetOutputDataObject(0));
if (s->GetMTime() != this->CurrentSelectionMTime)
......@@ -229,7 +230,7 @@ void vtkQtTableView::SetVTKSelection()
vtkSmartPointer<vtkSelection> selection;
selection.TakeReference(vtkConvertSelection::ToSelectionType(
s, d, vtkSelectionNode::INDICES, this->SelectionArrayNames, vtkSelectionNode::ROW));
s, d, vtkSelectionNode::INDICES, 0, vtkSelectionNode::ROW));
QItemSelection qisList = this->TableAdapter->
VTKIndexSelectionToQItemSelection(selection);
......@@ -267,10 +268,11 @@ void vtkQtTableView::Update()
{
return;
}
rep->Update();
// Make sure the input connection is up to date.
vtkAlgorithmOutput* conn = rep->GetInputConnection();
vtkAlgorithmOutput* selectionConn = rep->GetSelectionConnection();
vtkAlgorithmOutput* conn = rep->GetInternalOutputPort();
vtkAlgorithmOutput* selectionConn = rep->GetInternalSelectionOutputPort();
if (this->DataObjectToTable->GetInputConnection(0, 0) != conn ||
this->AddSelectedColumn->GetInputConnection(1, 0) != selectionConn)
{
......
......@@ -26,6 +26,7 @@
#include "vtkAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAnnotationLink.h"
#include "vtkConvertSelection.h"
#include "vtkDataRepresentation.h"
#include "vtkIdTypeArray.h"
......@@ -33,12 +34,11 @@
#include "vtkObjectFactory.h"
#include "vtkQtTreeModelAdapter.h"
#include "vtkSelection.h"
#include "vtkSelectionLink.h"
#include "vtkSelectionNode.h"
#include "vtkSmartPointer.h"
#include "vtkTree.h"
vtkCxxRevisionMacro(vtkQtTreeView, "1.9");
vtkCxxRevisionMacro(vtkQtTreeView, "1.10");
vtkStandardNewMacro(vtkQtTreeView);
//----------------------------------------------------------------------------
......@@ -160,16 +160,17 @@ void vtkQtTreeView::slotQtSelectionChanged(const QItemSelection& vtkNotUsed(s1),
vtkSelection *VTKIndexSelectList = this->TreeAdapter->QModelIndexListToVTKIndexSelection(qmil);
// Convert to the correct type of selection
vtkDataRepresentation* rep = this->GetRepresentation();
vtkDataObject* data = this->TreeAdapter->GetVTKDataObject();
vtkSmartPointer<vtkSelection> converted;
converted.TakeReference(vtkConvertSelection::ToSelectionType(
VTKIndexSelectList, data, this->SelectionType, this->SelectionArrayNames));
VTKIndexSelectList, data, rep->GetSelectionType(), rep->GetSelectionArrayNames()));
// Store the selection mtime
this->CurrentSelectionMTime = converted->GetMTime();
// Call select on the representation (all 'linked' views will receive this selection)
this->GetRepresentation()->Select(this, converted);
rep->Select(this, converted);
this->Selecting = false;
......@@ -197,7 +198,7 @@ void vtkQtTreeView::SetVTKSelection()
// See if the selection has changed in any way
vtkDataRepresentation* rep = this->GetRepresentation();
vtkSelection* s = rep->GetSelectionLink()->GetSelection();
vtkSelection* s = rep->GetAnnotationLink()->GetCurrentSelection();
if (s->GetMTime() != this->CurrentSelectionMTime)
{
this->CurrentSelectionMTime = s->GetMTime();
......@@ -231,6 +232,7 @@ void vtkQtTreeView::Update()
{
return;
}
rep->Update();
// Make the data current
vtkAlgorithm* alg = rep->GetInputConnection()->GetProducer();
......
......@@ -20,7 +20,6 @@ SET( Kit_SRCS
vtkGeoGraticule.cxx
vtkGeoImageNode.cxx
vtkGeoInteractorStyle.cxx
vtkGeoLineRepresentation.cxx
vtkGeoProjectionSource.cxx
vtkGeoProjection.cxx
vtkGeoRandomGraphSource.cxx
......
......@@ -59,11 +59,8 @@ int TestCoincidentGeoGraphRepresentation2D(int argc, char* argv[])
vtkStdString imageFile = fname;
// Create the view
vtkSmartPointer<vtkRenderWindow> win = vtkSmartPointer<vtkRenderWindow>::New();
win->SetMultiSamples(0); // ensure to have the same test image everywhere
vtkSmartPointer<vtkGeoView2D> view = vtkSmartPointer<vtkGeoView2D>::New();
view->SetupRenderWindow(win);
view->GetRenderWindow()->SetMultiSamples(0); // ensure to have the same test image everywhere
// Create the terrain
vtkSmartPointer<vtkGeoTerrain2D> terrain =
......@@ -266,30 +263,16 @@ int TestCoincidentGeoGraphRepresentation2D(int argc, char* argv[])
imageRep->SetSource(imageSource);
// Set up the viewport
win->SetSize(900, 600);
vtkSmartPointer<vtkGeoTerrainNode> root =
vtkSmartPointer<vtkGeoTerrainNode>::New();
terrainSource->FetchRoot(root);
double bounds[6];
root->GetModel()->GetBounds(bounds);
bounds[0] = bounds[0] - (bounds[1] - bounds[0])*0.01;
bounds[1] = bounds[1] + (bounds[1] - bounds[0])*0.01;
bounds[2] = bounds[2] - (bounds[3] - bounds[2])*0.01;
bounds[3] = bounds[3] + (bounds[3] - bounds[2])*0.01;
double scalex = (bounds[1] - bounds[0])/2.0;
double scaley = (bounds[3] - bounds[2])/2.0;
double scale = (scalex > scaley) ? scalex : scaley;
view->GetRenderer()->GetActiveCamera()->SetParallelScale(scale);
view->Update();
view->GetRenderer()->ResetCamera();
view->GetRenderWindow()->SetSize(900, 600);
view->Render();
view->ResetCamera();
view->GetRenderer()->GetActiveCamera()->Zoom(2.1);
view->GetRenderer()->Render();
int retVal = vtkRegressionTestImage(win);
view->Render();
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
win->GetInteractor()->Initialize();
win->GetInteractor()->Start();
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
terrainSource->ShutDown();
......
......@@ -113,14 +113,9 @@ int TestGeoView(int argc, char* argv[])
}
}
// Create the geo view.
VTK_CREATE(vtkRenderWindow, win);
win->SetMultiSamples(0);
VTK_CREATE(vtkGeoView, view);
//VTK_CREATE(vtkRenderView, view);
//VTK_CREATE(vtkGeoSphereTransform, trans);
//view->SetTransform(trans);
view->SetupRenderWindow(win);
win->SetSize(400,400);
view->GetRenderWindow()->SetMultiSamples(0);
view->GetRenderWindow()->SetSize(400,400);