OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ossimSlopeTool Class Reference

#include <ossimSlopeTool.h>

Inheritance diagram for ossimSlopeTool:
ossimChipProcTool ossimTool ossimProcessInterface ossimListenerManager ossimObject ossim::JsonInterface ossimReferenced

Public Member Functions

 ossimSlopeTool ()
 
 ~ossimSlopeTool ()
 
virtual void setUsage (ossimArgumentParser &ap)
 Initializes the aurgument parser with expected parameters and options. More...
 
virtual bool initialize (ossimArgumentParser &ap)
 Initializes from command line arguments. More...
 
virtual void initialize (const ossimKeywordlist &kwl)
 Reads processing params from KWL and prepares for execute. More...
 
virtual ossimString getClassName () const
 
- Public Member Functions inherited from ossimChipProcTool
 ossimChipProcTool ()
 default constructor More...
 
virtual ~ossimChipProcTool ()
 virtual destructor More...
 
virtual void clear ()
 Disconnects and clears the dem and image layers. More...
 
virtual bool execute ()
 Performs the actual product write. More...
 
virtual void abort ()
 
virtual bool isChipProcessor () const
 Overrides base class implementation to indicate this class supports getChip() calls. More...
 
virtual ossimListenerManagergetManager ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual ossimRefPtr< ossimImageDatagetChip (const ossimIrect &img_rect)
 The meat and potatos of this class. More...
 
virtual ossimRefPtr< ossimImageDatagetChip (const ossimGrect &gnd_rect)
 
ossimRefPtr< ossimImageDatagetChip (const ossimDrect &map_bounding_rect, const ossimDpt &gsd)
 
ossimRefPtr< ossimImageDatagetChip ()
 Get chip method that assumes pre-initialized state. More...
 
const ossimFilenamegetProductFilename () const
 
- Public Member Functions inherited from ossimTool
 ossimTool ()
 
virtual ~ossimTool ()
 
virtual void loadJSON (const Json::Value &json_request)
 Reads processing params from JSON object provided. More...
 
virtual void saveJSON (Json::Value &json) const
 Fetch product as JSON object when applicable Always returns true since using exception on error. More...
 
virtual const std::string & getResponse () const
 Fetch product as string (typically JSON) when applicable, otherwise passes back empty string. More...
 
virtual void getKwlTemplate (ossimKeywordlist &kwl)
 Assigns a template keywordlist to string for initializing derived classes. More...
 
void getAPI (std::string &out) const
 Outputs a JSON representation of the Utility's API. More...
 
std::string getAPI () const
 
void getBuildDate (std::string &s) const
 Gets build date. More...
 
void getRevision (std::string &s) const
 Gets revision. More...
 
void getVersion (std::string &s) const
 Gets version. More...
 
void setOutputStream (std::ostream *os)
 Redirects any console output to the supplied stream for logging or JNI application. More...
 
bool helpRequested () const
 Returns true when the initialization detects a "--help" option, so caller can avoid subsequent execute() call. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossim::JsonInterface
 JsonInterface ()
 
virtual ~JsonInterface ()
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual void setPercentComplete (double percentComplete)
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 

Static Public Attributes

static const char * DESCRIPTION
 Used by ossimUtilityFactory. More...
 

Protected Member Functions

virtual void initProcessingChain ()
 Derived classes initialize their custom chains here. More...
 
- Protected Member Functions inherited from ossimChipProcTool
void processRemainingArgs (ossimArgumentParser &ap)
 Intended to be called after derived class has picked off its own options from the parser, and arguments remain (such as input and output filenames). More...
 
virtual void finalizeChain ()
 Called after initProcessingChain() to append common items to the processing chain. More...
 
virtual void loadImageFiles ()
 Creates chains for image entries associated with specified keyword. More...
 
virtual void loadDemFiles ()
 Loads all DEM files specified in master KWL into the elev manager's database. More...
 
ossimRefPtr< ossimSingleImageChaincreateInputChain (const ossimFilename &image_file, ossim_uint32 entry_index=0)
 Creates the ossimSingleImageChain from image filename and populates the chain with resampler and product output projection on view-side of resampler's IVT. More...
 
void createOutputProjection ()
 Creates the output or view projection. More...
 
ossimRefPtr< ossimMapProjectionnewIdentityProjection ()
 Sets the single image chain for identity operations view to a ossimImageViewAffineTransform. More...
 
ossimRefPtr< ossimMapProjectionnewUtmProjection ()
 Convenience method to get a utm projection. More...
 
virtual void initializeProjectionGsd ()
 Initializes the projection gsd. More...
 
virtual void initializeAOI ()
 Initializes m_aoiViewRect with the output area of interest as specified in master KWL. More...
 
bool getProjectionOrigin (ossimGpt &gpt)
 Reads the KWL for origin latitude and central meridian. More...
 
ossimRefPtr< ossimImageFileWriternewWriter ()
 Creates a new writer. More...
 
void propagateGeometryToChains ()
 Loops through all chains and sets the output projection. More...
 
