7 #include <QScopedPointer>
9 #include <geos/geom/CoordinateArraySequence.h>
10 #include <geos/geom/CoordinateSequence.h>
11 #include <geos/geom/LineString.h>
12 #include <geos/geom/MultiPolygon.h>
13 #include <geos/geom/Polygon.h>
27 PixelFOV::PixelFOV() {
35 PixelFOV::~PixelFOV() {
64 const int numIfovs)
const {
76 QString msg =
"The number of instantaneous field of views must be a positive integer.";
84 boundaryVertices.append(instantaneousFov(camera));
85 return boundaryVertices;
92 double timeStep = 0.0;
99 for (
int i = 0; i < numIfovs; i++) {
105 if (iFov.isEmpty()) {
110 bool crosses =
false;
111 int numVerts = iFov.size();
112 for (
int j = 0; j < numVerts - 1; j++) {
113 if (fabs(iFov[j].y() - iFov[j+1].y()) > 180.0) {
123 for (
int j = 0; j < splitIFov.size(); j++) {
124 double averageLong = 0;
125 int numSubVerts = splitIFov[j].size();
126 for (
int k = 0; k < numSubVerts; k++) {
127 averageLong += splitIFov[j][k].y();
129 averageLong = averageLong / numSubVerts;
130 if (averageLong < 180) {
131 lowerVertices.append(splitIFov[j]);
134 upperVertices.append(splitIFov[j]);
142 double averageLong = 0;
143 for (
int j = 0; j < numVerts; j++) {
144 averageLong += iFov[j].y();
146 averageLong = averageLong / numVerts;
147 if (averageLong < 180) {
148 lowerVertices.append(iFov);
151 upperVertices.append(iFov);
159 if (!lowerVertices.isEmpty()) {
160 boundaryVertices.append(envelope(lowerVertices));
162 if (!upperVertices.isEmpty()) {
163 boundaryVertices.append(envelope(upperVertices));
166 return boundaryVertices;
187 int numVertices = offsets.size();
191 double unitNewLook[3];
198 double scale = focalLength / saveLook[2];
199 for (
int i = 0; i < numVertices; i++) {
200 double focalPlaneX = saveLook[0] * scale;
201 double focalPlaneY = saveLook[1] * scale;
202 focalPlaneX += offsets[i].x();
203 focalPlaneY += offsets[i].y();
204 newLook[0] = focalPlaneX;
205 newLook[1] = focalPlaneY;
207 vhat_c(newLook, unitNewLook);
228 QScopedPointer<geos::geom::CoordinateSequence> points(
new geos::geom::CoordinateArraySequence());
230 for (
int i = 0; i < vertices.size(); i++) {
231 points->add(geos::geom::Coordinate(vertices[i].x(), vertices[i].y()));
233 QScopedPointer<geos::geom::LineString> pointString(Isis::globalFactory.createLineString(
237 QScopedPointer<geos::geom::Geometry> boundingHull(pointString->convexHull());
240 geos::geom::CoordinateSequence *boundingPoints = boundingHull->getCoordinates();
243 for (
unsigned int i = 0; i < boundingPoints->getSize(); i++) {
244 boundingVertices.append(QPointF(boundingPoints->getAt(i).x,boundingPoints->getAt(i).y));
247 return boundingVertices;
267 QScopedPointer<geos::geom::CoordinateSequence> pts(
new geos::geom::CoordinateArraySequence());
268 for (
int i = 0; i < vertices.size(); i++) {
269 pts->add(geos::geom::Coordinate(vertices[i].y(), vertices[i].x()));
271 pts->add(geos::geom::Coordinate(vertices[0].y(), vertices[0].x()));
272 QScopedPointer<geos::geom::Polygon> originalPoly(Isis::globalFactory.createPolygon(
273 globalFactory.createLinearRing(pts.take()),
277 QScopedPointer<geos::geom::MultiPolygon> splitPolygons(
278 PolygonTools::SplitPolygonOn360(originalPoly.data()));
282 for (
unsigned int i = 0; i < splitPolygons->getNumGeometries(); i++) {
286 const geos::geom::Polygon *subPolygon =
287 dynamic_cast<const geos::geom::Polygon *
>(splitPolygons->getGeometryN(i));
288 geos::geom::CoordinateSequence *subCoordinates = subPolygon->
289 getExteriorRing()->getCoordinates();
290 for (
unsigned int j = 0; j < subCoordinates->getSize(); j++) {
291 subVertices.append(QPointF(subCoordinates->getAt(j).y,subCoordinates->getAt(j).x));
295 splitPoints.append(subVertices);
CameraDistortionMap * DistortionMap()
Returns a pointer to the CameraDistortionMap object.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
bool SetLookDirection(const double v[3])
Sets the look direction of the spacecraft.
double FocalLength() const
Returns the focal length.
virtual double exposureDuration() const
Return the exposure duration for the pixel that the camera is set to.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
#define _FILEINFO_
Macro for the filename and line number.
double UndistortedFocalPlaneZ() const
Return undistorted focal plane z.
virtual QList< QPointF > PixelIfovOffsets()
Returns the pixel ifov offsets from center of pixel, which defaults to the (pixel pitch * summing mod...
void LookDirection(double v[3]) const
Returns the look direction in the camera coordinate system.