14#include "Projection.h"
15#include "ProjectionFactory.h"
16#include "TProjection.h"
17#include "IException.h"
61 const int sl,
const int ss,
const int el,
62 const int es,
const double linc,
const double sinc) {
75 string msg =
"Invalid start/end line range [sl,el] specified for subarea";
76 throw IException(IException::Programmer, msg, _FILEINFO_);
80 string msg =
"Invalid start/end sample range [ss,es] specified for subarea";
81 throw IException(IException::Programmer, msg, _FILEINFO_);
86 string msg =
"Invalid line increment [linc] specified for subarea";
87 throw IException(IException::Programmer, msg, _FILEINFO_);
92 string msg =
"Invalid sample increment [sinc] specified for subarea";
93 throw IException(IException::Programmer, msg, _FILEINFO_);
128 Pvl inlabel = *icube->
label();
133 if(inlabel.findObject(
"IsisCube").hasGroup(
"Mapping")) {
134 inlabel.findObject(
"IsisCube").deleteGroup(
"Mapping");
135 results += PvlKeyword(
"MappingGroupDeleted",
"True");
140 if(inlabel.findObject(
"IsisCube").hasGroup(
"Instrument")) {
141 inlabel.findObject(
"IsisCube").deleteGroup(
"Instrument");
142 results += PvlKeyword(
"InstrumentGroupDeleted",
"True");
147 if(inlabel.findObject(
"IsisCube").hasGroup(
"Mapping")) {
153 PvlGroup &mapgroup = inlabel.findObject(
"IsisCube").findGroup(
"Mapping", Pvl::Traverse);
154 mapgroup.addKeyword(PvlKeyword(
"UpperLeftCornerX",
toString(proj->
XCoord())),
156 mapgroup.addKeyword(PvlKeyword(
"UpperLeftCornerY",
toString(proj->
YCoord())),
163 PvlGroup &mapgroup = inlabel.findObject(
"IsisCube").findGroup(
"Mapping", Pvl::Traverse);
164 QString pixresUnit = mapgroup[
"PixelResolution"].unit();
165 double pixres = toDouble(mapgroup[
"PixelResolution"][0]);
167 mapgroup[
"PixelResolution"].setUnits(pixresUnit);
168 QString scaleUnit = mapgroup[
"Scale"].unit();
169 double scale = mapgroup[
"Scale"];
171 mapgroup[
"Scale"].setUnits(scaleUnit);
177 PvlGroup &mapgroup = inlabel.findObject(
"IsisCube").findGroup(
"Mapping", Pvl::Traverse);
179 double minlat, maxlat;
180 double minlon, maxlon;
221 mapgroup.addKeyword(PvlKeyword(
"MinimumLatitude",
toString(minlat)),Pvl::Replace);
222 mapgroup.addKeyword(PvlKeyword(
"MaximumLatitude",
toString(maxlat)),Pvl::Replace);
223 mapgroup.addKeyword(PvlKeyword(
"MinimumLongitude",
toString(minlon)),Pvl::Replace);
224 mapgroup.addKeyword(PvlKeyword(
"MaximumLongitude",
toString(maxlon)),Pvl::Replace);
229 if(mapgroup.hasKeyword(
"MinimumLatitude")) {
230 mapgroup.deleteKeyword(
"MinimumLatitude");
232 if(mapgroup.hasKeyword(
"MaximumLatitude")) {
233 mapgroup.deleteKeyword(
"MaximumLatitude");
235 if(mapgroup.hasKeyword(
"MinimumLongitude")) {
236 mapgroup.deleteKeyword(
"MinimumLongitude");
238 if(mapgroup.hasKeyword(
"MaximumLongitude")) {
239 mapgroup.deleteKeyword(
"MaximumLongitude");
249 if(inlabel.findObject(
"IsisCube").hasGroup(
"Instrument")) {
251 inst = inlabel.findObject(
"IsisCube").findGroup(
"Instrument");
258 if(inlabel.findObject(
"IsisCube").hasGroup(
"Mapping")) {
260 mapgrp = inlabel.findObject(
"IsisCube").findGroup(
"Mapping");
This class is used to rewrite the "alpha" keywords out of the AlphaCube group or Instrument group.
void UpdateGroup(Cube &cube)
Writes or update the Alpha keywords (AlphaLines, AlphaSamples, AlphaStartingSamples,...
IO Handler for Isis Cubes.
void deleteGroup(const QString &group)
Deletes a group from the cube labels.
void putGroup(const PvlGroup &group)
Adds a group in a Label to the cube.
bool hasGroup(const QString &group) const
Return if the cube has a specified group in the labels.
Projection * projection()
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
virtual bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
double p_sinc
Sample increment for subarea.
int p_ss
Starting sample of subarea.
int p_el
Ending line of subarea.
double p_linc
Line increment for subarea.
int p_nl
Number of lines in original file.
int p_es
Ending sample of subarea.
int p_sl
Starting line of subarea.
void UpdateLabel(Cube *icube, Cube *ocube, PvlGroup &results)
Modifies a label for a file containing a subarea.
void SetSubArea(const int orignl, const int origns, const int sl, const int ss, const int el, const int es, const double linc, const double sinc)
Defines the subarea.
int p_ns
Number of samples in original file.
Base class for Map TProjections.
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
bool Has180Domain() const
This indicates if the longitude domain is -180 to 180 (as opposed to 0 to 360).
virtual double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
static double ToPositiveWest(const double lon, const int domain)
This method converts a longitude into the positive west direction.
bool IsPlanetographic() const
This indicates if the latitude type is planetographic (as opposed to planetocentric).
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
bool Has360Domain() const
This indicates if the longitude domain is 0 to 360 (as opposed to -180 to 180).
virtual double UniversalLatitude()
This returns a universal latitude (planetocentric).
bool IsPositiveEast() const
This indicates if the longitude direction type is positive west (as opposed to postive east).
virtual double Longitude() const
This returns a longitude with correct longitude direction and domain as specified in the label object...
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.