ossimRefPtr< ossimImageSourcecombineLayers (std::vector< ossimRefPtr< ossimSingleImageChain > > &layers) const
 When multiple input sources are present, this method instantiates a combiner and adds inputs. More...
 
void computeAdjustedViewFromGrect ()
 Initializes m_aoiViewRect given m_aoiGroundRect. More...
 
void setAoiToInputs ()
 Assigns the AOI to be the bounding rect of the union of all inputs. More...
 
void getBandList (ossim_uint32 image_idx, std::vector< ossim_uint32 > &bandList) const
 Gets the band list if BANDS keyword is set. More...
 
void setReaderProps (ossimImageHandler *ih) const
 Passes reader properties to single image handler if any. More...
 
 ossimChipProcTool (const ossimChipProcTool &obj)
 Hidden from use copy constructor. More...
 
const ossimChipProcTooloperator= (const ossimChipProcTool &)
 Hidden from use assignment operator. More...
 
ossimRefPtr< ossimGeoPolygoncreateClipPolygon () const
 
void findCenterGpt (ossimGpt &gpt)
 Tries to determine the AOI center point based on KWL entries, else returns NaNs in gpt. More...
 
ossimRefPtr< ossimImageSourcemosaicDemSources ()
 Some utilities need to work on DEMs as images. More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

bool m_recursiveCall
 
- Protected Attributes inherited from ossimChipProcTool
ossimRefPtr< ossimImageGeometrym_geom
 
ossimIrect m_aoiViewRect
 
ossimGrect m_aoiGroundRect
 
std::vector< ossimRefPtr< ossimSingleImageChain > > m_imgLayers
 
std::vector< ossimFilenamem_demSources
 
ossimRefPtr< ossimImageFileWriterm_writer
 
ossimRefPtr< ossimImageChainm_procChain
 
ossimRefPtr< ossimRectangleCutFilterm_cutRectFilter
 
bool m_projIsIdentity
 
ossimDpt m_gsd
 
bool m_geoScaled
 
ossimFilename m_productFilename
 
ossimScalarType m_productScalarType
 
bool m_needCutRect
 
- Protected Attributes inherited from ossimTool
ossimKeywordlist m_kwl
 
std::ostream * m_consoleStream
 
bool m_helpRequested
 
std::string m_response
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 

Additional Inherited Members

- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 

Detailed Description

Class for computing the slope on each elevation post and generatinga corresponding slope image. The output scalar type is a normalized float unless unsigned 8-bit is selected via the options.

Definition at line 21 of file ossimSlopeTool.h.

Constructor & Destructor Documentation

◆ ossimSlopeTool()

ossimSlopeTool::ossimSlopeTool ( )

Definition at line 39 of file ossimSlopeTool.cpp.

40 : m_recursiveCall (false)
41 {
42 }

◆ ~ossimSlopeTool()

ossimSlopeTool::~ossimSlopeTool ( )

Definition at line 44 of file ossimSlopeTool.cpp.

45 {
46 }

Member Function Documentation

◆ getClassName()

virtual ossimString ossimSlopeTool::getClassName ( ) const
inlinevirtual

Reimplemented from ossimTool.

Definition at line 48 of file ossimSlopeTool.h.

48 { return "ossimSlopeUtil"; }

◆ initialize() [1/2]

bool ossimSlopeTool::initialize ( ossimArgumentParser ap)
virtual

Initializes from command line arguments.

Returns
FALSE if –help option requested or no params provided, so that derived classes can
Note
Throws ossimException on error.

Reimplemented from ossimChipProcTool.

Definition at line 63 of file ossimSlopeTool.cpp.

References ossimChipProcTool::initialize(), ossimTool::m_helpRequested, and ossimChipProcTool::processRemainingArgs().

Referenced by initProcessingChain().

64 {
66  return false;
67  if (m_helpRequested)
68  return true;
69 
71  return true;
72 }
virtual bool initialize(ossimArgumentParser &ap)
Initial method to be ran prior to execute.
bool m_helpRequested
Definition: ossimTool.h:150
void processRemainingArgs(ossimArgumentParser &ap)
Intended to be called after derived class has picked off its own options from the parser...

◆ initialize() [2/2]

void ossimSlopeTool::initialize ( const ossimKeywordlist kwl)
virtual

Reads processing params from KWL and prepares for execute.

Returns TRUE if successful.

Note
Throws ossimException on error.

Reimplemented from ossimChipProcTool.

Definition at line 74 of file ossimSlopeTool.cpp.

References ossimChipProcTool::initialize().

75 {
76  // Base class does the heavy work:
78 }
virtual bool initialize(ossimArgumentParser &ap)
Initial method to be ran prior to execute.

◆ initProcessingChain()

void ossimSlopeTool::initProcessingChain ( )
protectedvirtual

Derived classes initialize their custom chains here.

Implements ossimChipProcTool.

Definition at line 80 of file ossimSlopeTool.cpp.

