OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimAtbMatchPoint.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // AUTHOR: Oscar Kramer (okramer@imagelinks.com)
6 //
7 // DESCRIPTION: Contains implementation of class
8 //
9 // LIMITATIONS: None.
10 //
11 //*****************************************************************************
12 // $Id: ossimAtbMatchPoint.cpp 15766 2009-10-20 12:37:09Z gpotts $
13 
18 
19 //***
20 // Define Trace flags for use within this file:
21 //***
22 #include <ossim/base/ossimTrace.h>
23 static ossimTrace traceExec ("ossimAtbMatchPoint:exec");
24 static ossimTrace traceDebug ("ossimAtbMatchPoint:debug");
25 
26 //*****************************************************************************
27 // DESTRUCTOR: ~ossimAtbMatchPoint()
28 //
29 // Need to delete each instance of an ossimAtbPointSource in thePointSourceList
30 //
31 //*****************************************************************************
33 {
34  thePointSourceList.clear();
35 }
36 
37 //*****************************************************************************
38 // METHOD: ossimAtbMatchPoint::addImage()
39 //
40 // Adds a new contribution to the sample set.
41 //
42 //*****************************************************************************
44 {
45  static const char MODULE[] = "ossimAtbMatchPoint::addImage()";
46  if (traceExec()) CLOG << "entering..." << endl;
47 
48  //***
49  // Assure that this image contains the view point corresponding to this
50  // matchpoint:
51  //***
52  if (!remapper->getBoundingRect().pointWithin(theViewPoint))
53  {
54  if (traceExec()) CLOG << "returning..." << endl;
55  return;
56  }
57 
58  //***
59  // Instantiate a point source for this image at this view point and
60  // save it in the list:
61  //***
62  ossimAtbPointSource* point_source = new ossimAtbPointSource(remapper,
63  theViewPoint);
64  thePointSourceList.push_back(point_source);
65 
66  if (traceExec()) CLOG << "returning..." << endl;
67  return;
68 }
69 
70 
71 //*****************************************************************************
72 // METHOD: ossimAtbMatchPoint::assignRemapValues()
73 //
74 // The target parameter value computed given all contributions. The target
75 // value is then used to establish the remap parameters for each image at this
76 // points location.
77 //
78 //*****************************************************************************
80 {
81  static const char MODULE[] = "ossimAtbMatchPoint::assignRemapValues()";
82  if (traceExec()) CLOG << "entering..." << endl;
83 
84  //***
85  // Determine the number of contributors. We require minimum of two:
86  //***
87  ossim_uint32 num_contributors = (ossim_uint32)thePointSourceList.size();
88  if (num_contributors < 2)
89  return false;
90 
91  //***
92  // Hand off the computation of the target pixel to the ATB engine being
93  // used. The engine implements the methods for computing targets, as these
94  // will vary according to algorithm being used:
95  //***
97 
98  if (traceExec()) CLOG << "returning..." << endl;
99  return true;
100 }
101 
102 
103 //*****************************************************************************
104 // METHOD: ossimAtbMatchPoint::setKernelSize(N)
105 //
106 // Hook to set the size of the kernel used by all point sources in computing
107 // their mean pixel value. The kernels will be resized to NxN.
108 //
109 //*****************************************************************************
111 {
112  static const char MODULE[] = "ossimAtbController::setKernelSize(N)";
113  if (traceExec()) CLOG << "entering..." << endl;
114 
115  vector<ossimAtbPointSource*>::iterator psi = thePointSourceList.begin();
116  while (psi != thePointSourceList.end())
117  (*psi)->setKernelSize(side_size);
118 
119  if (traceExec()) CLOG << "returning..." << endl;
120  return;
121 }
122 
123 
124 //*****************************************************************************
125 // METHOD: ossimAtbMatchPoint::setAtbRemapEngine
126 //
127 //*****************************************************************************
129 {
130  static const char MODULE[] = "ossimAtbMatchPoint::setAtbRemapEngine";
131  if (traceExec()) CLOG << "entering..." << endl;
132 
133  theGridRemapEngine = engine;
134 
135  //***
136  // Need to communicate this change of engine to the point sources that use
137  // it to arrive at a "source value":
138  //***
139  vector<ossimAtbPointSource*>::iterator source = thePointSourceList.begin();
140  while (source != thePointSourceList.end())
141  {
142  (*source)->setGridRemapEngine(engine);
143  source++;
144  }
145 
146  if (traceExec()) CLOG << "returning..." << endl;
147  return;
148 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
void setKernelSize(int side_size)
virtual void assignRemapValues(std::vector< ossimAtbPointSource *> &sources)=0
vector< ossimAtbPointSource * > thePointSourceList
#define CLOG
Definition: ossimTrace.h:23
ossimGridRemapEngine * theGridRemapEngine
void addImage(ossimGridRemapSource *image_source)
unsigned int ossim_uint32
void setGridRemapEngine(ossimGridRemapEngine *engine)
bool pointWithin(const ossimIpt &pt) const
Definition: ossimIrect.h:729