File: vtkGeoSource.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 118,532 kB
  • ctags: 138,251
  • sloc: cpp: 1,443,749; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,127; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 471; makefile: 95; objc: 17
file content (118 lines) | stat: -rw-r--r-- 4,110 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkGeoSource.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 vtkGeoSource - A multi-resolution geographic data source
//
// .SECTION Description
// vtkGeoSource is an abstract superclass for all multi-resolution data sources
// shown in a geographic view like vtkGeoView or vtkGeoView2D. vtkGeoSource
// subclasses need to implement the FetchRoot() method, which fills a
// vtkGeoTreeNode with the low-res data at the root, and FetchChild(), which
// produces a refinement of a parent node. Other geovis classes such as
// vtkGeoTerrain, vtkGeoTerrain2D, and vtkGeoAlignedImageSource use a
// vtkGeoSource subclass to build their geometry or image caches which are
// stored in trees. The source itself does not maintain the tree, but
// simply provides a mechanism for generating refined tree nodes.
//
// Sources are multi-threaded. Each source may have one or more worker threads
// associated with it, which this superclass manages. It is essential that the
// FetchChild() method is thread-safe, since it may be called from multiple
// workers simultaneously.

#ifndef vtkGeoSource_h
#define vtkGeoSource_h

#include "vtkGeovisCoreModule.h" // For export macro
#include "vtkObject.h"

class vtkAbstractTransform;
class vtkCollection;
class vtkConditionVariable;
class vtkGeoTreeNode;
class vtkMultiThreader;
class vtkMutexLock;

class VTKGEOVISCORE_EXPORT vtkGeoSource : public vtkObject
{
public:
  vtkTypeMacro(vtkGeoSource,vtkObject);

  vtkGeoSource();
  ~vtkGeoSource();

  // Description:
  // Blocking access methods to be implemented in subclasses.
  virtual bool FetchRoot(vtkGeoTreeNode* root) = 0;
  virtual bool FetchChild(vtkGeoTreeNode* node, int index, vtkGeoTreeNode* child) = 0;

  // Description:
  // Non-blocking methods for to use from the main application.
  // After calling RequestChildren() for a certain node,
  // GetRequestedNodes() will after a certain period of time return a
  // non-null pointer to a collection of four vtkGeoTreeNode objects,
  // which are the four children of the requested node.
  // The collection is reference counted, so you need to eventually
  // call Delete() on the returned collection pointer (if it is non-null).
  virtual void RequestChildren(vtkGeoTreeNode* node);
  virtual vtkCollection* GetRequestedNodes(vtkGeoTreeNode* node);

  // Description:
  // Spawn worker threads.
  void Initialize(int numThreads = 1);

  // Description:
  // Shut down the source. This terminates the thread and releases memory.
  void ShutDown();

  void WorkerThread();

  // Description:
  // Return the projection transformation used by this source.
  virtual vtkAbstractTransform* GetTransform() { return NULL; }

protected:

  vtkCollection* InputSet;
  vtkCollection* ProcessingSet;

  // Description:
  // Locks the set for reading or writing
  vtkMutexLock* InputSetLock;
  vtkMutexLock* ProcessingSetLock;
  vtkMutexLock* OutputSetLock;

  vtkMutexLock* Lock;

  vtkConditionVariable* Condition;

  vtkMultiThreader* Threader;
  bool StopThread;
  bool Initialized;

  //BTX
  class implementation;
  implementation* Implementation;
  //ETX

private:
  vtkGeoSource(const vtkGeoSource&); // Not implemented
  void operator=(const vtkGeoSource&); // Not implemented
};

#endif // vtkGeoSource_h