50 QString msg =
"Could not create camera or projection for [" +
53 realError.
append(firstError);
54 realError.
append(secondError);
131 double universalLat = lat.
degrees();
132 double universalLon = lon.
degrees();
289 bool allowEstimation) {
308 poly.
Polys()->clone());
310 geos::geom::Geometry *envelope = footprint->getEnvelope();
311 geos::geom::CoordinateSequence *coords = envelope->getCoordinates();
313 for (
unsigned int i = 0; i < coords->getSize(); i++) {
314 const geos::geom::Coordinate &coord = coords->getAt(i);
319 if (!minLat.
isValid() || minLat > coordLat)
321 if (!maxLat.
isValid() || maxLat < coordLat)
324 if (!minLon.
isValid() || minLon > coordLon)
326 if (!maxLon.
isValid() || maxLon < coordLon)
348 mappingGrp +=
PvlKeyword(
"LatitudeType",
"Planetocentric");
349 mappingGrp +=
PvlKeyword(
"LongitudeDomain",
"360");
350 mappingGrp +=
PvlKeyword(
"LongitudeDirection",
"PositiveEast");
353 mappingPvl += mappingGrp;
359 minLatDouble, maxLatDouble,
360 minLonDouble, maxLonDouble, mappingPvl);
369 if (mappingGrp.
hasKeyword(
"MinimumLatitude") &&
374 minLat =
Latitude(mappingGrp[
"MinimumLatitude"],
376 maxLat =
Latitude(mappingGrp[
"MaximumLatitude"],
378 minLon =
Longitude(mappingGrp[
"MinimumLongitude"],
380 maxLon =
Longitude(mappingGrp[
"MaximumLongitude"],
384 else if (allowEstimation && cube) {
414 int stepsPerLength = 20;
415 double aspectRatio = (double)lineCount / (
double)sampleCount;
416 double xStepSize = sampleCount / stepsPerLength;
417 double yStepSize = xStepSize * aspectRatio;
419 if (lineCount > sampleCount) {
420 aspectRatio = (double)sampleCount / (
double)lineCount;
421 yStepSize = lineCount / stepsPerLength;
422 xStepSize = yStepSize * aspectRatio;
425 double yWalked = 0.5;
428 for (
int i = 0; i < 3; i++) {
429 double xValue = 0.5 + ( i * (sampleCount / 2) );
431 while (yWalked <= lineCount) {
432 imagePoints.append( QPointF(xValue, yWalked) );
433 yWalked += yStepSize;
439 double xWalked = 0.5;
442 for (
int i = 0; i < 3; i++) {
443 double yValue = 0.5 + ( i * (lineCount / 2) );
445 while (xWalked <= sampleCount) {
446 imagePoints.append( QPointF(xWalked, yValue) );
447 xWalked += xStepSize;
453 double xDiagonalWalked = 0.5;
454 double yDiagonalWalked = 0.5;
455 xStepSize = sampleCount / stepsPerLength;
456 yStepSize = lineCount / stepsPerLength;
459 while ( (xDiagonalWalked <= sampleCount) && (yDiagonalWalked <= lineCount) ) {
460 imagePoints.append( QPointF(xDiagonalWalked, yDiagonalWalked) );
461 xDiagonalWalked += xStepSize;
462 yDiagonalWalked += yStepSize;
465 xDiagonalWalked = 0.5;
468 while ( (xDiagonalWalked <= sampleCount) && (yDiagonalWalked >= 0) ) {
469 imagePoints.append( QPointF(xDiagonalWalked, yDiagonalWalked) );
470 xDiagonalWalked += xStepSize;
471 yDiagonalWalked -= yStepSize;
474 foreach (QPointF imagePoint, imagePoints) {
475 if (tproj->
SetWorld(imagePoint.x(), imagePoint.y())) {
481 minLat = qMin(minLat, latResult);
486 maxLat = qMax(maxLat, latResult);
491 minLon = qMin(minLon, lonResult);
496 maxLon = qMax(maxLon, lonResult);
507 minLat < maxLat && minLon < maxLon);
This class defines a body-fixed surface point.
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Isis::Camera * p_camera
The camera (if the image has a camera)
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
double Sample() const
Returns the current line value of the camera model or projection.
double degrees() const
Get the angle in units of Degrees.
QString name() const
Gets the shape name.
Base class for Map TProjections.
Isis::Projection * p_projection
The projection (if the image is projected)
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
~UniversalGroundMap()
Destroys the UniversalGroundMap object.
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
double Resolution() const
Returns the resolution of the camera model or projection.
This class is designed to encapsulate the concept of a Latitude.
double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
double UniversalLatitude() const
Returns the universal latitude of the camera model or projection.
void read(Blob &blob) const
This method will read data from the specified Blob object.
double Line() const
Returns the current line value of the camera model or projection.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
bool SetGround(Latitude latitude, Longitude longitude)
Sets the lat/lon values to get the sample/line values.
Create cube polygons, read/write polygons to blobs.
bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
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.
This class is designed to encapsulate the concept of a Longitude.
Target * target() const
Returns a pointer to the target object.
These projections are used to map ring planes.
double RingLongitude() const
This returns a ring longitude with correct ring longitude direction and domain as specified in the la...
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
bool SetGround(Latitude lat, Longitude lon)
Returns whether the lat/lon position was set successfully in the camera model or projection.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
Contains multiple PvlContainers.
bool GroundRange(double &minlat, double &maxlat, double &minlon, double &maxlon, Pvl &pvl)
Computes the Ground Range.
#define _FILEINFO_
Macro for the filename and line number.
double Sample()
Returns the current sample number.
A single keyword-value pair.
A type of error that cannot be classified as any of the other error types.
double UniversalLongitude() const
Returns the universal longitude of the camera model or projection.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
CameraPriority
This enum is used to define whether to use a camera or projection primarily, and which to fall back o...
Container for cube-like labels.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
UniversalGroundMap(Cube &cube, CameraPriority priority=CameraFirst)
Constructs a UniversalGroundMap object from a cube.
double UniversalLatitude()
This returns a universal latitude (planetocentric).
bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
bool SetImage(double sample, double line)
Returns whether the sample/line postion was set successfully in the camera model or projection...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Base class for Map Projections of plane shapes.
void SetBand(const int band)
Set the image band number.
bool HasCamera()
Returns whether the ground map has a camera or not.
double Line()
Returns the current line number.
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
This is the default because cameras are projection-aware.
double RingRadius() const
This returns a radius.
bool SetUniversalGround(double lat, double lon)
Returns whether the lat/lon position was set successfully in the camera model or projection.
QString fileName() const
Returns the opened cube's filename.
ShapeModel * shape() const
Return the shape.
ProjectionType projectionType() const
Returns an enum value for the projection type.
geos::geom::MultiPolygon * Polys()
Return a geos Multipolygon.
ProjectionType
This enum defines the subclasses of Projection supported in Isis.
virtual void SetBand(const int band)
Virtual method that sets the band number.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
bool HasProjection()
Returns whether the ground map has a projection or not.
bool GroundRange(Cube *cube, Latitude &minLat, Latitude &maxLat, Longitude &minLon, Longitude &maxLon, bool allowEstimation=true)
Find the lat/lon range of the image.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
These projections are used to map triaxial and irregular-shaped bodies.
IO Handler for Isis Cubes.