Isis 3 Programmer Reference
GisBlob.cpp
Go to the documentation of this file.
1 
23 #include "GisBlob.h"
24 
25 // Qt library
26 #include <QDebug>
27 #include <QString>
28 
29 // other ISIS
30 #include "Blob.h"
31 #include "Cube.h"
32 
33 namespace Isis {
34 
38  GisBlob::GisBlob() : Blob("Footprint", "Polygon"), m_wkt() {
39  }
40 
41 
48  GisBlob::GisBlob(Cube &cube) : Blob("Footprint", "Polygon"), m_wkt() {
49  cube.read(*this);
51  }
52 
53 
58  }
59 
60 
66  QString GisBlob::polygon() const {
67  return (m_wkt);
68  }
69 
70 
76  void GisBlob::setPolygon(const QString &wkt) {
77  delete [] p_buffer;
78  p_nbytes = wkt.size();
79  p_buffer = new char[p_nbytes+1];
80  for (int i = 0 ; i < p_nbytes ; i++) {
81  p_buffer[i] = wkt[i].toLatin1();
82  }
83  p_buffer[p_nbytes] = 0;
85  return;
86  }
87 
88 
98  QString GisBlob::scrub(const char *rawbuf, int rbytes) const {
99  int i;
100  for (i = 0 ; i < rbytes ; i++) {
101  if (rawbuf[i] != 0) break;
102  }
103  int nbytes = rbytes - i;
104  return (QString::fromLatin1(&rawbuf[i], nbytes));
105  }
106 
107 } // Namespace Isis
QString polygon() const
Accesses the well-known text string that defines the polygon.
Definition: GisBlob.cpp:66
int p_nbytes
Size of blob data (in bytes)
Definition: Blob.h:99
char * p_buffer
Buffer blob data is stored in.
Definition: Blob.h:97
QString scrub(const char *rawbuf, int rbytes) const
This method will scrub all zeros that prefix the given buffer and convert it to a string using the nu...
Definition: GisBlob.cpp:98
~GisBlob()
Destroys the GisBlob object.
Definition: GisBlob.cpp:57
QString m_wkt
Well-known text string containing the polygon defintion for this GIS blob.
Definition: GisBlob.h:63
GisBlob()
Constructs an Isis polygon-type Blob named "Footprint.".
Definition: GisBlob.cpp:38
void read(Blob &blob) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:724
void setPolygon(const QString &wkt)
Sets the polygon using the given well-known text string.
Definition: GisBlob.cpp:76
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
IO Handler for Isis Cubes.
Definition: Cube.h:170