Commit 9bcda1c1 authored by Jeff Baumes's avatar Jeff Baumes

ENH: Adding new rendered representation classes

 - Adding new rendered graph, hierarchy, surface, tree area representations.
   These classes consolidate code that were in several different views.

 - Adding vtkHierarchicalGraphPipeline, which renders bundled graph edges
   on top of a tree. This is a convenience class used by
   vtkRenderedHierarchyRepresentation and vtkRenderedTreeAreaRepresentation.

 - Fixing up OverView geo views and hierarchy view.

 - Removing buggy hack in vtkScalarsToColors that caused problems with
   correctly rendering color arrays.

 - Added opacity to annotations.

 - vtkGraph now creates edge points on demand instead of throwing errors,
   and correctly deep copies edge points on force ownership call.

 - Updating geovis tests to use new graph representation API.

 - Moved vtkGeoEdgeStrategy to Infovis so it can be accessed in the graph
   representation.

 - Moved vtkGeoMath to Infovis since it is used by vtkGeoEdgeStrategy.

 - Removed vtkGeoGraphRepresentation and vtkGeoGraphRepresentation2D, which
   are now superceded by vtkRenderedGraphRepresentation.

 - Removed reference loop in vtkGeoLineRepresentation's ConvertSelection
   by removing the PROP property from the selection.

 - Updating vtkGeoView and vtkGeoView2D to new view architecture.

 - Added option to Glyph3D to output cell data along with point data
   on the output glyphs.

 - vtkGraphToPolyData now correctly uses the vertex endpoint positions
   as the start and end of the polyline for each edge.

 - vtkSelectionLink's SetSelection used to always trigger the algorithm to
   be modified. This is no longer true if the same selection is set multiple
   times.

 - Changed vtkSplineFilter to handle consecutive points at the same position
   instead of outputting errors.

 - Changed vtkCosmicTreeLayoutStrategy so the output arrays are called
   "TreeRadius" and "TreeScaleFactor" instead of appending those strings
   to the input size array name.

 - Changing treemap layout strategies to appropriately fill the points
   of the tree that are used for bundled edges.

 - Added ZRange to vtkGraphLayout, if you want vertices to have
   distinct Z values on an otherwise 2D layout. This avoids Z-buffer issues
   when rendering vertices as glyphs.

 - Added Transform property to vtkGraphLayout. This optional transform will
   be applied to locations output from the layout strategy. This is used
   in geo views.

 - Fixed vtkStackedTreeLayoutStrategy to not always place the root position
   for the bundled edges at (0,0,0).

 - Added progress events to vtkTreeRingToPolyData.

 - Allow non-equal array types when PassArray is on, using GetVarantValue
   and InsertVariantValue.

 - Adding option RenderOnMouseMove to vtkInteractorStyleRubberBand2D.
   This allows views to update hover balloons.

 - Fixing bug in vtkLabelHierarchy's iterator where if the lastPlaced array
   contained indices outside the current label set range, it would crash.

 - Adding support for an "ID" array which indicates the type of label
   being processed. This is used to use different font types with different
   sets of labels using the same label placer to place them all.

 - Adding support for multiple font properties to vtkLabelSizeCalculator,
   vtkLabeledDataMapper, vtkDynamic2DLabelPlacer.

 - Adding helper functions to vtkViewTheme to tell you whether a current
   lookup table matches its internal settings, or if it needs to be
   rebuilt. This minimizes pipeline updates.

 - Adding explicit ResetCamera() calls to view tests, because views no
   longer do this automatically.

 - Fixing vtkDataRepresentation so it does not re-do a shallow copy of inputs
   into the internal pipeline unless they have actually changed.

 - Revamping vtkGraphLayoutView to use vtkRenderedGraphRepresentation.

 - Revamping vtkHierarchicalGraphView to use
   vtkRenderedHierarchyRepresentation.

 - Revamping vtkTreeAreaView to use vtkRenderedTreeAreaRepresentation.

 - Updating vtkView to only take a collection of vtkRepresentations, instead
   of supporting multiple ports/connections. We can do this because
   representations now have this option of multiple inputs.

 - vtkView has an option ReuseSingleRepresentation, where it will use the
   same representation after removing/adding input connections. This is
   used in e.g. vtkGraphLayouView so that properties assigned to the view
   persist even when the input connection is reset.

 - Fixing vtkTreeLayoutView to the newer view architecture, even though
   it should be deprecated in the near term.

 - Adding vtkGeoSphereTransform, a simple transform that goes from
   lat-long-alt and rect coords. This is what the 3D geo view has as its
   transform.

 - Adding vtkAppendPoints, which simply appends all the points and associated
   data from multiple input datasets. This is used to append all label points
   into one data object.

 - Adding vtkApplyColors, which applies colors from lut/annotation/selection
   in one place for a dataset. This is used by the new rendered
   representations.

 - Adding vtkAssignCoordinatesLayoutStrategy which uses vtkAssignCoordinates
   inside the layout. This makes the geo "layout" paradigm of lat/long arrays
   consistent with other graph layout strategies, so they can all use
   vtkRenderedGraphRepresentation.

 - Adding vtkDistanceToCamera, computes the distance of each input point
   to the camera. This can be used to scale glyphs dynamically so they
   appear the same size on the screen.

 - Adding graph-based versions of vtkGraphHierarchicalBundle and
   vtkSplineFilter called vtkGraphHierarchicalBundleEdges and
   vtkSplineGraphEdges, which perform the same task as the originals, but
   output a graph with appropriate edge points, instead of polydata.
   This allows these filters to execute before vtkGraphToPolyData.

 - The new vtkGraphToGlyphs filter takes a vtkGraph and outputs polydata
   for the glyphs. The glyphs are dynamically sized based on the position
   from the camera in order tp create glyphs with constant screen size.

 - vtkGraphToPoints converts a graph to a set of points.
