OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRgbLutDataObject.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Author: Garrett Potts
7 //
8 //*************************************************************************
9 // $Id: ossimRgbLutDataObject.h 15766 2009-10-20 12:37:09Z gpotts $
10 #ifndef ossimRgbLutDataObject_HEADER
11 #define ossimRgbLutDataObject_HEADER
13 #include <ossim/base/ossimObject.h>
14 #include <iosfwd>
15 
16 class ossimKeywordlist;
17 
19 {
20 public:
22  const ossimRgbLutDataObject& lut);
26  ossimRgbLutDataObject(unsigned long numberOfEntries=0);
28  virtual ossimObject* dup()const
29  {
30  return new ossimRgbLutDataObject(*this);
31  }
32  const ossimRgbVector& operator[](unsigned int index)const
33  {
34  return index<theNumberOfEntries?theLut[index]:theLut[theNumberOfEntries-1];
35  }
36  ossimRgbVector& operator[](unsigned int index)
37  {
38  return index<theNumberOfEntries?theLut[index]:theLut[theNumberOfEntries-1];
39  }
40  const ossimRgbVector& operator[](int index)const
41  {
42  return index<(long)theNumberOfEntries?theLut[index]:theLut[theNumberOfEntries-1];
43  }
45  {
46  return index<(long)theNumberOfEntries?theLut[index]:theLut[theNumberOfEntries-1];
47  }
48  const ossimRgbVector& operator[](double normalizedIndex)const
49  {
50  int index = int(normalizedIndex*theNumberOfEntries+.5);
51  if (index < 0)
52  {
53  index = 0;
54  }
55  return (*this)[index];
56  }
57  ossimRgbVector& operator[](double normalizedIndex)
58  {
59  int index = int(normalizedIndex*theNumberOfEntries+.5);
60  if (index < 0)
61  {
62  index = 0;
63  }
64  return (*this)[index];
65  }
66  long getNumberOfEntries()const{return theNumberOfEntries;}
67  int findIndex(const ossimRgbVector& rgb)
68  {
69  return findIndex(rgb.getR(),
70  rgb.getG(),
71  rgb.getB());
72  }
73  int findIndex(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b);
74  ossimRgbLutDataObject& rotate(long numberOfElements=1);
75  ossimRgbLutDataObject rotate(long numberOfElements=1)const;
76 
78  bool operator ==(const ossimRgbLutDataObject& lut)const;
79 
80  virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
81  virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
82 protected:
83  virtual ~ossimRgbLutDataObject();
84 
87 
89 };
90 
91 #endif
unsigned char getR() const
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
friend OSSIMDLLEXPORT std::ostream & operator<<(std::ostream &out, const ossimObject &obj)
const ossimRgbVector & operator[](double normalizedIndex) const
ossimRgbVector & operator[](unsigned int index)
#define TYPE_DATA
Definition: ossimRtti.h:339
unsigned int ossim_uint32
unsigned char getB() const
ossimRgbVector & operator[](double normalizedIndex)
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
ossimRgbVector & operator[](int index)
unsigned char getG() const
ossimReferenced & operator=(const ossimReferenced &)
const ossimRgbVector & operator[](int index) const
int findIndex(const ossimRgbVector &rgb)
virtual ossimObject * dup() const
const ossimRgbVector & operator[](unsigned int index) const
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23