Commit adf10769 authored by Curtis Rose's avatar Curtis Rose
Browse files

Fixed an error with cam2map when matchmap was true, the user could add a...

Fixed an error with cam2map when matchmap was true, the user could add a mappingfile with a targetname that did not match the targetname in the instrument group of the cube file. Fixes #1952.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6881 41f8697f-d340-4b68-9986-7bafba869bb8
parent d1d98134
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ void IsisMain() {
  incam->BasicMapping(camMap);
  PvlGroup &camGrp = camMap.findGroup("Mapping");


  // Make the target info match the user mapfile
  double minlat, maxlat, minlon, maxlon;
  incam->GroundRange(minlat, maxlat, minlon, maxlon, userMap);
@@ -83,6 +82,16 @@ void IsisMain() {
  TProjection *outmap = NULL;
  bool trim = ui.GetBoolean("TRIM");

  // Make sure the target name of the input cube and map file match.
  if (userGrp.hasKeyword("TargetName") && !icube->group("Instrument").findKeyword("TargetName").isNull()) {
    if (!PvlKeyword::stringEqual(incam->target()->name(), userGrp.findKeyword("TargetName")[0])) {
      QString msg = "The TargetName: [" + incam->target()->name() + "] of the input cube: [" + icube->fileName() + 
                    "] does not match the TargetName: [" + userGrp.findKeyword("TargetName")[0] + "] of the map file: [" +
                    ui.GetFileName("MAP") + "].";
      throw IException(IException::User, msg, _FILEINFO_);
    }
  }
  
  if ( !ui.GetBoolean("MATCHMAP") ) {
    if (ui.GetString("DEFAULTRANGE") == "MAP") {
      camGrp.deleteKeyword("MinimumLatitude");
+5 −0
Original line number Diff line number Diff line
@@ -279,6 +279,11 @@
        Brought code closer to ISIS coding standards. Added test to read NAIF body frame info from labels.
        References #3934
     </change>
     <change name="Curtis Rose" date="2016-06-29">
        Fixed an error when matchmap was true, the user could attempt to add a mapping file
	with a targetname that did not match the targetname of the instrument group of
	the cube file. Fixes #1952.
     </change>
  </history>

  <oldName>
+22 −0
Original line number Diff line number Diff line
# This test will print errors thrown by the applicationName application.
APPNAME = cam2map

include $(ISISROOT)/make/isismake.tsts

commands:
#   TEST A: Test that an exception is thrown when targetnames of cube and map do not match.
	echo -e "Error Test A:" > $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) \
	  from=$(INPUT)/vesta.cub \
	  to=$(OUTPUT)/output.cub \
	  map=$(INPUT)/marsEquirectangular.map \
	  2>> $(OUTPUT)/error_temp.txt \
	  > /dev/null` ]]; \
	then \
	  true; \
	fi;

	$(SED) 's+\[/.*/input/+\[input/+' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt;

	$(RM) $(OUTPUT)/error_temp.txt;
	$(RM) $(OUTPUT)/output.cub;
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
APPNAME = cam2map

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from= $(INPUT)/vesta.cub \
		to=$(OUTPUT)/output.cub \
		map=$(INPUT)/vestaEquirectangular.map \
		matchmap=yes \
		>& /dev/null;