parent bba56ecf
......@@ -18,7 +18,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkScalarsToColors, "1.26");
vtkCxxRevisionMacro(vtkScalarsToColors, "1.27");
//----------------------------------------------------------------------------
vtkScalarsToColors::vtkScalarsToColors()
......@@ -108,31 +108,6 @@ vtkUnsignedCharArray *vtkScalarsToColors::MapScalars(vtkDataArray *scalars,
VTK_RGBA);
}//need to map
// Here is a bit of a hack.
// It is much faster to render RGB instead of RGBA when possible.
// I do not want to create a 3 component color array because
// it would be another condition. Give the mapper a hint that
// the colors have no alpha by setting the name.
// When the mapper can handle 3 component color array,
// I will change this logic to use NumberOfComponents as
// an indicator of opacity.
unsigned char* alphaPtr = newColors->GetPointer(0) + 3;
vtkIdType idx, num;
int opaque = 1;
num = newColors->GetNumberOfTuples();
for (idx = 0; idx < num; ++idx)
{
if (*alphaPtr < 255)
{
opaque = 0;
}
alphaPtr += 4;
}
if (opaque)
{
newColors->SetName("Opaque Colors");
}
return newColors;
}
......
......@@ -21,6 +21,7 @@
#include "vtkAnnotation.h"
#include "vtkInformation.h"
#include "vtkInformationDoubleKey.h"
#include "vtkInformationDoubleVectorKey.h"
#include "vtkInformationStringKey.h"
#include "vtkInformationVector.h"
......@@ -28,13 +29,14 @@
#include "vtkSelection.h"
#include "vtkSmartPointer.h"
vtkCxxRevisionMacro(vtkAnnotation, "1.2");
vtkCxxRevisionMacro(vtkAnnotation, "1.3");
vtkStandardNewMacro(vtkAnnotation);
vtkCxxSetObjectMacro(vtkAnnotation, Selection, vtkSelection);
vtkInformationKeyMacro(vtkAnnotation, LABEL, String);
vtkInformationKeyRestrictedMacro(vtkAnnotation, COLOR, DoubleVector, 2);
vtkInformationKeyRestrictedMacro(vtkAnnotation, COLOR, DoubleVector, 3);
vtkInformationKeyMacro(vtkAnnotation, OPACITY, Double);
vtkAnnotation::vtkAnnotation()
{
......
......@@ -65,6 +65,11 @@ public:
// This is stored as an RGB triple with values between 0 and 1.
static vtkInformationDoubleVectorKey* COLOR();
// Description:
// The color for this annotation.
// This is stored as a value between 0 and 1.
static vtkInformationDoubleKey* OPACITY();
// Description:
// Initialize the annotation to an empty state.
virtual void Initialize();
......
......@@ -63,7 +63,7 @@ private:
void operator=(const vtkGraphEdgePoints&); // Not implemented.
};
vtkStandardNewMacro(vtkGraphEdgePoints);
vtkCxxRevisionMacro(vtkGraphEdgePoints, "1.35");
vtkCxxRevisionMacro(vtkGraphEdgePoints, "1.36");
//----------------------------------------------------------------------------
// class vtkGraph
......@@ -72,7 +72,7 @@ vtkCxxSetObjectMacro(vtkGraph, Points, vtkPoints);
vtkCxxSetObjectMacro(vtkGraph, Internals, vtkGraphInternals);
vtkCxxSetObjectMacro(vtkGraph, EdgePoints, vtkGraphEdgePoints);
vtkCxxSetObjectMacro(vtkGraph, EdgeList, vtkIdTypeArray);
vtkCxxRevisionMacro(vtkGraph, "1.35");
vtkCxxRevisionMacro(vtkGraph, "1.36");
//----------------------------------------------------------------------------
vtkGraph::vtkGraph()
{
......@@ -990,8 +990,7 @@ double* vtkGraph::GetEdgePoint(vtkIdType e, vtkIdType i)
}
if (!this->EdgePoints)
{
vtkErrorMacro("No edge points defined.");
return 0;
this->EdgePoints = vtkGraphEdgePoints::New();
}
vtksys_stl::vector< vtksys_stl::vector<double> >::size_type numEdges = this->Internals->NumberOfEdges;
if (this->EdgePoints->Storage.size() < numEdges)
......@@ -1029,8 +1028,7 @@ void vtkGraph::SetEdgePoint(vtkIdType e, vtkIdType i, double x[3])
}
if (!this->EdgePoints)
{
vtkErrorMacro("No edge points defined.");
return;
this->EdgePoints = vtkGraphEdgePoints::New();
}
vtksys_stl::vector< vtksys_stl::vector<double> >::size_type numEdges = this->Internals->NumberOfEdges;
if (this->EdgePoints->Storage.size() < numEdges)
......@@ -1071,8 +1069,7 @@ void vtkGraph::ClearEdgePoints(vtkIdType e)
}
if (!this->EdgePoints)
{
vtkErrorMacro("No edge points defined.");
return;
this->EdgePoints = vtkGraphEdgePoints::New();
}
vtksys_stl::vector< vtksys_stl::vector<double> >::size_type numEdges = this->Internals->NumberOfEdges;
if (this->EdgePoints->Storage.size() < numEdges)
......@@ -1103,8 +1100,7 @@ void vtkGraph::AddEdgePoint(vtkIdType e, double x[3])
}
if (!this->EdgePoints)
{
vtkErrorMacro("No edge points defined.");
return;
this->EdgePoints = vtkGraphEdgePoints::New();
}
vtksys_stl::vector< vtksys_stl::vector<double> >::size_type numEdges = this->Internals->NumberOfEdges;
if (this->EdgePoints->Storage.size() < numEdges)
......@@ -1488,6 +1484,14 @@ void vtkGraph::ForceOwnership()
this->SetInternals(internals);
internals->Delete();
}
if (this->EdgePoints && this->EdgePoints->GetReferenceCount() > 1)
{
vtkGraphEdgePoints *oldEdgePoints = this->EdgePoints;
vtkGraphEdgePoints *edgePoints = vtkGraphEdgePoints::New();
edgePoints->Storage = oldEdgePoints->Storage;
this->EdgePoints = edgePoints;
oldEdgePoints->Delete();
}
}
//----------------------------------------------------------------------------
......
......@@ -14,22 +14,19 @@ SET( Kit_SRCS
vtkGeoArcs.cxx
vtkGeoAssignCoordinates.cxx
vtkGeoCamera.cxx
vtkGeoEdgeStrategy.cxx
vtkGeoFileImageSource.cxx
vtkGeoFileTerrainSource.cxx
vtkGeoGlobeSource.cxx
vtkGeoGraphRepresentation.cxx
vtkGeoGraphRepresentation2D.cxx
vtkGeoGraticule.cxx
vtkGeoImageNode.cxx
vtkGeoInteractorStyle.cxx
vtkGeoLineRepresentation.cxx
vtkGeoMath.cxx
vtkGeoProjectionSource.cxx
vtkGeoProjection.cxx
vtkGeoRandomGraphSource.cxx
vtkGeoSampleArcs.cxx
vtkGeoSource.cxx
vtkGeoSphereTransform.cxx
vtkGeoTerrain.cxx
vtkGeoTerrain2D.cxx
vtkGeoTerrainNode.cxx
......
......@@ -27,7 +27,6 @@
#include "vtkGeoAlignedImageRepresentation.h"
#include "vtkGeoFileImageSource.h"
#include "vtkGeoFileTerrainSource.h"
#include "vtkGeoGraphRepresentation2D.h"
#include "vtkGeoProjection.h"
#include "vtkGeoProjectionSource.h"
#include "vtkGeoTransform.h"
......@@ -41,6 +40,7 @@
#include "vtkMutableUndirectedGraph.h"
#include "vtkPolyData.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderedGraphRepresentation.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
......@@ -253,14 +253,12 @@ int TestCoincidentGeoGraphRepresentation2D(int argc, char* argv[])
}
graph->GetVertexData()->AddArray(colorScalars);
vtkSmartPointer<vtkGeoGraphRepresentation2D> graphRep =
vtkSmartPointer<vtkGeoGraphRepresentation2D>::New();
graphRep->SetTransform(transform);
vtkSmartPointer<vtkRenderedGraphRepresentation> graphRep =
vtkSmartPointer<vtkRenderedGraphRepresentation>::New();
graphRep->SetInput(graph);
graphRep->SetVertexColorArrayName("stuff");
graphRep->ColorVerticesOn();
graphRep->SetVertexLabelArrayName("stuff");
graphRep->VertexLabelVisibilityOff();
graphRep->SetColorVerticesByArray(true);
graphRep->SetLayoutStrategyToAssignCoordinates("longitude", "latitude");
view->AddRepresentation(graphRep);
......@@ -269,9 +267,24 @@ int TestCoincidentGeoGraphRepresentation2D(int argc, char* argv[])
// Set up the viewport
win->SetSize(900, 600);
view->GetRenderer()->GetActiveCamera()->SetParallelScale(95.8);
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->GetRenderer()->GetActiveCamera()->Zoom(2.1);
view->GetRenderer()->Render();
int retVal = vtkRegressionTestImage(win);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
......
......@@ -22,14 +22,14 @@
#include "vtkCamera.h"
#include "vtkGeoAlignedImageRepresentation.h"
#include "vtkGeoAlignedImageSource.h"
#include "vtkGeoEdgeStrategy.h"
#include "vtkGeoFileImageSource.h"
#include "vtkGeoFileTerrainSource.h"
#include "vtkGeoGlobeSource.h"
#include "vtkGeoGraphRepresentation.h"
#include "vtkGeoGraphRepresentation2D.h"
#include "vtkGeoProjection.h"
#include "vtkGeoProjectionSource.h"
#include "vtkGeoRandomGraphSource.h"
#include "vtkGeoSphereTransform.h"
#include "vtkGeoTerrain.h"
#include "vtkGeoTerrainNode.h"
#include "vtkGeoTerrain2D.h"
......@@ -39,6 +39,7 @@
#include "vtkGraphLayoutView.h"
#include "vtkJPEGReader.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderedGraphRepresentation.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
......@@ -115,6 +116,9 @@ int TestGeoView(int argc, char* argv[])
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);
......@@ -154,17 +158,6 @@ int TestGeoView(int argc, char* argv[])
imageRep2->SetSource(imageSource2);
view->AddRepresentation(imageRep2);
// Add a graph representation
vtkSmartPointer<vtkGeoRandomGraphSource> graphSource =
vtkSmartPointer<vtkGeoRandomGraphSource>::New();
graphSource->SetNumberOfVertices(100);
graphSource->StartWithTreeOn();
graphSource->SetNumberOfEdges(0);
vtkSmartPointer<vtkGeoGraphRepresentation> graphRep =
vtkSmartPointer<vtkGeoGraphRepresentation>::New();
graphRep->SetInputConnection(graphSource->GetOutputPort());
view->AddRepresentation(graphRep);
// Serialize databases
if (terrainSavePath.length() > 0)
{
......@@ -195,7 +188,27 @@ int TestGeoView(int argc, char* argv[])
}
imageRep->SetSource(imageSource);
view->GetRenderer()->ResetCameraClippingRange();
view->Update();
view->GetRenderer()->ResetCamera();
view->GetRenderer()->GetActiveCamera()->Zoom(1.2);
// Add a graph representation
vtkSmartPointer<vtkGeoRandomGraphSource> graphSource =
vtkSmartPointer<vtkGeoRandomGraphSource>::New();
graphSource->SetNumberOfVertices(100);
graphSource->StartWithTreeOn();
graphSource->SetNumberOfEdges(0);
vtkSmartPointer<vtkRenderedGraphRepresentation> graphRep =
vtkSmartPointer<vtkRenderedGraphRepresentation>::New();
graphRep->SetInputConnection(graphSource->GetOutputPort());
graphRep->SetLayoutStrategyToAssignCoordinates("longitude", "latitude");
VTK_CREATE(vtkGeoEdgeStrategy, edgeStrategy);
graphRep->SetEdgeLayoutStrategy(edgeStrategy);
view->AddRepresentation(graphRep);
vtkViewTheme* theme = vtkViewTheme::New();
view->ApplyViewTheme(theme);
theme->Delete();
//int retVal = vtkRegressionTestImage(win);
int retVal = vtkRegressionTestImageThreshold(win, 11);
......
......@@ -131,6 +131,7 @@ int TestGeoView2D(int argc, char* argv[])
vtkSmartPointer<vtkRenderWindow> win = vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<vtkGeoView2D> view = vtkSmartPointer<vtkGeoView2D>::New();
view->SetupRenderWindow(win);
view->GetRenderer()->GradientBackgroundOff();
// Create the terrain
vtkSmartPointer<vtkGeoTerrain2D> terrain =
......
......@@ -24,7 +24,6 @@
#include "vtkGeoAlignedImageRepresentation.h"
#include "vtkGeoFileImageSource.h"
#include "vtkGeoFileTerrainSource.h"
#include "vtkGeoGraphRepresentation2D.h"
#include "vtkGeoProjectionSource.h"
#include "vtkGeoRandomGraphSource.h"
#include "vtkGeoTerrain2D.h"
......@@ -33,6 +32,7 @@
#include "vtkJPEGReader.h"
#include "vtkPolyData.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderedGraphRepresentation.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
......@@ -79,17 +79,17 @@ int TestLabeledGeoView2D(int argc, char* argv[])
imageSource->Initialize();
imageRep->SetSource(imageSource);
view->AddRepresentation(imageRep);
view->SetLabelPlacementModeToLabelPlacer();
vtkSmartPointer<vtkGeoRandomGraphSource> graphSource =
vtkSmartPointer<vtkGeoRandomGraphSource>::New();
graphSource->SetNumberOfVertices(500);
vtkSmartPointer<vtkGeoGraphRepresentation2D> graphRep =
vtkSmartPointer<vtkGeoGraphRepresentation2D>::New();
graphSource->SetNumberOfVertices(1000);
vtkSmartPointer<vtkRenderedGraphRepresentation> graphRep =
vtkSmartPointer<vtkRenderedGraphRepresentation>::New();
graphRep->SetInputConnection(graphSource->GetOutputPort());
graphRep->SetVertexLabelArrayName("latitude");
graphRep->SetUseLabelHierarchy(true);
graphRep->SetVertexLabelVisibility(true);
graphRep->SetLayoutStrategyToAssignCoordinates("longitude", "latitude");
view->AddRepresentation(graphRep);
......
This diff is collapsed.
/*=========================================================================
Program: Visualization Toolkit
Module: vtkGeoGraphRepresentation.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkGeoGraphRepresentation - Displays a graph on a earth view.
//
// .SECTION Description
// vtkGeoGraphRepresentation is used to show a graph in a 3D geo view.
// Set the graph input with SetInputConnection(), then add the representation
// to a vtkGeoView.
//
// .SECTION See Also
// vtkGeoView
#ifndef __vtkGeoGraphRepresentation_h
#define __vtkGeoGraphRepresentation_h
#include "vtkDataRepresentation.h"
#include "vtkSmartPointer.h" // for ivars
class vtkActor;
class vtkActor2D;
class vtkAlgorithmOutput;
class vtkDataObject;
class vtkEdgeCenters;
class vtkEdgeLayout;
class vtkEdgeLayoutStrategy;
class vtkExtractSelectedGraph;
class vtkGeoAssignCoordinates;
class vtkGeoEdgeStrategy;
class vtkGraphMapper;
class vtkGraphToPolyData;
class vtkLabeledDataMapper;
class vtkPointSetToLabelHierarchy;
class vtkLabelPlacer;
class vtkLabelSizeCalculator;
class vtkMaskPoints;
class vtkPolyDataMapper;
class vtkSelection;
class vtkAbstractTransform;
class vtkTransformPolyDataFilter;
class vtkView;
class vtkViewTheme;
class VTK_GEOVIS_EXPORT vtkGeoGraphRepresentation : public vtkDataRepresentation
{
public:
static vtkGeoGraphRepresentation *New();
vtkTypeRevisionMacro(vtkGeoGraphRepresentation, vtkDataRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// The array to use for vertex labeling. Default is "label".
virtual void SetVertexLabelArrayName(const char* name);
virtual const char* GetVertexLabelArrayName();
// Description:
// Whether to show vertex labels.
virtual void SetVertexLabelVisibility(bool b);
virtual bool GetVertexLabelVisibility();
virtual void VertexLabelVisibilityOn() { this->SetVertexLabelVisibility(true); }
virtual void VertexLabelVisibilityOff() { this->SetVertexLabelVisibility(false); }
// Description:
// Sets the explode factor for the geo arcs.
virtual void SetExplodeFactor(double factor);
virtual double GetExplodeFactor();
// Description:
// The number of subdivisions per arc.
virtual void SetNumberOfSubdivisions(int num);
virtual int GetNumberOfSubdivisions();
// Description:
// The point array holding the latitude.
virtual void SetLatitudeArrayName(const char* name);
virtual const char* GetLatitudeArrayName();
// Description:
// The point array holding the longitude.
virtual void SetLongitudeArrayName(const char* name);
virtual const char* GetLongitudeArrayName();
// Description:
// The size of the vertex labels in pixels.
void SetVertexLabelFontSize(int size);
int GetVertexLabelFontSize();
// Description:
// Whether to color vertices using a data array.
void SetColorVertices(bool b);
bool GetColorVertices();
vtkBooleanMacro(ColorVertices, bool);
// Description:
// The data array to use to color vertices.
void SetVertexColorArrayName(const char* name);
const char* GetVertexColorArrayName();
// Description:
// Whether to show edge labels.
void SetEdgeLabelVisibility(bool b);
bool GetEdgeLabelVisibility();
vtkBooleanMacro(EdgeLabelVisibility, bool);
// Description:
// The data array to use for labelling edges.
void SetEdgeLabelArrayName(const char* name);
const char* GetEdgeLabelArrayName();
// Description:
// The edge layout strategy to use.
// The default is vtkGeoEdgeStrategy.
virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy* strategy);
virtual vtkEdgeLayoutStrategy* GetEdgeLayoutStrategy();
virtual void SetEdgeLayoutStrategyToGeo();
virtual void SetEdgeLayoutStrategyToArcParallel();
// Description:
// The size of edge labels in pixels.
void SetEdgeLabelFontSize(int size);
int GetEdgeLabelFontSize();
// Description:
// Whether to color edges using a data array.
void SetColorEdges(bool b);
bool GetColorEdges();
vtkBooleanMacro(ColorEdges, bool);
// Description:
// The data array to use for coloring edges.
void SetEdgeColorArrayName(const char* name);
const char* GetEdgeColorArrayName();
// Description:
// The transform used in vtkGeoAssignCoordinates to transform
// the vertex locations from lat/long to world coordinates.
void SetTransform(vtkAbstractTransform* trans);
vtkAbstractTransform* GetTransform();
// Description:
// Apply a theme to this view.
void ApplyViewTheme(vtkViewTheme* theme);
// Description:
// Called by the view when the renderer is about to render.
virtual void PrepareForRendering();
protected:
vtkGeoGraphRepresentation();
~vtkGeoGraphRepresentation();
// Decription:
// Store the name of the LabelText array so we dont update if
// we are already using the same array.
vtkSetStringMacro(LabelArrayName);
vtkGetStringMacro(LabelArrayName);
// Description:
// Sets the input pipeline connections for this representation.
virtual void SetupInputConnections();
// Decription:
// Adds the representation to the view. This is called from
// vtkView::AddRepresentation().
virtual bool AddToView(vtkView* view);
// Decription:
// Removes the representation to the view. This is called from
// vtkView::RemoveRepresentation().
virtual bool RemoveFromView(vtkView* view);
// Description:
// Convert the selection to a type appropriate for sharing with other
// representations through vtkSelectionLink.
// If the selection cannot be applied to this representation, returns NULL.
virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
//BTX
// Description:
// Internal pipeline objects.
vtkSmartPointer<vtkGeoAssignCoordinates> AssignCoordinates;
vtkSmartPointer<vtkLabelSizeCalculator> LabelSize;
vtkSmartPointer<vtkPointSetToLabelHierarchy> LabelHierarchy;
vtkSmartPointer<vtkLabelPlacer> LabelPlacer;
vtkSmartPointer<vtkLabeledDataMapper> LabelMapper;
vtkSmartPointer<vtkActor2D> LabelActor;
vtkSmartPointer<vtkEdgeLayout> EdgeLayout;
vtkSmartPointer<vtkGraphMapper> GraphMapper;
vtkSmartPointer<vtkActor> GraphActor;
vtkSmartPointer<vtkGraphToPolyData> GraphToPolyData;
vtkSmartPointer<vtkEdgeCenters> EdgeCenters;
vtkSmartPointer<vtkLabeledDataMapper> EdgeLabelMapper;
vtkSmartPointer<vtkActor2D> EdgeLabelActor;
vtkSmartPointer<vtkTransformPolyDataFilter> EdgeLabelTransform;
vtkSmartPointer<vtkExtractSelectedGraph> ExtractSelection;
vtkSmartPointer<vtkGraphMapper> SelectionMapper;
vtkSmartPointer<vtkActor> SelectionActor;
//ETX
char* LabelArrayName;
bool In3DGeoView;
private:
vtkGeoGraphRepresentation(const vtkGeoGraphRepresentation&); // Not implemented.
void operator=(const vtkGeoGraphRepresentation&); // Not implemented.
};
#endif
This diff is collapsed.
/*=========================================================================
Program: Visualization Toolkit
Module: vtkGeoGraphRepresentation2D.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkGeoGraphRepresentation2D - Displays a graph on a 2D earth view.
//
// .SECTION Description
// vtkGeoGraphRepresentation2D is used to show a graph in a 2D geo view.
// Set the graph input with SetInputConnection(), set the projection of the
// view with SetTransform(), then add the representation to a vtkGeoView2D.
//
// .SECTION See Also
// vtkGeoView2D
#ifndef __vtkGeoGraphRepresentation2D_h
#define __vtkGeoGraphRepresentation2D_h
#include "vtkDataRepresentation.h"
#include "vtkSmartPointer.h" // for ivars
class vtkActor;
class vtkActor2D;
class vtkAlgorithmOutput;
class vtkDataObject;
class vtkDynamic2DLabelMapper;
class vtkEdgeCenters;
class vtkEdgeLayout;
class vtkEdgeLayoutStrategy;
class vtkExtractSelectedGraph;
class vtkGeoAssignCoordinates;
class vtkGraphMapper;
class vtkGraphToPolyData;
class vtkLabeledDataMapper;
class vtkLabelPlacer;
class vtkLabelSizeCalculator;
class vtkPerturbCoincidentVertices;
class vtkPointSetToLabelHierarchy;
class vtkPolyDataMapper;
class vtkSelection;
class vtkAbstractTransform;
class vtkView;
class vtkViewTheme;
class VTK_GEOVIS_EXPORT vtkGeoGraphRepresentation2D : public vtkDataRepresentation
{
public:
static vtkGeoGraphRepresentation2D *New();
vtkTypeRevisionMacro(vtkGeoGraphRepresentation2D, vtkDataRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// The array to use for vertex labeling. Default is "label".
virtual void SetVertexLabelArrayName(const char* name);
virtual const char* GetVertexLabelArrayName();
// Description:
// Whether to show vertex labels.
virtual void SetVertexLabelVisibility(bool b);
virtual bool GetVertexLabelVisibility();
vtkBooleanMacro(VertexLabelVisibility, bool);
// Description:
// The point array holding the latitude.
virtual void SetLatitudeArrayName(const char* name);
virtual const char* GetLatitudeArrayName();
// Description:
// The point array holding the longitude.
virtual void SetLongitudeArrayName(const char* name);
virtual const char* GetLongitudeArrayName();
// Description:
// The size of the vertex labels in pixels.
void SetVertexLabelFontSize(int size);
int GetVertexLabelFontSize();
// Description:
// Whether to color vertices usin