/usr/include/ossim/imaging/ossimVertexExtractor.h is in libossim-dev 1.7.21-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: David Burken (dburken@imagelinks.com)
//
//*************************************************************************
// $Id: ossimVertexExtractor.h 13312 2008-07-27 01:26:52Z gpotts $
#ifndef ossimVertexExtractor_HEADER
#define ossimVertexExtractor_HEADER
#include <fstream>
#include <ossim/base/ossimOutputSource.h>
#include <ossim/base/ossimProcessInterface.h>
#include <ossim/base/ossimProcessProgressEvent.h>
#include <ossim/base/ossimIrect.h>
#include <ossim/base/ossimFilename.h>
#include <ossim/imaging/ossimImageSource.h>
class ossimImageSource;
//! Class ossimVertexExtractor
/*!
* Class designed to scan the area of interest and detect the valid vertices
* of non null image data.
*/
class OSSIMDLLEXPORT ossimVertexExtractor : public ossimOutputSource,
public ossimProcessInterface
{
public:
ossimVertexExtractor(ossimImageSource* inputSource=NULL);
virtual ~ossimVertexExtractor();
virtual ossimObject* getObject()
{
return this;
}
virtual const ossimObject* getObject()const
{
return this;
}
/*!
* Sets the area of interest in the source to extract the vertices from.
* @param rect ossimIrec representing source area of interest.
*/
void setAreaOfInterest(const ossimIrect& rect);
/*!
* Sets the name of the output keyword list file which the vertices will
* be dumped to.
* @param filename ossimFilename representing the output file.
*
* Note:
* - If "theFileStream" is open it will be closed.
*/
virtual void setOutputName(const ossimString& filename);
/*!
* Returns true if "theFileStream" is open, false if not.
*/
virtual bool isOpen() const;
/*!
* Opens "theFilename" for output.
* Returns true on success, false on error.
* Notes:
* - If the file was previously open then it will close it and re-opens the
* file.
* - Returns false if "theFilename" has not been set.
*/
virtual bool open();
/*!
* Closes "theFileStream".
*/
virtual void close();
/*!
* Calls protected methods scanForEdges, extractVertices, and
* writeVertices. Will error out if "theFilename" or "theAreaOfInterest
* has not been set or "theFilename" could not be opened.
*/
virtual bool execute();
virtual ossimObject* getObjectInterface() { return this; }
virtual ossimListenerManager* getListenerManagerInterface()
{
return this;
}
virtual void setPercentComplete(double percentComplete)
{
ossimProcessInterface::setPercentComplete(percentComplete);
ossimProcessProgressEvent event(this,
percentComplete);
fireEvent(event);
}
bool canConnectMyInputTo(ossim_int32 inputIndex,
const ossimConnectableObject* object)const
{
return (object&& PTR_CAST(ossimImageSource, object));
}
vector<ossimIpt> getVertices() { return theVertice; }
private:
/*!
* Walks each line from left and right side detecting first non null pixel.
* Returns true on success, false on error.
*/
bool scanForEdges();
/*!
* Extracts the vertices of the source. Uses "theLeftEdge" and
* "theRightEdge" data members.
* Returns true on success, false on error.
*/
bool extractVertices();
template<class T1>
void getMinAndIndex(T1* start, T1* end,
T1& minValue, ossim_int32& offsetFromStart);
template<class T2>
void getMaxAndIndex(T2* start, T2* end,
T2& maxValue, ossim_int32& offsetFromStart);
/*!
* Writes the result to the output file (theFilename).
* Returns true on success, false on error.
*/
bool writeVertices();
ossimIrect theAreaOfInterest;
ossimFilename theFilename;
std::ofstream theFileStream;
vector<ossimIpt> theVertice;
ossim_int32* theLeftEdge;
ossim_int32* theRightEdge;
//! Disallow copy constructor and operator=
ossimVertexExtractor(const ossimVertexExtractor&) {}
const ossimVertexExtractor& operator=(const ossimVertexExtractor& rhs)
{return rhs;}
TYPE_DATA
};
#endif
|