References ossimImageChain::add(), ossimKeywordlist::addPair(), ossimChipProcTool::combineLayers(), ossimKeywordNames::ELEVATION_SOURCE_KW, ossimRefPtr< T >::get(), ossimElevManager::getCellsForBounds(), ossimKeywordNames::IMAGE_FILE_KW, initialize(), ossimElevManager::instance(), ossimChipProcTool::m_aoiGroundRect, ossimChipProcTool::m_demSources, ossimChipProcTool::m_imgLayers, ossimTool::m_kwl, ossimChipProcTool::m_procChain, m_recursiveCall, ossimSlopeFilter::NORMALIZED, ossimKeywordlist::removeKeysThatMatch(), and ossimSlopeFilter::setSlopeType().

81 {
82  ostringstream key;
83 
84  // Reinitialization needs to skip this method if called recursively:
85  if (m_recursiveCall)
86  return;
87 
88  // Need to establish list of DEM cells given either the bounding rect or explicit DEM cells:
89  if (m_demSources.empty())
90  {
91  // Query elevation manager for cells providing needed coverage:
92  std::vector<ossimFilename> cells;
94 
95  // Insert the list of DEM cells into the KWL as input images:
97  for(ossim_uint32 idx=0; idx<cells.size(); ++idx)
98  {
99  // Add the DEM as an image source to the KWL:
100  ostringstream key;
102  m_kwl.addPair(key.str(), cells[idx].string() );
103  }
104  }
105  else
106  {
107  // DEMs explicitly listed in keywordlist, use these:
108  for(ossim_uint32 idx=0; idx<m_demSources.size(); ++idx)
109  {
110  // Add the DEM as an image source to the KWL:
111  ostringstream key;
113  m_kwl.addPair(key.str(), m_demSources[idx].string() );
114  }
115  }
116 
117  // Remove any occurence of elev_source in the KWL:
119  regex += "*";
120  m_kwl.removeKeysThatMatch(regex);
121 
122  // Reinitialize the object with the DEMs listed as input images and create a mosaic of them:
123  m_recursiveCall = true;
124  initialize(m_kwl);
125  m_recursiveCall = false;
127  m_procChain->add(combiner.get());
128 
129  // Finally add the slope filter:
132  m_procChain->add(slope_filter.get());
133 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
Filter class for computing the slope image of the input image connection.
ossimGrect m_aoiGroundRect
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
ossimRefPtr< ossimImageSource > combineLayers(std::vector< ossimRefPtr< ossimSingleImageChain > > &layers) const
When multiple input sources are present, this method instantiates a combiner and adds inputs...
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
void getCellsForBounds(const std::string &connectionString, const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
Gets a list of elevation cells needed to cover bounding box.
ossimRefPtr< ossimImageChain > m_procChain
void removeKeysThatMatch(const ossimString &regularExpression)
std::vector< ossimFilename > m_demSources
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
unsigned int ossim_uint32
std::vector< ossimRefPtr< ossimSingleImageChain > > m_imgLayers
virtual bool add(ossimConnectableObject *source)
Will return true or false if an image source was added to the chain.
virtual bool initialize(ossimArgumentParser &ap)
Initializes from command line arguments.
void setSlopeType(SlopeType t)
static const char * IMAGE_FILE_KW
static const char * ELEVATION_SOURCE_KW

◆ setUsage()

void ossimSlopeTool::setUsage ( ossimArgumentParser ap)
virtual

Initializes the aurgument parser with expected parameters and options.

It does not output anything. To see the usage, the caller will need to do something like:

ap.getApplicationUsage()->write(<ostream>);

Reimplemented from ossimChipProcTool.

Definition at line 48 of file ossimSlopeTool.cpp.

References DESCRIPTION, ossimArgumentParser::getApplicationName(), ossimArgumentParser::getApplicationUsage(), ossimApplicationUsage::setCommandLineUsage(), ossimApplicationUsage::setDescription(), and ossimChipProcTool::setUsage().

49 {
50  // Add options.
52  ossimString usageString = ap.getApplicationName();
53  usageString += " slope [options] <output-image>";
54  au->setCommandLineUsage(usageString);
55 
56  // Set the command line options:
58 
59  // Base class has its own:
61 }
std::string getApplicationName() const
return the application name, as specified by argv[0]
void setCommandLineUsage(const ossimString &explanation)
ossimApplicationUsage * getApplicationUsage()
virtual void setUsage(ossimArgumentParser &ap)
Initializes the aurgument parser with expected parameters and options.
void setDescription(const ossimString &desc)
static const char * DESCRIPTION
Used by ossimUtilityFactory.

Member Data Documentation

◆ DESCRIPTION

const char * ossimSlopeTool::DESCRIPTION
static
Initial value:
=
"Utility for computing the slope at each elevation post and generating "
"a corresponding slope image."

Used by ossimUtilityFactory.

Definition at line 51 of file ossimSlopeTool.h.

Referenced by ossimToolFactory::getCapabilities(), and setUsage().

◆ m_recursiveCall

bool ossimSlopeTool::m_recursiveCall
protected

Definition at line 55 of file ossimSlopeTool.h.

Referenced by initProcessingChain().


The documentation for this class was generated from the following files: