OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | List of all members
ossim::PhotoBlock Class Reference

Class for representing MSP PhotoBlock. More...

#include <PhotoBlock.h>

Inheritance diagram for ossim::PhotoBlock:
ossim::JsonInterface

Public Member Functions

 PhotoBlock ()
 Initialize the photoblock from a prior saved session. More...
 
 PhotoBlock (const Json::Value &pb_json_node)
 
 PhotoBlock (const PhotoBlock &copyThis)
 
 ~PhotoBlock ()
 
PhotoBlockoperator= (const PhotoBlock &copythis)
 
std::shared_ptr< ImagegetImage (const std::string &imageId)
 
std::shared_ptr< TiePointgetTiePoint (unsigned int tpId)
 
std::shared_ptr< GroundControlPointgetGroundPoint (const std::string &gpId)
 
ImageListgetImageList ()
 
TiePointListgetTiePointList ()
 
std::vector< std::shared_ptr< GroundControlPoint > > & getGroundPointList ()
 
unsigned int addImage (std::shared_ptr< Image > image)
 Adds the image to the photoblock at last position. More...
 
unsigned int addGroundPoint (std::shared_ptr< GroundControlPoint > groundPoint)
 Adds the image to the photoblock at last position. More...
 
unsigned int addTiePoint (std::shared_ptr< TiePoint > tiepoint)
 Adds the tiepoint to the PB. More...
 
void addTiePoints (TiePointList &tiepointList)
 Adds the list of tiepoints to the PB. More...
 
virtual void loadJSON (const Json::Value &json)
 
virtual void saveJSON (Json::Value &json) const
 
- Public Member Functions inherited from ossim::JsonInterface
 JsonInterface ()
 
virtual ~JsonInterface ()
 

Protected Attributes

std::vector< std::shared_ptr< Image > > m_imageList
 
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
 
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
 

Detailed Description

Class for representing MSP PhotoBlock.

Definition at line 25 of file PhotoBlock.h.

Constructor & Destructor Documentation

◆ PhotoBlock() [1/3]

ossim::PhotoBlock::PhotoBlock ( )

Initialize the photoblock from a prior saved session.

If none found, assumes a new, blank session is being started.

Definition at line 13 of file PhotoBlock.cpp.

14 {
15 }

◆ PhotoBlock() [2/3]

ossim::PhotoBlock::PhotoBlock ( const Json::Value &  pb_json_node)

Definition at line 17 of file PhotoBlock.cpp.

References loadJSON().

18 {
19  loadJSON(pb_json_node);
20 }
virtual void loadJSON(const Json::Value &json)
Definition: PhotoBlock.cpp:116

◆ PhotoBlock() [3/3]

ossim::PhotoBlock::PhotoBlock ( const PhotoBlock copyThis)

Definition at line 22 of file PhotoBlock.cpp.

