OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimViewshedTool.h
Go to the documentation of this file.
1 //**************************************************************************************************
2 //
3 // OSSIM Open Source Geospatial Data Processing Library
4 // See top level LICENSE.txt file for license information
5 //
6 //**************************************************************************************************
7 
8 #ifndef ossimViewshedUtil_HEADER
9 #define ossimViewshedUtil_HEADER
10 
16 #include <mutex>
22 {
23  friend class SectorProcessorJob;
24  friend class RadialProcessorJob;
25  friend class RadialProcessor;
26 
27 public:
30 
37  virtual void setUsage(ossimArgumentParser& ap);
38 
42  virtual bool initialize(ossimArgumentParser& ap);
43 
46  virtual void initialize(const ossimKeywordlist& kwl);
47 
49  virtual ossimRefPtr<ossimImageData> getChip(const ossimIrect& img_rect);
50 
53  virtual bool execute();
54 
56  virtual void clear();
57 
58  virtual ossimString getClassName() const { return "ossimViewshedUtil"; }
59 
61  static const char* DESCRIPTION;
62 
64  void test();
65 
66 protected:
67  class Radial
68  {
69  public:
70  Radial() : azimuth (0), elevation (-99999999.0), insideAoi(false) {}
71 
72  // Angles are stored as arctangents: azimuth = dy/dx, elevation = dz/dx
73  double azimuth;
74  double elevation;
75  bool insideAoi;
76  };
77 
78  virtual void initProcessingChain();
79  virtual void initializeProjectionGsd();
80  virtual void initializeAOI();
81  void paintReticle();
82  void initRadials();
83  bool writeHorizonProfile();
84  void computeRadius();
85  bool optimizeFOV();
86  bool computeViewshed(); // assigns m_outBuffer with single-band viewshed image
87 
90  double m_obsHgtAbvTer; // meters above the terrain
91  double m_visRadius; // meters
94  bool m_displayAsRadar; // True when explicit visRadius is supplied
95  ossim_uint32 m_halfWindow; // visRadius adjusted by GSD (in pixels)
103  std::shared_ptr<ossimJobMultiThreadQueue> m_jobMtQueue;
105  double m_startFov;
106  double m_stopFov;
109  std::map<double, double> m_horizonMap;
110 
111  // For debugging:
112  double d_accumT;
113  std::mutex d_mutex;
114 };
115 
123 {
124  friend class ossimViewshedTool;
125 public:
127  : m_vsUtil (vs_util), m_sector (sector), m_numRadials (numRadials) {}
128 
129 protected:
130  virtual void run();
131 
132 private:
136 };
137 
138 
140 {
141  friend class ossimViewshedTool;
142 public:
144  ossim_uint32 sector,
145  ossim_uint32 radial,
146  ossim_uint32 numRadials)
147  : m_vsUtil (vs_util), m_sector (sector), m_radial (radial), m_numRadials (numRadials) {}
148 
149 
150 protected:
151  virtual void run();
152 
153 private:
158 };
159 
168 {
169 public:
170  static void doRadial(ossimViewshedTool* vs, ossim_uint32 s, ossim_uint32 r);
171 
172 private:
173  static std::mutex m_bufMutex;
175 };
176 
177 #endif
std::shared_ptr< ossimJobMultiThreadQueue > m_jobMtQueue
virtual bool initialize(ossimArgumentParser &ap)
Initial method to be ran prior to execute.
ossimRefPtr< ossimImageData > getChip()
Get chip method that assumes pre-initialized state.
virtual void initProcessingChain()=0
Derived classes initialize their custom chains here.
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
virtual void run()
Abstract method and must be overriden by the base class.
ossim_uint8 m_overlayValue
ossim_uint8 m_visibleValue
virtual ossimString getClassName() const
This class provides a common entry point for both SectorProcessorJob and RadialProcessorJob for proce...
ossim_uint8 m_hiddenValue
RadialProcessorJob(ossimViewshedTool *vs_util, ossim_uint32 sector, ossim_uint32 radial, ossim_uint32 numRadials)
virtual void initializeProjectionGsd()
Initializes the projection gsd.
ossimRefPtr< ossimMemoryImageSource > m_memSource
For support of multithreading.
virtual void setUsage(ossimArgumentParser &ap)
Initializes the aurgument parser with expected parameters and options.
virtual void clear()
Disconnects and clears the dem and image layers.
SectorProcessorJob(ossimViewshedTool *vs_util, ossim_uint32 sector, ossim_uint32 numRadials)
unsigned int ossim_uint32
virtual void run()
Abstract method and must be overriden by the base class.
ossimViewshedTool * m_vsUtil
ossimViewshedTool * m_vsUtil
ossim_int32 m_reticleSize
ossimRefPtr< ossimImageData > m_outBuffer
static void doRadial(ossimViewshedTool *vs, ossim_uint32 s, ossim_uint32 r)
static std::mutex m_bufMutex
ossim_uint32 m_halfWindow
virtual void initializeAOI()
Initializes m_aoiViewRect with the output area of interest as specified in master KWL...
ossimFilename m_horizonFile
std::map< double, double > m_horizonMap
ossim_uint32 m_numRadials
static const char * DESCRIPTION
Used by ossimUtilityFactory.
This is the job callback interface It allows one to attach and listen for different states of the job...
Definition: ossimJob.h:149
ossim_uint32 m_numRadials
virtual bool execute()
Performs the actual product write.
unsigned char ossim_uint8
ossim_uint32 m_numThreads
int ossim_int32