OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimAnnotationObject.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See LICENSE.txt file in the top level directory.
5 //
6 // Author: Garrett Potts
7 //
8 //*************************************************************************
9 // $Id: ossimAnnotationObject.cpp 9094 2006-06-13 19:12:40Z dburken $
11 
12 RTTI_DEF1(ossimAnnotationObject, "ossimAnnotationObject", ossimObject)
13 
15 
17 {}
18 
20 {
21  theIdCounter = 0;
22 }
23 
25 {
27  ++theIdCounter;
28  return id;
29 }
30 
32  ossim_uint8 g,
33  ossim_uint8 b,
34  ossim_uint8 thickness)
35  :theRed(r),
36  theGreen(g),
37  theBlue(b),
38  theThickness(thickness)
39 {
40  theId = getNextId();
41 }
42 
44  ossim_uint8 g,
45  ossim_uint8 b)
46 {
47  theRed = r;
48  theGreen = g;
49  theBlue = b;
50 }
51 
53 {
54  theThickness = thickness;
55 }
56 
58  ossim_uint8 &g,
59  ossim_uint8 &b)const
60 {
61  r = theRed;
62  g = theGreen;
63  b = theBlue;
64 }
65 
67 {
68  return theThickness;
69 }
70 
72 {
73  return theId;
74 }
75 
77 {
78  theId = getNextId();
79  return getId();
80 }
81 
83  const char* prefix) const
84 {
85  kwl.add(prefix, "red", theRed);
86  kwl.add(prefix, "green", theGreen);
87  kwl.add(prefix, "blue", theBlue);
88  kwl.add(prefix, "thickness", theThickness);
89 
90  return ossimObject::saveState(kwl, prefix);
91 }
92 
94  const char* prefix)
95 {
96  const char* red = kwl.find(prefix, "red");
97  const char* green = kwl.find(prefix, "green");
98  const char* blue = kwl.find(prefix, "blue");
99  const char* thickness = kwl.find(prefix, "thickness");
100 
101  if(red)
102  {
104  }
105  if(green)
106  {
108  }
109  if(blue)
110  {
112  }
113  if(thickness)
114  {
115  theThickness = (ossim_uint8)ossimString(thickness).toLong();
116  }
117 
118  return ossimObject::loadState(kwl, prefix);
119 }
120 
121 bool ossimAnnotationObject::isPointWithin(const ossimDpt& /* imagePoint */) const
122 {
123  return false;
124 }
125 
127 {
128  return theName;
129 }
130 
132 {
133  theName = name;
134 }
135 
137 {
138  ossimDrect rect;
139  getBoundingRect(rect);
140  return rect;
141 }
142 
144 {
145  applyScale(scale.x,
146  scale.y);
147 }
148 
150 {
151  out << setw(15)<<setiosflags(ios::left)<<"Red:" << (long)theRed
152  << setw(15)<<setiosflags(ios::left)<<"\nGreen:" << (long)theGreen
153  << setw(15)<<setiosflags(ios::left)<<"\nBlue:" << (long)theBlue
154  << setw(15)<<setiosflags(ios::left)<<"\nThickness:"<< (long)theThickness
155  << "\ncolor_red: " << (long)theRed
156  << "\ncolor_green: " << (long)theGreen
157  << "\ncolor_blue: " << (long)theBlue
158  << "\nthickness: " << (long)theThickness << std::endl;
159  return out;
160 }
virtual void setName(const ossimString &name)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the current state of this object.
ossim_uint32 getId() const
static ossim_uint32 getNextId()
virtual void setThickness(ossim_uint8 thickness)
Represents serializable keyword/value map.
const char * find(const char *key) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
double y
Definition: ossimDpt.h:165
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static ossim_uint32 theIdCounter
virtual std::ostream & print(std::ostream &out) const
Generic print method.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossimDrect getBoundingRect() const
virtual ossimString getName() const
unsigned int ossim_uint32
virtual ossim_uint32 setId()
void getColor(ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b) const
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
virtual void applyScale(double x, double y)=0
long toLong() const
toLong&#39;s deprecated, please use the toInts...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimAnnotationObject(ossim_uint8 r=255, ossim_uint8 g=255, ossim_uint8 b=255, ossim_uint8 thickness=1)
double x
Definition: ossimDpt.h:164
virtual bool isPointWithin(const ossimDpt &imagePoint) const
ossim_uint8 getThickness() const
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23