23 : m_imageList (copyThis.m_imageList),
24  m_tiePointList (copyThis.m_tiePointList)
25 {
26  *this = copyThis;
27 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92

◆ ~PhotoBlock()

ossim::PhotoBlock::~PhotoBlock ( )

Definition at line 29 of file PhotoBlock.cpp.

References m_imageList, and m_tiePointList.

30 {
31  m_imageList.clear();
32  m_tiePointList.clear();
33 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92

Member Function Documentation

◆ addGroundPoint()

unsigned int ossim::PhotoBlock::addGroundPoint ( std::shared_ptr< GroundControlPoint groundPoint)

Adds the image to the photoblock at last position.

Sets the image's pb index member.

Parameters
imagesTo be added to PB
Returns
The PB index of the image in the photoblock.

Definition at line 52 of file PhotoBlock.cpp.

References m_gcpList.

53 {
54  unsigned int last_idx = m_gcpList.size();
55  m_gcpList.push_back(gcp);
56  return last_idx;
57 }
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

◆ addImage()

unsigned int ossim::PhotoBlock::addImage ( std::shared_ptr< Image image)

Adds the image to the photoblock at last position.

Sets the image's pb index member.

Parameters
imagesTo be added to PB
Returns
The PB index of the image in the photoblock.

Definition at line 45 of file PhotoBlock.cpp.

References m_imageList.

46 {
47  unsigned int last_idx = m_imageList.size();
48  m_imageList.push_back(image);
49  return last_idx;
50 }
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92

◆ addTiePoint()

unsigned int ossim::PhotoBlock::addTiePoint ( std::shared_ptr< TiePoint tiepoint)

Adds the tiepoint to the PB.

Parameters
tiepointTo be added to PB
Returns
The index of the TP in the photoblock (should be same as TP ID)

Definition at line 59 of file PhotoBlock.cpp.

References m_tiePointList.

Referenced by addTiePoints().

60 {
61  unsigned int index = m_tiePointList.size();
62  m_tiePointList.push_back(tiepoint);
63  return index;
64 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93

◆ addTiePoints()

void ossim::PhotoBlock::addTiePoints ( TiePointList tiepointList)

Adds the list of tiepoints to the PB.

Parameters
tiepointListTo be added to PB

Definition at line 66 of file PhotoBlock.cpp.

References addTiePoint().

67 {
68  for (size_t i=0; i<tiepointList.size(); ++i)
69  {
70  addTiePoint(tiepointList[i]);
71  }
72 }
unsigned int addTiePoint(std::shared_ptr< TiePoint > tiepoint)
Adds the tiepoint to the PB.
Definition: PhotoBlock.cpp:59

◆ getGroundPoint()

shared_ptr< GroundControlPoint > ossim::PhotoBlock::getGroundPoint ( const std::string &  gpId)

Definition at line 88 of file PhotoBlock.cpp.

References m_gcpList.

89 {
90  std::shared_ptr<GroundControlPoint> result;
91  for (size_t i=0; i<m_gcpList.size(); ++i)
92  {
93  if (m_gcpList[i]->getId() == gcpId)
94  {
95  result = m_gcpList[i];
96  break;
97  }
98  }
99  return result;
100 }
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

◆ getGroundPointList()

std::vector<std::shared_ptr<GroundControlPoint> >& ossim::PhotoBlock::getGroundPointList ( )
inline

Definition at line 47 of file PhotoBlock.h.

References m_gcpList.

47 { return m_gcpList; }
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

◆ getImage()

shared_ptr< Image > ossim::PhotoBlock::getImage ( const std::string &  imageId)

Definition at line 74 of file PhotoBlock.cpp.

References m_imageList.

75 {
76  std::shared_ptr<Image> result;
77  for (size_t i=0; i<m_imageList.size(); ++i)
78  {
79  if (m_imageList[i]->getImageId() == imageId)
80  {
81  result = m_imageList[i];
82  break;
83  }
84  }
85  return result;
86 }
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92

◆ getImageList()

ImageList& ossim::PhotoBlock::getImageList ( )
inline

Definition at line 45 of file PhotoBlock.h.

References m_imageList.

Referenced by main().

45 { return m_imageList; }
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92

◆ getTiePoint()

shared_ptr< TiePoint > ossim::PhotoBlock::getTiePoint ( unsigned int  tpId)

Definition at line 102 of file PhotoBlock.cpp.

References m_tiePointList.

103 {
104  std::shared_ptr<TiePoint> result;
105  for (size_t i=0; i<m_tiePointList.size(); ++i)
106  {
107  if (m_tiePointList[i]->getTiePointId() == tpId)
108  {
109  result = m_tiePointList[i];
110  break;
111  }
112  }
113  return result;
114 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93

◆ getTiePointList()

TiePointList& ossim::PhotoBlock::getTiePointList ( )
inline

Definition at line 46 of file PhotoBlock.h.

References m_tiePointList.

Referenced by main().

46 { return m_tiePointList; }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93

◆ loadJSON()

void ossim::PhotoBlock::loadJSON ( const Json::Value &  json)
virtual

Implements ossim::JsonInterface.

Definition at line 116 of file PhotoBlock.cpp.

References m_gcpList, m_imageList, and m_tiePointList.

Referenced by PhotoBlock().

117 {
118  // Always do images first, as tiepoints will be using the image list to correct image ID:
119  if (pb_json_node.isMember("images"))
120  {
121  const Json::Value& listJson = pb_json_node["images"];
122  unsigned int count = listJson.size();
123  for (unsigned int i=0; i<count; ++i)
124  {
125  const Json::Value& jsonItem = listJson[i];
126  shared_ptr<Image> item (new Image(jsonItem));
127  m_imageList.push_back(item);
128  }
129  }
130 
131  if (pb_json_node.isMember("groundPoints"))
132  {
133  const Json::Value& listJson = pb_json_node["groundPoints"];
134  unsigned int count = listJson.size();
135  for (unsigned int i=0; i<count; ++i)
136  {
137  const Json::Value& jsonItem = listJson[i];
138  shared_ptr<GroundControlPoint> item (new GroundControlPoint(jsonItem));
139  m_gcpList.push_back(item);
140  }
141  }
142 
143  if (pb_json_node.isMember("tiePoints"))
144  {
145  const Json::Value& listJson = pb_json_node["tiePoints"];
146  unsigned int count = listJson.size();
147  for (unsigned int i=0; i<count; ++i)
148  {
149  const Json::Value& jsonItem = listJson[i];
150  shared_ptr<TiePoint> item (new TiePoint(jsonItem));
151  m_tiePointList.push_back(item);
152  }
153  }
154 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

◆ operator=()

PhotoBlock & ossim::PhotoBlock::operator= ( const PhotoBlock copythis)

Definition at line 35 of file PhotoBlock.cpp.

References m_gcpList, m_imageList, and m_tiePointList.

36 {
37  m_imageList = copythis.m_imageList;
38  m_tiePointList = copythis.m_tiePointList;
39  m_gcpList = copythis.m_gcpList;
40  return *this;
41 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

◆ saveJSON()

void ossim::PhotoBlock::saveJSON ( Json::Value &  json) const
virtual

Implements ossim::JsonInterface.

Definition at line 156 of file PhotoBlock.cpp.

References m_gcpList, m_imageList, and m_tiePointList.

157 {
158  Json::Value imageListJson (Json::arrayValue);
159  unsigned int count = m_imageList.size();
160  for (unsigned int i=0; i<count; ++i)
161  {
162  m_imageList[i]->saveJSON(imageListJson[i]);
163  }
164  pbJSON["images"] = imageListJson;
165 
166  Json::Value gcpListJson (Json::arrayValue);
167  count = m_gcpList.size();
168  for (unsigned int i=0; i<count; ++i)
169  {
170  m_gcpList[i]->saveJSON(gcpListJson[i]);
171  }
172  pbJSON["groundPoints"] = gcpListJson;
173 
174  Json::Value tpListJson (Json::arrayValue);
175  count = m_tiePointList.size();
176  for (unsigned int i=0; i<count; ++i)
177  {
178  m_tiePointList[i]->saveJSON(tpListJson[i]);
179  }
180  pbJSON["tiePoints"] = tpListJson;
181 }
std::vector< std::shared_ptr< TiePoint > > m_tiePointList
Definition: PhotoBlock.h:93
std::vector< std::shared_ptr< Image > > m_imageList
Definition: PhotoBlock.h:92
std::vector< std::shared_ptr< GroundControlPoint > > m_gcpList
Definition: PhotoBlock.h:94

Member Data Documentation

◆ m_gcpList

std::vector<std::shared_ptr<GroundControlPoint> > ossim::PhotoBlock::m_gcpList
protected

◆ m_imageList

std::vector<std::shared_ptr<Image> > ossim::PhotoBlock::m_imageList
protected

Definition at line 92 of file PhotoBlock.h.

Referenced by addImage(), getImage(), getImageList(), loadJSON(), operator=(), saveJSON(), and ~PhotoBlock().

◆ m_tiePointList

std::vector<std::shared_ptr<TiePoint> > ossim::PhotoBlock::m_tiePointList
protected

The documentation for this class was generated from the following files: