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

#include <ossimHistogramWriter.h>

Inheritance diagram for ossimHistogramWriter:
ossimOutputSource ossimProcessInterface ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimHistogramWriter (ossimImageSource *inputSource=0, ossimObject *owner=0)
 
void setAreaOfInterest (const ossimIrect &rect)
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual bool execute ()
 
virtual bool isOpen () const
 
virtual bool open ()
 
virtual bool open (const ossimFilename &filename)
 
virtual void close ()
 
virtual void setOutputName (const ossimString &outputName)
 
virtual void setFilename (const ossimFilename &filename)
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual void processProgressEvent (ossimProcessProgressEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void abort ()
 Overrides base to pass on abort to theHistogramSource. More...
 
- Public Member Functions inherited from ossimOutputSource
 ossimOutputSource (ossimObject *owner=NULL)
 
 ossimOutputSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimOutputSource ()
 
virtual bool open (const ossimString &outputName)
 
virtual const ossimStringgetOutputName ()
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual void initialize ()
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () 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 isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- 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 ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- 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)
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void propertyEvent (ossimPropertyEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

virtual ~ossimHistogramWriter ()
 
virtual void writeHistogram ()
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

ossimIrect theAreaOfInterest
 
ossimFilename theFilename
 
std::ofstream * theFileStream
 
ossimHistogramWriterProcessListenertheProcessListener
 
ossimHistogramSourcetheHistogramSource
 stored for abort call only. More...
 
- Protected Attributes inherited from ossimOutputSource
ossimString theOutputName
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Friends

class ossimHistogramWriterProcessListener
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- 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

Definition at line 29 of file ossimHistogramWriter.h.

Constructor & Destructor Documentation

◆ ossimHistogramWriter()

ossimHistogramWriter::ossimHistogramWriter ( ossimImageSource inputSource = 0,
ossimObject owner = 0 
)

Definition at line 48 of file ossimHistogramWriter.cpp.

References ossimConnectableObject::connectMyInputTo(), ossimIrect::makeNan(), ossimHistogramWriterProcessListener, theAreaOfInterest, and theProcessListener.

50  : ossimOutputSource(owner,
51  1,
52  0,
53  true,
54  false),
56  theFilename(),
57  theFileStream(0),
60 {
62 
64  connectMyInputTo(0, inputSource);
65 }
ossimOutputSource(ossimObject *owner=NULL)
ossimHistogramWriterProcessListener * theProcessListener
std::ofstream * theFileStream
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
ossimHistogramSource * theHistogramSource
stored for abort call only.
void makeNan()
Definition: ossimIrect.h:329
friend class ossimHistogramWriterProcessListener

◆ ~ossimHistogramWriter()

ossimHistogramWriter::~ossimHistogramWriter ( )
protectedvirtual

Definition at line 67 of file ossimHistogramWriter.cpp.

References close(), isOpen(), theHistogramSource, and theProcessListener.

68 {
69  if(isOpen())
70  {
71  close();
72  }
74  {
75  delete theProcessListener;
77  }
78 
79  // This does not need to be deleted here. Simply stored for abort.
81  {
83  }
84 }
ossimHistogramWriterProcessListener * theProcessListener
virtual bool isOpen() const
ossimHistogramSource * theHistogramSource
stored for abort call only.

Member Function Documentation

◆ abort()

void ossimHistogramWriter::abort ( )
virtual

Overrides base to pass on abort to theHistogramSource.

Reimplemented from ossimProcessInterface.

Definition at line 285 of file ossimHistogramWriter.cpp.

References ossimProcessInterface::abort(), ossimProcessInterface::PROCESS_STATUS_ABORTED, PTR_CAST, ossimProcessInterface::setProcessStatus(), and theHistogramSource.

286 {
287  //---
288  // Call base abort. This sets the status to PROCESS_STATUS_ABORT_REQUEST so the processor
289  // knows to abort.
290  //---
292 
293  // Propagate to histo source.
294  if (theHistogramSource)
295  {
296  ossimImageHistogramSource* histoSource =
298  if (histoSource)
299  {
300  histoSource->abort();
301  }
302  }
303 
304  //---
305  // Now set status to "ABORTED" so ossimProcessInterface::isAborted returns true so the
306  // writeHistogram method doesn't write the file if the process was aborted.
307  //---
309 }
virtual void setProcessStatus(ossimProcessStatus processStatus)
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimHistogramSource * theHistogramSource
stored for abort call only.

◆ canConnectMyInputTo()

bool ossimHistogramWriter::canConnectMyInputTo ( ossim_int32  myInputIndex,
const ossimConnectableObject object 
) const
virtual

required to be overriden by derived classes

Implements ossimConnectableObject.

Definition at line 135 of file ossimHistogramWriter.cpp.

References PTR_CAST.

137 {
138  return (object&&(inputIndex == 0)&&
139  (PTR_CAST(ossimHistogramSource, object)||
140  PTR_CAST(ossimImageSource, object)));
141 }
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321

◆ close()

void ossimHistogramWriter::close ( )
virtual

Generic interface to allow one to close a consumer. For displays this might minimize the window and free up internal pointers for file writers it will make sure the file stream is closed and flushed.

Implements ossimOutputSource.

Definition at line 118 of file ossimHistogramWriter.cpp.

References theFileStream.

Referenced by open(), and ~ossimHistogramWriter().

119 {
120  delete theFileStream;
121  theFileStream = 0;
122 }
std::ofstream * theFileStream

◆ connectInputEvent()

void ossimHistogramWriter::connectInputEvent ( ossimConnectionEvent event)
virtual

Reimplemented from ossimConnectableObjectListener.

Definition at line 162 of file ossimHistogramWriter.cpp.

References ossimListenerManager::addListener(), ossimConnectableObject::getInput(), ossimEvent::getObject(), ossimConnectionEvent::getOldObject(), and PTR_CAST.

164 {
165  if(event.getObject() == this)
166  {
167  if(event.getOldObject())
168  {
169  event.getOldObject()->removeListener((ossimProcessListener*)this);
170  }
171  if(getInput(0)&&
173  {
175  }
176  }
177 }
virtual bool addListener(ossimListener *listener)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
const ossimObject * getObject() const
This is the originating object that originally produced the event.
Definition: ossimEvent.cpp:64
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossimConnectableObject * getOldObject(ossim_uint32 i=0)

◆ disconnectInputEvent()

void ossimHistogramWriter::disconnectInputEvent ( ossimConnectionEvent event)
virtual

Reimplemented from ossimConnectableObjectListener.

Definition at line 179 of file ossimHistogramWriter.cpp.

References ossimConnectableObject::getInput(), ossimConnectionEvent::getOldObject(), and PTR_CAST.

181 {
182  if(event.getOldObject()&&
184  {
185  event.getOldObject()->removeListener((ossimProcessListener*)this);
186  }
187 }
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossimConnectableObject * getOldObject(ossim_uint32 i=0)

◆ execute()

bool ossimHistogramWriter::execute ( )
virtual

Implements ossimProcessInterface.

Definition at line 214 of file ossimHistogramWriter.cpp.

References writeHistogram().

Referenced by ossimImageHandler::buildHistogram(), and ossimImageFileWriter::writeHistogramFile().

215 {
216  writeHistogram();
217 
218  return true;
219 }

◆ getObject() [1/2]

ossimObject * ossimHistogramWriter::getObject ( )
virtual

Implements ossimProcessInterface.

Definition at line 91 of file ossimHistogramWriter.cpp.

92 {
93  return this;
94 }

◆ getObject() [2/2]

const ossimObject * ossimHistogramWriter::getObject ( ) const
virtual

Implements ossimProcessInterface.

Definition at line 143 of file ossimHistogramWriter.cpp.

144 {
145  return this;
146 }

◆ isOpen()

bool ossimHistogramWriter::isOpen ( ) const
virtual

Implements ossimOutputSource.

Definition at line 96 of file ossimHistogramWriter.cpp.

References theFileStream.

Referenced by open(), writeHistogram(), and ~ossimHistogramWriter().

97 {
98  return (theFileStream != 0);
99 }
std::ofstream * theFileStream

◆ loadState()

bool ossimHistogramWriter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimOutputSource.

Definition at line 198 of file ossimHistogramWriter.cpp.

References ossimConnectableObject::getNumberOfInputs(), ossimOutputSource::loadState(), and ossimConnectableObject::setNumberOfInputs().

200 {
201  bool result = ossimOutputSource::loadState(kwl, prefix);
202 
203  if(result)
204  {
205  if(!getNumberOfInputs())
206  {
208  }
209  }
210 
211  return result;
212 }
virtual void setNumberOfInputs(ossim_int32 numberOfInputs)
Will set the number of inputs.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.

◆ open() [1/2]

bool ossimHistogramWriter::open ( )
virtual

open the histogram file for output. Note if the file was previously open then it will close it and re-opens the file.

Implements ossimOutputSource.

Definition at line 101 of file ossimHistogramWriter.cpp.

References ossimString::c_str(), close(), isOpen(), theFilename, and theFileStream.

Referenced by writeHistogram().

102 {
103  if(isOpen())
104  {
105  close();
106  }
107 
109 
110  return theFileStream->good();
111 }
virtual bool isOpen() const
std::ofstream * theFileStream
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47

◆ open() [2/2]

bool ossimHistogramWriter::open ( const ossimFilename filename)
virtual

Definition at line 113 of file ossimHistogramWriter.cpp.

References ossimOutputSource::open().

114 {
115  return ossimOutputSource::open(filename);
116 }
virtual bool open()=0

◆ processProgressEvent()

void ossimHistogramWriter::processProgressEvent ( ossimProcessProgressEvent event)
virtual

Definition at line 148 of file ossimHistogramWriter.cpp.

References ossimProcessProgressEvent::getMessage(), ossimEvent::getObject(), ossimProcessProgressEvent::getPercentComplete(), ossimProcessInterface::setCurrentMessage(), and ossimProcessInterface::setPercentComplete().

150 {
151  // we will raise the event if its coming from our
152  // input. This means that we are connected to a
153  // ossimHistogramSource.
154  //
155  if(event.getObject() != this)
156  {
159  }
160 }
virtual void setPercentComplete(double percentComplete)
const ossimObject * getObject() const
This is the originating object that originally produced the event.
Definition: ossimEvent.cpp:64
void setCurrentMessage(const ossimString &message)

◆ saveState()

bool ossimHistogramWriter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of the object to a keyword list. Return true if ok or false on error.

Reimplemented from ossimOutputSource.

Definition at line 189 of file ossimHistogramWriter.cpp.

References ossimOutputSource::saveState().

191 {
192  bool result = ossimOutputSource::saveState(kwl, prefix);
193 
194 
195  return result;
196 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

◆ setAreaOfInterest()

void ossimHistogramWriter::setAreaOfInterest ( const ossimIrect rect)

Definition at line 86 of file ossimHistogramWriter.cpp.

References theAreaOfInterest.

87 {
88  theAreaOfInterest = rect;
89 }

◆ setFilename()

void ossimHistogramWriter::setFilename ( const ossimFilename filename)
virtual

Definition at line 130 of file ossimHistogramWriter.cpp.

References theFilename.

Referenced by ossimImageHandler::buildHistogram(), setOutputName(), and ossimImageFileWriter::writeHistogramFile().

131 {
132  theFilename = filename;
133 }

◆ setOutputName()

void ossimHistogramWriter::setOutputName ( const ossimString outputName)
virtual

Overrides the base class and maps the outputName to a filename.

Reimplemented from ossimOutputSource.

Definition at line 124 of file ossimHistogramWriter.cpp.

References setFilename(), and ossimOutputSource::setOutputName().

125 {
127  setFilename(outputName);
128 }
virtual void setOutputName(const ossimString &outputName)
virtual void setFilename(const ossimFilename &filename)

◆ writeHistogram()

void ossimHistogramWriter::writeHistogram ( )
protectedvirtual

Definition at line 221 of file ossimHistogramWriter.cpp.

References ossimListenerManager::addListener(), ossimConnectableObject::connectMyInputTo(), ossimSource::enableSource(), ossimHistogramSource::getHistogram(), ossimConnectableObject::getInput(), ossimProcessInterface::isAborted(), isOpen(), open(), PTR_CAST, ossimMultiResLevelHistogram::saveState(), theHistogramSource, theProcessListener, and ossimRefPtr< T >::valid().

Referenced by execute().

222 {
223  if(!getInput(0))
224  {
225  cerr << "ossimHistogramWriter::writeHistogram is not connected" << endl;
226  return;
227  }
229  bool deleteHistoSource = false;
230  if(!histoSource)
231  {
232  histoSource = new ossimImageHistogramSource;
233  histoSource->connectMyInputTo(0, getInput(0));
234  histoSource->enableSource();
235  deleteHistoSource = true;
236 
237  //---
238  // Capture the pointer for abort call. Note a ossimHistogramSource has
239  // no abort so the abort will only work through the
240  // ossimImageHistogramSource pointer.
241  //---
243  }
244 
245  // Capture the pointer for abort call.
246  theHistogramSource = histoSource;
247 
248  histoSource->addListener( theProcessListener);
249 
251 
252  // Don't write histogram if abort flag was set...
253  if(histo.valid() && !isAborted() )
254  {
255  ossimKeywordlist kwl;
256  histo->saveState(kwl);
257  if(!isOpen())
258  {
259  open();
260  if(!isOpen())
261  {
262  if(traceDebug())
263  {
264  ossimNotify(ossimNotifyLevel_WARN) << "unable to open file " << theFilename << endl;
265  }
266  }
267  }
268  if( isOpen() )
269  {
271  }
272  }
273  histoSource->removeListener(theProcessListener);
274 
275  if(deleteHistoSource)
276  {
277  delete histoSource;
278  histoSource = 0;
279  }
280  theHistogramSource = 0;
281 
282  close();
283 }
virtual bool addListener(ossimListener *listener)
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
ossimHistogramWriterProcessListener * theProcessListener
virtual bool isOpen() const
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
std::ofstream * theFileStream
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual void enableSource()
Definition: ossimSource.cpp:84
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual void writeToStream(std::ostream &out) const
ossimHistogramSource * theHistogramSource
stored for abort call only.
virtual ossimRefPtr< ossimMultiResLevelHistogram > getHistogram()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual bool removeListener(ossimListener *listener)

Friends And Related Function Documentation

◆ ossimHistogramWriterProcessListener

Definition at line 34 of file ossimHistogramWriter.h.

Referenced by ossimHistogramWriter().

Member Data Documentation

◆ theAreaOfInterest

ossimIrect ossimHistogramWriter::theAreaOfInterest
protected

Definition at line 90 of file ossimHistogramWriter.h.

Referenced by ossimHistogramWriter(), and setAreaOfInterest().

◆ theFilename

ossimFilename ossimHistogramWriter::theFilename
protected

Definition at line 91 of file ossimHistogramWriter.h.

Referenced by open(), and setFilename().

◆ theFileStream

std::ofstream* ossimHistogramWriter::theFileStream
protected

Definition at line 92 of file ossimHistogramWriter.h.

Referenced by close(), isOpen(), and open().

◆ theHistogramSource

ossimHistogramSource* ossimHistogramWriter::theHistogramSource
protected

stored for abort call only.

Definition at line 96 of file ossimHistogramWriter.h.

Referenced by abort(), writeHistogram(), and ~ossimHistogramWriter().

◆ theProcessListener

ossimHistogramWriterProcessListener* ossimHistogramWriter::theProcessListener
protected

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