/usr/include/ossim/base/ossimIpt.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 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: David Burken
//
// Description:
//
// Contains class declaration for ipt.
// Used to represent an interger point containing an x and y data member.
//
//*******************************************************************
// $Id: ossimIpt.h 14789 2009-06-29 16:48:14Z dburken $
#ifndef ossimIpt_HEADER
#define ossimIpt_HEADER
#include <iosfwd>
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimCommon.h>
#include <ossim/base/ossimDpt.h>
// Forward class declarations.
class ossimFpt;
class ossimDpt3d;
class ossimString;
class OSSIMDLLEXPORT ossimIpt
{
public:
ossimIpt() : x(0), y(0) {}
ossimIpt(ossim_int32 anX, ossim_int32 aY) : x(anX), y(aY) {}
ossimIpt(const ossimIpt& pt) : x(pt.x), y(pt.y) {}
ossimIpt(const ossimDpt& pt);
ossimIpt(const ossimFpt& pt);
ossimIpt(const ossimDpt3d &pt);
const ossimIpt& operator=(const ossimIpt& pt);
const ossimIpt& operator=(const ossimDpt& pt);
const ossimIpt& operator=(const ossimFpt& pt);
bool operator==(const ossimIpt& pt) const
{ return ( (x == pt.x) && (y == pt.y) ); }
bool operator!=(const ossimIpt& pt) const
{ return ( (x != pt.x) || (y != pt.y) ); }
void makeNan(){x = OSSIM_INT_NAN; y=OSSIM_INT_NAN;}
bool hasNans()const
{
return ( (x==OSSIM_INT_NAN) || (y==OSSIM_INT_NAN) );
}
bool isNan()const
{
return ( (x==OSSIM_INT_NAN) && (y==OSSIM_INT_NAN) );
}
std::ostream& print(std::ostream& os) const;
friend OSSIMDLLEXPORT std::ostream& operator<<(std::ostream& os,
const ossimIpt& pt);
/**
* @return ossimString representing point.
*
* Format: ( 30, -90 )
* -x- -y-
*/
ossimString toString() const;
/**
* Initializes this point from string. This method opens an istream to
* s and then calls operator>>.
*
* Expected format: ( 30, -90 )
* -x- -y-
*
* @param s String to initialize from.
*
* @see operator>>
*/
void toPoint(const std::string& s);
/**
* Method to input the formatted string of the "operator<<".
*
* Expected format: ( 30, -90 )
* -x- -y-
*
* This method starts by doing a "makeNan" on pt. So if anything goes
* wrong with the stream or parsing pt could be all or partially nan.
*
* @param is Input stream istream to formatted text.
* @param pt osimIpt to be initialized from stream.
* @return istream pass in.
*/
friend OSSIMDLLEXPORT std::istream& operator>>(std::istream& is,
ossimIpt& pt);
/*!
* METHOD: length()
* Returns the RSS of the components.
*/
double length() const { return sqrt((double)x*x + (double)y*y); }
//***
// OPERATORS: +, -, +=, -=
// Point add/subtract with other point:
//***
ossimIpt operator+(const ossimIpt& p) const
{ return ossimIpt(x+p.x, y+p.y); }
ossimIpt operator-(const ossimIpt& p) const
{ return ossimIpt(x-p.x, y-p.y); }
const ossimIpt& operator+=(const ossimIpt& p)
{ x += p.x; y += p.y; return *this; }
const ossimIpt& operator-=(const ossimIpt& p)
{ x -= p.x; y -= p.y; return *this; }
//***
// OPERATORS: *, /
// Scale point components by scalar:
//***
ossimDpt operator*(const double& d) const
{ return ossimDpt(d*x, d*y); }
ossimDpt operator/(const double& d) const
{ return ossimDpt(x/d, y/d); }
//***
// Public data members:
//***
union {ossim_int32 x; ossim_int32 u; ossim_int32 samp;};
union {ossim_int32 y; ossim_int32 v; ossim_int32 line;};
};
inline const ossimIpt& ossimIpt::operator=(const ossimIpt& pt)
{
if (this != &pt)
{
x = pt.x;
y = pt.y;
}
return *this;
}
#endif
|